rockchip_vop2_reg.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (C) Rockchip Electronics Co.Ltd
  4. * Author: Andy Yan <andy.yan@rock-chips.com>
  5. */
  6. #include <linux/kernel.h>
  7. #include <linux/component.h>
  8. #include <linux/mod_devicetable.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/of.h>
  11. #include <drm/drm_fourcc.h>
  12. #include <drm/drm_plane.h>
  13. #include <drm/drm_print.h>
  14. #include "rockchip_drm_vop2.h"
  15. static const uint32_t formats_cluster[] = {
  16. DRM_FORMAT_XRGB2101010,
  17. DRM_FORMAT_XBGR2101010,
  18. DRM_FORMAT_XRGB8888,
  19. DRM_FORMAT_ARGB8888,
  20. DRM_FORMAT_XBGR8888,
  21. DRM_FORMAT_ABGR8888,
  22. DRM_FORMAT_RGB888,
  23. DRM_FORMAT_BGR888,
  24. DRM_FORMAT_RGB565,
  25. DRM_FORMAT_BGR565,
  26. DRM_FORMAT_YUV420_8BIT, /* yuv420_8bit non-Linear mode only */
  27. DRM_FORMAT_YUV420_10BIT, /* yuv420_10bit non-Linear mode only */
  28. DRM_FORMAT_YUYV, /* yuv422_8bit non-Linear mode only*/
  29. DRM_FORMAT_Y210, /* yuv422_10bit non-Linear mode only */
  30. };
  31. static const uint32_t formats_esmart[] = {
  32. DRM_FORMAT_XRGB8888,
  33. DRM_FORMAT_ARGB8888,
  34. DRM_FORMAT_XBGR8888,
  35. DRM_FORMAT_ABGR8888,
  36. DRM_FORMAT_RGB888,
  37. DRM_FORMAT_BGR888,
  38. DRM_FORMAT_RGB565,
  39. DRM_FORMAT_BGR565,
  40. DRM_FORMAT_NV12, /* yuv420_8bit linear mode, 2 plane */
  41. DRM_FORMAT_NV21, /* yvu420_8bit linear mode, 2 plane */
  42. DRM_FORMAT_NV16, /* yuv422_8bit linear mode, 2 plane */
  43. DRM_FORMAT_NV61, /* yvu422_8bit linear mode, 2 plane */
  44. DRM_FORMAT_NV20, /* yuv422_10bit linear mode, 2 plane, no padding */
  45. DRM_FORMAT_NV24, /* yuv444_8bit linear mode, 2 plane */
  46. DRM_FORMAT_NV42, /* yvu444_8bit linear mode, 2 plane */
  47. DRM_FORMAT_NV30, /* yuv444_10bit linear mode, 2 plane, no padding */
  48. DRM_FORMAT_NV15, /* yuv420_10bit linear mode, 2 plane, no padding */
  49. DRM_FORMAT_YVYU, /* yuv422_8bit[YVYU] linear mode */
  50. DRM_FORMAT_VYUY, /* yuv422_8bit[VYUY] linear mode */
  51. DRM_FORMAT_YUYV, /* yuv422_8bit[YUYV] linear mode */
  52. DRM_FORMAT_UYVY, /* yuv422_8bit[UYVY] linear mode */
  53. };
  54. static const uint32_t formats_rk356x_esmart[] = {
  55. DRM_FORMAT_XRGB8888,
  56. DRM_FORMAT_ARGB8888,
  57. DRM_FORMAT_XBGR8888,
  58. DRM_FORMAT_ABGR8888,
  59. DRM_FORMAT_RGB888,
  60. DRM_FORMAT_BGR888,
  61. DRM_FORMAT_RGB565,
  62. DRM_FORMAT_BGR565,
  63. DRM_FORMAT_NV12, /* yuv420_8bit linear mode, 2 plane */
  64. DRM_FORMAT_NV21, /* yuv420_8bit linear mode, 2 plane */
  65. DRM_FORMAT_NV15, /* yuv420_10bit linear mode, 2 plane, no padding */
  66. DRM_FORMAT_NV16, /* yuv422_8bit linear mode, 2 plane */
  67. DRM_FORMAT_NV61, /* yuv422_8bit linear mode, 2 plane */
  68. DRM_FORMAT_NV20, /* yuv422_10bit linear mode, 2 plane, no padding */
  69. DRM_FORMAT_NV24, /* yuv444_8bit linear mode, 2 plane */
  70. DRM_FORMAT_NV42, /* yuv444_8bit linear mode, 2 plane */
  71. DRM_FORMAT_NV30, /* yuv444_10bit linear mode, 2 plane, no padding */
  72. DRM_FORMAT_YVYU, /* yuv422_8bit[YVYU] linear mode */
  73. DRM_FORMAT_VYUY, /* yuv422_8bit[VYUY] linear mode */
  74. };
  75. static const uint32_t formats_smart[] = {
  76. DRM_FORMAT_XRGB8888,
  77. DRM_FORMAT_ARGB8888,
  78. DRM_FORMAT_XBGR8888,
  79. DRM_FORMAT_ABGR8888,
  80. DRM_FORMAT_RGB888,
  81. DRM_FORMAT_BGR888,
  82. DRM_FORMAT_RGB565,
  83. DRM_FORMAT_BGR565,
  84. };
  85. static const uint64_t format_modifiers[] = {
  86. DRM_FORMAT_MOD_LINEAR,
  87. DRM_FORMAT_MOD_INVALID,
  88. };
  89. static const uint64_t format_modifiers_afbc[] = {
  90. DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16),
  91. DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
  92. AFBC_FORMAT_MOD_SPARSE),
  93. DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
  94. AFBC_FORMAT_MOD_YTR),
  95. DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
  96. AFBC_FORMAT_MOD_CBR),
  97. DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
  98. AFBC_FORMAT_MOD_YTR |
  99. AFBC_FORMAT_MOD_SPARSE),
  100. DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
  101. AFBC_FORMAT_MOD_CBR |
  102. AFBC_FORMAT_MOD_SPARSE),
  103. DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
  104. AFBC_FORMAT_MOD_YTR |
  105. AFBC_FORMAT_MOD_CBR),
  106. DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
  107. AFBC_FORMAT_MOD_YTR |
  108. AFBC_FORMAT_MOD_CBR |
  109. AFBC_FORMAT_MOD_SPARSE),
  110. /* SPLIT mandates SPARSE, RGB modes mandates YTR */
  111. DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
  112. AFBC_FORMAT_MOD_YTR |
  113. AFBC_FORMAT_MOD_SPARSE |
  114. AFBC_FORMAT_MOD_SPLIT),
  115. DRM_FORMAT_MOD_INVALID,
  116. };
  117. static const struct vop2_video_port_data rk3568_vop_video_ports[] = {
  118. {
  119. .id = 0,
  120. .feature = VOP2_VP_FEATURE_OUTPUT_10BIT,
  121. .gamma_lut_len = 1024,
  122. .cubic_lut_len = 9 * 9 * 9,
  123. .max_output = { 4096, 2304 },
  124. .pre_scan_max_dly = { 69, 53, 53, 42 },
  125. .offset = 0xc00,
  126. }, {
  127. .id = 1,
  128. .gamma_lut_len = 1024,
  129. .max_output = { 2048, 1536 },
  130. .pre_scan_max_dly = { 40, 40, 40, 40 },
  131. .offset = 0xd00,
  132. }, {
  133. .id = 2,
  134. .gamma_lut_len = 1024,
  135. .max_output = { 1920, 1080 },
  136. .pre_scan_max_dly = { 40, 40, 40, 40 },
  137. .offset = 0xe00,
  138. },
  139. };
  140. /*
  141. * rk3568 vop with 2 cluster, 2 esmart win, 2 smart win.
  142. * Every cluster can work as 4K win or split into two win.
  143. * All win in cluster support AFBCD.
  144. *
  145. * Every esmart win and smart win support 4 Multi-region.
  146. *
  147. * Scale filter mode:
  148. *
  149. * * Cluster: bicubic for horizontal scale up, others use bilinear
  150. * * ESmart:
  151. * * nearest-neighbor/bilinear/bicubic for scale up
  152. * * nearest-neighbor/bilinear/average for scale down
  153. *
  154. *
  155. * @TODO describe the wind like cpu-map dt nodes;
  156. */
  157. static const struct vop2_win_data rk3568_vop_win_data[] = {
  158. {
  159. .name = "Smart0-win0",
  160. .phys_id = ROCKCHIP_VOP2_SMART0,
  161. .base = 0x1c00,
  162. .formats = formats_smart,
  163. .nformats = ARRAY_SIZE(formats_smart),
  164. .format_modifiers = format_modifiers,
  165. .layer_sel_id = 3,
  166. .supported_rotations = DRM_MODE_REFLECT_Y,
  167. .type = DRM_PLANE_TYPE_PRIMARY,
  168. .max_upscale_factor = 8,
  169. .max_downscale_factor = 8,
  170. .dly = { 20, 47, 41 },
  171. }, {
  172. .name = "Smart1-win0",
  173. .phys_id = ROCKCHIP_VOP2_SMART1,
  174. .formats = formats_smart,
  175. .nformats = ARRAY_SIZE(formats_smart),
  176. .format_modifiers = format_modifiers,
  177. .base = 0x1e00,
  178. .layer_sel_id = 7,
  179. .supported_rotations = DRM_MODE_REFLECT_Y,
  180. .type = DRM_PLANE_TYPE_PRIMARY,
  181. .max_upscale_factor = 8,
  182. .max_downscale_factor = 8,
  183. .dly = { 20, 47, 41 },
  184. }, {
  185. .name = "Esmart1-win0",
  186. .phys_id = ROCKCHIP_VOP2_ESMART1,
  187. .formats = formats_rk356x_esmart,
  188. .nformats = ARRAY_SIZE(formats_rk356x_esmart),
  189. .format_modifiers = format_modifiers,
  190. .base = 0x1a00,
  191. .layer_sel_id = 6,
  192. .supported_rotations = DRM_MODE_REFLECT_Y,
  193. .type = DRM_PLANE_TYPE_PRIMARY,
  194. .max_upscale_factor = 8,
  195. .max_downscale_factor = 8,
  196. .dly = { 20, 47, 41 },
  197. }, {
  198. .name = "Esmart0-win0",
  199. .phys_id = ROCKCHIP_VOP2_ESMART0,
  200. .formats = formats_rk356x_esmart,
  201. .nformats = ARRAY_SIZE(formats_rk356x_esmart),
  202. .format_modifiers = format_modifiers,
  203. .base = 0x1800,
  204. .layer_sel_id = 2,
  205. .supported_rotations = DRM_MODE_REFLECT_Y,
  206. .type = DRM_PLANE_TYPE_PRIMARY,
  207. .max_upscale_factor = 8,
  208. .max_downscale_factor = 8,
  209. .dly = { 20, 47, 41 },
  210. }, {
  211. .name = "Cluster0-win0",
  212. .phys_id = ROCKCHIP_VOP2_CLUSTER0,
  213. .base = 0x1000,
  214. .formats = formats_cluster,
  215. .nformats = ARRAY_SIZE(formats_cluster),
  216. .format_modifiers = format_modifiers_afbc,
  217. .layer_sel_id = 0,
  218. .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 |
  219. DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
  220. .max_upscale_factor = 4,
  221. .max_downscale_factor = 4,
  222. .dly = { 0, 27, 21 },
  223. .type = DRM_PLANE_TYPE_OVERLAY,
  224. .feature = WIN_FEATURE_AFBDC | WIN_FEATURE_CLUSTER,
  225. }, {
  226. .name = "Cluster1-win0",
  227. .phys_id = ROCKCHIP_VOP2_CLUSTER1,
  228. .base = 0x1200,
  229. .formats = formats_cluster,
  230. .nformats = ARRAY_SIZE(formats_cluster),
  231. .format_modifiers = format_modifiers_afbc,
  232. .layer_sel_id = 1,
  233. .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 |
  234. DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
  235. .type = DRM_PLANE_TYPE_OVERLAY,
  236. .max_upscale_factor = 4,
  237. .max_downscale_factor = 4,
  238. .dly = { 0, 27, 21 },
  239. .feature = WIN_FEATURE_AFBDC | WIN_FEATURE_CLUSTER,
  240. },
  241. };
  242. static const struct vop2_video_port_data rk3588_vop_video_ports[] = {
  243. {
  244. .id = 0,
  245. .feature = VOP2_VP_FEATURE_OUTPUT_10BIT,
  246. .gamma_lut_len = 1024,
  247. .cubic_lut_len = 9 * 9 * 9, /* 9x9x9 */
  248. .max_output = { 4096, 2304 },
  249. /* hdr2sdr sdr2hdr hdr2hdr sdr2sdr */
  250. .pre_scan_max_dly = { 76, 65, 65, 54 },
  251. .offset = 0xc00,
  252. }, {
  253. .id = 1,
  254. .feature = VOP2_VP_FEATURE_OUTPUT_10BIT,
  255. .gamma_lut_len = 1024,
  256. .cubic_lut_len = 729, /* 9x9x9 */
  257. .max_output = { 4096, 2304 },
  258. .pre_scan_max_dly = { 76, 65, 65, 54 },
  259. .offset = 0xd00,
  260. }, {
  261. .id = 2,
  262. .feature = VOP2_VP_FEATURE_OUTPUT_10BIT,
  263. .gamma_lut_len = 1024,
  264. .cubic_lut_len = 17 * 17 * 17, /* 17x17x17 */
  265. .max_output = { 4096, 2304 },
  266. .pre_scan_max_dly = { 52, 52, 52, 52 },
  267. .offset = 0xe00,
  268. }, {
  269. .id = 3,
  270. .gamma_lut_len = 1024,
  271. .max_output = { 2048, 1536 },
  272. .pre_scan_max_dly = { 52, 52, 52, 52 },
  273. .offset = 0xf00,
  274. },
  275. };
  276. /*
  277. * rk3588 vop with 4 cluster, 4 esmart win.
  278. * Every cluster can work as 4K win or split into two win.
  279. * All win in cluster support AFBCD.
  280. *
  281. * Every esmart win and smart win support 4 Multi-region.
  282. *
  283. * Scale filter mode:
  284. *
  285. * * Cluster: bicubic for horizontal scale up, others use bilinear
  286. * * ESmart:
  287. * * nearest-neighbor/bilinear/bicubic for scale up
  288. * * nearest-neighbor/bilinear/average for scale down
  289. *
  290. * AXI Read ID assignment:
  291. * Two AXI bus:
  292. * AXI0 is a read/write bus with a higher performance.
  293. * AXI1 is a read only bus.
  294. *
  295. * Every window on a AXI bus must assigned two unique
  296. * read id(yrgb_r_id/uv_r_id, valid id are 0x1~0xe).
  297. *
  298. * AXI0:
  299. * Cluster0/1, Esmart0/1, WriteBack
  300. *
  301. * AXI 1:
  302. * Cluster2/3, Esmart2/3
  303. *
  304. */
  305. static const struct vop2_win_data rk3588_vop_win_data[] = {
  306. {
  307. .name = "Cluster0-win0",
  308. .phys_id = ROCKCHIP_VOP2_CLUSTER0,
  309. .base = 0x1000,
  310. .formats = formats_cluster,
  311. .nformats = ARRAY_SIZE(formats_cluster),
  312. .format_modifiers = format_modifiers_afbc,
  313. .layer_sel_id = 0,
  314. .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 |
  315. DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
  316. .axi_bus_id = 0,
  317. .axi_yrgb_r_id = 2,
  318. .axi_uv_r_id = 3,
  319. .max_upscale_factor = 4,
  320. .max_downscale_factor = 4,
  321. .dly = { 4, 26, 29 },
  322. .type = DRM_PLANE_TYPE_PRIMARY,
  323. .feature = WIN_FEATURE_AFBDC | WIN_FEATURE_CLUSTER,
  324. }, {
  325. .name = "Cluster1-win0",
  326. .phys_id = ROCKCHIP_VOP2_CLUSTER1,
  327. .base = 0x1200,
  328. .formats = formats_cluster,
  329. .nformats = ARRAY_SIZE(formats_cluster),
  330. .format_modifiers = format_modifiers_afbc,
  331. .layer_sel_id = 1,
  332. .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 |
  333. DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
  334. .type = DRM_PLANE_TYPE_PRIMARY,
  335. .axi_bus_id = 0,
  336. .axi_yrgb_r_id = 6,
  337. .axi_uv_r_id = 7,
  338. .max_upscale_factor = 4,
  339. .max_downscale_factor = 4,
  340. .dly = { 4, 26, 29 },
  341. .feature = WIN_FEATURE_AFBDC | WIN_FEATURE_CLUSTER,
  342. }, {
  343. .name = "Cluster2-win0",
  344. .phys_id = ROCKCHIP_VOP2_CLUSTER2,
  345. .base = 0x1400,
  346. .formats = formats_cluster,
  347. .nformats = ARRAY_SIZE(formats_cluster),
  348. .format_modifiers = format_modifiers_afbc,
  349. .layer_sel_id = 4,
  350. .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 |
  351. DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
  352. .type = DRM_PLANE_TYPE_PRIMARY,
  353. .axi_bus_id = 1,
  354. .axi_yrgb_r_id = 2,
  355. .axi_uv_r_id = 3,
  356. .max_upscale_factor = 4,
  357. .max_downscale_factor = 4,
  358. .dly = { 4, 26, 29 },
  359. .feature = WIN_FEATURE_AFBDC | WIN_FEATURE_CLUSTER,
  360. }, {
  361. .name = "Cluster3-win0",
  362. .phys_id = ROCKCHIP_VOP2_CLUSTER3,
  363. .base = 0x1600,
  364. .formats = formats_cluster,
  365. .nformats = ARRAY_SIZE(formats_cluster),
  366. .format_modifiers = format_modifiers_afbc,
  367. .layer_sel_id = 5,
  368. .supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 |
  369. DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
  370. .type = DRM_PLANE_TYPE_PRIMARY,
  371. .axi_bus_id = 1,
  372. .axi_yrgb_r_id = 6,
  373. .axi_uv_r_id = 7,
  374. .max_upscale_factor = 4,
  375. .max_downscale_factor = 4,
  376. .dly = { 4, 26, 29 },
  377. .feature = WIN_FEATURE_AFBDC | WIN_FEATURE_CLUSTER,
  378. }, {
  379. .name = "Esmart0-win0",
  380. .phys_id = ROCKCHIP_VOP2_ESMART0,
  381. .formats = formats_esmart,
  382. .nformats = ARRAY_SIZE(formats_esmart),
  383. .format_modifiers = format_modifiers,
  384. .base = 0x1800,
  385. .layer_sel_id = 2,
  386. .supported_rotations = DRM_MODE_REFLECT_Y,
  387. .type = DRM_PLANE_TYPE_OVERLAY,
  388. .axi_bus_id = 0,
  389. .axi_yrgb_r_id = 0x0a,
  390. .axi_uv_r_id = 0x0b,
  391. .max_upscale_factor = 8,
  392. .max_downscale_factor = 8,
  393. .dly = { 23, 45, 48 },
  394. }, {
  395. .name = "Esmart1-win0",
  396. .phys_id = ROCKCHIP_VOP2_ESMART1,
  397. .formats = formats_esmart,
  398. .nformats = ARRAY_SIZE(formats_esmart),
  399. .format_modifiers = format_modifiers,
  400. .base = 0x1a00,
  401. .layer_sel_id = 3,
  402. .supported_rotations = DRM_MODE_REFLECT_Y,
  403. .type = DRM_PLANE_TYPE_OVERLAY,
  404. .axi_bus_id = 0,
  405. .axi_yrgb_r_id = 0x0c,
  406. .axi_uv_r_id = 0x01,
  407. .max_upscale_factor = 8,
  408. .max_downscale_factor = 8,
  409. .dly = { 23, 45, 48 },
  410. }, {
  411. .name = "Esmart2-win0",
  412. .phys_id = ROCKCHIP_VOP2_ESMART2,
  413. .base = 0x1c00,
  414. .formats = formats_esmart,
  415. .nformats = ARRAY_SIZE(formats_esmart),
  416. .format_modifiers = format_modifiers,
  417. .layer_sel_id = 6,
  418. .supported_rotations = DRM_MODE_REFLECT_Y,
  419. .type = DRM_PLANE_TYPE_OVERLAY,
  420. .axi_bus_id = 1,
  421. .axi_yrgb_r_id = 0x0a,
  422. .axi_uv_r_id = 0x0b,
  423. .max_upscale_factor = 8,
  424. .max_downscale_factor = 8,
  425. .dly = { 23, 45, 48 },
  426. }, {
  427. .name = "Esmart3-win0",
  428. .phys_id = ROCKCHIP_VOP2_ESMART3,
  429. .formats = formats_esmart,
  430. .nformats = ARRAY_SIZE(formats_esmart),
  431. .format_modifiers = format_modifiers,
  432. .base = 0x1e00,
  433. .layer_sel_id = 7,
  434. .supported_rotations = DRM_MODE_REFLECT_Y,
  435. .type = DRM_PLANE_TYPE_OVERLAY,
  436. .axi_bus_id = 1,
  437. .axi_yrgb_r_id = 0x0c,
  438. .axi_uv_r_id = 0x0d,
  439. .max_upscale_factor = 8,
  440. .max_downscale_factor = 8,
  441. .dly = { 23, 45, 48 },
  442. },
  443. };
  444. static const struct vop2_data rk3566_vop = {
  445. .feature = VOP2_FEATURE_HAS_SYS_GRF,
  446. .nr_vps = 3,
  447. .max_input = { 4096, 2304 },
  448. .max_output = { 4096, 2304 },
  449. .vp = rk3568_vop_video_ports,
  450. .win = rk3568_vop_win_data,
  451. .win_size = ARRAY_SIZE(rk3568_vop_win_data),
  452. .soc_id = 3566,
  453. };
  454. static const struct vop2_data rk3568_vop = {
  455. .feature = VOP2_FEATURE_HAS_SYS_GRF,
  456. .nr_vps = 3,
  457. .max_input = { 4096, 2304 },
  458. .max_output = { 4096, 2304 },
  459. .vp = rk3568_vop_video_ports,
  460. .win = rk3568_vop_win_data,
  461. .win_size = ARRAY_SIZE(rk3568_vop_win_data),
  462. .soc_id = 3568,
  463. };
  464. static const struct vop2_data rk3588_vop = {
  465. .feature = VOP2_FEATURE_HAS_SYS_GRF | VOP2_FEATURE_HAS_VO1_GRF |
  466. VOP2_FEATURE_HAS_VOP_GRF | VOP2_FEATURE_HAS_SYS_PMU,
  467. .nr_vps = 4,
  468. .max_input = { 4096, 4320 },
  469. .max_output = { 4096, 4320 },
  470. .vp = rk3588_vop_video_ports,
  471. .win = rk3588_vop_win_data,
  472. .win_size = ARRAY_SIZE(rk3588_vop_win_data),
  473. .soc_id = 3588,
  474. };
  475. static const struct of_device_id vop2_dt_match[] = {
  476. {
  477. .compatible = "rockchip,rk3566-vop",
  478. .data = &rk3566_vop,
  479. }, {
  480. .compatible = "rockchip,rk3568-vop",
  481. .data = &rk3568_vop,
  482. }, {
  483. .compatible = "rockchip,rk3588-vop",
  484. .data = &rk3588_vop
  485. }, {
  486. },
  487. };
  488. MODULE_DEVICE_TABLE(of, vop2_dt_match);
  489. static int vop2_probe(struct platform_device *pdev)
  490. {
  491. struct device *dev = &pdev->dev;
  492. return component_add(dev, &vop2_component_ops);
  493. }
  494. static void vop2_remove(struct platform_device *pdev)
  495. {
  496. component_del(&pdev->dev, &vop2_component_ops);
  497. }
  498. struct platform_driver vop2_platform_driver = {
  499. .probe = vop2_probe,
  500. .remove_new = vop2_remove,
  501. .driver = {
  502. .name = "rockchip-vop2",
  503. .of_match_table = vop2_dt_match,
  504. },
  505. };