From: Aliaksandr Smirnou <asmirnou@pinefeat.co.uk>
To: kieran.bingham@ideasonboard.com
Cc: asmirnou@pinefeat.co.uk, conor+dt@kernel.org,
devicetree@vger.kernel.org, hverkuil@xs4all.nl,
jacopo.mondi@ideasonboard.com, krzk+dt@kernel.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
mchehab@kernel.org, robh@kernel.org
Subject: Re: [PATCH v5 2/2] media: i2c: Pinefeat cef168 lens control board driver
Date: Mon, 6 Oct 2025 21:46:35 +0100 [thread overview]
Message-ID: <20251006204635.17501-1-asmirnou@pinefeat.co.uk> (raw)
In-Reply-To: <175969431602.1246375.2429212814766056041@ping.linuxembedded.co.uk>
On Sun, 05 Oct 2025 20:58:36 +0100, Kieran Bingham wrote:
> > The focus distance reported by the lens is the distance between the
> > camera's sensor and the subject currently in focus, measured in meters.
> > It correlates with the focus position - higher positions correspond to
> > greater distances - but the relationship is non-linear.
>
> What's measuring this distance ? Something in the lens, rather than the
> sensor?
It doesn't actively measure the distance. The lens contains a distance
encoder that maps motor steps to an approximate focus distance, calibrated
for that lens model/type at the factory.
> > the Linux V4L2 API does not allow the minimum and
> > maximum values to be changed while the driver is running.
>
> Have you tried with __v4l2_ctrl_modify_range() ?
>
> We should make sure this also generates an event that libcamera can
> subscribe to to make sure it knows there's been an update.
Thanks. The unlocked variant of this function works. Previously I tried
its locked variant that led to locking issues, that's why I though it
is not possible.
I'll use that approach and get rid of the custom control.
> I see, so a user interaction can update it too. Does the driver have to
> poll to get this update? Or does it just find out on the next read ?
The driver reads all lens data at once, so it knows the focus range on
the next read.
I hope it is ok to modify the focus range straight in g_volatile_ctrl,
when the focus value is requested and read from the lens.
> We're also pushing for a core control for this I think. That's something
> we 'need' in libcamera globally for all cameras. Unfortunately I can't
> point you at an existing control yet ;-(
Good to know. Then for now, I'll keep the custom control for the lens ID,
and switch to a common one once it becomes available.
One suggestion was to use the device name to store the lens ID, but I
couldn't find a way to modify the name after probe, since the lens might
be disconnected and replaced with another. Also, for I2C devices, the
device name appears to be assigned by the kernel.
> I'll see if I can find time to order a kit, and get a compatible lens. I
> have a Nikon DSLR though so I don't have lenses to match this yet :-(
We will be happy to provide a product sample for free, just let us know
the delivery address by email.
prev parent reply other threads:[~2025-10-06 20:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-05 13:32 [PATCH v5 0/2] Pinefeat cef168 lens control board driver Aliaksandr Smirnou
2025-10-05 13:32 ` [PATCH v5 1/2] dt-bindings: Pinefeat cef168 lens control board Aliaksandr Smirnou
2025-10-07 19:39 ` Conor Dooley
2025-10-05 13:32 ` [PATCH v5 2/2] media: i2c: Pinefeat cef168 lens control board driver Aliaksandr Smirnou
2025-10-05 14:32 ` Kieran Bingham
2025-10-05 18:00 ` Aliaksandr Smirnou
2025-10-05 19:58 ` Kieran Bingham
2025-10-06 20:46 ` Aliaksandr Smirnou [this message]
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=20251006204635.17501-1-asmirnou@pinefeat.co.uk \
--to=asmirnou@pinefeat.co.uk \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hverkuil@xs4all.nl \
--cc=jacopo.mondi@ideasonboard.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=robh@kernel.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