From 8299d1f057439f94c6a4412e2e5c5082b82a30c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 21 Aug 2021 10:54:34 +0200 Subject: bcm27xx: add kernel 5.10 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rebased RPi foundation patches on linux 5.10.59, removed applied and reverted patches, wireless patches and defconfig patches. bcm2708: boot tested on RPi B+ v1.2 bcm2709: boot tested on RPi 4B v1.1 4G bcm2711: boot tested on RPi 4B v1.1 4G Signed-off-by: Álvaro Fernández Rojas --- ...edia-i2c-imx290-Add-H-and-V-flip-controls.patch | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 target/linux/bcm27xx/patches-5.10/950-0273-media-i2c-imx290-Add-H-and-V-flip-controls.patch (limited to 'target/linux/bcm27xx/patches-5.10/950-0273-media-i2c-imx290-Add-H-and-V-flip-controls.patch') diff --git a/target/linux/bcm27xx/patches-5.10/950-0273-media-i2c-imx290-Add-H-and-V-flip-controls.patch b/target/linux/bcm27xx/patches-5.10/950-0273-media-i2c-imx290-Add-H-and-V-flip-controls.patch new file mode 100644 index 0000000000..0ad9193d6d --- /dev/null +++ b/target/linux/bcm27xx/patches-5.10/950-0273-media-i2c-imx290-Add-H-and-V-flip-controls.patch @@ -0,0 +1,83 @@ +From ab78051da1ad984c5b424c1e75f487d2a2f2c026 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Thu, 11 Jun 2020 18:34:16 +0100 +Subject: [PATCH] media: i2c: imx290: Add H and V flip controls + +The sensor supports horizontal and vertical flips, so support them +through V4L2_CID_HFLIP and V4L2_CID_VFLIP. + +This sensor does NOT change the Bayer order when changing the +direction of readout, therefore no special handling is required for +that. + +Signed-off-by: Dave Stevenson +--- + drivers/media/i2c/imx290.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +--- a/drivers/media/i2c/imx290.c ++++ b/drivers/media/i2c/imx290.c +@@ -34,6 +34,7 @@ enum imx290_clk_index { + #define IMX290_STANDBY 0x3000 + #define IMX290_REGHOLD 0x3001 + #define IMX290_XMSTA 0x3002 ++#define IMX290_FLIP_WINMODE 0x3007 + #define IMX290_FR_FDG_SEL 0x3009 + #define IMX290_BLKLEVEL_LOW 0x300a + #define IMX290_BLKLEVEL_HIGH 0x300b +@@ -107,6 +108,8 @@ struct imx290 { + struct v4l2_ctrl *pixel_rate; + struct v4l2_ctrl *hblank; + struct v4l2_ctrl *vblank; ++ struct v4l2_ctrl *hflip; ++ struct v4l2_ctrl *vflip; + struct v4l2_ctrl *exposure; + + struct mutex lock; +@@ -600,6 +603,7 @@ static int imx290_set_ctrl(struct v4l2_c + struct imx290 *imx290 = container_of(ctrl->handler, + struct imx290, ctrls); + int ret = 0; ++ u8 val; + + /* V4L2 controls values will be applied only when power is already up */ + if (!pm_runtime_get_if_in_use(imx290->dev)) +@@ -618,6 +622,16 @@ static int imx290_set_ctrl(struct v4l2_c + case V4L2_CID_VBLANK: + ret = imx290_set_vmax(imx290, ctrl->val); + break; ++ case V4L2_CID_HFLIP: ++ case V4L2_CID_VFLIP: ++ /* WINMODE is in bits [6:4], so need to read-modify-write */ ++ ret = imx290_read_reg(imx290, IMX290_FLIP_WINMODE, &val); ++ if (ret) ++ break; ++ val &= ~0x03; ++ val |= imx290->vflip->val | (imx290->hflip->val << 1); ++ ret = imx290_write_reg(imx290, IMX290_FLIP_WINMODE, val); ++ break; + case V4L2_CID_TEST_PATTERN: + if (ctrl->val) { + imx290_write_reg(imx290, IMX290_BLKLEVEL_LOW, 0x00); +@@ -924,6 +938,9 @@ static int imx290_set_stream(struct v4l2 + imx290_stop_streaming(imx290); + pm_runtime_put(imx290->dev); + } ++ /* vflip and hflip cannot change during streaming */ ++ __v4l2_ctrl_grab(imx290->vflip, enable); ++ __v4l2_ctrl_grab(imx290->hflip, enable); + + unlock_and_return: + +@@ -1217,6 +1234,11 @@ static int imx290_probe(struct i2c_clien + IMX290_EXPOSURE_STEP, + mode->vmax - 4); + ++ imx290->hflip = v4l2_ctrl_new_std(&imx290->ctrls, &imx290_ctrl_ops, ++ V4L2_CID_HFLIP, 0, 1, 1, 0); ++ imx290->vflip = v4l2_ctrl_new_std(&imx290->ctrls, &imx290_ctrl_ops, ++ V4L2_CID_VFLIP, 0, 1, 1, 0); ++ + imx290->link_freq = + v4l2_ctrl_new_int_menu(&imx290->ctrls, &imx290_ctrl_ops, + V4L2_CID_LINK_FREQ, -- cgit v1.2.3