gmsl-cameras.dtsi 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2017 Ideas on Board <[email protected]>
  4. * Copyright (C) 2021 Jacopo Mondi <[email protected]>
  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. #include <dt-bindings/gpio/gpio.h>
  32. /* Validate the board file settings. */
  33. #if !defined(GMSL_CAMERA_RDACM20) && !defined(GMSL_CAMERA_RDACM21)
  34. #error "Camera model should be defined by the board file"
  35. #endif
  36. #if defined(GMSL_CAMERA_RDACM20) && defined(GMSL_CAMERA_RDACM21)
  37. #error "A single camera model should be selected"
  38. #endif
  39. #if !defined(GMSL_CAMERA_0) && !defined(GMSL_CAMERA_1) && \
  40. !defined(GMSL_CAMERA_2) && !defined(GMSL_CAMERA_3) && \
  41. !defined(GMSL_CAMERA_4) && !defined(GMSL_CAMERA_5) && \
  42. !defined(GMSL_CAMERA_6) && !defined(GMSL_CAMERA_7)
  43. #error "At least one camera should be selected"
  44. #endif
  45. /* Deduce from the enabled cameras which GMSL channels are active. */
  46. #if defined(GMSL_CAMERA_0) || defined(GMSL_CAMERA_1) || \
  47. defined(GMSL_CAMERA_2) || defined(GMSL_CAMERA_3)
  48. #define GMSL_0
  49. #endif
  50. #if defined(GMSL_CAMERA_4) || defined(GMSL_CAMERA_5) || \
  51. defined(GMSL_CAMERA_6) || defined(GMSL_CAMERA_7)
  52. #define GMSL_1
  53. #endif
  54. /* Deduce the camera model compatible string. */
  55. #if defined(GMSL_CAMERA_RDACM20)
  56. #define GMSL_CAMERA_MODEL "imi,rdacm20"
  57. #elif defined(GMSL_CAMERA_RDACM21)
  58. #define GMSL_CAMERA_MODEL "imi,rdacm21"
  59. #endif
  60. #ifdef GMSL_0
  61. &vin0 {
  62. status = "okay";
  63. };
  64. &vin1 {
  65. status = "okay";
  66. };
  67. &vin2 {
  68. status = "okay";
  69. };
  70. &vin3 {
  71. status = "okay";
  72. };
  73. &gmsl0 {
  74. status = "okay";
  75. #if defined(GMSL_CAMERA_RDACM21)
  76. maxim,reverse-channel-microvolt = <100000>;
  77. #endif
  78. ports {
  79. #ifdef GMSL_CAMERA_0
  80. port@0 {
  81. max9286_in0: endpoint {
  82. remote-endpoint = <&fakra_con0>;
  83. };
  84. };
  85. #endif
  86. #ifdef GMSL_CAMERA_1
  87. port@1 {
  88. max9286_in1: endpoint{
  89. remote-endpoint = <&fakra_con1>;
  90. };
  91. };
  92. #endif
  93. #ifdef GMSL_CAMERA_2
  94. port@2 {
  95. max9286_in2: endpoint {
  96. remote-endpoint = <&fakra_con2>;
  97. };
  98. };
  99. #endif
  100. #ifdef GMSL_CAMERA_3
  101. port@3 {
  102. max9286_in3: endpoint {
  103. remote-endpoint = <&fakra_con3>;
  104. };
  105. };
  106. #endif
  107. };
  108. i2c-mux {
  109. #ifdef GMSL_CAMERA_0
  110. i2c@0 {
  111. status = "okay";
  112. camera@51 {
  113. compatible = GMSL_CAMERA_MODEL;
  114. reg = <0x51>, <0x61>;
  115. port {
  116. fakra_con0: endpoint {
  117. remote-endpoint = <&max9286_in0>;
  118. };
  119. };
  120. };
  121. };
  122. #endif
  123. #ifdef GMSL_CAMERA_1
  124. i2c@1 {
  125. status = "okay";
  126. camera@52 {
  127. compatible = GMSL_CAMERA_MODEL;
  128. reg = <0x52>, <0x62>;
  129. port {
  130. fakra_con1: endpoint {
  131. remote-endpoint = <&max9286_in1>;
  132. };
  133. };
  134. };
  135. };
  136. #endif
  137. #ifdef GMSL_CAMERA_2
  138. i2c@2 {
  139. status = "okay";
  140. camera@53 {
  141. compatible = GMSL_CAMERA_MODEL;
  142. reg = <0x53>, <0x63>;
  143. port {
  144. fakra_con2: endpoint {
  145. remote-endpoint = <&max9286_in2>;
  146. };
  147. };
  148. };
  149. };
  150. #endif
  151. #ifdef GMSL_CAMERA_3
  152. i2c@3 {
  153. status = "okay";
  154. camera@54 {
  155. compatible = GMSL_CAMERA_MODEL;
  156. reg = <0x54>, <0x64>;
  157. port {
  158. fakra_con3: endpoint {
  159. remote-endpoint = <&max9286_in3>;
  160. };
  161. };
  162. };
  163. };
  164. #endif
  165. };
  166. };
  167. #endif /* ifdef GMSL_0 */
  168. #ifdef GMSL_1
  169. &vin4 {
  170. status = "okay";
  171. };
  172. &vin5 {
  173. status = "okay";
  174. };
  175. &vin6 {
  176. status = "okay";
  177. };
  178. &vin7 {
  179. status = "okay";
  180. };
  181. &gmsl1 {
  182. status = "okay";
  183. #if defined(GMSL_CAMERA_RDACM21)
  184. maxim,reverse-channel-microvolt = <100000>;
  185. #endif
  186. ports {
  187. #ifdef GMSL_CAMERA_4
  188. port@0 {
  189. max9286_in4: endpoint {
  190. remote-endpoint = <&fakra_con4>;
  191. };
  192. };
  193. #endif
  194. #ifdef GMSL_CAMERA_5
  195. port@1 {
  196. max9286_in5: endpoint{
  197. remote-endpoint = <&fakra_con5>;
  198. };
  199. };
  200. #endif
  201. #ifdef GMSL_CAMERA_6
  202. port@2 {
  203. max9286_in6: endpoint {
  204. remote-endpoint = <&fakra_con6>;
  205. };
  206. };
  207. #endif
  208. #ifdef GMSL_CAMERA_7
  209. port@3 {
  210. max9286_in7: endpoint {
  211. remote-endpoint = <&fakra_con7>;
  212. };
  213. };
  214. #endif
  215. };
  216. i2c-mux {
  217. #ifdef GMSL_CAMERA_4
  218. i2c@0 {
  219. status = "okay";
  220. camera@55 {
  221. compatible = GMSL_CAMERA_MODEL;
  222. reg = <0x55>, <0x65>;
  223. port {
  224. fakra_con4: endpoint {
  225. remote-endpoint = <&max9286_in4>;
  226. };
  227. };
  228. };
  229. };
  230. #endif
  231. #ifdef GMSL_CAMERA_5
  232. i2c@1 {
  233. status = "okay";
  234. camera@56 {
  235. compatible = GMSL_CAMERA_MODEL;
  236. reg = <0x56>, <0x66>;
  237. port {
  238. fakra_con5: endpoint {
  239. remote-endpoint = <&max9286_in5>;
  240. };
  241. };
  242. };
  243. };
  244. #endif
  245. #ifdef GMSL_CAMERA_6
  246. i2c@2 {
  247. status = "okay";
  248. camera@57 {
  249. compatible = GMSL_CAMERA_MODEL;
  250. reg = <0x57>, <0x67>;
  251. port {
  252. fakra_con6: endpoint {
  253. remote-endpoint = <&max9286_in6>;
  254. };
  255. };
  256. };
  257. };
  258. #endif
  259. #ifdef GMSL_CAMERA_7
  260. i2c@3 {
  261. status = "okay";
  262. camera@58 {
  263. compatible = GMSL_CAMERA_MODEL;
  264. reg = <0x58>, <0x68>;
  265. port {
  266. fakra_con7: endpoint {
  267. remote-endpoint = <&max9286_in7>;
  268. };
  269. };
  270. };
  271. };
  272. #endif
  273. };
  274. };
  275. #endif /* ifdef GMSL_1 */