linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] OV02C10: image upside down in kernel 6.16
       [not found] <7d38cf46-670e-462e-b7c2-78f9aaa9eb43@runbox.com>
@ 2025-08-08  9:03 ` Frederic Stuyk
  2025-08-08  9:27   ` Bryan O'Donoghue
  0 siblings, 1 reply; 4+ messages in thread
From: Frederic Stuyk @ 2025-08-08  9:03 UTC (permalink / raw)
  To: hansg; +Cc: bod, mchehab, linux-media, linux-kernel

Hello,

I'm using the OV02C10 camera sensor on a system running Linux kernel 
6.16 (CachyOS, Arch-based).
I assume CachyOS customizations do not affect camera handling.

The sensor is detected and streams video correctly, but the image 
appears upside down by default.
Tested with GNOME Camera, qcam, and Firefox using an online webcam test 
page.

Querying the sensor orientation metadata shows:

     $ v4l2-ctl -d /dev/v4l-subdev6 -C camera_sensor_rotation
     camera_sensor_rotation: 0

This control is read-only and cannot be changed.

This suggests that either the driver incorrectly reports the orientation 
as 0, or that the platform is missing a quirk to reflect the actual 
physical mounting of the sensor.

I’d be happy to provide more details (e.g., logs, info...) if needed.

Here is some information about my system:

     Vendor:      LENOVO
     Product:     ThinkBook 13x G4 IMH (model: 21KR)
     BIOS:        MTCN51WW
     Kernel:      6.16.0-5-cachyos
     Arch:        x86_64

I’m reporting this to you as the driver maintainer. Please let me know 
if I should follow a different process — this is my first time reporting 
a kernel issue.

Note: Hans, we briefly exchanged emails on March 24th regarding early 
testing of this driver (as Kernel patch), and the same orientation issue 
was already visible at that time.

Best regards,
Frédéric

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] OV02C10: image upside down in kernel 6.16
  2025-08-08  9:03 ` [BUG] OV02C10: image upside down in kernel 6.16 Frederic Stuyk
@ 2025-08-08  9:27   ` Bryan O'Donoghue
  2025-08-08  9:33     ` Bryan O'Donoghue
  0 siblings, 1 reply; 4+ messages in thread
From: Bryan O'Donoghue @ 2025-08-08  9:27 UTC (permalink / raw)
  To: Frederic Stuyk, hansg; +Cc: mchehab, linux-media, linux-kernel

On 08/08/2025 10:03, Frederic Stuyk wrote:
> Querying the sensor orientation metadata shows:
> 
>       $ v4l2-ctl -d /dev/v4l-subdev6 -C camera_sensor_rotation
>       camera_sensor_rotation: 0
> 
> This control is read-only and cannot be changed.

Register is defined but not used.

deckard$ grep ROT drivers/media/i2c/ov02c10.c
#define OV02C10_ROTATE_CONTROL		CCI_REG8(0x3820)
#define OV02C10_CONFIG_ROTATE		0x18

::set_ctrl()
case V4L2_CID_HFLIP:
case V4L2_CID_VFLIP:
cci_write(ov02c10->regmap, OV02C10_ROTATE_CONTROL,
           ov02c10->hflip->val | ov02c10->vflip->val << 1, &ret);

::init_controls()

ov02c10->hflip = v4l2_ctrl_new_std(ctrl_hdlr, &ov02c10_ctrl_ops,
                                    V4L2_CID_HFLIP, 0, 1, 1, 0);
if (ov02e10->hflip)
         ov02e10->hflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;

ov02c10->vflip = v4l2_ctrl_new_std(ctrl_hdlr, &ov02c10_ctrl_ops,
                                    V4L2_CID_VFLIP, 0, 1, 1, 0);
if (ov02c10->vflip)
         ov02c10->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;

Something like that should work.

I think Hans said the ACPI tables provide the orientation for the sensor.

---
bod

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] OV02C10: image upside down in kernel 6.16
  2025-08-08  9:27   ` Bryan O'Donoghue
@ 2025-08-08  9:33     ` Bryan O'Donoghue
  2025-08-08 14:49       ` Frederic Stuyk
  0 siblings, 1 reply; 4+ messages in thread
From: Bryan O'Donoghue @ 2025-08-08  9:33 UTC (permalink / raw)
  To: Frederic Stuyk, hansg; +Cc: mchehab, linux-media, linux-kernel

