bcm27xx: add support for linux v5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.15 / 950-0469-media-i2c-imx477-Allow-control-of-on-sensor-DPC.patch
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
5
6 A module parameter "dpc_enable" is added to allow the control of the
7 sensor's on-board DPC (Defective Pixel Correction) function.
8
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.
11
12 Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
13 ---
14 drivers/media/i2c/imx477.c | 8 ++++++++
15 1 file changed, 8 insertions(+)
16
17 --- a/drivers/media/i2c/imx477.c
18 +++ b/drivers/media/i2c/imx477.c
19 @@ -21,6 +21,10 @@
20 #include <media/v4l2-fwnode.h>
21 #include <media/v4l2-mediabus.h>
22
23 +static int dpc_enable = 1;
24 +module_param(dpc_enable, int, 0644);
25 +MODULE_PARM_DESC(dpc_enable, "Enable on-sensor DPC");
26 +
27 #define IMX477_REG_VALUE_08BIT 1
28 #define IMX477_REG_VALUE_16BIT 2
29
30 @@ -1713,6 +1717,10 @@ static int imx477_start_streaming(struct
31 return ret;
32 }
33
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);
37 +
38 /* Apply customized values from user */
39 ret = __v4l2_ctrl_handler_setup(imx477->sd.ctrl_handler);
40 if (ret)