ath25: switch default kernel to 5.15
[openwrt/openwrt.git] / target / linux / at91 / patches-5.10 / 175-media-atmel-atmel-isc-add-CC-initialization-function.patch
1 From 0db91d2a803221c313c9f2cd1d71050d7c5a7b5b Mon Sep 17 00:00:00 2001
2 From: Eugen Hristev <eugen.hristev@microchip.com>
3 Date: Tue, 13 Apr 2021 12:57:17 +0200
4 Subject: [PATCH 175/247] media: atmel: atmel-isc: add CC initialization
5 function
6
7 The CC submodule is a part of the atmel-isc pipeline, and stands for
8 Color Correction. It is used to apply gains and offsets to the
9 chroma (U, V) components of the YUV elements.
10 Implement the CC submodule initialization, as a product
11 specific function, which currently configures the neutral point in color
12 correction.
13
14 [hverkuil: made isc_sama5d2_config_cc static]
15
16 Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
17 Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
18 Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
19 ---
20 drivers/media/platform/atmel/atmel-isc-base.c | 1 +
21 drivers/media/platform/atmel/atmel-isc.h | 3 +++
22 drivers/media/platform/atmel/atmel-sama5d2-isc.c | 14 ++++++++++++++
23 3 files changed, 18 insertions(+)
24
25 --- a/drivers/media/platform/atmel/atmel-isc-base.c
26 +++ b/drivers/media/platform/atmel/atmel-isc-base.c
27 @@ -661,6 +661,7 @@ static void isc_set_pipeline(struct isc_
28
29 isc->config_csc(isc);
30 isc->config_cbc(isc);
31 + isc->config_cc(isc);
32 }
33
34 static int isc_update_profile(struct isc_device *isc)
35 --- a/drivers/media/platform/atmel/atmel-isc.h
36 +++ b/drivers/media/platform/atmel/atmel-isc.h
37 @@ -224,6 +224,8 @@ struct isc_reg_offsets {
38 * specific CSC module
39 * @config_cbc: pointer to a function that initializes product
40 * specific CBC module
41 + * @config_cc: pointer to a function that initializes product
42 + * specific CC module
43 *
44 * @offsets: struct holding the product specific register offsets
45 */
46 @@ -297,6 +299,7 @@ struct isc_device {
47 struct {
48 void (*config_csc)(struct isc_device *isc);
49 void (*config_cbc)(struct isc_device *isc);
50 + void (*config_cc)(struct isc_device *isc);
51 };
52
53 struct isc_reg_offsets offsets;
54 --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
55 +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
56 @@ -83,6 +83,19 @@ static void isc_sama5d2_config_cbc(struc
57 isc->ctrls.contrast);
58 }
59
60 +static void isc_sama5d2_config_cc(struct isc_device *isc)
61 +{
62 + struct regmap *regmap = isc->regmap;
63 +
64 + /* Configure each register at the neutral fixed point 1.0 or 0.0 */
65 + regmap_write(regmap, ISC_CC_RR_RG, (1 << 8));
66 + regmap_write(regmap, ISC_CC_RB_OR, 0);
67 + regmap_write(regmap, ISC_CC_GR_GG, (1 << 8) << 16);
68 + regmap_write(regmap, ISC_CC_GB_OG, 0);
69 + regmap_write(regmap, ISC_CC_BR_BG, 0);
70 + regmap_write(regmap, ISC_CC_BB_OB, (1 << 8));
71 +}
72 +
73 /* Gamma table with gamma 1/2.2 */
74 static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
75 /* 0 --> gamma 1/1.8 */
76 @@ -251,6 +264,7 @@ static int atmel_isc_probe(struct platfo
77
78 isc->config_csc = isc_sama5d2_config_csc;
79 isc->config_cbc = isc_sama5d2_config_cbc;
80 + isc->config_cc = isc_sama5d2_config_cc;
81
82 isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;
83 isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET;