Tom Rini | 53633a8 | 2024-02-29 12:33:36 -0500 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2017 Ideas on Board <kieran.bingham@ideasonboard.com> |
| 4 | * Copyright (C) 2021 Jacopo Mondi <jacopo+renesas@jmondi.org> |
| 5 | * |
| 6 | * Device Tree Source (overlay) that describes GMSL camera connected to |
| 7 | * Fakra connectors for the Eagle V3M and Condor V3H (and compatible) boards. |
| 8 | * |
| 9 | * The following cameras are currently supported: RDACM20 and RDACM21. |
| 10 | * |
| 11 | * The board .dts file that include this has to select which cameras are in use |
| 12 | * by specifying the camera model with: |
| 13 | * |
| 14 | * #define GMSL_CAMERA_RDACM20 |
| 15 | * or |
| 16 | * #define GMSL_CAMERA_RDACM21 |
| 17 | * |
| 18 | * And which cameras are connected to the board by defining: |
| 19 | * for GMSL channel 0: |
| 20 | * #define GMSL_CAMERA_0 |
| 21 | * #define GMSL_CAMERA_1 |
| 22 | * #define GMSL_CAMERA_2 |
| 23 | * #define GMSL_CAMERA_3 |
| 24 | * |
| 25 | * for GMSL channel 1: |
| 26 | * #define GMSL_CAMERA_4 |
| 27 | * #define GMSL_CAMERA_5 |
| 28 | * #define GMSL_CAMERA_6 |
| 29 | * #define GMSL_CAMERA_7 |
| 30 | */ |
| 31 | |
| 32 | #include <dt-bindings/gpio/gpio.h> |
| 33 | |
| 34 | /* Validate the board file settings. */ |
| 35 | #if !defined(GMSL_CAMERA_RDACM20) && !defined(GMSL_CAMERA_RDACM21) |
| 36 | #error "Camera model should be defined by the board file" |
| 37 | #endif |
| 38 | |
| 39 | #if defined(GMSL_CAMERA_RDACM20) && defined(GMSL_CAMERA_RDACM21) |
| 40 | #error "A single camera model should be selected" |
| 41 | #endif |
| 42 | |
| 43 | #if !defined(GMSL_CAMERA_0) && !defined(GMSL_CAMERA_1) && \ |
| 44 | !defined(GMSL_CAMERA_2) && !defined(GMSL_CAMERA_3) && \ |
| 45 | !defined(GMSL_CAMERA_4) && !defined(GMSL_CAMERA_5) && \ |
| 46 | !defined(GMSL_CAMERA_6) && !defined(GMSL_CAMERA_7) |
| 47 | #error "At least one camera should be selected" |
| 48 | #endif |
| 49 | |
| 50 | /* Deduce from the enabled cameras which GMSL channels are active. */ |
| 51 | #if defined(GMSL_CAMERA_0) || defined(GMSL_CAMERA_1) || \ |
| 52 | defined(GMSL_CAMERA_2) || defined(GMSL_CAMERA_3) |
| 53 | #define GMSL_0 |
| 54 | #endif |
| 55 | |
| 56 | #if defined(GMSL_CAMERA_4) || defined(GMSL_CAMERA_5) || \ |
| 57 | defined(GMSL_CAMERA_6) || defined(GMSL_CAMERA_7) |
| 58 | #define GMSL_1 |
| 59 | #endif |
| 60 | |
| 61 | /* Deduce the camera model compatible string. */ |
| 62 | #if defined(GMSL_CAMERA_RDACM20) |
| 63 | #define GMSL_CAMERA_MODEL "imi,rdacm20" |
| 64 | #elif defined(GMSL_CAMERA_RDACM21) |
| 65 | #define GMSL_CAMERA_MODEL "imi,rdacm21" |
| 66 | #endif |
| 67 | |
| 68 | #ifdef GMSL_0 |
| 69 | &vin0 { |
| 70 | status = "okay"; |
| 71 | }; |
| 72 | |
| 73 | &vin1 { |
| 74 | status = "okay"; |
| 75 | }; |
| 76 | |
| 77 | &vin2 { |
| 78 | status = "okay"; |
| 79 | }; |
| 80 | |
| 81 | &vin3 { |
| 82 | status = "okay"; |
| 83 | }; |
| 84 | |
| 85 | &gmsl0 { |
| 86 | status = "okay"; |
| 87 | |
| 88 | #if defined(GMSL_CAMERA_RDACM21) |
| 89 | maxim,reverse-channel-microvolt = <100000>; |
| 90 | #endif |
| 91 | |
| 92 | ports { |
| 93 | #ifdef GMSL_CAMERA_0 |
| 94 | port@0 { |
| 95 | max9286_in0: endpoint { |
| 96 | remote-endpoint = <&fakra_con0>; |
| 97 | }; |
| 98 | }; |
| 99 | #endif |
| 100 | |
| 101 | #ifdef GMSL_CAMERA_1 |
| 102 | port@1 { |
| 103 | max9286_in1: endpoint { |
| 104 | remote-endpoint = <&fakra_con1>; |
| 105 | }; |
| 106 | |
| 107 | }; |
| 108 | #endif |
| 109 | |
| 110 | #ifdef GMSL_CAMERA_2 |
| 111 | port@2 { |
| 112 | max9286_in2: endpoint { |
| 113 | remote-endpoint = <&fakra_con2>; |
| 114 | }; |
| 115 | |
| 116 | }; |
| 117 | #endif |
| 118 | |
| 119 | #ifdef GMSL_CAMERA_3 |
| 120 | port@3 { |
| 121 | max9286_in3: endpoint { |
| 122 | remote-endpoint = <&fakra_con3>; |
| 123 | }; |
| 124 | |
| 125 | }; |
| 126 | #endif |
| 127 | }; |
| 128 | |
| 129 | i2c-mux { |
| 130 | #ifdef GMSL_CAMERA_0 |
| 131 | i2c@0 { |
| 132 | status = "okay"; |
| 133 | |
| 134 | camera@51 { |
| 135 | compatible = GMSL_CAMERA_MODEL; |
| 136 | reg = <0x51>, <0x61>; |
| 137 | |
| 138 | port { |
| 139 | fakra_con0: endpoint { |
| 140 | remote-endpoint = <&max9286_in0>; |
| 141 | }; |
| 142 | }; |
| 143 | }; |
| 144 | }; |
| 145 | #endif |
| 146 | |
| 147 | #ifdef GMSL_CAMERA_1 |
| 148 | i2c@1 { |
| 149 | status = "okay"; |
| 150 | |
| 151 | camera@52 { |
| 152 | compatible = GMSL_CAMERA_MODEL; |
| 153 | reg = <0x52>, <0x62>; |
| 154 | |
| 155 | port { |
| 156 | fakra_con1: endpoint { |
| 157 | remote-endpoint = <&max9286_in1>; |
| 158 | }; |
| 159 | }; |
| 160 | }; |
| 161 | }; |
| 162 | #endif |
| 163 | |
| 164 | #ifdef GMSL_CAMERA_2 |
| 165 | i2c@2 { |
| 166 | status = "okay"; |
| 167 | |
| 168 | camera@53 { |
| 169 | compatible = GMSL_CAMERA_MODEL; |
| 170 | reg = <0x53>, <0x63>; |
| 171 | |
| 172 | port { |
| 173 | fakra_con2: endpoint { |
| 174 | remote-endpoint = <&max9286_in2>; |
| 175 | }; |
| 176 | }; |
| 177 | }; |
| 178 | }; |
| 179 | #endif |
| 180 | |
| 181 | #ifdef GMSL_CAMERA_3 |
| 182 | i2c@3 { |
| 183 | status = "okay"; |
| 184 | |
| 185 | camera@54 { |
| 186 | compatible = GMSL_CAMERA_MODEL; |
| 187 | reg = <0x54>, <0x64>; |
| 188 | |
| 189 | port { |
| 190 | fakra_con3: endpoint { |
| 191 | remote-endpoint = <&max9286_in3>; |
| 192 | }; |
| 193 | }; |
| 194 | }; |
| 195 | }; |
| 196 | #endif |
| 197 | }; |
| 198 | }; |
| 199 | #endif /* ifdef GMSL_0 */ |
| 200 | |
| 201 | #ifdef GMSL_1 |
| 202 | &vin4 { |
| 203 | status = "okay"; |
| 204 | }; |
| 205 | |
| 206 | &vin5 { |
| 207 | status = "okay"; |
| 208 | }; |
| 209 | |
| 210 | &vin6 { |
| 211 | status = "okay"; |
| 212 | }; |
| 213 | |
| 214 | &vin7 { |
| 215 | status = "okay"; |
| 216 | }; |
| 217 | |
| 218 | &gmsl1 { |
| 219 | status = "okay"; |
| 220 | |
| 221 | #if defined(GMSL_CAMERA_RDACM21) |
| 222 | maxim,reverse-channel-microvolt = <100000>; |
| 223 | #endif |
| 224 | |
| 225 | ports { |
| 226 | #ifdef GMSL_CAMERA_4 |
| 227 | port@0 { |
| 228 | max9286_in4: endpoint { |
| 229 | remote-endpoint = <&fakra_con4>; |
| 230 | }; |
| 231 | }; |
| 232 | #endif |
| 233 | |
| 234 | #ifdef GMSL_CAMERA_5 |
| 235 | port@1 { |
| 236 | max9286_in5: endpoint { |
| 237 | remote-endpoint = <&fakra_con5>; |
| 238 | }; |
| 239 | |
| 240 | }; |
| 241 | #endif |
| 242 | |
| 243 | #ifdef GMSL_CAMERA_6 |
| 244 | port@2 { |
| 245 | max9286_in6: endpoint { |
| 246 | remote-endpoint = <&fakra_con6>; |
| 247 | }; |
| 248 | |
| 249 | }; |
| 250 | #endif |
| 251 | |
| 252 | #ifdef GMSL_CAMERA_7 |
| 253 | port@3 { |
| 254 | max9286_in7: endpoint { |
| 255 | remote-endpoint = <&fakra_con7>; |
| 256 | }; |
| 257 | |
| 258 | }; |
| 259 | #endif |
| 260 | }; |
| 261 | |
| 262 | i2c-mux { |
| 263 | #ifdef GMSL_CAMERA_4 |
| 264 | i2c@0 { |
| 265 | status = "okay"; |
| 266 | |
| 267 | camera@55 { |
| 268 | compatible = GMSL_CAMERA_MODEL; |
| 269 | reg = <0x55>, <0x65>; |
| 270 | |
| 271 | port { |
| 272 | fakra_con4: endpoint { |
| 273 | remote-endpoint = <&max9286_in4>; |
| 274 | }; |
| 275 | }; |
| 276 | }; |
| 277 | }; |
| 278 | #endif |
| 279 | |
| 280 | #ifdef GMSL_CAMERA_5 |
| 281 | i2c@1 { |
| 282 | status = "okay"; |
| 283 | |
| 284 | camera@56 { |
| 285 | compatible = GMSL_CAMERA_MODEL; |
| 286 | reg = <0x56>, <0x66>; |
| 287 | |
| 288 | port { |
| 289 | fakra_con5: endpoint { |
| 290 | remote-endpoint = <&max9286_in5>; |
| 291 | }; |
| 292 | }; |
| 293 | }; |
| 294 | }; |
| 295 | #endif |
| 296 | |
| 297 | #ifdef GMSL_CAMERA_6 |
| 298 | i2c@2 { |
| 299 | status = "okay"; |
| 300 | |
| 301 | camera@57 { |
| 302 | compatible = GMSL_CAMERA_MODEL; |
| 303 | reg = <0x57>, <0x67>; |
| 304 | |
| 305 | port { |
| 306 | fakra_con6: endpoint { |
| 307 | remote-endpoint = <&max9286_in6>; |
| 308 | }; |
| 309 | }; |
| 310 | }; |
| 311 | }; |
| 312 | #endif |
| 313 | |
| 314 | #ifdef GMSL_CAMERA_7 |
| 315 | i2c@3 { |
| 316 | status = "okay"; |
| 317 | |
| 318 | camera@58 { |
| 319 | compatible = GMSL_CAMERA_MODEL; |
| 320 | reg = <0x58>, <0x68>; |
| 321 | |
| 322 | port { |
| 323 | fakra_con7: endpoint { |
| 324 | remote-endpoint = <&max9286_in7>; |
| 325 | }; |
| 326 | }; |
| 327 | }; |
| 328 | }; |
| 329 | #endif |
| 330 | }; |
| 331 | }; |
| 332 | #endif /* ifdef GMSL_1 */ |