193-media-atmel-atmel-sama5d2-isc-fix-YUYV-format.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From 21261e30679118b96ed537d1cdf9e12682fc1b29 Mon Sep 17 00:00:00 2001
  2. From: Eugen Hristev <[email protected]>
  3. Date: Wed, 9 Jun 2021 15:00:28 +0200
  4. Subject: [PATCH 193/247] media: atmel: atmel-sama5d2-isc: fix YUYV format
  5. SAMA5D2 does not have the YCYC field for the RLP (rounding, limiting,
  6. packaging) module.
  7. The YCYC field is supposed to work with interleaved YUV formats like YUYV.
  8. In SAMA5D2, we have to use YYCC field, which is used for both planar
  9. formats like YUV420 and interleaved formats like YUYV.
  10. Fix the according rlp callback to replace the generic YCYC field (which
  11. makes more sense from a logical point of view) with the required YYCC
  12. field.
  13. Fixes: debfa496871c ("media: atmel: atmel-isc-base: add support for more formats and additional pipeline modules")
  14. Signed-off-by: Eugen Hristev <[email protected]>
  15. Signed-off-by: Hans Verkuil <[email protected]>
  16. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  17. ---
  18. .../media/platform/atmel/atmel-sama5d2-isc.c | 17 +++++++++++++++++
  19. 1 file changed, 17 insertions(+)
  20. --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  21. +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  22. @@ -255,6 +255,23 @@ static void isc_sama5d2_config_rlp(struc
  23. struct regmap *regmap = isc->regmap;
  24. u32 rlp_mode = isc->config.rlp_cfg_mode;
  25. + /*
  26. + * In sama5d2, the YUV planar modes and the YUYV modes are treated
  27. + * in the same way in RLP register.
  28. + * Normally, YYCC mode should be Luma(n) - Color B(n) - Color R (n)
  29. + * and YCYC should be Luma(n + 1) - Color B (n) - Luma (n) - Color R (n)
  30. + * but in sama5d2, the YCYC mode does not exist, and YYCC must be
  31. + * selected for both planar and interleaved modes, as in fact
  32. + * both modes are supported.
  33. + *
  34. + * Thus, if the YCYC mode is selected, replace it with the
  35. + * sama5d2-compliant mode which is YYCC .
  36. + */
  37. + if ((rlp_mode & ISC_RLP_CFG_MODE_YCYC) == ISC_RLP_CFG_MODE_YCYC) {
  38. + rlp_mode &= ~ISC_RLP_CFG_MODE_MASK;
  39. + rlp_mode |= ISC_RLP_CFG_MODE_YYCC;
  40. + }
  41. +
  42. regmap_update_bits(regmap, ISC_RLP_CFG + isc->offsets.rlp,
  43. ISC_RLP_CFG_MODE_MASK, rlp_mode);
  44. }