183-media-atmel-atmel-isc-base-add-support-for-more-form.patch 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. From fa9e6cd8f3ba4a277c06e4c1fb01cd69b3a57234 Mon Sep 17 00:00:00 2001
  2. From: Eugen Hristev <[email protected]>
  3. Date: Tue, 13 Apr 2021 12:57:25 +0200
  4. Subject: [PATCH 183/247] media: atmel: atmel-isc-base: add support for more
  5. formats and additional pipeline modules
  6. Add support for additional formats supported by newer pipelines, and for
  7. additional pipeline modules.
  8. Signed-off-by: Eugen Hristev <[email protected]>
  9. Signed-off-by: Hans Verkuil <[email protected]>
  10. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  11. ---
  12. drivers/media/platform/atmel/atmel-isc-base.c | 48 +++++++++++++++----
  13. 1 file changed, 38 insertions(+), 10 deletions(-)
  14. diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c
  15. index 7862d6bf850d..dcb321ad10b8 100644
  16. --- a/drivers/media/platform/atmel/atmel-isc-base.c
  17. +++ b/drivers/media/platform/atmel/atmel-isc-base.c
  18. @@ -855,6 +855,8 @@ static int isc_try_validate_formats(struct isc_device *isc)
  19. case V4L2_PIX_FMT_YUV420:
  20. case V4L2_PIX_FMT_YUV422P:
  21. case V4L2_PIX_FMT_YUYV:
  22. + case V4L2_PIX_FMT_UYVY:
  23. + case V4L2_PIX_FMT_VYUY:
  24. ret = 0;
  25. yuv = true;
  26. break;
  27. @@ -869,6 +871,7 @@ static int isc_try_validate_formats(struct isc_device *isc)
  28. break;
  29. case V4L2_PIX_FMT_GREY:
  30. case V4L2_PIX_FMT_Y10:
  31. + case V4L2_PIX_FMT_Y16:
  32. ret = 0;
  33. grey = true;
  34. break;
  35. @@ -899,6 +902,8 @@ static int isc_try_validate_formats(struct isc_device *isc)
  36. */
  37. static int isc_try_configure_rlp_dma(struct isc_device *isc, bool direct_dump)
  38. {
  39. + isc->try_config.rlp_cfg_mode = 0;
  40. +
  41. switch (isc->try_config.fourcc) {
  42. case V4L2_PIX_FMT_SBGGR8:
  43. case V4L2_PIX_FMT_SGBRG8:
  44. @@ -965,7 +970,19 @@ static int isc_try_configure_rlp_dma(struct isc_device *isc, bool direct_dump)
  45. isc->try_config.bpp = 16;
  46. break;
  47. case V4L2_PIX_FMT_YUYV:
  48. - isc->try_config.rlp_cfg_mode = ISC_RLP_CFG_MODE_YYCC;
  49. + isc->try_config.rlp_cfg_mode = ISC_RLP_CFG_MODE_YCYC | ISC_RLP_CFG_YMODE_YUYV;
  50. + isc->try_config.dcfg_imode = ISC_DCFG_IMODE_PACKED32;
  51. + isc->try_config.dctrl_dview = ISC_DCTRL_DVIEW_PACKED;
  52. + isc->try_config.bpp = 16;
  53. + break;
  54. + case V4L2_PIX_FMT_UYVY:
  55. + isc->try_config.rlp_cfg_mode = ISC_RLP_CFG_MODE_YCYC | ISC_RLP_CFG_YMODE_UYVY;
  56. + isc->try_config.dcfg_imode = ISC_DCFG_IMODE_PACKED32;
  57. + isc->try_config.dctrl_dview = ISC_DCTRL_DVIEW_PACKED;
  58. + isc->try_config.bpp = 16;
  59. + break;
  60. + case V4L2_PIX_FMT_VYUY:
  61. + isc->try_config.rlp_cfg_mode = ISC_RLP_CFG_MODE_YCYC | ISC_RLP_CFG_YMODE_VYUY;
  62. isc->try_config.dcfg_imode = ISC_DCFG_IMODE_PACKED32;
  63. isc->try_config.dctrl_dview = ISC_DCTRL_DVIEW_PACKED;
  64. isc->try_config.bpp = 16;
  65. @@ -976,8 +993,11 @@ static int isc_try_configure_rlp_dma(struct isc_device *isc, bool direct_dump)
  66. isc->try_config.dctrl_dview = ISC_DCTRL_DVIEW_PACKED;
  67. isc->try_config.bpp = 8;
  68. break;
  69. + case V4L2_PIX_FMT_Y16:
  70. + isc->try_config.rlp_cfg_mode = ISC_RLP_CFG_MODE_DATY10 | ISC_RLP_CFG_LSH;
  71. + fallthrough;
  72. case V4L2_PIX_FMT_Y10:
  73. - isc->try_config.rlp_cfg_mode = ISC_RLP_CFG_MODE_DATY10;
  74. + isc->try_config.rlp_cfg_mode |= ISC_RLP_CFG_MODE_DATY10;
  75. isc->try_config.dcfg_imode = ISC_DCFG_IMODE_PACKED16;
  76. isc->try_config.dctrl_dview = ISC_DCTRL_DVIEW_PACKED;
  77. isc->try_config.bpp = 16;
  78. @@ -1011,7 +1031,8 @@ static int isc_try_configure_pipeline(struct isc_device *isc)
  79. /* if sensor format is RAW, we convert inside ISC */
  80. if (ISC_IS_FORMAT_RAW(isc->try_config.sd_format->mbus_code)) {
  81. isc->try_config.bits_pipeline = CFA_ENABLE |
  82. - WB_ENABLE | GAM_ENABLES;
  83. + WB_ENABLE | GAM_ENABLES | DPC_BLCENABLE |
  84. + CC_ENABLE;
  85. } else {
  86. isc->try_config.bits_pipeline = 0x0;
  87. }
  88. @@ -1020,8 +1041,9 @@ static int isc_try_configure_pipeline(struct isc_device *isc)
  89. /* if sensor format is RAW, we convert inside ISC */
  90. if (ISC_IS_FORMAT_RAW(isc->try_config.sd_format->mbus_code)) {
  91. isc->try_config.bits_pipeline = CFA_ENABLE |
  92. - CSC_ENABLE | WB_ENABLE | GAM_ENABLES |
  93. - SUB420_ENABLE | SUB422_ENABLE | CBC_ENABLE;
  94. + CSC_ENABLE | GAM_ENABLES | WB_ENABLE |
  95. + SUB420_ENABLE | SUB422_ENABLE | CBC_ENABLE |
  96. + DPC_BLCENABLE;
  97. } else {
  98. isc->try_config.bits_pipeline = 0x0;
  99. }
  100. @@ -1031,33 +1053,39 @@ static int isc_try_configure_pipeline(struct isc_device *isc)
  101. if (ISC_IS_FORMAT_RAW(isc->try_config.sd_format->mbus_code)) {
  102. isc->try_config.bits_pipeline = CFA_ENABLE |
  103. CSC_ENABLE | WB_ENABLE | GAM_ENABLES |
  104. - SUB422_ENABLE | CBC_ENABLE;
  105. + SUB422_ENABLE | CBC_ENABLE | DPC_BLCENABLE;
  106. } else {
  107. isc->try_config.bits_pipeline = 0x0;
  108. }
  109. break;
  110. case V4L2_PIX_FMT_YUYV:
  111. + case V4L2_PIX_FMT_UYVY:
  112. + case V4L2_PIX_FMT_VYUY:
  113. /* if sensor format is RAW, we convert inside ISC */
  114. if (ISC_IS_FORMAT_RAW(isc->try_config.sd_format->mbus_code)) {
  115. isc->try_config.bits_pipeline = CFA_ENABLE |
  116. CSC_ENABLE | WB_ENABLE | GAM_ENABLES |
  117. - SUB422_ENABLE | CBC_ENABLE;
  118. + SUB422_ENABLE | CBC_ENABLE | DPC_BLCENABLE;
  119. } else {
  120. isc->try_config.bits_pipeline = 0x0;
  121. }
  122. break;
  123. case V4L2_PIX_FMT_GREY:
  124. - if (ISC_IS_FORMAT_RAW(isc->try_config.sd_format->mbus_code)) {
  125. + case V4L2_PIX_FMT_Y16:
  126. /* if sensor format is RAW, we convert inside ISC */
  127. + if (ISC_IS_FORMAT_RAW(isc->try_config.sd_format->mbus_code)) {
  128. isc->try_config.bits_pipeline = CFA_ENABLE |
  129. CSC_ENABLE | WB_ENABLE | GAM_ENABLES |
  130. - CBC_ENABLE;
  131. + CBC_ENABLE | DPC_BLCENABLE;
  132. } else {
  133. isc->try_config.bits_pipeline = 0x0;
  134. }
  135. break;
  136. default:
  137. - isc->try_config.bits_pipeline = 0x0;
  138. + if (ISC_IS_FORMAT_RAW(isc->try_config.sd_format->mbus_code))
  139. + isc->try_config.bits_pipeline = WB_ENABLE | DPC_BLCENABLE;
  140. + else
  141. + isc->try_config.bits_pipeline = 0x0;
  142. }
  143. /* Tune the pipeline to product specific */
  144. --
  145. 2.32.0