175-media-atmel-atmel-isc-add-CC-initialization-function.patch 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. From 0db91d2a803221c313c9f2cd1d71050d7c5a7b5b Mon Sep 17 00:00:00 2001
  2. From: Eugen Hristev <[email protected]>
  3. Date: Tue, 13 Apr 2021 12:57:17 +0200
  4. Subject: [PATCH 175/247] media: atmel: atmel-isc: add CC initialization
  5. function
  6. The CC submodule is a part of the atmel-isc pipeline, and stands for
  7. Color Correction. It is used to apply gains and offsets to the
  8. chroma (U, V) components of the YUV elements.
  9. Implement the CC submodule initialization, as a product
  10. specific function, which currently configures the neutral point in color
  11. correction.
  12. [hverkuil: made isc_sama5d2_config_cc static]
  13. Signed-off-by: Eugen Hristev <[email protected]>
  14. Signed-off-by: Hans Verkuil <[email protected]>
  15. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  16. ---
  17. drivers/media/platform/atmel/atmel-isc-base.c | 1 +
  18. drivers/media/platform/atmel/atmel-isc.h | 3 +++
  19. drivers/media/platform/atmel/atmel-sama5d2-isc.c | 14 ++++++++++++++
  20. 3 files changed, 18 insertions(+)
  21. diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c
  22. index a6b62e009c38..ffce8de2cf4d 100644
  23. --- a/drivers/media/platform/atmel/atmel-isc-base.c
  24. +++ b/drivers/media/platform/atmel/atmel-isc-base.c
  25. @@ -661,6 +661,7 @@ static void isc_set_pipeline(struct isc_device *isc, u32 pipeline)
  26. isc->config_csc(isc);
  27. isc->config_cbc(isc);
  28. + isc->config_cc(isc);
  29. }
  30. static int isc_update_profile(struct isc_device *isc)
  31. diff --git a/drivers/media/platform/atmel/atmel-isc.h b/drivers/media/platform/atmel/atmel-isc.h
  32. index 86edeea2d5cd..293746664cef 100644
  33. --- a/drivers/media/platform/atmel/atmel-isc.h
  34. +++ b/drivers/media/platform/atmel/atmel-isc.h
  35. @@ -224,6 +224,8 @@ struct isc_reg_offsets {
  36. * specific CSC module
  37. * @config_cbc: pointer to a function that initializes product
  38. * specific CBC module
  39. + * @config_cc: pointer to a function that initializes product
  40. + * specific CC module
  41. *
  42. * @offsets: struct holding the product specific register offsets
  43. */
  44. @@ -297,6 +299,7 @@ struct isc_device {
  45. struct {
  46. void (*config_csc)(struct isc_device *isc);
  47. void (*config_cbc)(struct isc_device *isc);
  48. + void (*config_cc)(struct isc_device *isc);
  49. };
  50. struct isc_reg_offsets offsets;
  51. diff --git a/drivers/media/platform/atmel/atmel-sama5d2-isc.c b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  52. index ed575eb3726d..903920b74965 100644
  53. --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  54. +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  55. @@ -83,6 +83,19 @@ static void isc_sama5d2_config_cbc(struct isc_device *isc)
  56. isc->ctrls.contrast);
  57. }
  58. +static void isc_sama5d2_config_cc(struct isc_device *isc)
  59. +{
  60. + struct regmap *regmap = isc->regmap;
  61. +
  62. + /* Configure each register at the neutral fixed point 1.0 or 0.0 */
  63. + regmap_write(regmap, ISC_CC_RR_RG, (1 << 8));
  64. + regmap_write(regmap, ISC_CC_RB_OR, 0);
  65. + regmap_write(regmap, ISC_CC_GR_GG, (1 << 8) << 16);
  66. + regmap_write(regmap, ISC_CC_GB_OG, 0);
  67. + regmap_write(regmap, ISC_CC_BR_BG, 0);
  68. + regmap_write(regmap, ISC_CC_BB_OB, (1 << 8));
  69. +}
  70. +
  71. /* Gamma table with gamma 1/2.2 */
  72. static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
  73. /* 0 --> gamma 1/1.8 */
  74. @@ -251,6 +264,7 @@ static int atmel_isc_probe(struct platform_device *pdev)
  75. isc->config_csc = isc_sama5d2_config_csc;
  76. isc->config_cbc = isc_sama5d2_config_cbc;
  77. + isc->config_cc = isc_sama5d2_config_cc;
  78. isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;
  79. isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET;
  80. --
  81. 2.32.0