From: Hans de Goede <hansg@kernel.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
Jakob Berg Jespersen <dev@berg.pm>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Daniel Scally <dan.scally@ideasonboard.com>,
Fernando Rimoli <fernandorimoli11@gmail.com>,
Tooraj Taraz <tooraj.taraz@yahoo.com>,
"Joseph V. Lavigne" <jlavig88@gmail.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 1/2] media: i2c: ov8865: fix horizontal flip control polarity
Date: Wed, 29 Jul 2026 15:15:20 +0200 [thread overview]
Message-ID: <98d755d5-68b8-47db-8444-6aee5dab4da1@kernel.org> (raw)
In-Reply-To: <amktg0O4JqGJEHMc@kekkonen.localdomain>
Hi,
On 29-Jul-26 00:30, Sakari Ailus wrote:
> Hi Jacob,
>
> Thanks for the set.
>
> On Mon, Jul 20, 2026 at 04:28:40PM +0200, Jakob Berg Jespersen wrote:
>> The ov8865's native readout is horizontally mirrored and the
>> FORMAT2 FLIP_HORZ bits (reg 0x3821) un-mirror it: with the bits
>> cleared the image is mirrored, with them set it is not. The driver
>> maps V4L2_CID_HFLIP=1 to setting the bits, so requesting a flip
>> produces an unflipped image and vice versa.
>>
>> This is user-visible on the Surface Pro 7+ rear camera (mounted with a
>> 180 degree rotation, SSDB degree=180): libcamera requests HFLIP=1+VFLIP=1
>> to undo the mount rotation and gets a horizontally flipped image.
>>
>> Verified by a live 4-state flip/image matrix on the streaming sensor:
>>
>> hflip=0 vflip=0 -> 180 degree rotation (both flips)
>> hflip=1 vflip=0 -> vertical flip only
>> hflip=0 vflip=1 -> correct image
>> hflip=1 vflip=1 -> horizontal flip only
>>
>> (vertical flip = reflection over a horizontal mirror line, as on water;
>> horizontal flip = reflection over a vertical mirror line, as in a mirror)
>>
>> which is only consistent with an inverted HFLIP and a correct VFLIP.
>>
>> Invert the polarity so HFLIP=0 yields the unflipped image.
>
> Is this just about, looking at the patch, that the driver before this patch
> effectively implements an inverted HFLIP control? I think the description
> could be simplified.
Ack and even more so for the second patch. The text about
"like the ov8865" really does not belong in the commit message
there.
Regards,
Hans
>
>>
>> Signed-off-by: Jakob Berg Jespersen <dev@berg.pm>
>> ---
>> drivers/media/i2c/ov8865.c | 8 +++++++-
>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c
>> index c6d53c3d55ca..901ea7c16395 100644
>> --- a/drivers/media/i2c/ov8865.c
>> +++ b/drivers/media/i2c/ov8865.c
>> @@ -2204,8 +2204,14 @@ static int ov8865_flip_horz_configure(struct ov8865_sensor *sensor, bool enable)
>> u8 bits = OV8865_FORMAT2_FLIP_HORZ_ISP_EN |
>> OV8865_FORMAT2_FLIP_HORZ_SENSOR_EN;
>>
>> + /*
>> + * The sensor's native readout is horizontally mirrored; the
>> + * FLIP_HORZ bits un-mirror it. Map the control so that HFLIP=0
>> + * yields an unmirrored image (verified on Surface Pro 7+ rear
>> + * camera by a live flip-control/image matrix test).
>> + */
>
> Just a comment saying this is inverted in the sensor considering HFLIP
> should be enough here.
>
>> return ov8865_update_bits(sensor, OV8865_FORMAT2_REG, bits,
>> - enable ? bits : 0);
>> + enable ? 0 : bits);
>> }
>>
>> /* Test Pattern */
>>
>
next prev parent reply other threads:[~2026-07-29 13:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Q5OH0unwBM9QICxTJXBm1W7LkqYpiGtPRvNqI8FMsDW63Z1AgVArhC3__6dhY4hjrsuDCsbMfvArNyf_qB0Akw==@protonmail.internalid>
2026-07-20 14:28 ` [PATCH RFC 0/2] media: i2c: Surface Pro 7+ camera flip fixes Jakob Berg Jespersen
2026-07-20 14:28 ` [PATCH RFC 1/2] media: i2c: ov8865: fix horizontal flip control polarity Jakob Berg Jespersen
2026-07-28 22:30 ` Sakari Ailus
2026-07-29 13:15 ` Hans de Goede [this message]
2026-07-29 13:13 ` Hans de Goede
2026-07-20 14:28 ` [PATCH RFC 2/2] media: i2c: ov5693: fix horizontal flip polarity and Bayer phase Jakob Berg Jespersen
2026-07-20 17:39 ` Fernando Rimoli
2026-07-29 13:18 ` Hans de Goede
2026-07-22 22:14 ` [PATCH RFC 0/2] media: i2c: Surface Pro 7+ camera flip fixes Bryan O'Donoghue
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=98d755d5-68b8-47db-8444-6aee5dab4da1@kernel.org \
--to=hansg@kernel.org \
--cc=dan.scally@ideasonboard.com \
--cc=dev@berg.pm \
--cc=fernandorimoli11@gmail.com \
--cc=jlavig88@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tooraj.taraz@yahoo.com \
/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