media: atmel: atmel-isc: extract CBC submodule config into separate function
authorEugen Hristev <eugen.hristev@microchip.com>
Tue, 13 Apr 2021 10:57:07 +0000 (12:57 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 8 Jun 2021 10:57:28 +0000 (12:57 +0200)
The CBC submodule is a part of the atmel-isc pipeline, and stands for
Contrast Brightness Control. It is used to apply gains and offsets to the
luma (Y) and chroma (U, V) components of the YUV elements.
The CBC submodule should be initialized in the product specific driver
as it's product specific. Other products can implement it differently

[hverkuil: made isc_sama5d2_config_cbc static]

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/atmel/atmel-isc-base.c
drivers/media/platform/atmel/atmel-isc.h
drivers/media/platform/atmel/atmel-sama5d2-isc.c

index 18136e58a7548e4d932fcb9db69eb530216d5b04..865410e10e70af20ada427c002a183898f7c6f93 100644 (file)
@@ -655,9 +655,7 @@ static void isc_set_pipeline(struct isc_device *isc, u32 pipeline)
        regmap_bulk_write(regmap, ISC_GAM_RENTRY, gamma, GAMMA_ENTRIES);
 
        isc->config_csc(isc);
-
-       regmap_write(regmap, ISC_CBC_BRIGHT, ctrls->brightness);
-       regmap_write(regmap, ISC_CBC_CONTRAST, ctrls->contrast);
+       isc->config_cbc(isc);
 }
 
 static int isc_update_profile(struct isc_device *isc)
index ef3a0451192d669442d1e44a4286494578d304d3..cb47932197b1544de6112eca5fcc042dd53e6b56 100644 (file)
@@ -203,6 +203,8 @@ struct isc_reg_offsets {
  *
  * @config_csc:                pointer to a function that initializes product
  *                     specific CSC module
+ * @config_cbc:                pointer to a function that initializes product
+ *                     specific CBC module
  *
  * @offsets:           struct holding the product specific register offsets
  */
@@ -275,6 +277,7 @@ struct isc_device {
 
        struct {
                void (*config_csc)(struct isc_device *isc);
+               void (*config_cbc)(struct isc_device *isc);
        };
 
        struct isc_reg_offsets          offsets;
index 607b9e306f9db90190e637476e8ae5de71a4ed89..b5f654f263cc600463a8edb3a6fb06ac677b736c 100644 (file)
@@ -73,6 +73,14 @@ static void isc_sama5d2_config_csc(struct isc_device *isc)
                     0xFEE | (0x80 << 16));
 }
 
+static void isc_sama5d2_config_cbc(struct isc_device *isc)
+{
+       struct regmap *regmap = isc->regmap;
+
+       regmap_write(regmap, ISC_CBC_BRIGHT, isc->ctrls.brightness);
+       regmap_write(regmap, ISC_CBC_CONTRAST, isc->ctrls.contrast);
+}
+
 /* Gamma table with gamma 1/2.2 */
 static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
        /* 0 --> gamma 1/1.8 */
@@ -218,6 +226,7 @@ static int atmel_isc_probe(struct platform_device *pdev)
        isc->max_height = ISC_SAMA5D2_MAX_SUPPORT_HEIGHT;
 
        isc->config_csc = isc_sama5d2_config_csc;
+       isc->config_cbc = isc_sama5d2_config_cbc;
 
        isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;