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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. --- a/drivers/media/platform/atmel/atmel-isc-base.c
  22. +++ b/drivers/media/platform/atmel/atmel-isc-base.c
  23. @@ -661,6 +661,7 @@ static void isc_set_pipeline(struct isc_
  24. isc->config_csc(isc);
  25. isc->config_cbc(isc);
  26. + isc->config_cc(isc);
  27. }
  28. static int isc_update_profile(struct isc_device *isc)
  29. --- a/drivers/media/platform/atmel/atmel-isc.h
  30. +++ b/drivers/media/platform/atmel/atmel-isc.h
  31. @@ -224,6 +224,8 @@ struct isc_reg_offsets {
  32. * specific CSC module
  33. * @config_cbc: pointer to a function that initializes product
  34. * specific CBC module
  35. + * @config_cc: pointer to a function that initializes product
  36. + * specific CC module
  37. *
  38. * @offsets: struct holding the product specific register offsets
  39. */
  40. @@ -297,6 +299,7 @@ struct isc_device {
  41. struct {
  42. void (*config_csc)(struct isc_device *isc);
  43. void (*config_cbc)(struct isc_device *isc);
  44. + void (*config_cc)(struct isc_device *isc);
  45. };
  46. struct isc_reg_offsets offsets;
  47. --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  48. +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  49. @@ -83,6 +83,19 @@ static void isc_sama5d2_config_cbc(struc
  50. isc->ctrls.contrast);
  51. }
  52. +static void isc_sama5d2_config_cc(struct isc_device *isc)
  53. +{
  54. + struct regmap *regmap = isc->regmap;
  55. +
  56. + /* Configure each register at the neutral fixed point 1.0 or 0.0 */
  57. + regmap_write(regmap, ISC_CC_RR_RG, (1 << 8));
  58. + regmap_write(regmap, ISC_CC_RB_OR, 0);
  59. + regmap_write(regmap, ISC_CC_GR_GG, (1 << 8) << 16);
  60. + regmap_write(regmap, ISC_CC_GB_OG, 0);
  61. + regmap_write(regmap, ISC_CC_BR_BG, 0);
  62. + regmap_write(regmap, ISC_CC_BB_OB, (1 << 8));
  63. +}
  64. +
  65. /* Gamma table with gamma 1/2.2 */
  66. static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
  67. /* 0 --> gamma 1/1.8 */
  68. @@ -251,6 +264,7 @@ static int atmel_isc_probe(struct platfo
  69. isc->config_csc = isc_sama5d2_config_csc;
  70. isc->config_cbc = isc_sama5d2_config_cbc;
  71. + isc->config_cc = isc_sama5d2_config_cc;
  72. isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;
  73. isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET;