1 From 2b6edd13bb5152c659466987846b481df8b37393 Mon Sep 17 00:00:00 2001
2 From: David Plowman <david.plowman@raspberrypi.com>
3 Date: Wed, 8 Sep 2021 14:15:17 +0100
4 Subject: [PATCH] media: i2c: imx477: Allow control of on-sensor DPC
6 A module parameter "dpc_enable" is added to allow the control of the
7 sensor's on-board DPC (Defective Pixel Correction) function.
9 This is a global setting to be configured before using the sensor;
10 there is no intention that this would ever be changed on-the-fly.
12 Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
14 drivers/media/i2c/imx477.c | 8 ++++++++
15 1 file changed, 8 insertions(+)
17 --- a/drivers/media/i2c/imx477.c
18 +++ b/drivers/media/i2c/imx477.c
20 #include <media/v4l2-fwnode.h>
21 #include <media/v4l2-mediabus.h>
23 +static int dpc_enable = 1;
24 +module_param(dpc_enable, int, 0644);
25 +MODULE_PARM_DESC(dpc_enable, "Enable on-sensor DPC");
27 #define IMX477_REG_VALUE_08BIT 1
28 #define IMX477_REG_VALUE_16BIT 2
30 @@ -1713,6 +1717,10 @@ static int imx477_start_streaming(struct
34 + /* Set on-sensor DPC. */
35 + imx477_write_reg(imx477, 0x0b05, IMX477_REG_VALUE_08BIT, !!dpc_enable);
36 + imx477_write_reg(imx477, 0x0b06, IMX477_REG_VALUE_08BIT, !!dpc_enable);
38 /* Apply customized values from user */
39 ret = __v4l2_ctrl_handler_setup(imx477->sd.ctrl_handler);