2
0

162-media-atmel-atmel-isc-extract-CSC-submodule-config-i.patch 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. From 6ccda3cf6a102ac4f6e21386d0dd0fedfb066525 Mon Sep 17 00:00:00 2001
  2. From: Eugen Hristev <[email protected]>
  3. Date: Tue, 13 Apr 2021 12:57:04 +0200
  4. Subject: [PATCH 162/247] media: atmel: atmel-isc: extract CSC submodule config
  5. into separate function
  6. The CSC submodule is a part of the atmel-isc pipeline, and stands for
  7. Color Space Conversion. It is used to apply a matrix transformation to
  8. RGB pixels to convert them to the YUV components.
  9. The CSC submodule should be initialized in the product specific driver
  10. as it's product specific. Other products can implement it differently.
  11. [hverkuil: made isc_sama5d2_config_csc static]
  12. Signed-off-by: Eugen Hristev <[email protected]>
  13. Signed-off-by: Hans Verkuil <[email protected]>
  14. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  15. ---
  16. drivers/media/platform/atmel/atmel-isc-base.c | 8 +-------
  17. drivers/media/platform/atmel/atmel-isc.h | 7 +++++++
  18. drivers/media/platform/atmel/atmel-sama5d2-isc.c | 15 +++++++++++++++
  19. 3 files changed, 23 insertions(+), 7 deletions(-)
  20. --- a/drivers/media/platform/atmel/atmel-isc-base.c
  21. +++ b/drivers/media/platform/atmel/atmel-isc-base.c
  22. @@ -654,13 +654,7 @@ static void isc_set_pipeline(struct isc_
  23. regmap_bulk_write(regmap, ISC_GAM_GENTRY, gamma, GAMMA_ENTRIES);
  24. regmap_bulk_write(regmap, ISC_GAM_RENTRY, gamma, GAMMA_ENTRIES);
  25. - /* Convert RGB to YUV */
  26. - regmap_write(regmap, ISC_CSC_YR_YG, 0x42 | (0x81 << 16));
  27. - regmap_write(regmap, ISC_CSC_YB_OY, 0x19 | (0x10 << 16));
  28. - regmap_write(regmap, ISC_CSC_CBR_CBG, 0xFDA | (0xFB6 << 16));
  29. - regmap_write(regmap, ISC_CSC_CBB_OCB, 0x70 | (0x80 << 16));
  30. - regmap_write(regmap, ISC_CSC_CRR_CRG, 0x70 | (0xFA2 << 16));
  31. - regmap_write(regmap, ISC_CSC_CRB_OCR, 0xFEE | (0x80 << 16));
  32. + isc->config_csc(isc);
  33. regmap_write(regmap, ISC_CBC_BRIGHT, ctrls->brightness);
  34. regmap_write(regmap, ISC_CBC_CONTRAST, ctrls->contrast);
  35. --- a/drivers/media/platform/atmel/atmel-isc.h
  36. +++ b/drivers/media/platform/atmel/atmel-isc.h
  37. @@ -191,6 +191,9 @@ struct isc_ctrls {
  38. *
  39. * @max_width: maximum frame width, dependent on the internal RAM
  40. * @max_height: maximum frame height, dependent on the internal RAM
  41. + *
  42. + * @config_csc: pointer to a function that initializes product
  43. + * specific CSC module
  44. */
  45. struct isc_device {
  46. struct regmap *regmap;
  47. @@ -258,6 +261,10 @@ struct isc_device {
  48. u32 max_width;
  49. u32 max_height;
  50. +
  51. + struct {
  52. + void (*config_csc)(struct isc_device *isc);
  53. + };
  54. };
  55. extern struct isc_format formats_list[];
  56. --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  57. +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  58. @@ -54,6 +54,19 @@
  59. #define ISC_CLK_MAX_DIV 255
  60. +static void isc_sama5d2_config_csc(struct isc_device *isc)
  61. +{
  62. + struct regmap *regmap = isc->regmap;
  63. +
  64. + /* Convert RGB to YUV */
  65. + regmap_write(regmap, ISC_CSC_YR_YG, 0x42 | (0x81 << 16));
  66. + regmap_write(regmap, ISC_CSC_YB_OY, 0x19 | (0x10 << 16));
  67. + regmap_write(regmap, ISC_CSC_CBR_CBG, 0xFDA | (0xFB6 << 16));
  68. + regmap_write(regmap, ISC_CSC_CBB_OCB, 0x70 | (0x80 << 16));
  69. + regmap_write(regmap, ISC_CSC_CRR_CRG, 0x70 | (0xFA2 << 16));
  70. + regmap_write(regmap, ISC_CSC_CRB_OCR, 0xFEE | (0x80 << 16));
  71. +}
  72. +
  73. /* Gamma table with gamma 1/2.2 */
  74. static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
  75. /* 0 --> gamma 1/1.8 */
  76. @@ -219,6 +232,8 @@ static int atmel_isc_probe(struct platfo
  77. isc->max_width = ISC_SAMA5D2_MAX_SUPPORT_WIDTH;
  78. isc->max_height = ISC_SAMA5D2_MAX_SUPPORT_HEIGHT;
  79. + isc->config_csc = isc_sama5d2_config_csc;
  80. +
  81. /* sama5d2-isc - 8 bits per beat */
  82. isc->dcfg = ISC_DCFG_YMBSIZE_BEATS8 | ISC_DCFG_CMBSIZE_BEATS8;