From e58cd453d58b20c6a6f34d3591640aa19aa14d25 Mon Sep 17 00:00:00 2001 From: Claudiu Beznea Date: Fri, 4 Feb 2022 15:57:50 +0200 Subject: at91: add kernel support for sama7g5 soc Add kernel support for SAMA7G5 by back-porting mainline kernel patches. Among SAMA7G5 features could be remembered: - ARM Cortex-A7 - double data rate multi-port dynamic RAM controller supporting DDR2, DDR3, DDR3L, LPDDR2, LPDDR3 up to 533MHz - peripherals for audio, video processing - 1 gigabit + 1 megabit Ethernet controllers - 6 CAN controllers - trust zone support - DVFS for CPU - criptography IPs Signed-off-by: Claudiu Beznea --- ...-atmel-isc-extract-CSC-submodule-config-i.patch | 103 +++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 target/linux/at91/patches-5.10/162-media-atmel-atmel-isc-extract-CSC-submodule-config-i.patch (limited to 'target/linux/at91/patches-5.10/162-media-atmel-atmel-isc-extract-CSC-submodule-config-i.patch') diff --git a/target/linux/at91/patches-5.10/162-media-atmel-atmel-isc-extract-CSC-submodule-config-i.patch b/target/linux/at91/patches-5.10/162-media-atmel-atmel-isc-extract-CSC-submodule-config-i.patch new file mode 100644 index 0000000000..da382d3587 --- /dev/null +++ b/target/linux/at91/patches-5.10/162-media-atmel-atmel-isc-extract-CSC-submodule-config-i.patch @@ -0,0 +1,103 @@ +From 6ccda3cf6a102ac4f6e21386d0dd0fedfb066525 Mon Sep 17 00:00:00 2001 +From: Eugen Hristev +Date: Tue, 13 Apr 2021 12:57:04 +0200 +Subject: [PATCH 162/247] media: atmel: atmel-isc: extract CSC submodule config + into separate function + +The CSC submodule is a part of the atmel-isc pipeline, and stands for +Color Space Conversion. It is used to apply a matrix transformation to +RGB pixels to convert them to the YUV components. +The CSC 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_csc static] + +Signed-off-by: Eugen Hristev +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +--- + 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 07ba439eb7e9..6c709f6a408c 100644 +--- a/drivers/media/platform/atmel/atmel-isc-base.c ++++ b/drivers/media/platform/atmel/atmel-isc-base.c +@@ -654,13 +654,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 88ec4268de11..ebdb9ed791a7 100644 +--- a/drivers/media/platform/atmel/atmel-isc.h ++++ b/drivers/media/platform/atmel/atmel-isc.h +@@ -191,6 +191,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; +@@ -258,6 +261,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 12edeb07b618..19d0f750636c 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 + ++static 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 */ + static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = { + /* 0 --> gamma 1/1.8 */ +@@ -219,6 +232,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.32.0 + -- cgit v1.2.3