Re: [PATCH v2 1/8] media: v4l: ctrls: add a control for flash/strobe duration

From: Sakari Ailus
Date: Tue Mar 18 2025 - 09:28:31 EST


Hi Richard,

On Fri, Mar 14, 2025 at 05:08:16PM +0100, Richard Leitner wrote:
> Hi Sakari,
>
> On Fri, Mar 14, 2025 at 01:34:07PM +0000, Sakari Ailus wrote:
> > Hi Richard,
> >
> > On Fri, Mar 14, 2025 at 11:25:09AM +0100, Richard Leitner wrote:
> > > On Fri, Mar 14, 2025 at 09:20:23AM +0000, Sakari Ailus wrote:
> [...]
> > > > On Fri, Mar 14, 2025 at 09:49:55AM +0100, Richard Leitner wrote:
> > > > > Add a control V4L2_CID_FLASH_DURATION to set the duration of a
> > > > > flash/strobe pulse. This is different to the V4L2_CID_FLASH_TIMEOUT
> > > > > control, as the timeout defines a limit after which the flash is
> > > > > "forcefully" turned off again.
> > > > >
> > > > > On the other hand the new V4L2_CID_FLASH_DURATION is the desired length
> > > > > of the flash/strobe pulse
> > > >
> > > > What's the actual difference between the two? To me they appear the same,
> > > > just expressed in a different way.
> > >
> > > According to FLASH_TIMEOUT documentation:
> > >
> > > Hardware timeout for flash. The flash strobe is stopped after this
> > > period of time has passed from the start of the strobe. [1]
> > >
> > > This is a little bit unspecific, but as also discussed with Dave [2]
> > > according to the documentation of V4L2_FLASH_FAULT_TIMEOUT it seems to
> > > be targeted at providing a "real timeout" control, not settings the
> > > desired duration:
> > >
> > > The flash strobe was still on when the timeout set by the user
> > > --- V4L2_CID_FLASH_TIMEOUT control --- has expired. Not all flash
> > > controllers may set this in all such conditions. [1]
> > >
> > > If I understood that wrong, I'm also happy to use FLASH_TIMEOUT for this
> > > use-case. But tbh I think FLASH_DURATION would be more specific.
> > >
> > > As this still seems unclear: Should the documentation be
> > > changed/rewritten if we stick with the FLASH_DURATION approach?
> > >
> > > [1] https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-flash.html
> > > [2] https://lore.kernel.org/lkml/CAPY8ntB8i4OyUWAL8k899yUd5QsRifJXiOfWXKceGQ7TNZ4OUw@xxxxxxxxxxxxxx/
> >
> > Right, I think I can see what you're after.
> >
> > How does the sensor determine when to start the strobe, i.e. on which frame
> > and which part of the exposure of that frame?
>
> In general I think it's not part of V4L2_CID_FLASH_DURATION to take any
> assumptions on that, as that's sensor/flash specific IMHO.
>
> In case of the ov9282 sensor driver (which is also part of this series)
> the strobe is started synchronously with the exposure on each frame
> start.
> Being even more specific on the ov9292, the sensor also offers the
> possibility to shift that strobe start in in either direction using a
> register. Implementing this "flash shift" (as it's called in the sensors
> datasheet) is currently under test on my side. I will likely send a
> series for that in the coming weeks.

Ok, so you get a single frame exposed with a flash when you start
streaming, is that correct?

>
> > > > > Signed-off-by: Richard Leitner <richard.leitner@xxxxxxxxx>
> > > > > ---
> > > > > drivers/media/v4l2-core/v4l2-ctrls-defs.c | 1 +
> > > > > include/uapi/linux/v4l2-controls.h | 1 +
> > > > > 2 files changed, 2 insertions(+)
> [...]
> >

--
Regards,

Sakari Ailus