From: Mehdi Djait <mehdi.djait@linux.intel.com>
To: Tarang Raval <tarang.raval@siliconsignals.io>
Cc: sakari.ailus@linux.intel.com,
Himanshu Bhavani <himanshu.bhavani@siliconsignals.io>,
Elgin Perumbilly <elgin.perumbilly@siliconsignals.io>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
Hans Verkuil <hverkuil+cisco@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 06/17] media: i2c: os05b10: Add H/V flip support
Date: Tue, 21 Jul 2026 19:43:40 +0200 [thread overview]
Message-ID: <al-vFc6M7Z5cY5ZG@mdjait-mobl> (raw)
In-Reply-To: <20260718200912.16001-7-tarang.raval@siliconsignals.io>
Hi Tarang,
On Sun, Jul 19, 2026 at 01:38:57AM +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@siliconsignals.io>
> ---
> drivers/media/i2c/os05b10.c | 56 ++++++++++++++++++++++++++++++++++---
> 1 file changed, 52 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/i2c/os05b10.c b/drivers/media/i2c/os05b10.c
> index abf3d2970900..61c51844a91e 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_LINK_FREQ_600MHZ (600 * HZ_PER_MHZ)
> @@ -231,7 +235,6 @@ static const struct cci_reg_sequence os05b10_common_regs[] = {
> { CCI_REG8(0x370f), 0x1c },
> { CCI_REG8(0x3710), 0x00 },
> { CCI_REG8(0x3713), 0x00 },
> - { CCI_REG8(0x3716), 0x24 },
> { CCI_REG8(0x371a), 0x1e },
> { CCI_REG8(0x3724), 0x09 },
> { CCI_REG8(0x3725), 0xb2 },
> @@ -465,6 +468,8 @@ struct os05b10 {
> struct v4l2_ctrl *vblank;
> struct v4l2_ctrl *gain;
> struct v4l2_ctrl *exposure;
> + struct v4l2_ctrl *vflip;
> + struct v4l2_ctrl *hflip;
>
> u32 link_freq_index;
> u32 data_lanes;
> @@ -513,6 +518,16 @@ static inline struct os05b10 *to_os05b10(struct v4l2_subdev *sd)
> return container_of_const(sd, struct os05b10, sd);
> };
>
> +static u32 os05b10_get_format_code(struct os05b10 *os05b10)
> +{
> + static const u32 codes[2][2] = {
> + { MEDIA_BUS_FMT_SBGGR10_1X10, MEDIA_BUS_FMT_SGBRG10_1X10, },
> + { MEDIA_BUS_FMT_SGRBG10_1X10, MEDIA_BUS_FMT_SRGGB10_1X10, },
> + };
> +
> + return codes[os05b10->vflip->val][os05b10->hflip->val];
> +}
> +
> static int os05b10_set_ctrl(struct v4l2_ctrl *ctrl)
> {
> struct os05b10 *os05b10 = container_of_const(ctrl->handler,
> @@ -556,6 +571,20 @@ static int os05b10_set_ctrl(struct v4l2_ctrl *ctrl)
> ret = cci_write(os05b10->cci, OS05B10_REG_EXPOSURE,
> ctrl->val, NULL);
> break;
> + case V4L2_CID_HFLIP:
> + case V4L2_CID_VFLIP:
> + ret = cci_update_bits(os05b10->cci, OS05B10_REG_FORMAT1,
> + OS05B10_MIRROR | OS05B10_FLIP,
> + (!os05b10->hflip->val ?
> + OS05B10_MIRROR : 0) |
> + (os05b10->vflip->val ?
> + OS05B10_FLIP : 0), NULL);
> +
> + ret |= cci_write(os05b10->cci, OS05B10_REG_ANALOG_FLIP,
> + (os05b10->vflip->val == 1) ?
> + OS05B10_FLIP_ENABLE : OS05B10_FLIP_DISABLE,
> + NULL);
I don't know about the ret |= assignment
You can use the last parameter of the cci_*() helpers. That would make
this cleaner and not combine two error codes to produce something weird.
If you pass &ret to cci_write() the helper will check if an error
already occured and return it.
> + break;
> default:
> ret = -EINVAL;
> break;
--
Kind Regards
Mehdi Djait
next prev parent reply other threads:[~2026-07-21 17:43 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-18 20:08 [PATCH v3 00/17] media: i2c: os05b10: Refactor driver and Add new features Tarang Raval
2026-07-18 20:08 ` [PATCH v3 01/17] media: i2c: os05b10: Use pm_runtime_get_if_active() when applying controls Tarang Raval
2026-07-22 5:58 ` Jai Luthra
2026-07-24 6:47 ` Tarang Raval
2026-07-18 20:08 ` [PATCH v3 02/17] media: i2c: os05b10: drop unused group-hold programming Tarang Raval
2026-07-18 20:08 ` [PATCH v3 03/17] media: i2c: os05b10: add register definitions and use them in init table Tarang Raval
2026-07-21 17:25 ` Mehdi Djait
2026-07-24 13:09 ` Vladimir Zapolskiy
2026-07-18 20:08 ` [PATCH v3 04/17] media: i2c: os05b10: split common and mode-specific init registers Tarang Raval
2026-07-21 17:40 ` Mehdi Djait
2026-07-24 13:15 ` Vladimir Zapolskiy
2026-07-18 20:08 ` [PATCH v3 05/17] media: i2c: os05b10: add V4L2 digital gain control Tarang Raval
2026-07-24 13:19 ` Vladimir Zapolskiy
2026-07-24 14:15 ` Tarang Raval
2026-07-18 20:08 ` [PATCH v3 06/17] media: i2c: os05b10: Add H/V flip support Tarang Raval
2026-07-21 17:43 ` Mehdi Djait [this message]
2026-07-22 5:51 ` Jai Luthra
2026-07-24 7:01 ` Tarang Raval
2026-07-24 13:27 ` Vladimir Zapolskiy
2026-07-18 20:08 ` [PATCH v3 07/17] media: i2c: os05b10: Add test pattern options Tarang Raval
2026-07-21 17:50 ` Mehdi Djait
2026-07-24 13:43 ` Vladimir Zapolskiy
2026-07-18 20:08 ` [PATCH v3 08/17] media: i2c: os05b10: add 12-bit RAW mode support Tarang Raval
2026-07-24 14:08 ` Vladimir Zapolskiy
2026-07-24 14:30 ` Tarang Raval
2026-07-24 15:03 ` Vladimir Zapolskiy
2026-07-18 20:09 ` [PATCH v3 09/17] media: i2c: os05b10: update pixel rate on 10/12-bit mode switch Tarang Raval
2026-07-22 6:17 ` Jai Luthra
2026-07-22 6:19 ` Jai Luthra
2026-07-24 9:08 ` Tarang Raval
2026-07-25 7:26 ` Vladimir Zapolskiy
2026-07-18 20:09 ` [PATCH v3 10/17] media: i2c: os05b10: Add 1080p and 2x2 binning 720p modes Tarang Raval
2026-07-22 6:05 ` Jai Luthra
2026-07-24 6:44 ` Tarang Raval
2026-07-18 20:09 ` [PATCH v3 11/17] media: i2c: os05b10: keep vblank and exposure range in sync on mode switch Tarang Raval
2026-07-25 7:30 ` Vladimir Zapolskiy
2026-07-18 20:09 ` [PATCH v3 12/17] media: i2c: os05b10: Update active format before adjusting framing controls Tarang Raval
2026-07-25 7:32 ` Vladimir Zapolskiy
2026-07-18 20:09 ` [PATCH v3 13/17] media: i2c: os05b10: Rename vmax variable in VBLANK control Tarang Raval
2026-07-25 7:33 ` Vladimir Zapolskiy
2026-07-18 20:09 ` [PATCH v3 14/17] media: i2c: os05b10: add 2-lane support Tarang Raval
2026-07-25 7:38 ` Vladimir Zapolskiy
2026-07-18 20:09 ` [PATCH v3 15/17] media: i2c: os05b10: fix negative hblank calculation Tarang Raval
2026-07-22 6:14 ` Jai Luthra
2026-07-24 8:14 ` Tarang Raval
2026-07-18 20:09 ` [PATCH v3 16/17] media: i2c: os05b10: Enable runtime PM autosuspend Tarang Raval
2026-07-22 6:08 ` Jai Luthra
2026-07-24 7:02 ` Tarang Raval
2026-07-24 9:58 ` Jai Luthra
2026-07-18 20:09 ` [PATCH v3 17/17] media: i2c: os05b10: remove unused control fields, simplify error handling Tarang Raval
2026-07-25 11:33 ` Vladimir Zapolskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=al-vFc6M7Z5cY5ZG@mdjait-mobl \
--to=mehdi.djait@linux.intel.com \
--cc=elgin.perumbilly@siliconsignals.io \
--cc=himanshu.bhavani@siliconsignals.io \
--cc=hverkuil+cisco@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tarang.raval@siliconsignals.io \
--cc=vladimir.zapolskiy@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®