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