[PATCH 06/15] media: microchip-isc: add gamma 1.8 and 2.4 curves for SAMA7G5
From: Balakrishnan Sambath
Date: Wed Dec 02 2026 - 02:16:36 EST
Add 1/2.4 and 1/1.8 tables after the existing 1/2.2 one in
isc_sama7g5_gamma_table and set gamma_max to 2, so V4L2_CID_GAMMA
selects 0 (1/2.2), 1 (1/2.4) or 2 (1/1.8).
1/2.2 stays at index 0 because gamma_max was 0 before, so an explicit
gamma of 0 keeps its curve.
The control default was gamma_max, which would now pick 1/1.8 on SAMA7G5.
Add gamma_def to struct isc_device and set it to 0 on SAMA7G5 and 2 on
SAMA5D2, so the default stays 1/2.2 on both.
Co-developed-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@xxxxxxxxxxxxx>
Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@xxxxxxxxxxxxx>
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@xxxxxxxxxxxxx>
---
.../media/platform/microchip/microchip-isc-base.c | 2 +-
drivers/media/platform/microchip/microchip-isc.h | 2 ++
.../platform/microchip/microchip-sama5d2-isc.c | 1 +
.../platform/microchip/microchip-sama7g5-isc.c | 33 ++++++++++++++++++++--
4 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index 4cbdc43da715..86f0eb86b76d 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -1656,7 +1656,7 @@ static int isc_ctrl_init(struct isc_device *isc)
v4l2_ctrl_new_std(hdl, ops, V4L2_CID_BRIGHTNESS, -1024, 1023, 1, 0);
v4l2_ctrl_new_std(hdl, ops, V4L2_CID_GAMMA, 0, isc->gamma_max, 1,
- isc->gamma_max);
+ isc->gamma_def);
isc->awb_ctrl = v4l2_ctrl_new_std(hdl, &isc_awb_ops,
V4L2_CID_AUTO_WHITE_BALANCE,
0, 1, 1, 1);
diff --git a/drivers/media/platform/microchip/microchip-isc.h b/drivers/media/platform/microchip/microchip-isc.h
index d7bcd74efff9..31d9cf84b318 100644
--- a/drivers/media/platform/microchip/microchip-isc.h
+++ b/drivers/media/platform/microchip/microchip-isc.h
@@ -243,6 +243,7 @@ enum isc_scaler_pads {
* @gamma_table: pointer to the table with gamma values, has
* gamma_max sets of GAMMA_ENTRIES entries each
* @gamma_max: maximum number of sets of inside the gamma_table
+ * @gamma_def: default set inside the gamma_table
*
* @max_width: maximum frame width, dependent on the internal RAM
* @max_height: maximum frame height, dependent on the internal RAM
@@ -345,6 +346,7 @@ struct isc_device {
/* pointer to the defined gamma table */
const u32 (*gamma_table)[GAMMA_ENTRIES];
u32 gamma_max;
+ u32 gamma_def;
u32 max_width;
u32 max_height;
diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
index 5e41eee45dbd..a93f95434270 100644
--- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
@@ -460,6 +460,7 @@ static int microchip_isc_probe(struct platform_device *pdev)
isc->gamma_table = isc_sama5d2_gamma_table;
isc->gamma_max = 2;
+ isc->gamma_def = 2;
isc->max_width = ISC_SAMA5D2_MAX_SUPPORT_WIDTH;
isc->max_height = ISC_SAMA5D2_MAX_SUPPORT_HEIGHT;
diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
index 80bd0fd3716d..415c58c42614 100644
--- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
@@ -350,9 +350,9 @@ static void isc_sama7g5_adapt_pipeline(struct isc_device *isc)
isc->try_config.bits_pipeline &= ISC_SAMA7G5_PIPELINE;
}
-/* Gamma table with gamma 1/2.2 */
+/* Gamma tables with gamma values 0.45(Default), 0.42, 0.56 */
static const u32 isc_sama7g5_gamma_table[][GAMMA_ENTRIES] = {
- /* index 0 --> gamma bipartite */
+ /* index 0 --> gamma bipartite 1/2.2(=0.45) */
{
0x780, 0x3c02c0, 0x520200, 0x6201c0, 0x700180, 0x7c0160,
0x870140, 0x910120, 0x9a0100, 0xa20100, 0xaa0100, 0xb200e0,
@@ -365,6 +365,32 @@ static const u32 isc_sama7g5_gamma_table[][GAMMA_ENTRIES] = {
0x3130028, 0x3270026, 0x33a0024, 0x34c0024, 0x35e0024, 0x3700022,
0x3810022, 0x3920020, 0x3a20022, 0x3b3001e, 0x3c20020, 0x3d2001e,
0x3e1001e, 0x3f0001e, 0x3ff001c, 0x40d001c },
+ /* index 1 --> gamma bipartite 1/2.4(=0.42) */
+ {
+ 0x960, 0x4b0300, 0x630260, 0x7601c0, 0x8401a0, 0x910180,
+ 0x9d0160, 0xa80120, 0xb10120, 0xba0120, 0xc30100, 0xcb0100,
+ 0xd300e0, 0xda00e0, 0xe100e0, 0xe800c0, 0xee00c0, 0xf400c0,
+ 0xfa00c0, 0x10000a0, 0x10500c0, 0x10b00a0, 0x11000a0, 0x11500a0,
+ 0x11a00a0, 0x11f00a0, 0x12400a0, 0x12900a0, 0x12e00a0, 0x13300a0,
+ 0x1380080, 0x13c00a0, 0x1410072, 0x17a0060, 0x1aa0054, 0x1d4004a,
+ 0x1f90044, 0x21b003e, 0x23a003a, 0x2570036, 0x2720032, 0x28b0030,
+ 0x2a3002e, 0x2ba002c, 0x2d0002c, 0x2e60028, 0x2fa0028, 0x30e0026,
+ 0x3210024, 0x3330024, 0x3450022, 0x3560022, 0x3670020, 0x3770020,
+ 0x387001e, 0x396001e, 0x3a5001c, 0x3b3001c, 0x3c1001c, 0x3cf001c,
+ 0x3dd001c, 0x3eb001c, 0x3f9001c, 0x407001c },
+ /* index 2 --> gamma bipartite 1/1.8(=0.56) */
+ {
+ 0x400, 0x2001e0, 0x2f0180, 0x3b0140, 0x450120, 0x4e0120,
+ 0x5700e0, 0x5e0100, 0x6600c0, 0x6c00e0, 0x7300c0, 0x7900c0,
+ 0x7f00c0, 0x8500c0, 0x8b00a0, 0x9000a0, 0x9500a0, 0x9a00a0,
+ 0x9f00a0, 0xa400a0, 0xa900a0, 0xae0080, 0xb200a0, 0xb70080,
+ 0xbb0080, 0xbf0080, 0xc300a0, 0xc80080, 0xcc0080, 0xd00080,
+ 0xd40060, 0xd70080, 0xdb0070, 0x113005e, 0x1420056, 0x16d004e,
+ 0x1940048, 0x1b80044, 0x1da0040, 0x1fa003c, 0x218003a, 0x2350038,
+ 0x2510036, 0x26c0034, 0x2860034, 0x2a00030, 0x2b80030, 0x2d0002e,
+ 0x2e7002e, 0x2fe002c, 0x314002c, 0x32a002a, 0x33f002a, 0x3540028,
+ 0x3680028, 0x37c0028, 0x3900026, 0x3a30026, 0x3b60026, 0x3c90024,
+ 0x3db0024, 0x3ed0024, 0x3ff0024, 0x4110024 },
};
static int xisc_parse_dt(struct device *dev, struct isc_device *isc)
@@ -482,7 +508,8 @@ static int microchip_xisc_probe(struct platform_device *pdev)
}
isc->gamma_table = isc_sama7g5_gamma_table;
- isc->gamma_max = 0;
+ isc->gamma_max = 2;
+ isc->gamma_def = 0;
data = of_device_get_match_data(dev);
if (!data)
--
2.34.1