166-media-atmel-atmel-isc-add-CBC-to-the-reg-offsets-str.patch 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. From 52e4b779ae1af3e322d0c673375dcd51315739d4 Mon Sep 17 00:00:00 2001
  2. From: Eugen Hristev <[email protected]>
  3. Date: Tue, 13 Apr 2021 12:57:08 +0200
  4. Subject: [PATCH 166/247] media: atmel: atmel-isc: add CBC to the reg offsets
  5. struct
  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. Add cbc to the reg offsets struct. This will allow different products
  10. to have a different reg offset for this particular module.
  11. Signed-off-by: Eugen Hristev <[email protected]>
  12. Signed-off-by: Hans Verkuil <[email protected]>
  13. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  14. ---
  15. drivers/media/platform/atmel/atmel-isc-base.c | 2 +-
  16. drivers/media/platform/atmel/atmel-isc-regs.h | 3 +++
  17. drivers/media/platform/atmel/atmel-isc.h | 2 ++
  18. drivers/media/platform/atmel/atmel-sama5d2-isc.c | 7 +++++--
  19. 4 files changed, 11 insertions(+), 3 deletions(-)
  20. --- a/drivers/media/platform/atmel/atmel-isc-base.c
  21. +++ b/drivers/media/platform/atmel/atmel-isc-base.c
  22. @@ -2325,7 +2325,7 @@ int isc_pipeline_init(struct isc_device
  23. REG_FIELD(ISC_GAM_CTRL, 2, 2),
  24. REG_FIELD(ISC_GAM_CTRL, 3, 3),
  25. REG_FIELD(ISC_CSC_CTRL + isc->offsets.csc, 0, 0),
  26. - REG_FIELD(ISC_CBC_CTRL, 0, 0),
  27. + REG_FIELD(ISC_CBC_CTRL + isc->offsets.cbc, 0, 0),
  28. REG_FIELD(ISC_SUB422_CTRL, 0, 0),
  29. REG_FIELD(ISC_SUB420_CTRL, 0, 0),
  30. };
  31. --- a/drivers/media/platform/atmel/atmel-isc-regs.h
  32. +++ b/drivers/media/platform/atmel/atmel-isc-regs.h
  33. @@ -177,6 +177,9 @@
  34. /* Color Space Conversion CRB OCR Register */
  35. #define ISC_CSC_CRB_OCR 0x000003b0
  36. +/* Offset for CBC register specific to sama5d2 product */
  37. +#define ISC_SAMA5D2_CBC_OFFSET 0
  38. +
  39. /* Contrast And Brightness Control Register */
  40. #define ISC_CBC_CTRL 0x000003b4
  41. --- a/drivers/media/platform/atmel/atmel-isc.h
  42. +++ b/drivers/media/platform/atmel/atmel-isc.h
  43. @@ -146,9 +146,11 @@ struct isc_ctrls {
  44. /*
  45. * struct isc_reg_offsets - ISC device register offsets
  46. * @csc: Offset for the CSC register
  47. + * @cbc: Offset for the CBC register
  48. */
  49. struct isc_reg_offsets {
  50. u32 csc;
  51. + u32 cbc;
  52. };
  53. /*
  54. --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  55. +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  56. @@ -77,8 +77,10 @@ static void isc_sama5d2_config_cbc(struc
  57. {
  58. struct regmap *regmap = isc->regmap;
  59. - regmap_write(regmap, ISC_CBC_BRIGHT, isc->ctrls.brightness);
  60. - regmap_write(regmap, ISC_CBC_CONTRAST, isc->ctrls.contrast);
  61. + regmap_write(regmap, ISC_CBC_BRIGHT + isc->offsets.cbc,
  62. + isc->ctrls.brightness);
  63. + regmap_write(regmap, ISC_CBC_CONTRAST + isc->offsets.cbc,
  64. + isc->ctrls.contrast);
  65. }
  66. /* Gamma table with gamma 1/2.2 */
  67. @@ -250,6 +252,7 @@ static int atmel_isc_probe(struct platfo
  68. isc->config_cbc = isc_sama5d2_config_cbc;
  69. isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;
  70. + isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET;
  71. /* sama5d2-isc - 8 bits per beat */
  72. isc->dcfg = ISC_DCFG_YMBSIZE_BEATS8 | ISC_DCFG_CMBSIZE_BEATS8;