From dcb1e1bb4f98664bd9ab00eb2349037a3eb54b53 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Wed, 15 May 2024 12:43:15 +0100 Subject: [PATCH] media: imx290: Add module parameter to allow selection of HCG mode The sensor has Low Conversion Gain (HCG) and High Conversion Gain (HCG) modes, with the supposedly the HCG mode having better noise performance at high gains. As this parameter changes the gain range of the sensor, it isn't possible to make this an automatic property, and there is no suitable V4L2 control to set it, so just add it as a module parameter. Signed-off-by: Dave Stevenson --- drivers/media/i2c/imx290.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c index 6dacd38ae947a1..c685dbe2d34270 100644 --- a/drivers/media/i2c/imx290.c +++ b/drivers/media/i2c/imx290.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -41,6 +42,9 @@ #define IMX290_WINMODE_720P (1 << 4) #define IMX290_WINMODE_CROP (4 << 4) #define IMX290_FR_FDG_SEL CCI_REG8(0x3009) +#define IMX290_FDG_HCG BIT(4) +#define IMX290_FRSEL_60FPS BIT(0) +#define IMX290_FDG_LCG 0 #define IMX290_BLKLEVEL CCI_REG16_LE(0x300a) #define IMX290_GAIN CCI_REG8(0x3014) #define IMX290_VMAX CCI_REG24_LE(0x3018) @@ -162,6 +166,10 @@ #define IMX290_NUM_SUPPLIES 3 +static bool hcg_mode; +module_param(hcg_mode, bool, 0664); +MODULE_PARM_DESC(hcg_mode, "Enable HCG mode"); + enum imx290_colour_variant { IMX290_VARIANT_COLOUR, IMX290_VARIANT_MONO, @@ -649,7 +657,8 @@ static int imx290_set_data_lanes(struct imx290 *imx290) &ret); cci_write(imx290->regmap, IMX290_CSI_LANE_MODE, imx290->nlanes - 1, &ret); - cci_write(imx290->regmap, IMX290_FR_FDG_SEL, 0x01, &ret); + cci_write(imx290->regmap, IMX290_FR_FDG_SEL, IMX290_FRSEL_60FPS | + (hcg_mode ? IMX290_FDG_HCG : IMX290_FDG_LCG), &ret); return ret; }