Commit 2873f85b authored by Eugen Hristev's avatar Eugen Hristev Committed by Mauro Carvalho Chehab

media: atmel: atmel-isc: add CC initialization function

The CC submodule is a part of the atmel-isc pipeline, and stands for
Color Correction. It is used to apply gains and offsets to the
chroma (U, V) components of the YUV elements.
Implement the CC submodule initialization, as a product
specific function, which currently configures the neutral point in color
correction.

[hverkuil: made isc_sama5d2_config_cc static]
Signed-off-by: default avatarEugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 5507b101
...@@ -661,6 +661,7 @@ static void isc_set_pipeline(struct isc_device *isc, u32 pipeline) ...@@ -661,6 +661,7 @@ static void isc_set_pipeline(struct isc_device *isc, u32 pipeline)
isc->config_csc(isc); isc->config_csc(isc);
isc->config_cbc(isc); isc->config_cbc(isc);
isc->config_cc(isc);
} }
static int isc_update_profile(struct isc_device *isc) static int isc_update_profile(struct isc_device *isc)
......
...@@ -225,6 +225,8 @@ struct isc_reg_offsets { ...@@ -225,6 +225,8 @@ struct isc_reg_offsets {
* specific CSC module * specific CSC module
* @config_cbc: pointer to a function that initializes product * @config_cbc: pointer to a function that initializes product
* specific CBC module * specific CBC module
* @config_cc: pointer to a function that initializes product
* specific CC module
* *
* @offsets: struct holding the product specific register offsets * @offsets: struct holding the product specific register offsets
*/ */
...@@ -298,6 +300,7 @@ struct isc_device { ...@@ -298,6 +300,7 @@ struct isc_device {
struct { struct {
void (*config_csc)(struct isc_device *isc); void (*config_csc)(struct isc_device *isc);
void (*config_cbc)(struct isc_device *isc); void (*config_cbc)(struct isc_device *isc);
void (*config_cc)(struct isc_device *isc);
}; };
struct isc_reg_offsets offsets; struct isc_reg_offsets offsets;
......
...@@ -83,6 +83,19 @@ static void isc_sama5d2_config_cbc(struct isc_device *isc) ...@@ -83,6 +83,19 @@ static void isc_sama5d2_config_cbc(struct isc_device *isc)
isc->ctrls.contrast); isc->ctrls.contrast);
} }
static void isc_sama5d2_config_cc(struct isc_device *isc)
{
struct regmap *regmap = isc->regmap;
/* Configure each register at the neutral fixed point 1.0 or 0.0 */
regmap_write(regmap, ISC_CC_RR_RG, (1 << 8));
regmap_write(regmap, ISC_CC_RB_OR, 0);
regmap_write(regmap, ISC_CC_GR_GG, (1 << 8) << 16);
regmap_write(regmap, ISC_CC_GB_OG, 0);
regmap_write(regmap, ISC_CC_BR_BG, 0);
regmap_write(regmap, ISC_CC_BB_OB, (1 << 8));
}
/* Gamma table with gamma 1/2.2 */ /* Gamma table with gamma 1/2.2 */
static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = { static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
/* 0 --> gamma 1/1.8 */ /* 0 --> gamma 1/1.8 */
...@@ -230,6 +243,7 @@ static int atmel_isc_probe(struct platform_device *pdev) ...@@ -230,6 +243,7 @@ static int atmel_isc_probe(struct platform_device *pdev)
isc->config_csc = isc_sama5d2_config_csc; isc->config_csc = isc_sama5d2_config_csc;
isc->config_cbc = isc_sama5d2_config_cbc; isc->config_cbc = isc_sama5d2_config_cbc;
isc->config_cc = isc_sama5d2_config_cc;
isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET; isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET;
isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET; isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment