ipq40xx: fritzrepeater-1200: fix MDIO and PHY probing
[openwrt/openwrt.git] / target / linux / at91 / patches-5.10 / 169-media-atmel-atmel-isc-add-HIS-to-register-offsets.patch
1 From 8c19aa14b8303a0e7c4bae42f3f00f9a2a65b0db Mon Sep 17 00:00:00 2001
2 From: Eugen Hristev <eugen.hristev@microchip.com>
3 Date: Tue, 13 Apr 2021 12:57:11 +0200
4 Subject: [PATCH 169/247] media: atmel: atmel-isc: add HIS to register offsets
5
6 The HIS submodule is a part of the atmel-isc pipeline, and stands for
7 Histogram. This module performs a color histogram that can be read and used
8 by the main processor.
9 Add his to the reg offsets struct.
10 This will allow different products to have a different reg offset for this
11 particular module.
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 | 11 +++++++----
18 drivers/media/platform/atmel/atmel-isc-regs.h | 2 ++
19 drivers/media/platform/atmel/atmel-isc.h | 2 ++
20 drivers/media/platform/atmel/atmel-sama5d2-isc.c | 1 +
21 4 files changed, 12 insertions(+), 4 deletions(-)
22
23 --- a/drivers/media/platform/atmel/atmel-isc-base.c
24 +++ b/drivers/media/platform/atmel/atmel-isc-base.c
25 @@ -686,12 +686,13 @@ static void isc_set_histogram(struct isc
26 struct isc_ctrls *ctrls = &isc->ctrls;
27
28 if (enable) {
29 - regmap_write(regmap, ISC_HIS_CFG,
30 + regmap_write(regmap, ISC_HIS_CFG + isc->offsets.his,
31 ISC_HIS_CFG_MODE_GR |
32 (isc->config.sd_format->cfa_baycfg
33 << ISC_HIS_CFG_BAYSEL_SHIFT) |
34 ISC_HIS_CFG_RAR);
35 - regmap_write(regmap, ISC_HIS_CTRL, ISC_HIS_CTRL_EN);
36 + regmap_write(regmap, ISC_HIS_CTRL + isc->offsets.his,
37 + ISC_HIS_CTRL_EN);
38 regmap_write(regmap, ISC_INTEN, ISC_INT_HISDONE);
39 ctrls->hist_id = ISC_HIS_CFG_MODE_GR;
40 isc_update_profile(isc);
41 @@ -700,7 +701,8 @@ static void isc_set_histogram(struct isc
42 ctrls->hist_stat = HIST_ENABLED;
43 } else {
44 regmap_write(regmap, ISC_INTDIS, ISC_INT_HISDONE);
45 - regmap_write(regmap, ISC_HIS_CTRL, ISC_HIS_CTRL_DIS);
46 + regmap_write(regmap, ISC_HIS_CTRL + isc->offsets.his,
47 + ISC_HIS_CTRL_DIS);
48
49 ctrls->hist_stat = HIST_DISABLED;
50 }
51 @@ -1836,7 +1838,8 @@ static void isc_awb_work(struct work_str
52 ctrls->awb = ISC_WB_NONE;
53 }
54 }
55 - regmap_write(regmap, ISC_HIS_CFG, hist_id | baysel | ISC_HIS_CFG_RAR);
56 + regmap_write(regmap, ISC_HIS_CFG + isc->offsets.his,
57 + hist_id | baysel | ISC_HIS_CFG_RAR);
58 isc_update_profile(isc);
59 /* if awb has been disabled, we don't need to start another histogram */
60 if (ctrls->awb)
61 --- a/drivers/media/platform/atmel/atmel-isc-regs.h
62 +++ b/drivers/media/platform/atmel/atmel-isc-regs.h
63 @@ -224,6 +224,8 @@
64 #define ISC_RLP_CFG_MODE_YYCC_LIMITED 0xc
65 #define ISC_RLP_CFG_MODE_MASK GENMASK(3, 0)
66
67 +/* Offset for HIS register specific to sama5d2 product */
68 +#define ISC_SAMA5D2_HIS_OFFSET 0
69 /* Histogram Control Register */
70 #define ISC_HIS_CTRL 0x000003d4
71
72 --- a/drivers/media/platform/atmel/atmel-isc.h
73 +++ b/drivers/media/platform/atmel/atmel-isc.h
74 @@ -150,6 +150,7 @@ struct isc_ctrls {
75 * @sub422: Offset for the SUB422 register
76 * @sub420: Offset for the SUB420 register
77 * @rlp: Offset for the RLP register
78 + * @his: Offset for the HIS related registers
79 */
80 struct isc_reg_offsets {
81 u32 csc;
82 @@ -157,6 +158,7 @@ struct isc_reg_offsets {
83 u32 sub422;
84 u32 sub420;
85 u32 rlp;
86 + u32 his;
87 };
88
89 /*
90 --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
91 +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
92 @@ -256,6 +256,7 @@ static int atmel_isc_probe(struct platfo
93 isc->offsets.sub422 = ISC_SAMA5D2_SUB422_OFFSET;
94 isc->offsets.sub420 = ISC_SAMA5D2_SUB420_OFFSET;
95 isc->offsets.rlp = ISC_SAMA5D2_RLP_OFFSET;
96 + isc->offsets.his = ISC_SAMA5D2_HIS_OFFSET;
97
98 /* sama5d2-isc - 8 bits per beat */
99 isc->dcfg = ISC_DCFG_YMBSIZE_BEATS8 | ISC_DCFG_CMBSIZE_BEATS8;