fd7ed1e94d87af4eed78f3cb62f803b6771787bc
[openwrt/staging/hauke.git] / target / linux / at91 / patches-5.15 / 165-media-atmel-atmel-isc-extract-CBC-submodule-config-i.patch
1 From aa31e58d80d233385fa3b972e6b85f293e2a9093 Mon Sep 17 00:00:00 2001
2 From: Eugen Hristev <eugen.hristev@microchip.com>
3 Date: Tue, 13 Apr 2021 12:57:07 +0200
4 Subject: [PATCH 165/247] media: atmel: atmel-isc: extract CBC submodule config
5 into separate function
6
7 The CBC submodule is a part of the atmel-isc pipeline, and stands for
8 Contrast Brightness Control. It is used to apply gains and offsets to the
9 luma (Y) and chroma (U, V) components of the YUV elements.
10 The CBC submodule should be initialized in the product specific driver
11 as it's product specific. Other products can implement it differently
12
13 [hverkuil: made isc_sama5d2_config_cbc static]
14
15 Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
16 Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
17 Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
18 ---
19 drivers/media/platform/atmel/atmel-isc-base.c | 4 +---
20 drivers/media/platform/atmel/atmel-isc.h | 3 +++
21 drivers/media/platform/atmel/atmel-sama5d2-isc.c | 9 +++++++++
22 3 files changed, 13 insertions(+), 3 deletions(-)
23
24 --- a/drivers/media/platform/atmel/atmel-isc-base.c
25 +++ b/drivers/media/platform/atmel/atmel-isc-base.c
26 @@ -655,9 +655,7 @@ static void isc_set_pipeline(struct isc_
27 regmap_bulk_write(regmap, ISC_GAM_RENTRY, gamma, GAMMA_ENTRIES);
28
29 isc->config_csc(isc);
30 -
31 - regmap_write(regmap, ISC_CBC_BRIGHT, ctrls->brightness);
32 - regmap_write(regmap, ISC_CBC_CONTRAST, ctrls->contrast);
33 + isc->config_cbc(isc);
34 }
35
36 static int isc_update_profile(struct isc_device *isc)
37 --- a/drivers/media/platform/atmel/atmel-isc.h
38 +++ b/drivers/media/platform/atmel/atmel-isc.h
39 @@ -202,6 +202,8 @@ struct isc_reg_offsets {
40 *
41 * @config_csc: pointer to a function that initializes product
42 * specific CSC module
43 + * @config_cbc: pointer to a function that initializes product
44 + * specific CBC module
45 *
46 * @offsets: struct holding the product specific register offsets
47 */
48 @@ -274,6 +276,7 @@ struct isc_device {
49
50 struct {
51 void (*config_csc)(struct isc_device *isc);
52 + void (*config_cbc)(struct isc_device *isc);
53 };
54
55 struct isc_reg_offsets offsets;
56 --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
57 +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
58 @@ -73,6 +73,14 @@ static void isc_sama5d2_config_csc(struc
59 0xFEE | (0x80 << 16));
60 }
61
62 +static void isc_sama5d2_config_cbc(struct isc_device *isc)
63 +{
64 + struct regmap *regmap = isc->regmap;
65 +
66 + regmap_write(regmap, ISC_CBC_BRIGHT, isc->ctrls.brightness);
67 + regmap_write(regmap, ISC_CBC_CONTRAST, isc->ctrls.contrast);
68 +}
69 +
70 /* Gamma table with gamma 1/2.2 */
71 static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
72 /* 0 --> gamma 1/1.8 */
73 @@ -239,6 +247,7 @@ static int atmel_isc_probe(struct platfo
74 isc->max_height = ISC_SAMA5D2_MAX_SUPPORT_HEIGHT;
75
76 isc->config_csc = isc_sama5d2_config_csc;
77 + isc->config_cbc = isc_sama5d2_config_cbc;
78
79 isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;
80