ath25: switch default kernel to 5.15
[openwrt/staging/ldir.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 --- a/drivers/media/platform/atmel/atmel-isc-base.c
27 +++ b/drivers/media/platform/atmel/atmel-isc-base.c
28 @@ -719,11 +719,10 @@ static void isc_set_histogram(struct isc
29 static int isc_configure(struct isc_device *isc)
30 {
31 struct regmap *regmap = isc->regmap;
32 - u32 pfe_cfg0, rlp_mode, dcfg, mask, pipeline;
33 + u32 pfe_cfg0, dcfg, mask, pipeline;
34 struct isc_subdev_entity *subdev = isc->current_subdev;
35
36 pfe_cfg0 = isc->config.sd_format->pfe_cfg0_bps;
37 - rlp_mode = isc->config.rlp_cfg_mode;
38 pipeline = isc->config.bits_pipeline;
39
40 dcfg = isc->config.dcfg_imode | isc->dcfg;
41 @@ -736,8 +735,7 @@ static int isc_configure(struct isc_devi
42
43 regmap_update_bits(regmap, ISC_PFE_CFG0, mask, pfe_cfg0);
44
45 - regmap_update_bits(regmap, ISC_RLP_CFG + isc->offsets.rlp,
46 - ISC_RLP_CFG_MODE_MASK, rlp_mode);
47 + isc->config_rlp(isc);
48
49 regmap_write(regmap, ISC_DCFG + isc->offsets.dma, dcfg);
50
51 --- a/drivers/media/platform/atmel/atmel-isc.h
52 +++ b/drivers/media/platform/atmel/atmel-isc.h
53 @@ -230,6 +230,8 @@ struct isc_reg_offsets {
54 * specific CC module
55 * @config_gam: pointer to a function that initializes product
56 * specific GAMMA module
57 + * @config_rlp: pointer to a function that initializes product
58 + * specific RLP module
59 * @config_ctrls: pointer to a functoin that initializes product
60 * specific v4l2 controls.
61 *
62 @@ -308,6 +310,7 @@ struct isc_device {
63 void (*config_cbc)(struct isc_device *isc);
64 void (*config_cc)(struct isc_device *isc);
65 void (*config_gam)(struct isc_device *isc);
66 + void (*config_rlp)(struct isc_device *isc);
67
68 void (*config_ctrls)(struct isc_device *isc,
69 const struct v4l2_ctrl_ops *ops);
70 --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
71 +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
72 @@ -117,6 +117,15 @@ static void isc_sama5d2_config_gam(struc
73 /* No specific gamma configuration */
74 }
75
76 +static void isc_sama5d2_config_rlp(struct isc_device *isc)
77 +{
78 + struct regmap *regmap = isc->regmap;
79 + u32 rlp_mode = isc->config.rlp_cfg_mode;
80 +
81 + regmap_update_bits(regmap, ISC_RLP_CFG + isc->offsets.rlp,
82 + ISC_RLP_CFG_MODE_MASK, rlp_mode);
83 +}
84 +
85 /* Gamma table with gamma 1/2.2 */
86 static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
87 /* 0 --> gamma 1/1.8 */
88 @@ -288,6 +297,7 @@ static int atmel_isc_probe(struct platfo
89 isc->config_cbc = isc_sama5d2_config_cbc;
90 isc->config_cc = isc_sama5d2_config_cc;
91 isc->config_gam = isc_sama5d2_config_gam;
92 + isc->config_rlp = isc_sama5d2_config_rlp;
93 isc->config_ctrls = isc_sama5d2_config_ctrls;
94
95 isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;