2021-04-01 18:19:00

by Eugen Hristev

[permalink] [raw]
Subject: [PATCH 06/30] media: atmel: atmel-isc: extract CSC submodule config into separate function

The CSC submodule should be initialized in the product specific driver
as it's product specific. Other products can implement it differently.

Signed-off-by: Eugen Hristev <[email protected]>
---
drivers/media/platform/atmel/atmel-isc-base.c | 8 +-------
drivers/media/platform/atmel/atmel-isc.h | 7 +++++++
drivers/media/platform/atmel/atmel-sama5d2-isc.c | 15 +++++++++++++++
3 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c
index ff40ee2e2759..31f63ba90c71 100644
--- a/drivers/media/platform/atmel/atmel-isc-base.c
+++ b/drivers/media/platform/atmel/atmel-isc-base.c
@@ -646,13 +646,7 @@ static void isc_set_pipeline(struct isc_device *isc, u32 pipeline)
regmap_bulk_write(regmap, ISC_GAM_GENTRY, gamma, GAMMA_ENTRIES);
regmap_bulk_write(regmap, ISC_GAM_RENTRY, gamma, GAMMA_ENTRIES);

- /* Convert RGB to YUV */
- regmap_write(regmap, ISC_CSC_YR_YG, 0x42 | (0x81 << 16));
- regmap_write(regmap, ISC_CSC_YB_OY, 0x19 | (0x10 << 16));
- regmap_write(regmap, ISC_CSC_CBR_CBG, 0xFDA | (0xFB6 << 16));
- regmap_write(regmap, ISC_CSC_CBB_OCB, 0x70 | (0x80 << 16));
- regmap_write(regmap, ISC_CSC_CRR_CRG, 0x70 | (0xFA2 << 16));
- regmap_write(regmap, ISC_CSC_CRB_OCR, 0xFEE | (0x80 << 16));
+ isc->config_csc(isc);

regmap_write(regmap, ISC_CBC_BRIGHT, ctrls->brightness);
regmap_write(regmap, ISC_CBC_CONTRAST, ctrls->contrast);
diff --git a/drivers/media/platform/atmel/atmel-isc.h b/drivers/media/platform/atmel/atmel-isc.h
index d14ae096fbf6..bb0b4419deff 100644
--- a/drivers/media/platform/atmel/atmel-isc.h
+++ b/drivers/media/platform/atmel/atmel-isc.h
@@ -192,6 +192,9 @@ struct isc_ctrls {
*
* @max_width: maximum frame width, dependent on the internal RAM
* @max_height: maximum frame height, dependent on the internal RAM
+ *
+ * @config_csc: pointer to a function that initializes product
+ * specific CSC module
*/
struct isc_device {
struct regmap *regmap;
@@ -259,6 +262,10 @@ struct isc_device {

u32 max_width;
u32 max_height;
+
+ struct {
+ void (*config_csc)(struct isc_device *isc);
+ };
};

extern struct isc_format formats_list[];
diff --git a/drivers/media/platform/atmel/atmel-sama5d2-isc.c b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
index 6d9942dcd7c1..d9f06daffdf8 100644
--- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c
+++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c
@@ -54,6 +54,19 @@

#define ISC_CLK_MAX_DIV 255

+void isc_sama5d2_config_csc(struct isc_device *isc)
+{
+ struct regmap *regmap = isc->regmap;
+
+ /* Convert RGB to YUV */
+ regmap_write(regmap, ISC_CSC_YR_YG, 0x42 | (0x81 << 16));
+ regmap_write(regmap, ISC_CSC_YB_OY, 0x19 | (0x10 << 16));
+ regmap_write(regmap, ISC_CSC_CBR_CBG, 0xFDA | (0xFB6 << 16));
+ regmap_write(regmap, ISC_CSC_CBB_OCB, 0x70 | (0x80 << 16));
+ regmap_write(regmap, ISC_CSC_CRR_CRG, 0x70 | (0xFA2 << 16));
+ regmap_write(regmap, ISC_CSC_CRB_OCR, 0xFEE | (0x80 << 16));
+}
+
/* Gamma table with gamma 1/2.2 */
const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
/* 0 --> gamma 1/1.8 */
@@ -198,6 +211,8 @@ static int atmel_isc_probe(struct platform_device *pdev)
isc->max_width = ISC_SAMA5D2_MAX_SUPPORT_WIDTH;
isc->max_height = ISC_SAMA5D2_MAX_SUPPORT_HEIGHT;

+ isc->config_csc = isc_sama5d2_config_csc;
+
/* sama5d2-isc - 8 bits per beat */
isc->dcfg = ISC_DCFG_YMBSIZE_BEATS8 | ISC_DCFG_CMBSIZE_BEATS8;

--
2.25.1


2021-04-01 20:39:40

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 06/30] media: atmel: atmel-isc: extract CSC submodule config into separate function

Hi Eugen,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v5.12-rc5 next-20210401]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Eugen-Hristev/media-atmel-atmel-isc-add-support-for-xisc/20210402-024144
base: git://linuxtv.org/media_tree.git master
config: arm64-randconfig-r024-20210401 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/16c4afad71c41ecb74d0afff8e7ccc7e868d3cdd
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Eugen-Hristev/media-atmel-atmel-isc-add-support-for-xisc/20210402-024144
git checkout 16c4afad71c41ecb74d0afff8e7ccc7e868d3cdd
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> drivers/media/platform/atmel/atmel-sama5d2-isc.c:57:6: warning: no previous prototype for 'isc_sama5d2_config_csc' [-Wmissing-prototypes]
57 | void isc_sama5d2_config_csc(struct isc_device *isc)
| ^~~~~~~~~~~~~~~~~~~~~~


vim +/isc_sama5d2_config_csc +57 drivers/media/platform/atmel/atmel-sama5d2-isc.c

56
> 57 void isc_sama5d2_config_csc(struct isc_device *isc)
58 {
59 struct regmap *regmap = isc->regmap;
60
61 /* Convert RGB to YUV */
62 regmap_write(regmap, ISC_CSC_YR_YG, 0x42 | (0x81 << 16));
63 regmap_write(regmap, ISC_CSC_YB_OY, 0x19 | (0x10 << 16));
64 regmap_write(regmap, ISC_CSC_CBR_CBG, 0xFDA | (0xFB6 << 16));
65 regmap_write(regmap, ISC_CSC_CBB_OCB, 0x70 | (0x80 << 16));
66 regmap_write(regmap, ISC_CSC_CRR_CRG, 0x70 | (0xFA2 << 16));
67 regmap_write(regmap, ISC_CSC_CRB_OCR, 0xFEE | (0x80 << 16));
68 }
69

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (2.45 kB)
.config.gz (37.02 kB)
Download all attachments