042fc609fedeabc6faf22ad91bfd0bb8c92100a1
[openwrt/openwrt.git] / target / linux / at91 / patches-5.15 / 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 --- a/drivers/media/platform/atmel/atmel-isc-base.c
23 +++ b/drivers/media/platform/atmel/atmel-isc-base.c
24 @@ -1059,6 +1059,10 @@ static int isc_try_configure_pipeline(st
25 default:
26 isc->try_config.bits_pipeline = 0x0;
27 }
28 +
29 + /* Tune the pipeline to product specific */
30 + isc->adapt_pipeline(isc);
31 +
32 return 0;
33 }
34
35 --- a/drivers/media/platform/atmel/atmel-isc.h
36 +++ b/drivers/media/platform/atmel/atmel-isc.h
37 @@ -235,6 +235,9 @@ struct isc_reg_offsets {
38 * @config_ctrls: pointer to a functoin that initializes product
39 * specific v4l2 controls.
40 *
41 + * @adapt_pipeline: pointer to a function that adapts the pipeline bits
42 + * to the product specific pipeline
43 + *
44 * @offsets: struct holding the product specific register offsets
45 * @controller_formats: pointer to the array of possible formats that the
46 * controller can output
47 @@ -320,6 +323,8 @@ struct isc_device {
48
49 void (*config_ctrls)(struct isc_device *isc,
50 const struct v4l2_ctrl_ops *ops);
51 +
52 + void (*adapt_pipeline)(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 @@ -54,6 +54,10 @@
59
60 #define ISC_CLK_MAX_DIV 255
61
62 +#define ISC_SAMA5D2_PIPELINE \
63 + (WB_ENABLE | CFA_ENABLE | CC_ENABLE | GAM_ENABLES | CSC_ENABLE | \
64 + CBC_ENABLE | SUB422_ENABLE | SUB420_ENABLE)
65 +
66 /* This is a list of the formats that the ISC can *output* */
67 static const struct isc_format sama5d2_controller_formats[] = {
68 {
69 @@ -257,6 +261,11 @@ static void isc_sama5d2_config_rlp(struc
70 ISC_RLP_CFG_MODE_MASK, rlp_mode);
71 }
72
73 +static void isc_sama5d2_adapt_pipeline(struct isc_device *isc)
74 +{
75 + isc->try_config.bits_pipeline &= ISC_SAMA5D2_PIPELINE;
76 +}
77 +
78 /* Gamma table with gamma 1/2.2 */
79 static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
80 /* 0 --> gamma 1/1.8 */
81 @@ -431,6 +440,8 @@ static int atmel_isc_probe(struct platfo
82 isc->config_rlp = isc_sama5d2_config_rlp;
83 isc->config_ctrls = isc_sama5d2_config_ctrls;
84
85 + isc->adapt_pipeline = isc_sama5d2_adapt_pipeline;
86 +
87 isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;
88 isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET;
89 isc->offsets.sub422 = ISC_SAMA5D2_SUB422_OFFSET;