6d937fdeb7ba8b1ac6048e5174cb17c685a927cf
[openwrt/openwrt.git] / target / linux / at91 / patches-5.15 / 167-media-atmel-atmel-isc-add-SUB422-and-SUB420-to-regis.patch
1 From aebb741058a63c3493f4139d11d6f290d5691e9b Mon Sep 17 00:00:00 2001
2 From: Eugen Hristev <eugen.hristev@microchip.com>
3 Date: Tue, 13 Apr 2021 12:57:09 +0200
4 Subject: [PATCH 167/247] media: atmel: atmel-isc: add SUB422 and SUB420 to
5 register offsets
6
7 The SUB submodules are a part of the atmel-isc pipeline, and stand for
8 Subsampling. They are used to subsample the original YUV 4:4:4 pixel ratio
9 aspect to either 4:2:2 or 4:2:0.
10 Add sub420 and sub422 to the reg offsets struct.
11 This will allow different products to have a different reg offset for these
12 particular modules.
13
14 Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
15 Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
16 Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
17 ---
18 drivers/media/platform/atmel/atmel-isc-base.c | 4 ++--
19 drivers/media/platform/atmel/atmel-isc-regs.h | 4 ++++
20 drivers/media/platform/atmel/atmel-isc.h | 4 ++++
21 drivers/media/platform/atmel/atmel-sama5d2-isc.c | 2 ++
22 4 files changed, 12 insertions(+), 2 deletions(-)
23
24 --- a/drivers/media/platform/atmel/atmel-isc-base.c
25 +++ b/drivers/media/platform/atmel/atmel-isc-base.c
26 @@ -2326,8 +2326,8 @@ int isc_pipeline_init(struct isc_device
27 REG_FIELD(ISC_GAM_CTRL, 3, 3),
28 REG_FIELD(ISC_CSC_CTRL + isc->offsets.csc, 0, 0),
29 REG_FIELD(ISC_CBC_CTRL + isc->offsets.cbc, 0, 0),
30 - REG_FIELD(ISC_SUB422_CTRL, 0, 0),
31 - REG_FIELD(ISC_SUB420_CTRL, 0, 0),
32 + REG_FIELD(ISC_SUB422_CTRL + isc->offsets.sub422, 0, 0),
33 + REG_FIELD(ISC_SUB420_CTRL + isc->offsets.sub420, 0, 0),
34 };
35
36 for (i = 0; i < ISC_PIPE_LINE_NODE_NUM; i++) {
37 --- a/drivers/media/platform/atmel/atmel-isc-regs.h
38 +++ b/drivers/media/platform/atmel/atmel-isc-regs.h
39 @@ -194,9 +194,13 @@
40 #define ISC_CBC_CONTRAST 0x000003c0
41 #define ISC_CBC_CONTRAST_MASK GENMASK(11, 0)
42
43 +/* Offset for SUB422 register specific to sama5d2 product */
44 +#define ISC_SAMA5D2_SUB422_OFFSET 0
45 /* Subsampling 4:4:4 to 4:2:2 Control Register */
46 #define ISC_SUB422_CTRL 0x000003c4
47
48 +/* Offset for SUB420 register specific to sama5d2 product */
49 +#define ISC_SAMA5D2_SUB420_OFFSET 0
50 /* Subsampling 4:2:2 to 4:2:0 Control Register */
51 #define ISC_SUB420_CTRL 0x000003cc
52
53 --- a/drivers/media/platform/atmel/atmel-isc.h
54 +++ b/drivers/media/platform/atmel/atmel-isc.h
55 @@ -147,10 +147,14 @@ struct isc_ctrls {
56 * struct isc_reg_offsets - ISC device register offsets
57 * @csc: Offset for the CSC register
58 * @cbc: Offset for the CBC register
59 + * @sub422: Offset for the SUB422 register
60 + * @sub420: Offset for the SUB420 register
61 */
62 struct isc_reg_offsets {
63 u32 csc;
64 u32 cbc;
65 + u32 sub422;
66 + u32 sub420;
67 };
68
69 /*
70 --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
71 +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
72 @@ -253,6 +253,8 @@ static int atmel_isc_probe(struct platfo
73
74 isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;
75 isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET;
76 + isc->offsets.sub422 = ISC_SAMA5D2_SUB422_OFFSET;
77 + isc->offsets.sub420 = ISC_SAMA5D2_SUB420_OFFSET;
78
79 /* sama5d2-isc - 8 bits per beat */
80 isc->dcfg = ISC_DCFG_YMBSIZE_BEATS8 | ISC_DCFG_CMBSIZE_BEATS8;