165-media-atmel-atmel-isc-extract-CBC-submodule-config-i.patch 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. From aa31e58d80d233385fa3b972e6b85f293e2a9093 Mon Sep 17 00:00:00 2001
  2. From: Eugen Hristev <[email protected]>
  3. Date: Tue, 13 Apr 2021 12:57:07 +0200
  4. Subject: [PATCH 165/247] media: atmel: atmel-isc: extract CBC submodule config
  5. into separate function
  6. The CBC submodule is a part of the atmel-isc pipeline, and stands for
  7. Contrast Brightness Control. It is used to apply gains and offsets to the
  8. luma (Y) and chroma (U, V) components of the YUV elements.
  9. The CBC 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_cbc 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 | 4 +---
  17. drivers/media/platform/atmel/atmel-isc.h | 3 +++
  18. drivers/media/platform/atmel/atmel-sama5d2-isc.c | 9 +++++++++
  19. 3 files changed, 13 insertions(+), 3 deletions(-)
  20. --- a/drivers/media/platform/atmel/atmel-isc-base.c
  21. +++ b/drivers/media/platform/atmel/atmel-isc-base.c
  22. @@ -655,9 +655,7 @@ static void isc_set_pipeline(struct isc_
  23. regmap_bulk_write(regmap, ISC_GAM_RENTRY, gamma, GAMMA_ENTRIES);
  24. isc->config_csc(isc);
  25. -
  26. - regmap_write(regmap, ISC_CBC_BRIGHT, ctrls->brightness);
  27. - regmap_write(regmap, ISC_CBC_CONTRAST, ctrls->contrast);
  28. + isc->config_cbc(isc);
  29. }
  30. static int isc_update_profile(struct isc_device *isc)
  31. --- a/drivers/media/platform/atmel/atmel-isc.h
  32. +++ b/drivers/media/platform/atmel/atmel-isc.h
  33. @@ -202,6 +202,8 @@ struct isc_reg_offsets {
  34. *
  35. * @config_csc: pointer to a function that initializes product
  36. * specific CSC module
  37. + * @config_cbc: pointer to a function that initializes product
  38. + * specific CBC module
  39. *
  40. * @offsets: struct holding the product specific register offsets
  41. */
  42. @@ -274,6 +276,7 @@ struct isc_device {
  43. struct {
  44. void (*config_csc)(struct isc_device *isc);
  45. + void (*config_cbc)(struct isc_device *isc);
  46. };
  47. struct isc_reg_offsets offsets;
  48. --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  49. +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  50. @@ -73,6 +73,14 @@ static void isc_sama5d2_config_csc(struc
  51. 0xFEE | (0x80 << 16));
  52. }
  53. +static void isc_sama5d2_config_cbc(struct isc_device *isc)
  54. +{
  55. + struct regmap *regmap = isc->regmap;
  56. +
  57. + regmap_write(regmap, ISC_CBC_BRIGHT, isc->ctrls.brightness);
  58. + regmap_write(regmap, ISC_CBC_CONTRAST, isc->ctrls.contrast);
  59. +}
  60. +
  61. /* Gamma table with gamma 1/2.2 */
  62. static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
  63. /* 0 --> gamma 1/1.8 */
  64. @@ -239,6 +247,7 @@ static int atmel_isc_probe(struct platfo
  65. isc->max_height = ISC_SAMA5D2_MAX_SUPPORT_HEIGHT;
  66. isc->config_csc = isc_sama5d2_config_csc;
  67. + isc->config_cbc = isc_sama5d2_config_cbc;
  68. isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;