Re: [PATCH v2 06/15] media: i2c: os05b10: Add H/V flip support

From: Mehdi Djait

Date: Thu Jul 02 2026 - 04:14:45 EST


Hi Tarang,

On Wed, Mar 25, 2026 at 05:13:52PM +0530, Tarang Raval wrote:
> Add HFLIP and VFLIP controls, lock them while streaming,
> and update the reported Bayer format based on the flip state.
>
> Signed-off-by: Tarang Raval <tarang.raval@xxxxxxxxxxxxxxxxx>
> ---
> drivers/media/i2c/os05b10.c | 59 ++++++++++++++++++++++++++++++++++---
> 1 file changed, 55 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/i2c/os05b10.c b/drivers/media/i2c/os05b10.c
> index 2f47b02149b7..bf848eb9ba52 100644
> --- a/drivers/media/i2c/os05b10.c
> +++ b/drivers/media/i2c/os05b10.c
> @@ -96,6 +96,10 @@
> #define OS05B10_MIRROR BIT(3)
> #define OS05B10_FLIP GENMASK(5, 4)
>
> +#define OS05B10_REG_ANALOG_FLIP CCI_REG8(0x3716)
> +#define OS05B10_FLIP_ENABLE 0x04
> +#define OS05B10_FLIP_DISABLE 0x24
> +
> #define OS05B10_REG_FORMAT2 CCI_REG8(0x3821)
> #define OS05B10_HDR_ENABLE 0x04

[..]

> + case V4L2_CID_HFLIP:
> + case V4L2_CID_VFLIP:
> + ret = cci_update_bits(os05b10->cci, OS05B10_REG_FORMAT1,
> + GENMASK(5, 3),

OS05B10_MIRROR and OS05B10_FLIP can be used here instead of GENMASK(5,
3)

> + (!os05b10->hflip->val) << 3 |
> + os05b10->vflip->val << 5 |
> + os05b10->vflip->val << 4, NULL);

And here also.

This will make the code much cleaner.

> + if (ret)
> + return ret;
> +
> + ret = cci_write(os05b10->cci, OS05B10_REG_ANALOG_FLIP,
> + (os05b10->vflip->val == 1) ?
> + OS05B10_FLIP_ENABLE : OS05B10_FLIP_DISABLE,
> + NULL);
> + break;
> default:
> ret = -EINVAL;
> break;

--
Kind Regards
Mehdi Djait