66c70e4ca37ef37f67a328ddfc9293dacdfc2d2d
[openwrt/staging/dedeckeh.git] / target / linux / at91 / patches-5.10 / 181-media-atmel-atmel-isc-create-an-adapt-pipeline-callb.patch
1 From 8601f1fc0a9a22788bfa6369fbbf83b3828a5b42 Mon Sep 17 00:00:00 2001
2 From: Eugen Hristev <eugen.hristev@microchip.com>
3 Date: Tue, 13 Apr 2021 12:57:23 +0200
4 Subject: [PATCH 181/247] media: atmel: atmel-isc: create an adapt pipeline
5 callback for product specific
6
7 Once the pipeline is set in the base code, create a callback that will adapt
8 the ISC pipeline to each product.
9 Create the adapt_pipeline callback that will be used in this fashion.
10
11 [hverkuil: made isc_sama5d2_adapt_pipeline static]
12
13 Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
14 Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
15 Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
16 ---
17 drivers/media/platform/atmel/atmel-isc-base.c | 4 ++++
18 drivers/media/platform/atmel/atmel-isc.h | 5 +++++
19 drivers/media/platform/atmel/atmel-sama5d2-isc.c | 11 +++++++++++
20 3 files changed, 20 insertions(+)
21
22 diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c
23 index 90a62d43fdb1..7862d6bf850d 100644
24 --- a/drivers/media/platform/atmel/atmel-isc-base.c
25 +++ b/drivers/media/platform/atmel/atmel-isc-base.c
26 @@ -1059,6 +1059,10 @@ static int isc_try_configure_pipeline(struct isc_device *isc)
27 default:
28 isc->try_config.bits_pipeline = 0x0;
29 }
30 +
31 + /* Tune the pipeline to product specific */
32 + isc->adapt_pipeline(isc);
33 +
34 return 0;
35 }
36
37 diff --git a/drivers/media/platform/atmel/atmel-isc.h b/drivers/media/platform/atmel/atmel-isc.h
38 index b34737c09a5b..f59b2426ae74 100644
39 --- a/drivers/media/platform/atmel/atmel-isc.h
40 +++ b/drivers/media/platform/atmel/atmel-isc.h
41 @@ -235,6 +235,9 @@ struct isc_reg_offsets {
42 * @config_ctrls: pointer to a functoin that initializes product
43 * specific v4l2 controls.
44 *
45 + * @adapt_pipeline: pointer to a function that adapts the pipeline bits
46 + * to the product specific pipeline
47 + *
48 * @offsets: struct holding the product specific register offsets
49 * @controller_formats: pointer to the array of possible formats that the
50 * controller can output
51 @@ -320,6 +323,8 @@ struct isc_device {
52
53 void (*config_ctrls)(struct isc_device *isc,
54 const struct v4l2_ctrl_ops *ops);
55 +
56 + void (*adapt_pipeline)(struct isc_device *isc);
57 };
58
59 struct isc_reg_offsets offsets;
60 diff --git a/drivers/media/platform/atmel/atmel-sama5d2-isc.c b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
61 index b8c1b57ed820..26c971a380ca 100644
62 --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
63 +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
64 @@ -54,6 +54,10 @@
65
66 #define ISC_CLK_MAX_DIV 255
67
68 +#define ISC_SAMA5D2_PIPELINE \
69 + (WB_ENABLE | CFA_ENABLE | CC_ENABLE | GAM_ENABLES | CSC_ENABLE | \
70 + CBC_ENABLE | SUB422_ENABLE | SUB420_ENABLE)
71 +
72 /* This is a list of the formats that the ISC can *output* */
73 static const struct isc_format sama5d2_controller_formats[] = {
74 {
75 @@ -257,6 +261,11 @@ static void isc_sama5d2_config_rlp(struct isc_device *isc)
76 ISC_RLP_CFG_MODE_MASK, rlp_mode);
77 }
78
79 +static void isc_sama5d2_adapt_pipeline(struct isc_device *isc)
80 +{
81 + isc->try_config.bits_pipeline &= ISC_SAMA5D2_PIPELINE;
82 +}
83 +
84 /* Gamma table with gamma 1/2.2 */
85 static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
86 /* 0 --> gamma 1/1.8 */
87 @@ -431,6 +440,8 @@ static int atmel_isc_probe(struct platform_device *pdev)
88 isc->config_rlp = isc_sama5d2_config_rlp;
89 isc->config_ctrls = isc_sama5d2_config_ctrls;
90
91 + isc->adapt_pipeline = isc_sama5d2_adapt_pipeline;
92 +
93 isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;
94 isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET;
95 isc->offsets.sub422 = ISC_SAMA5D2_SUB422_OFFSET;
96 --
97 2.32.0
98