Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0+
0002 /*
0003  * Copyright (C) 2017 Ideas on Board <kieran.bingham@ideasonboard.com>
0004  * Copyright (C) 2021 Jacopo Mondi <jacopo+renesas@jmondi.org>
0005  *
0006  * Device Tree Source (overlay) that describes GMSL camera connected to
0007  * Fakra connectors for the Eagle V3M and Condor V3H (and compatible) boards.
0008  *
0009  * The following cameras are currently supported: RDACM20 and RDACM21.
0010  *
0011  * The board .dts file that include this has to select which cameras are in use
0012  * by specifying the camera model with:
0013  *
0014  * #define GMSL_CAMERA_RDACM20
0015  * or
0016  * #define GMSL_CAMERA_RDACM21
0017  *
0018  * And which cameras are connected to the board by defining:
0019  * for GMSL channel 0:
0020  *         #define GMSL_CAMERA_0
0021  *         #define GMSL_CAMERA_1
0022  *         #define GMSL_CAMERA_2
0023  *         #define GMSL_CAMERA_3
0024  *
0025  * for GMSL channel 1:
0026  *         #define GMSL_CAMERA_4
0027  *         #define GMSL_CAMERA_5
0028  *         #define GMSL_CAMERA_6
0029  *         #define GMSL_CAMERA_7
0030  */
0031 
0032 #include <dt-bindings/gpio/gpio.h>
0033 
0034 /* Validate the board file settings. */
0035 #if !defined(GMSL_CAMERA_RDACM20) && !defined(GMSL_CAMERA_RDACM21)
0036 #error "Camera model should be defined by the board file"
0037 #endif
0038 
0039 #if defined(GMSL_CAMERA_RDACM20) && defined(GMSL_CAMERA_RDACM21)
0040 #error "A single camera model should be selected"
0041 #endif
0042 
0043 #if !defined(GMSL_CAMERA_0) && !defined(GMSL_CAMERA_1) && \
0044     !defined(GMSL_CAMERA_2) && !defined(GMSL_CAMERA_3) && \
0045     !defined(GMSL_CAMERA_4) && !defined(GMSL_CAMERA_5) && \
0046     !defined(GMSL_CAMERA_6) && !defined(GMSL_CAMERA_7)
0047 #error "At least one camera should be selected"
0048 #endif
0049 
0050 /* Deduce from the enabled cameras which GMSL channels are active. */
0051 #if defined(GMSL_CAMERA_0) || defined(GMSL_CAMERA_1) || \
0052     defined(GMSL_CAMERA_2) || defined(GMSL_CAMERA_3)
0053 #define GMSL_0
0054 #endif
0055 
0056 #if defined(GMSL_CAMERA_4) || defined(GMSL_CAMERA_5) || \
0057     defined(GMSL_CAMERA_6) || defined(GMSL_CAMERA_7)
0058 #define GMSL_1
0059 #endif
0060 
0061 /* Deduce the camera model compatible string. */
0062 #if defined(GMSL_CAMERA_RDACM20)
0063 #define GMSL_CAMERA_MODEL "imi,rdacm20"
0064 #elif defined(GMSL_CAMERA_RDACM21)
0065 #define GMSL_CAMERA_MODEL "imi,rdacm21"
0066 #endif
0067 
0068 #ifdef GMSL_0
0069 &vin0 {
0070         status = "okay";
0071 };
0072 
0073 &vin1 {
0074         status = "okay";
0075 };
0076 
0077 &vin2 {
0078         status = "okay";
0079 };
0080 
0081 &vin3 {
0082         status = "okay";
0083 };
0084 
0085 &gmsl0 {
0086         status = "okay";
0087 
0088 #if defined(GMSL_CAMERA_RDACM21)
0089         maxim,reverse-channel-microvolt = <100000>;
0090 #endif
0091 
0092         ports {
0093 #ifdef GMSL_CAMERA_0
0094                 port@0 {
0095                         max9286_in0: endpoint {
0096                                 remote-endpoint = <&fakra_con0>;
0097                         };
0098                 };
0099 #endif
0100 
0101 #ifdef GMSL_CAMERA_1
0102                 port@1 {
0103                         max9286_in1: endpoint{
0104                                 remote-endpoint = <&fakra_con1>;
0105                         };
0106 
0107                 };
0108 #endif
0109 
0110 #ifdef GMSL_CAMERA_2
0111                 port@2 {
0112                         max9286_in2: endpoint {
0113                                 remote-endpoint = <&fakra_con2>;
0114                         };
0115 
0116                 };
0117 #endif
0118 
0119 #ifdef GMSL_CAMERA_3
0120                 port@3 {
0121                         max9286_in3: endpoint {
0122                                 remote-endpoint = <&fakra_con3>;
0123                         };
0124 
0125                 };
0126 #endif
0127         };
0128 
0129         i2c-mux {
0130 #ifdef GMSL_CAMERA_0
0131                 i2c@0 {
0132                         status = "okay";
0133 
0134                         camera@51 {
0135                                 compatible = GMSL_CAMERA_MODEL;
0136                                 reg = <0x51>, <0x61>;
0137 
0138                                 port {
0139                                         fakra_con0: endpoint {
0140                                                 remote-endpoint = <&max9286_in0>;
0141                                         };
0142                                 };
0143                         };
0144                 };
0145 #endif
0146 
0147 #ifdef GMSL_CAMERA_1
0148                 i2c@1 {
0149                         status = "okay";
0150 
0151                         camera@52 {
0152                                 compatible = GMSL_CAMERA_MODEL;
0153                                 reg = <0x52>, <0x62>;
0154 
0155                                 port {
0156                                         fakra_con1: endpoint {
0157                                                 remote-endpoint = <&max9286_in1>;
0158                                         };
0159                                 };
0160                         };
0161                 };
0162 #endif
0163 
0164 #ifdef GMSL_CAMERA_2
0165                 i2c@2 {
0166                         status = "okay";
0167 
0168                         camera@53 {
0169                                 compatible = GMSL_CAMERA_MODEL;
0170                                 reg = <0x53>, <0x63>;
0171 
0172                                 port {
0173                                         fakra_con2: endpoint {
0174                                                 remote-endpoint = <&max9286_in2>;
0175                                         };
0176                                 };
0177                         };
0178                 };
0179 #endif
0180 
0181 #ifdef GMSL_CAMERA_3
0182                 i2c@3 {
0183                         status = "okay";
0184 
0185                         camera@54 {
0186                                 compatible = GMSL_CAMERA_MODEL;
0187                                 reg = <0x54>, <0x64>;
0188 
0189                                 port {
0190                                         fakra_con3: endpoint {
0191                                                 remote-endpoint = <&max9286_in3>;
0192                                         };
0193                                 };
0194                         };
0195                 };
0196 #endif
0197         };
0198 };
0199 #endif /* ifdef GMSL_0 */
0200 
0201 #ifdef GMSL_1
0202 &vin4 {
0203         status = "okay";
0204 };
0205 
0206 &vin5 {
0207         status = "okay";
0208 };
0209 
0210 &vin6 {
0211         status = "okay";
0212 };
0213 
0214 &vin7 {
0215         status = "okay";
0216 };
0217 
0218 &gmsl1 {
0219         status = "okay";
0220 
0221 #if defined(GMSL_CAMERA_RDACM21)
0222         maxim,reverse-channel-microvolt = <100000>;
0223 #endif
0224 
0225         ports {
0226 #ifdef GMSL_CAMERA_4
0227                 port@0 {
0228                         max9286_in4: endpoint {
0229                                 remote-endpoint = <&fakra_con4>;
0230                         };
0231                 };
0232 #endif
0233 
0234 #ifdef GMSL_CAMERA_5
0235                 port@1 {
0236                         max9286_in5: endpoint{
0237                                 remote-endpoint = <&fakra_con5>;
0238                         };
0239 
0240                 };
0241 #endif
0242 
0243 #ifdef GMSL_CAMERA_6
0244                 port@2 {
0245                         max9286_in6: endpoint {
0246                                 remote-endpoint = <&fakra_con6>;
0247                         };
0248 
0249                 };
0250 #endif
0251 
0252 #ifdef GMSL_CAMERA_7
0253                 port@3 {
0254                         max9286_in7: endpoint {
0255                                 remote-endpoint = <&fakra_con7>;
0256                         };
0257 
0258                 };
0259 #endif
0260         };
0261 
0262         i2c-mux {
0263 #ifdef GMSL_CAMERA_4
0264                 i2c@0 {
0265                         status = "okay";
0266 
0267                         camera@55 {
0268                                 compatible = GMSL_CAMERA_MODEL;
0269                                 reg = <0x55>, <0x65>;
0270 
0271                                 port {
0272                                         fakra_con4: endpoint {
0273                                                 remote-endpoint = <&max9286_in4>;
0274                                         };
0275                                 };
0276                         };
0277                 };
0278 #endif
0279 
0280 #ifdef GMSL_CAMERA_5
0281                 i2c@1 {
0282                         status = "okay";
0283 
0284                         camera@56 {
0285                                 compatible = GMSL_CAMERA_MODEL;
0286                                 reg = <0x56>, <0x66>;
0287 
0288                                 port {
0289                                         fakra_con5: endpoint {
0290                                                 remote-endpoint = <&max9286_in5>;
0291                                         };
0292                                 };
0293                         };
0294                 };
0295 #endif
0296 
0297 #ifdef GMSL_CAMERA_6
0298                 i2c@2 {
0299                         status = "okay";
0300 
0301                         camera@57 {
0302                                 compatible = GMSL_CAMERA_MODEL;
0303                                 reg = <0x57>, <0x67>;
0304 
0305                                 port {
0306                                         fakra_con6: endpoint {
0307                                                 remote-endpoint = <&max9286_in6>;
0308                                         };
0309                                 };
0310                         };
0311                 };
0312 #endif
0313 
0314 #ifdef GMSL_CAMERA_7
0315                 i2c@3 {
0316                         status = "okay";
0317 
0318                         camera@58 {
0319                                 compatible = GMSL_CAMERA_MODEL;
0320                                 reg = <0x58>, <0x68>;
0321 
0322                                 port {
0323                                         fakra_con7: endpoint {
0324                                                 remote-endpoint = <&max9286_in7>;
0325                                         };
0326                                 };
0327                         };
0328                 };
0329 #endif
0330         };
0331 };
0332 #endif /* ifdef GMSL_1 */