a27ef80567c49717d9ca17403a287a560e666a74
[openwrt/staging/jow.git] / target / linux / at91 / patches-5.10 / 168-media-atmel-atmel-isc-add-RLP-to-register-offsets.patch
1 From b432a8b0fc88de5b49236482053d8d372c68ee55 Mon Sep 17 00:00:00 2001
2 From: Eugen Hristev <eugen.hristev@microchip.com>
3 Date: Tue, 13 Apr 2021 12:57:10 +0200
4 Subject: [PATCH 168/247] media: atmel: atmel-isc: add RLP to register offsets
5
6 The RLP submodule is a part of the atmel-isc pipeline, and stands for
7 Rounding,Limiting and Packaging. It used to extract specific data from the
8 ISC pipeline. For example if we want to output greyscale 8 bit, we would
9 use limiting to 8 bits, and packaging to Luma component only.
10 Add rlp to the reg offsets struct.
11 This will allow different products to have a different reg offset for this
12 particular module.
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 | 2 ++
20 drivers/media/platform/atmel/atmel-isc.h | 2 ++
21 drivers/media/platform/atmel/atmel-sama5d2-isc.c | 1 +
22 4 files changed, 7 insertions(+), 2 deletions(-)
23
24 diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c
25 index b398cdfdc2c9..25c90b821067 100644
26 --- a/drivers/media/platform/atmel/atmel-isc-base.c
27 +++ b/drivers/media/platform/atmel/atmel-isc-base.c
28 @@ -726,8 +726,8 @@ static int isc_configure(struct isc_device *isc)
29
30 regmap_update_bits(regmap, ISC_PFE_CFG0, mask, pfe_cfg0);
31
32 - regmap_update_bits(regmap, ISC_RLP_CFG, ISC_RLP_CFG_MODE_MASK,
33 - rlp_mode);
34 + regmap_update_bits(regmap, ISC_RLP_CFG + isc->offsets.rlp,
35 + ISC_RLP_CFG_MODE_MASK, rlp_mode);
36
37 regmap_write(regmap, ISC_DCFG, dcfg);
38
39 diff --git a/drivers/media/platform/atmel/atmel-isc-regs.h b/drivers/media/platform/atmel/atmel-isc-regs.h
40 index 04839def6ef6..2205484e04fc 100644
41 --- a/drivers/media/platform/atmel/atmel-isc-regs.h
42 +++ b/drivers/media/platform/atmel/atmel-isc-regs.h
43 @@ -204,6 +204,8 @@
44 /* Subsampling 4:2:2 to 4:2:0 Control Register */
45 #define ISC_SUB420_CTRL 0x000003cc
46
47 +/* Offset for RLP register specific to sama5d2 product */
48 +#define ISC_SAMA5D2_RLP_OFFSET 0
49 /* Rounding, Limiting and Packing Configuration Register */
50 #define ISC_RLP_CFG 0x000003d0
51
52 diff --git a/drivers/media/platform/atmel/atmel-isc.h b/drivers/media/platform/atmel/atmel-isc.h
53 index 9eb85540d89d..4a5293c66f49 100644
54 --- a/drivers/media/platform/atmel/atmel-isc.h
55 +++ b/drivers/media/platform/atmel/atmel-isc.h
56 @@ -149,12 +149,14 @@ struct isc_ctrls {
57 * @cbc: Offset for the CBC register
58 * @sub422: Offset for the SUB422 register
59 * @sub420: Offset for the SUB420 register
60 + * @rlp: Offset for the RLP register
61 */
62 struct isc_reg_offsets {
63 u32 csc;
64 u32 cbc;
65 u32 sub422;
66 u32 sub420;
67 + u32 rlp;
68 };
69
70 /*
71 diff --git a/drivers/media/platform/atmel/atmel-sama5d2-isc.c b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
72 index 57ea1ae50c44..b01b5b9f229b 100644
73 --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
74 +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
75 @@ -255,6 +255,7 @@ static int atmel_isc_probe(struct platform_device *pdev)
76 isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET;
77 isc->offsets.sub422 = ISC_SAMA5D2_SUB422_OFFSET;
78 isc->offsets.sub420 = ISC_SAMA5D2_SUB420_OFFSET;
79 + isc->offsets.rlp = ISC_SAMA5D2_RLP_OFFSET;
80
81 /* sama5d2-isc - 8 bits per beat */
82 isc->dcfg = ISC_DCFG_YMBSIZE_BEATS8 | ISC_DCFG_CMBSIZE_BEATS8;
83 --
84 2.32.0
85