Skip to content

Commit 70ea1a4

Browse files
6by9pelwell
authored andcommitted
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 <dave.stevenson@raspberrypi.com>
1 parent 4546b86 commit 70ea1a4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/media/i2c/imx290.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/gpio/consumer.h>
1414
#include <linux/i2c.h>
1515
#include <linux/module.h>
16+
#include <linux/moduleparam.h>
1617
#include <linux/of.h>
1718
#include <linux/pm_runtime.h>
1819
#include <linux/regmap.h>
@@ -41,6 +42,9 @@
4142
#define IMX290_WINMODE_720P (1 << 4)
4243
#define IMX290_WINMODE_CROP (4 << 4)
4344
#define IMX290_FR_FDG_SEL CCI_REG8(0x3009)
45+
#define IMX290_FDG_HCG BIT(4)
46+
#define IMX290_FRSEL_60FPS BIT(0)
47+
#define IMX290_FDG_LCG 0
4448
#define IMX290_BLKLEVEL CCI_REG16_LE(0x300a)
4549
#define IMX290_GAIN CCI_REG8(0x3014)
4650
#define IMX290_VMAX CCI_REG24_LE(0x3018)
@@ -162,6 +166,10 @@
162166

163167
#define IMX290_NUM_SUPPLIES 3
164168

169+
static bool hcg_mode;
170+
module_param(hcg_mode, bool, 0664);
171+
MODULE_PARM_DESC(hcg_mode, "Enable HCG mode");
172+
165173
enum imx290_colour_variant {
166174
IMX290_VARIANT_COLOUR,
167175
IMX290_VARIANT_MONO,
@@ -697,7 +705,8 @@ static int imx290_set_data_lanes(struct imx290 *imx290)
697705
&ret);
698706
cci_write(imx290->regmap, IMX290_CSI_LANE_MODE, imx290->nlanes - 1,
699707
&ret);
700-
cci_write(imx290->regmap, IMX290_FR_FDG_SEL, 0x01, &ret);
708+
cci_write(imx290->regmap, IMX290_FR_FDG_SEL, IMX290_FRSEL_60FPS |
709+
(hcg_mode ? IMX290_FDG_HCG : IMX290_FDG_LCG), &ret);
701710

702711
return ret;
703712
}

0 commit comments

Comments
 (0)