179-media-atmel-atmel-isc-create-callback-for-RLP-submod.patch 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. From ece1d7059731e31875e6eb464da4fb4a16465305 Mon Sep 17 00:00:00 2001
  2. From: Eugen Hristev <[email protected]>
  3. Date: Tue, 13 Apr 2021 12:57:21 +0200
  4. Subject: [PATCH 179/247] media: atmel: atmel-isc: create callback for RLP
  5. submodule product specific
  6. The RLP submodule is a part of the atmel-isc pipeline, and stands for
  7. Rounding,Limiting and Packaging. It used to extract specific data from the
  8. ISC pipeline. For example if we want to output greyscale 8 bit, we would
  9. use limiting to 8 bits, and packaging to Luma component only.
  10. Create a product specific callback for initializing the RLP submodule
  11. of the pipeline
  12. [hverkuil: made isc_sama5d2_config_rlp 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 | 6 ++----
  18. drivers/media/platform/atmel/atmel-isc.h | 3 +++
  19. drivers/media/platform/atmel/atmel-sama5d2-isc.c | 10 ++++++++++
  20. 3 files changed, 15 insertions(+), 4 deletions(-)
  21. diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c
  22. index aef0d6570d39..67c16ca17672 100644
  23. --- a/drivers/media/platform/atmel/atmel-isc-base.c
  24. +++ b/drivers/media/platform/atmel/atmel-isc-base.c
  25. @@ -719,11 +719,10 @@ static void isc_set_histogram(struct isc_device *isc, bool enable)
  26. static int isc_configure(struct isc_device *isc)
  27. {
  28. struct regmap *regmap = isc->regmap;
  29. - u32 pfe_cfg0, rlp_mode, dcfg, mask, pipeline;
  30. + u32 pfe_cfg0, dcfg, mask, pipeline;
  31. struct isc_subdev_entity *subdev = isc->current_subdev;
  32. pfe_cfg0 = isc->config.sd_format->pfe_cfg0_bps;
  33. - rlp_mode = isc->config.rlp_cfg_mode;
  34. pipeline = isc->config.bits_pipeline;
  35. dcfg = isc->config.dcfg_imode | isc->dcfg;
  36. @@ -736,8 +735,7 @@ static int isc_configure(struct isc_device *isc)
  37. regmap_update_bits(regmap, ISC_PFE_CFG0, mask, pfe_cfg0);
  38. - regmap_update_bits(regmap, ISC_RLP_CFG + isc->offsets.rlp,
  39. - ISC_RLP_CFG_MODE_MASK, rlp_mode);
  40. + isc->config_rlp(isc);
  41. regmap_write(regmap, ISC_DCFG + isc->offsets.dma, dcfg);
  42. diff --git a/drivers/media/platform/atmel/atmel-isc.h b/drivers/media/platform/atmel/atmel-isc.h
  43. index 151997c11f56..24006327c5e4 100644
  44. --- a/drivers/media/platform/atmel/atmel-isc.h
  45. +++ b/drivers/media/platform/atmel/atmel-isc.h
  46. @@ -230,6 +230,8 @@ struct isc_reg_offsets {
  47. * specific CC module
  48. * @config_gam: pointer to a function that initializes product
  49. * specific GAMMA module
  50. + * @config_rlp: pointer to a function that initializes product
  51. + * specific RLP module
  52. * @config_ctrls: pointer to a functoin that initializes product
  53. * specific v4l2 controls.
  54. *
  55. @@ -308,6 +310,7 @@ struct isc_device {
  56. void (*config_cbc)(struct isc_device *isc);
  57. void (*config_cc)(struct isc_device *isc);
  58. void (*config_gam)(struct isc_device *isc);
  59. + void (*config_rlp)(struct isc_device *isc);
  60. void (*config_ctrls)(struct isc_device *isc,
  61. const struct v4l2_ctrl_ops *ops);
  62. diff --git a/drivers/media/platform/atmel/atmel-sama5d2-isc.c b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  63. index b99849ecb8a1..86704a1a24b9 100644
  64. --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  65. +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
  66. @@ -117,6 +117,15 @@ static void isc_sama5d2_config_gam(struct isc_device *isc)
  67. /* No specific gamma configuration */
  68. }
  69. +static void isc_sama5d2_config_rlp(struct isc_device *isc)
  70. +{
  71. + struct regmap *regmap = isc->regmap;
  72. + u32 rlp_mode = isc->config.rlp_cfg_mode;
  73. +
  74. + regmap_update_bits(regmap, ISC_RLP_CFG + isc->offsets.rlp,
  75. + ISC_RLP_CFG_MODE_MASK, rlp_mode);
  76. +}
  77. +
  78. /* Gamma table with gamma 1/2.2 */
  79. static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
  80. /* 0 --> gamma 1/1.8 */
  81. @@ -288,6 +297,7 @@ static int atmel_isc_probe(struct platform_device *pdev)
  82. isc->config_cbc = isc_sama5d2_config_cbc;
  83. isc->config_cc = isc_sama5d2_config_cc;
  84. isc->config_gam = isc_sama5d2_config_gam;
  85. + isc->config_rlp = isc_sama5d2_config_rlp;
  86. isc->config_ctrls = isc_sama5d2_config_ctrls;
  87. isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;
  88. --
  89. 2.32.0