On 08/08/2025 10:27, Bryan O'Donoghue wrote:
> On 08/08/2025 10:03, Frederic Stuyk wrote:
>> Querying the sensor orientation metadata shows:
>>
>>       $ v4l2-ctl -d /dev/v4l-subdev6 -C camera_sensor_rotation
>>       camera_sensor_rotation: 0
>>
>> This control is read-only and cannot be changed.
> 
> Register is defined but not used.
> 
> deckard$ grep ROT drivers/media/i2c/ov02c10.c
> #define OV02C10_ROTATE_CONTROL        CCI_REG8(0x3820)
> #define OV02C10_CONFIG_ROTATE        0x18
> 
> ::set_ctrl()
> case V4L2_CID_HFLIP:
> case V4L2_CID_VFLIP:
> cci_write(ov02c10->regmap, OV02C10_ROTATE_CONTROL,
>            ov02c10->hflip->val | ov02c10->vflip->val << 1, &ret);
> 
> ::init_controls()
> 
> ov02c10->hflip = v4l2_ctrl_new_std(ctrl_hdlr, &ov02c10_ctrl_ops,
>                                     V4L2_CID_HFLIP, 0, 1, 1, 0);
> if (ov02e10->hflip)
>          ov02e10->hflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
> 
> ov02c10->vflip = v4l2_ctrl_new_std(ctrl_hdlr, &ov02c10_ctrl_ops,
>                                     V4L2_CID_VFLIP, 0, 1, 1, 0);
> if (ov02c10->vflip)
>          ov02c10->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
> 
> Something like that should work.
> 
> I think Hans said the ACPI tables provide the orientation for the sensor.
> 
> ---
> bod

0x3820: default 0xa0

bit5: vflip_blc_0
bit4: vflip_0
bit3: hmirror_0
bit2: hbin4_0
bit1: hbin2_0
bit0: vbinf_0

So you want to set bit3 = 0x08

---
bod

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] OV02C10: image upside down in kernel 6.16
  2025-08-08  9:33     ` Bryan O'Donoghue
@ 2025-08-08 14:49       ` Frederic Stuyk
  0 siblings, 0 replies; 4+ messages in thread
From: Frederic Stuyk @ 2025-08-08 14:49 UTC (permalink / raw)
  To: Bryan O'Donoghue, hansg; +Cc: mchehab, linux-media, linux-kernel

Hi Bryan,

Based on your answer below, I tested the following minimal patch on 
kernel 6.16 and confirmed it fixes the image orientation on my laptop 
(Lenovo ThinkBook 13x G4 IMH):

--- a/drivers/media/i2c/ov02c10.c
+++ b/drivers/media/i2c/ov02c10.c
@@ -107,7 +107,7 @@ static const struct reg_sequence 
sensor_1928x1092_30fps_setting[] = {
      {0x3816, 0x01},
      {0x3817, 0x01},

-    {0x3820, 0xb0},
+    {0x3820, 0xa8},
      {0x3821, 0x00},
      {0x3822, 0x80},
      {0x3823, 0x08},


Tested ok with gnome camera, qcam & firefox.

Would it make sense to add a quirk specific to this laptop model?

Also, the image appears heavily blue-ish under normal lighting 
conditions, regardless of the application used. It's a different topic, 
but I thought it was worth mentioning.

Let me know if there's anything else I can try or information to provide.

Best regards,
Frederic




On 08/08/2025 11:33, Bryan O'Donoghue wrote:
> On 08/08/2025 10:27, Bryan O'Donoghue wrote:
>> On 08/08/2025 10:03, Frederic Stuyk wrote:
>>> Querying the sensor orientation metadata shows:
>>>
>>>       $ v4l2-ctl -d /dev/v4l-subdev6 -C camera_sensor_rotation
>>>       camera_sensor_rotation: 0
>>>
>>> This control is read-only and cannot be changed.
>>
>> Register is defined but not used.
>>
>> deckard$ grep ROT drivers/media/i2c/ov02c10.c
>> #define OV02C10_ROTATE_CONTROL        CCI_REG8(0x3820)
>> #define OV02C10_CONFIG_ROTATE        0x18
>>
>> ::set_ctrl()
>> case V4L2_CID_HFLIP:
>> case V4L2_CID_VFLIP:
>> cci_write(ov02c10->regmap, OV02C10_ROTATE_CONTROL,
>>            ov02c10->hflip->val | ov02c10->vflip->val << 1, &ret);
>>
>> ::init_controls()
>>
>> ov02c10->hflip = v4l2_ctrl_new_std(ctrl_hdlr, &ov02c10_ctrl_ops,
>>                                     V4L2_CID_HFLIP, 0, 1, 1, 0);
>> if (ov02e10->hflip)
>>          ov02e10->hflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
>>
>> ov02c10->vflip = v4l2_ctrl_new_std(ctrl_hdlr, &ov02c10_ctrl_ops,
>>                                     V4L2_CID_VFLIP, 0, 1, 1, 0);
>> if (ov02c10->vflip)
>>          ov02c10->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
>>
>> Something like that should work.
>>
>> I think Hans said the ACPI tables provide the orientation for the 
>> sensor.
>>
>> ---
>> bod
>
> 0x3820: default 0xa0
>
> bit5: vflip_blc_0
> bit4: vflip_0
> bit3: hmirror_0
> bit2: hbin4_0
> bit1: hbin2_0
> bit0: vbinf_0
>
> So you want to set bit3 = 0x08
>
> ---
> bod


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-08 14:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <7d38cf46-670e-462e-b7c2-78f9aaa9eb43@runbox.com>
2025-08-08  9:03 ` [BUG] OV02C10: image upside down in kernel 6.16 Frederic Stuyk
2025-08-08  9:27   ` Bryan O'Donoghue
2025-08-08  9:33     ` Bryan O'Donoghue
2025-08-08 14:49       ` Frederic Stuyk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).