Message ID | 20250828-flash-support-v1-0-4c5dc674a05b@emfend.at |
---|---|
Headers | show |
Series |
|
Related | show |
Quoting Matthias Fend (2025-08-28 14:09:37) > This series brings initial support for v4l2 flash devices. > > With these patches, v4l2 flash devices can be controlled by applications > via libcamera controls. Applications therefore only require one API and do > not have to worry about details such as finding the appropriate v4l2 flash > device. > > The controls are currently quite transparent and no advanced flash > sequences (pre-flash, AGC precorrection, etc.) are supported. > > This functionality should be easy to integrate into the various pipeline > handlers and is implemented as an example for the RKSIP1 pipeline. Just to bridge the kernel side and libcamera side - there's a current series in progress that could impact this one : - https://lore.kernel.org/all/20250901-ov9282-flash-strobe-v7-0-d58d5a694afc@linux.dev/ This series adds two new v4l2 controls: - V4L2_CID_FLASH_DURATION: "Strobe duration": This control enables setting a desired flash/strobe length/duration in µs. - V4L2_CID_FLASH_HW_STROBE_SIGNAL: "Hardware strobe signal": This control enables the hardware strobe output signal of a v4l2 device. As a first user of these new controls add basic flash/strobe support for ov9282 sensors using their "hardware strobe output". The duration calculation is only interpolated from various measurements, as no documentation was found. Further flash/strobe-related controls as well as a migration to v4l2-cci helpers for ov9282 will likely be implemented in future series. All register addresses/values are based on the OV9281 datasheet v1.53 (january 2019). This series was tested using an ov9281 VisionComponents camera module. Signed-off-by: Richard Leitner <richard.leitner@linux.dev> that might add parts that would be relevant in this series. -- Kieran > > Signed-off-by: Matthias Fend <matthias.fend@emfend.at> > --- > Matthias Fend (5): > libcamera: control_ids_draft: Add flash controls > libcamera: Add support for camera flash devices > Documentation: Add flash driver requirements > libcamera: Add flash helpers for pipeline handlers > rkisp1: Add support for camera flash devices > > Documentation/documentation-contents.rst | 1 + > Documentation/flash_driver_requirements.rst | 40 +++++ > Documentation/index.rst | 1 + > Documentation/meson.build | 1 + > include/libcamera/internal/camera_flash.h | 75 ++++++++ > include/libcamera/internal/camera_sensor.h | 2 + > include/libcamera/internal/flash_control.h | 23 +++ > src/libcamera/camera_flash.cpp | 248 ++++++++++++++++++++++++++ > src/libcamera/control_ids_draft.yaml | 69 +++++++ > src/libcamera/flash_control.cpp | 103 +++++++++++ > src/libcamera/meson.build | 2 + > src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 + > src/libcamera/sensor/camera_sensor_legacy.cpp | 13 ++ > src/libcamera/sensor/camera_sensor_raw.cpp | 13 ++ > 14 files changed, 596 insertions(+) > --- > base-commit: d54e5537ca0909339bb6950f3a565c9077406a3c > change-id: 20250827-flash-support-dd67b41a82b9 > > Best regards, > -- > Matthias Fend <matthias.fend@emfend.at> >
Hi Kieran, On Wed, Sep 03, 2025 at 12:05:18PM +0100, Kieran Bingham wrote: > Quoting Matthias Fend (2025-08-28 14:09:37) > > This series brings initial support for v4l2 flash devices. > > > > With these patches, v4l2 flash devices can be controlled by applications > > via libcamera controls. Applications therefore only require one API and do > > not have to worry about details such as finding the appropriate v4l2 flash > > device. > > > > The controls are currently quite transparent and no advanced flash > > sequences (pre-flash, AGC precorrection, etc.) are supported. > > > > This functionality should be easy to integrate into the various pipeline > > handlers and is implemented as an example for the RKSIP1 pipeline. > > Just to bridge the kernel side and libcamera side - there's a current > series in progress that could impact this one : Thanks for setting up this link between kernel and libcamera. I wasn't aware there's simultaneous work on flash control in libcamera. But of course that's great to see :) Kieran, Matthias, please feel free to share your thoughts/feedback on the kernel series. Apart from this series I have a few more flash/strobe related patches in my downstream tree, which I will send as soon as this one got merged. One thing that might me interesting to you is the strobe shift functionality. It enables shifting the point of time the strobe starts relatively (before and after) the exposure start. regards;rl P.S.: If the libcamera-devel mailing list had been included in the public-inbox at https://lore.kernel.org/, I likely would have found it myself. Perhaps that's a possibility for the future? ;) > > - https://lore.kernel.org/all/20250901-ov9282-flash-strobe-v7-0-d58d5a694afc@linux.dev/ > > This series adds two new v4l2 controls: > - V4L2_CID_FLASH_DURATION: "Strobe duration": This control enables > setting a desired flash/strobe length/duration in µs. > - V4L2_CID_FLASH_HW_STROBE_SIGNAL: "Hardware strobe signal": This > control enables the hardware strobe output signal of a v4l2 device. > > As a first user of these new controls add basic flash/strobe support > for ov9282 sensors using their "hardware strobe output". The duration > calculation is only interpolated from various measurements, as no > documentation was found. > > Further flash/strobe-related controls as well as a migration to v4l2-cci > helpers for ov9282 will likely be implemented in future series. > > All register addresses/values are based on the OV9281 datasheet v1.53 > (january 2019). This series was tested using an ov9281 VisionComponents > camera module. > > Signed-off-by: Richard Leitner <richard.leitner@linux.dev> > > that might add parts that would be relevant in this series. > > -- > Kieran > > > > > > Signed-off-by: Matthias Fend <matthias.fend@emfend.at> > > --- > > Matthias Fend (5): > > libcamera: control_ids_draft: Add flash controls > > libcamera: Add support for camera flash devices > > Documentation: Add flash driver requirements > > libcamera: Add flash helpers for pipeline handlers > > rkisp1: Add support for camera flash devices > > > > Documentation/documentation-contents.rst | 1 + > > Documentation/flash_driver_requirements.rst | 40 +++++ > > Documentation/index.rst | 1 + > > Documentation/meson.build | 1 + > > include/libcamera/internal/camera_flash.h | 75 ++++++++ > > include/libcamera/internal/camera_sensor.h | 2 + > > include/libcamera/internal/flash_control.h | 23 +++ > > src/libcamera/camera_flash.cpp | 248 ++++++++++++++++++++++++++ > > src/libcamera/control_ids_draft.yaml | 69 +++++++ > > src/libcamera/flash_control.cpp | 103 +++++++++++ > > src/libcamera/meson.build | 2 + > > src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 + > > src/libcamera/sensor/camera_sensor_legacy.cpp | 13 ++ > > src/libcamera/sensor/camera_sensor_raw.cpp | 13 ++ > > 14 files changed, 596 insertions(+) > > --- > > base-commit: d54e5537ca0909339bb6950f3a565c9077406a3c > > change-id: 20250827-flash-support-dd67b41a82b9 > > > > Best regards, > > -- > > Matthias Fend <matthias.fend@emfend.at> > >
Hi all, Am 03.09.2025 um 13:50 schrieb Richard Leitner: > Hi Kieran, > > On Wed, Sep 03, 2025 at 12:05:18PM +0100, Kieran Bingham wrote: >> Quoting Matthias Fend (2025-08-28 14:09:37) >>> This series brings initial support for v4l2 flash devices. >>> >>> With these patches, v4l2 flash devices can be controlled by applications >>> via libcamera controls. Applications therefore only require one API and do >>> not have to worry about details such as finding the appropriate v4l2 flash >>> device. >>> >>> The controls are currently quite transparent and no advanced flash >>> sequences (pre-flash, AGC precorrection, etc.) are supported. >>> >>> This functionality should be easy to integrate into the various pipeline >>> handlers and is implemented as an example for the RKSIP1 pipeline. >> >> Just to bridge the kernel side and libcamera side - there's a current >> series in progress that could impact this one : > > Thanks for setting up this link between kernel and libcamera. I wasn't > aware there's simultaneous work on flash control in libcamera. But of > course that's great to see :) > > Kieran, Matthias, please feel free to share your thoughts/feedback on > the kernel series. > > Apart from this series I have a few more flash/strobe related patches > in my downstream tree, which I will send as soon as this one got > merged. One thing that might me interesting to you is the strobe shift > functionality. It enables shifting the point of time the strobe > starts relatively (before and after) the exposure start. In general, I don't see any major problem with adding further controls here. But what is currently not supported is simply adding flash-specific v4l2 controls to a camera sensor driver. The current implementation searches for a MEDIA_ENT_F_FLASH subdevice. This means that only the V4L2_CID_FLASH_* controls offered by such corresponding subdevices are used. Currently, I am only aware of three drivers that use V4L2_CID_FLASH_* controls without being a MEDIA_ENT_F_FLASH subdevice: media/usb/gspca/sn9c20x.c media/i2c/vd55g1.c media/i2c/vd56g3.c The ov9282 could now become another one. If a sensor also has some kind of flash controller integrated, I see two possibilities: a) The driver creates two subdevices (MEDIA_ENT_F_CAM_SENSOR and MEDIA_ENT_F_FLASH). b) libcamera implements a special solution and also searches the sensors for potential flash controls. Instead of a minimum requirement for the implemented controls, the controls that are found would simply be offered to the user. If a real flash controller is also present, the controls of both subdevices are combined and then assigned accordingly. The question is what to do if a control is offered by both subdevices. It's probably not difficult to guess that I would prefer option a) ;) Best regards ~Matthias > > regards;rl > > P.S.: If the libcamera-devel mailing list had been included in the > public-inbox at https://lore.kernel.org/, I likely would have found it > myself. Perhaps that's a possibility for the future? ;) > >> >> - https://lore.kernel.org/all/20250901-ov9282-flash-strobe-v7-0-d58d5a694afc@linux.dev/ >> >> This series adds two new v4l2 controls: >> - V4L2_CID_FLASH_DURATION: "Strobe duration": This control enables >> setting a desired flash/strobe length/duration in µs. >> - V4L2_CID_FLASH_HW_STROBE_SIGNAL: "Hardware strobe signal": This >> control enables the hardware strobe output signal of a v4l2 device. >> >> As a first user of these new controls add basic flash/strobe support >> for ov9282 sensors using their "hardware strobe output". The duration >> calculation is only interpolated from various measurements, as no >> documentation was found. >> >> Further flash/strobe-related controls as well as a migration to v4l2-cci >> helpers for ov9282 will likely be implemented in future series. >> >> All register addresses/values are based on the OV9281 datasheet v1.53 >> (january 2019). This series was tested using an ov9281 VisionComponents >> camera module. >> >> Signed-off-by: Richard Leitner <richard.leitner@linux.dev> >> >> that might add parts that would be relevant in this series. >> >> -- >> Kieran >> >> >>> >>> Signed-off-by: Matthias Fend <matthias.fend@emfend.at> >>> --- >>> Matthias Fend (5): >>> libcamera: control_ids_draft: Add flash controls >>> libcamera: Add support for camera flash devices >>> Documentation: Add flash driver requirements >>> libcamera: Add flash helpers for pipeline handlers >>> rkisp1: Add support for camera flash devices >>> >>> Documentation/documentation-contents.rst | 1 + >>> Documentation/flash_driver_requirements.rst | 40 +++++ >>> Documentation/index.rst | 1 + >>> Documentation/meson.build | 1 + >>> include/libcamera/internal/camera_flash.h | 75 ++++++++ >>> include/libcamera/internal/camera_sensor.h | 2 + >>> include/libcamera/internal/flash_control.h | 23 +++ >>> src/libcamera/camera_flash.cpp | 248 ++++++++++++++++++++++++++ >>> src/libcamera/control_ids_draft.yaml | 69 +++++++ >>> src/libcamera/flash_control.cpp | 103 +++++++++++ >>> src/libcamera/meson.build | 2 + >>> src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 + >>> src/libcamera/sensor/camera_sensor_legacy.cpp | 13 ++ >>> src/libcamera/sensor/camera_sensor_raw.cpp | 13 ++ >>> 14 files changed, 596 insertions(+) >>> --- >>> base-commit: d54e5537ca0909339bb6950f3a565c9077406a3c >>> change-id: 20250827-flash-support-dd67b41a82b9 >>> >>> Best regards, >>> -- >>> Matthias Fend <matthias.fend@emfend.at> >>>
Hi Matthias, looping in Sakari, Laurent and Dave as they are the main reviewers of the kernel series. On Thu, Sep 04, 2025 at 08:42:28AM +0200, Matthias Fend wrote: > Hi all, > > Am 03.09.2025 um 13:50 schrieb Richard Leitner: > > Hi Kieran, > > > > On Wed, Sep 03, 2025 at 12:05:18PM +0100, Kieran Bingham wrote: > > > Quoting Matthias Fend (2025-08-28 14:09:37) > > > > This series brings initial support for v4l2 flash devices. > > > > > > > > With these patches, v4l2 flash devices can be controlled by applications > > > > via libcamera controls. Applications therefore only require one API and do > > > > not have to worry about details such as finding the appropriate v4l2 flash > > > > device. > > > > > > > > The controls are currently quite transparent and no advanced flash > > > > sequences (pre-flash, AGC precorrection, etc.) are supported. > > > > > > > > This functionality should be easy to integrate into the various pipeline > > > > handlers and is implemented as an example for the RKSIP1 pipeline. > > > > > > Just to bridge the kernel side and libcamera side - there's a current > > > series in progress that could impact this one : > > > > Thanks for setting up this link between kernel and libcamera. I wasn't > > aware there's simultaneous work on flash control in libcamera. But of > > course that's great to see :) > > > > Kieran, Matthias, please feel free to share your thoughts/feedback on > > the kernel series. > > > > Apart from this series I have a few more flash/strobe related patches > > in my downstream tree, which I will send as soon as this one got > > merged. One thing that might me interesting to you is the strobe shift > > functionality. It enables shifting the point of time the strobe > > starts relatively (before and after) the exposure start. > > In general, I don't see any major problem with adding further controls here. > But what is currently not supported is simply adding flash-specific v4l2 > controls to a camera sensor driver. > > The current implementation searches for a MEDIA_ENT_F_FLASH subdevice. This > means that only the V4L2_CID_FLASH_* controls offered by such corresponding > subdevices are used. > > Currently, I am only aware of three drivers that use V4L2_CID_FLASH_* > controls without being a MEDIA_ENT_F_FLASH subdevice: > media/usb/gspca/sn9c20x.c > media/i2c/vd55g1.c > media/i2c/vd56g3.c > > The ov9282 could now become another one. > > If a sensor also has some kind of flash controller integrated, I see two > possibilities: > > a) The driver creates two subdevices (MEDIA_ENT_F_CAM_SENSOR and > MEDIA_ENT_F_FLASH). > > b) libcamera implements a special solution and also searches the sensors for > potential flash controls. Instead of a minimum requirement for the > implemented controls, the controls that are found would simply be offered to > the user. If a real flash controller is also present, the controls of both > subdevices are combined and then assigned accordingly. The question is what > to do if a control is offered by both subdevices. > > It's probably not difficult to guess that I would prefer option a) ;) Thanks for your feedback! I definitely got your point, but I'm uncertain whether a MEDIA_ENT_F_FLASH subdevice is the most appropriate "container" for this flash/strobe case. The ov9282 sensor provides only a configurable strobe signal output. It doesn't contain an actual flash/LED driver or light source. It's essentially a "strobe/flash signal source" rather than a "flash device". Therefore from a system perspective, the sensor's strobe output would typically connect to an external flash controller or LED driver. The sensor itself doesn't control the actual light emission, it just provides the signal. So this raises some questions to me: 1) Should a "strobe signal source" be contained in MEDIA_ENT_F_CAM_SENSOR or MEDIA_ENT_F_FLASH? 2) Would it make sense to create a separate subdevice type for such "strobe signal sources"? 3) Are there any ohter subdevices that provide similar "signal generation" functionality (for e.g. strobe/flash, focus, mechanical shutter, stabilizer, ...)? Understanding how these are or would be classified could provide some common ground for our case. I may be missing some important libcamera context here, as I'm no user of it (yet?)... sorry for that ;) regards;rl > > Best regards > ~Matthias > > > > > regards;rl > > > > P.S.: If the libcamera-devel mailing list had been included in the > > public-inbox at https://lore.kernel.org/, I likely would have found it > > myself. Perhaps that's a possibility for the future? ;) > > > > > > > > - https://lore.kernel.org/all/20250901-ov9282-flash-strobe-v7-0-d58d5a694afc@linux.dev/ > > > > > > This series adds two new v4l2 controls: > > > - V4L2_CID_FLASH_DURATION: "Strobe duration": This control enables > > > setting a desired flash/strobe length/duration in µs. > > > - V4L2_CID_FLASH_HW_STROBE_SIGNAL: "Hardware strobe signal": This > > > control enables the hardware strobe output signal of a v4l2 device. > > > > > > As a first user of these new controls add basic flash/strobe support > > > for ov9282 sensors using their "hardware strobe output". The duration > > > calculation is only interpolated from various measurements, as no > > > documentation was found. > > > > > > Further flash/strobe-related controls as well as a migration to v4l2-cci > > > helpers for ov9282 will likely be implemented in future series. > > > > > > All register addresses/values are based on the OV9281 datasheet v1.53 > > > (january 2019). This series was tested using an ov9281 VisionComponents > > > camera module. > > > > > > Signed-off-by: Richard Leitner <richard.leitner@linux.dev> > > > > > > that might add parts that would be relevant in this series. > > > > > > -- > > > Kieran > > > > > > > > > > > > > > Signed-off-by: Matthias Fend <matthias.fend@emfend.at> > > > > --- > > > > Matthias Fend (5): > > > > libcamera: control_ids_draft: Add flash controls > > > > libcamera: Add support for camera flash devices > > > > Documentation: Add flash driver requirements > > > > libcamera: Add flash helpers for pipeline handlers > > > > rkisp1: Add support for camera flash devices > > > > > > > > Documentation/documentation-contents.rst | 1 + > > > > Documentation/flash_driver_requirements.rst | 40 +++++ > > > > Documentation/index.rst | 1 + > > > > Documentation/meson.build | 1 + > > > > include/libcamera/internal/camera_flash.h | 75 ++++++++ > > > > include/libcamera/internal/camera_sensor.h | 2 + > > > > include/libcamera/internal/flash_control.h | 23 +++ > > > > src/libcamera/camera_flash.cpp | 248 ++++++++++++++++++++++++++ > > > > src/libcamera/control_ids_draft.yaml | 69 +++++++ > > > > src/libcamera/flash_control.cpp | 103 +++++++++++ > > > > src/libcamera/meson.build | 2 + > > > > src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 + > > > > src/libcamera/sensor/camera_sensor_legacy.cpp | 13 ++ > > > > src/libcamera/sensor/camera_sensor_raw.cpp | 13 ++ > > > > 14 files changed, 596 insertions(+) > > > > --- > > > > base-commit: d54e5537ca0909339bb6950f3a565c9077406a3c > > > > change-id: 20250827-flash-support-dd67b41a82b9 > > > > > > > > Best regards, > > > > -- > > > > Matthias Fend <matthias.fend@emfend.at> > > > > >
Hi Matthias and Richard On Thu, 4 Sept 2025 at 09:51, Richard Leitner <richard.leitner@linux.dev> wrote: > > Hi Matthias, > > looping in Sakari, Laurent and Dave as they are the main reviewers of the > kernel series. > > On Thu, Sep 04, 2025 at 08:42:28AM +0200, Matthias Fend wrote: > > Hi all, > > > > Am 03.09.2025 um 13:50 schrieb Richard Leitner: > > > Hi Kieran, > > > > > > On Wed, Sep 03, 2025 at 12:05:18PM +0100, Kieran Bingham wrote: > > > > Quoting Matthias Fend (2025-08-28 14:09:37) > > > > > This series brings initial support for v4l2 flash devices. > > > > > > > > > > With these patches, v4l2 flash devices can be controlled by applications > > > > > via libcamera controls. Applications therefore only require one API and do > > > > > not have to worry about details such as finding the appropriate v4l2 flash > > > > > device. > > > > > > > > > > The controls are currently quite transparent and no advanced flash > > > > > sequences (pre-flash, AGC precorrection, etc.) are supported. > > > > > > > > > > This functionality should be easy to integrate into the various pipeline > > > > > handlers and is implemented as an example for the RKSIP1 pipeline. > > > > > > > > Just to bridge the kernel side and libcamera side - there's a current > > > > series in progress that could impact this one : > > > > > > Thanks for setting up this link between kernel and libcamera. I wasn't > > > aware there's simultaneous work on flash control in libcamera. But of > > > course that's great to see :) > > > > > > Kieran, Matthias, please feel free to share your thoughts/feedback on > > > the kernel series. > > > > > > Apart from this series I have a few more flash/strobe related patches > > > in my downstream tree, which I will send as soon as this one got > > > merged. One thing that might me interesting to you is the strobe shift > > > functionality. It enables shifting the point of time the strobe > > > starts relatively (before and after) the exposure start. > > > > In general, I don't see any major problem with adding further controls here. > > But what is currently not supported is simply adding flash-specific v4l2 > > controls to a camera sensor driver. > > > > The current implementation searches for a MEDIA_ENT_F_FLASH subdevice. This > > means that only the V4L2_CID_FLASH_* controls offered by such corresponding > > subdevices are used. > > > > Currently, I am only aware of three drivers that use V4L2_CID_FLASH_* > > controls without being a MEDIA_ENT_F_FLASH subdevice: > > media/usb/gspca/sn9c20x.c > > media/i2c/vd55g1.c > > media/i2c/vd56g3.c > > > > The ov9282 could now become another one. > > > > If a sensor also has some kind of flash controller integrated, I see two > > possibilities: > > > > a) The driver creates two subdevices (MEDIA_ENT_F_CAM_SENSOR and > > MEDIA_ENT_F_FLASH). > > > > b) libcamera implements a special solution and also searches the sensors for > > potential flash controls. Instead of a minimum requirement for the > > implemented controls, the controls that are found would simply be offered to > > the user. If a real flash controller is also present, the controls of both > > subdevices are combined and then assigned accordingly. The question is what > > to do if a control is offered by both subdevices. > > > > It's probably not difficult to guess that I would prefer option a) ;) > > Thanks for your feedback! I definitely got your point, but I'm uncertain > whether a MEDIA_ENT_F_FLASH subdevice is the most appropriate "container" > for this flash/strobe case. > > The ov9282 sensor provides only a configurable strobe signal output. > It doesn't contain an actual flash/LED driver or light source. It's > essentially a "strobe/flash signal source" rather than a "flash device". > > Therefore from a system perspective, the sensor's strobe output would > typically connect to an external flash controller or LED driver. The > sensor itself doesn't control the actual light emission, it just provides > the signal. Indeed, the ov9282 patch would correspond to the FlashStrobeSourceExternal mode described in the controls. It is not in itself a flash driver. > So this raises some questions to me: > > 1) Should a "strobe signal source" be contained in MEDIA_ENT_F_CAM_SENSOR > or MEDIA_ENT_F_FLASH? > > 2) Would it make sense to create a separate subdevice type for such > "strobe signal sources"? > > 3) Are there any ohter subdevices that provide similar "signal > generation" functionality (for e.g. strobe/flash, focus, mechanical > shutter, stabilizer, ...)? Understanding how these are or would be > classified could provide some common ground for our case. An external strobe signal source is almost always going to be from the sensor. OV9282 works quite nicely with flashes as it is a global shutter sensor. Rolling shutter sensors have far more complications unless they either: - also have an mechanical shutter so that the array can be treated as having a global reset and readout. - or it's an LED flash that is kept on from at least the start of exposure of the first line to the end of readout of the last line. David and Naush have more experience in the mechanics of synchronising flashes, shutters, and readout than I do, so I'll defer to them for the niggles. Dave > I may be missing some important libcamera context here, as I'm no user > of it (yet?)... sorry for that ;) > > regards;rl > > > > > Best regards > > ~Matthias > > > > > > > > regards;rl > > > > > > P.S.: If the libcamera-devel mailing list had been included in the > > > public-inbox at https://lore.kernel.org/, I likely would have found it > > > myself. Perhaps that's a possibility for the future? ;) > > > > > > > > > > > - https://lore.kernel.org/all/20250901-ov9282-flash-strobe-v7-0-d58d5a694afc@linux.dev/ > > > > > > > > This series adds two new v4l2 controls: > > > > - V4L2_CID_FLASH_DURATION: "Strobe duration": This control enables > > > > setting a desired flash/strobe length/duration in 盜. > > > > - V4L2_CID_FLASH_HW_STROBE_SIGNAL: "Hardware strobe signal": This > > > > control enables the hardware strobe output signal of a v4l2 device. > > > > > > > > As a first user of these new controls add basic flash/strobe support > > > > for ov9282 sensors using their "hardware strobe output". The duration > > > > calculation is only interpolated from various measurements, as no > > > > documentation was found. > > > > > > > > Further flash/strobe-related controls as well as a migration to v4l2-cci > > > > helpers for ov9282 will likely be implemented in future series. > > > > > > > > All register addresses/values are based on the OV9281 datasheet v1.53 > > > > (january 2019). This series was tested using an ov9281 VisionComponents > > > > camera module. > > > > > > > > Signed-off-by: Richard Leitner <richard.leitner@linux.dev> > > > > > > > > that might add parts that would be relevant in this series. > > > > > > > > -- > > > > Kieran > > > > > > > > > > > > > > > > > > Signed-off-by: Matthias Fend <matthias.fend@emfend.at> > > > > > --- > > > > > Matthias Fend (5): > > > > > libcamera: control_ids_draft: Add flash controls > > > > > libcamera: Add support for camera flash devices > > > > > Documentation: Add flash driver requirements > > > > > libcamera: Add flash helpers for pipeline handlers > > > > > rkisp1: Add support for camera flash devices > > > > > > > > > > Documentation/documentation-contents.rst | 1 + > > > > > Documentation/flash_driver_requirements.rst | 40 +++++ > > > > > Documentation/index.rst | 1 + > > > > > Documentation/meson.build | 1 + > > > > > include/libcamera/internal/camera_flash.h | 75 ++++++++ > > > > > include/libcamera/internal/camera_sensor.h | 2 + > > > > > include/libcamera/internal/flash_control.h | 23 +++ > > > > > src/libcamera/camera_flash.cpp | 248 ++++++++++++++++++++++++++ > > > > > src/libcamera/control_ids_draft.yaml | 69 +++++++ > > > > > src/libcamera/flash_control.cpp | 103 +++++++++++ > > > > > src/libcamera/meson.build | 2 + > > > > > src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 + > > > > > src/libcamera/sensor/camera_sensor_legacy.cpp | 13 ++ > > > > > src/libcamera/sensor/camera_sensor_raw.cpp | 13 ++ > > > > > 14 files changed, 596 insertions(+) > > > > > --- > > > > > base-commit: d54e5537ca0909339bb6950f3a565c9077406a3c > > > > > change-id: 20250827-flash-support-dd67b41a82b9 > > > > > > > > > > Best regards, > > > > > -- > > > > > Matthias Fend <matthias.fend@emfend.at> > > > > > > >
On Thu, 4 Sept 2025 at 19:32, Dave Stevenson <dave.stevenson@raspberrypi.com> wrote: > > Hi Matthias and Richard > > On Thu, 4 Sept 2025 at 09:51, Richard Leitner <richard.leitner@linux.dev> wrote: > > > > Hi Matthias, > > > > looping in Sakari, Laurent and Dave as they are the main reviewers of the > > kernel series. > > > > On Thu, Sep 04, 2025 at 08:42:28AM +0200, Matthias Fend wrote: > > > Hi all, > > > > > > Am 03.09.2025 um 13:50 schrieb Richard Leitner: > > > > Hi Kieran, > > > > > > > > On Wed, Sep 03, 2025 at 12:05:18PM +0100, Kieran Bingham wrote: > > > > > Quoting Matthias Fend (2025-08-28 14:09:37) > > > > > > This series brings initial support for v4l2 flash devices. > > > > > > > > > > > > With these patches, v4l2 flash devices can be controlled by applications > > > > > > via libcamera controls. Applications therefore only require one API and do > > > > > > not have to worry about details such as finding the appropriate v4l2 flash > > > > > > device. > > > > > > > > > > > > The controls are currently quite transparent and no advanced flash > > > > > > sequences (pre-flash, AGC precorrection, etc.) are supported. > > > > > > > > > > > > This functionality should be easy to integrate into the various pipeline > > > > > > handlers and is implemented as an example for the RKSIP1 pipeline. > > > > > > > > > > Just to bridge the kernel side and libcamera side - there's a current > > > > > series in progress that could impact this one : > > > > > > > > Thanks for setting up this link between kernel and libcamera. I wasn't > > > > aware there's simultaneous work on flash control in libcamera. But of > > > > course that's great to see :) > > > > > > > > Kieran, Matthias, please feel free to share your thoughts/feedback on > > > > the kernel series. > > > > > > > > Apart from this series I have a few more flash/strobe related patches > > > > in my downstream tree, which I will send as soon as this one got > > > > merged. One thing that might me interesting to you is the strobe shift > > > > functionality. It enables shifting the point of time the strobe > > > > starts relatively (before and after) the exposure start. > > > > > > In general, I don't see any major problem with adding further controls here. > > > But what is currently not supported is simply adding flash-specific v4l2 > > > controls to a camera sensor driver. > > > > > > The current implementation searches for a MEDIA_ENT_F_FLASH subdevice. This > > > means that only the V4L2_CID_FLASH_* controls offered by such corresponding > > > subdevices are used. > > > > > > Currently, I am only aware of three drivers that use V4L2_CID_FLASH_* > > > controls without being a MEDIA_ENT_F_FLASH subdevice: > > > media/usb/gspca/sn9c20x.c > > > media/i2c/vd55g1.c > > > media/i2c/vd56g3.c > > > > > > The ov9282 could now become another one. > > > > > > If a sensor also has some kind of flash controller integrated, I see two > > > possibilities: > > > > > > a) The driver creates two subdevices (MEDIA_ENT_F_CAM_SENSOR and > > > MEDIA_ENT_F_FLASH). > > > > > > b) libcamera implements a special solution and also searches the sensors for > > > potential flash controls. Instead of a minimum requirement for the > > > implemented controls, the controls that are found would simply be offered to > > > the user. If a real flash controller is also present, the controls of both > > > subdevices are combined and then assigned accordingly. The question is what > > > to do if a control is offered by both subdevices. > > > > > > It's probably not difficult to guess that I would prefer option a) ;) > > > > Thanks for your feedback! I definitely got your point, but I'm uncertain > > whether a MEDIA_ENT_F_FLASH subdevice is the most appropriate "container" > > for this flash/strobe case. > > > > The ov9282 sensor provides only a configurable strobe signal output. > > It doesn't contain an actual flash/LED driver or light source. It's > > essentially a "strobe/flash signal source" rather than a "flash device". > > > > Therefore from a system perspective, the sensor's strobe output would > > typically connect to an external flash controller or LED driver. The > > sensor itself doesn't control the actual light emission, it just provides > > the signal. > > Indeed, the ov9282 patch would correspond to the > FlashStrobeSourceExternal mode described in the controls. It is not in > itself a flash driver. > > > So this raises some questions to me: > > > > 1) Should a "strobe signal source" be contained in MEDIA_ENT_F_CAM_SENSOR > > or MEDIA_ENT_F_FLASH? > > > > 2) Would it make sense to create a separate subdevice type for such > > "strobe signal sources"? > > > > 3) Are there any ohter subdevices that provide similar "signal > > generation" functionality (for e.g. strobe/flash, focus, mechanical > > shutter, stabilizer, ...)? Understanding how these are or would be > > classified could provide some common ground for our case. > > An external strobe signal source is almost always going to be from the sensor. > > OV9282 works quite nicely with flashes as it is a global shutter sensor. > > Rolling shutter sensors have far more complications unless they either: > - also have an mechanical shutter so that the array can be treated as > having a global reset and readout. > - or it's an LED flash that is kept on from at least the start of > exposure of the first line to the end of readout of the last line. > > David and Naush have more experience in the mechanics of synchronising > flashes, shutters, and readout than I do, so I'll defer to them for > the niggles. I can confirm there are many (many!) niggles syncing flash devices with sensor readout :) I'll write out my thoughts and experiences at some point, but as David mentioned in a previous email, flash support really wants to include the AGC algorithm considerations as well as the device side (sensor <-> flash) operations. Regards, Naush > > Dave > > > I may be missing some important libcamera context here, as I'm no user > > of it (yet?)... sorry for that ;) > > > > regards;rl > > > > > > > > Best regards > > > ~Matthias > > > > > > > > > > > regards;rl > > > > > > > > P.S.: If the libcamera-devel mailing list had been included in the > > > > public-inbox at https://lore.kernel.org/, I likely would have found it > > > > myself. Perhaps that's a possibility for the future? ;) > > > > > > > > > > > > > > - https://lore.kernel.org/all/20250901-ov9282-flash-strobe-v7-0-d58d5a694afc@linux.dev/ > > > > > > > > > > This series adds two new v4l2 controls: > > > > > - V4L2_CID_FLASH_DURATION: "Strobe duration": This control enables > > > > > setting a desired flash/strobe length/duration in 盜. > > > > > - V4L2_CID_FLASH_HW_STROBE_SIGNAL: "Hardware strobe signal": This > > > > > control enables the hardware strobe output signal of a v4l2 device. > > > > > > > > > > As a first user of these new controls add basic flash/strobe support > > > > > for ov9282 sensors using their "hardware strobe output". The duration > > > > > calculation is only interpolated from various measurements, as no > > > > > documentation was found. > > > > > > > > > > Further flash/strobe-related controls as well as a migration to v4l2-cci > > > > > helpers for ov9282 will likely be implemented in future series. > > > > > > > > > > All register addresses/values are based on the OV9281 datasheet v1.53 > > > > > (january 2019). This series was tested using an ov9281 VisionComponents > > > > > camera module. > > > > > > > > > > Signed-off-by: Richard Leitner <richard.leitner@linux.dev> > > > > > > > > > > that might add parts that would be relevant in this series. > > > > > > > > > > -- > > > > > Kieran > > > > > > > > > > > > > > > > > > > > > > Signed-off-by: Matthias Fend <matthias.fend@emfend.at> > > > > > > --- > > > > > > Matthias Fend (5): > > > > > > libcamera: control_ids_draft: Add flash controls > > > > > > libcamera: Add support for camera flash devices > > > > > > Documentation: Add flash driver requirements > > > > > > libcamera: Add flash helpers for pipeline handlers > > > > > > rkisp1: Add support for camera flash devices > > > > > > > > > > > > Documentation/documentation-contents.rst | 1 + > > > > > > Documentation/flash_driver_requirements.rst | 40 +++++ > > > > > > Documentation/index.rst | 1 + > > > > > > Documentation/meson.build | 1 + > > > > > > include/libcamera/internal/camera_flash.h | 75 ++++++++ > > > > > > include/libcamera/internal/camera_sensor.h | 2 + > > > > > > include/libcamera/internal/flash_control.h | 23 +++ > > > > > > src/libcamera/camera_flash.cpp | 248 ++++++++++++++++++++++++++ > > > > > > src/libcamera/control_ids_draft.yaml | 69 +++++++ > > > > > > src/libcamera/flash_control.cpp | 103 +++++++++++ > > > > > > src/libcamera/meson.build | 2 + > > > > > > src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 + > > > > > > src/libcamera/sensor/camera_sensor_legacy.cpp | 13 ++ > > > > > > src/libcamera/sensor/camera_sensor_raw.cpp | 13 ++ > > > > > > 14 files changed, 596 insertions(+) > > > > > > --- > > > > > > base-commit: d54e5537ca0909339bb6950f3a565c9077406a3c > > > > > > change-id: 20250827-flash-support-dd67b41a82b9 > > > > > > > > > > > > Best regards, > > > > > > -- > > > > > > Matthias Fend <matthias.fend@emfend.at> > > > > > > > > >
Diving in this discussion after reviewing the kernel series from Richard. On Fri, Sep 05, 2025 at 09:40:52AM +0100, Naushir Patuck wrote: > On Thu, 4 Sept 2025 at 19:32, Dave Stevenson wrote: > > On Thu, 4 Sept 2025 at 09:51, Richard Leitner wrote: > > > On Thu, Sep 04, 2025 at 08:42:28AM +0200, Matthias Fend wrote: > > > > Am 03.09.2025 um 13:50 schrieb Richard Leitner: > > > > > On Wed, Sep 03, 2025 at 12:05:18PM +0100, Kieran Bingham wrote: > > > > > > Quoting Matthias Fend (2025-08-28 14:09:37) > > > > > > > This series brings initial support for v4l2 flash devices. > > > > > > > > > > > > > > With these patches, v4l2 flash devices can be controlled by applications > > > > > > > via libcamera controls. Applications therefore only require one API and do > > > > > > > not have to worry about details such as finding the appropriate v4l2 flash > > > > > > > device. > > > > > > > > > > > > > > The controls are currently quite transparent and no advanced flash > > > > > > > sequences (pre-flash, AGC precorrection, etc.) are supported. > > > > > > > > > > > > > > This functionality should be easy to integrate into the various pipeline > > > > > > > handlers and is implemented as an example for the RKSIP1 pipeline. > > > > > > > > > > > > Just to bridge the kernel side and libcamera side - there's a current > > > > > > series in progress that could impact this one : > > > > > > > > > > Thanks for setting up this link between kernel and libcamera. I wasn't > > > > > aware there's simultaneous work on flash control in libcamera. But of > > > > > course that's great to see :) > > > > > > > > > > Kieran, Matthias, please feel free to share your thoughts/feedback on > > > > > the kernel series. > > > > > > > > > > Apart from this series I have a few more flash/strobe related patches > > > > > in my downstream tree, which I will send as soon as this one got > > > > > merged. One thing that might me interesting to you is the strobe shift > > > > > functionality. It enables shifting the point of time the strobe > > > > > starts relatively (before and after) the exposure start. > > > > > > > > In general, I don't see any major problem with adding further controls here. > > > > But what is currently not supported is simply adding flash-specific v4l2 > > > > controls to a camera sensor driver. > > > > > > > > The current implementation searches for a MEDIA_ENT_F_FLASH subdevice. This > > > > means that only the V4L2_CID_FLASH_* controls offered by such corresponding > > > > subdevices are used. > > > > > > > > Currently, I am only aware of three drivers that use V4L2_CID_FLASH_* > > > > controls without being a MEDIA_ENT_F_FLASH subdevice: > > > > media/usb/gspca/sn9c20x.c > > > > media/i2c/vd55g1.c > > > > media/i2c/vd56g3.c > > > > > > > > The ov9282 could now become another one. > > > > > > > > If a sensor also has some kind of flash controller integrated, I see two > > > > possibilities: > > > > > > > > a) The driver creates two subdevices (MEDIA_ENT_F_CAM_SENSOR and > > > > MEDIA_ENT_F_FLASH). > > > > > > > > b) libcamera implements a special solution and also searches the sensors for > > > > potential flash controls. Instead of a minimum requirement for the > > > > implemented controls, the controls that are found would simply be offered to > > > > the user. If a real flash controller is also present, the controls of both > > > > subdevices are combined and then assigned accordingly. The question is what > > > > to do if a control is offered by both subdevices. > > > > > > > > It's probably not difficult to guess that I would prefer option a) ;) > > > > > > Thanks for your feedback! I definitely got your point, but I'm uncertain > > > whether a MEDIA_ENT_F_FLASH subdevice is the most appropriate "container" > > > for this flash/strobe case. > > > > > > The ov9282 sensor provides only a configurable strobe signal output. > > > It doesn't contain an actual flash/LED driver or light source. It's > > > essentially a "strobe/flash signal source" rather than a "flash device". > > > > > > Therefore from a system perspective, the sensor's strobe output would > > > typically connect to an external flash controller or LED driver. The > > > sensor itself doesn't control the actual light emission, it just provides > > > the signal. > > > > Indeed, the ov9282 patch would correspond to the > > FlashStrobeSourceExternal mode described in the controls. It is not in > > itself a flash driver. That's right, so I don't think it should expose a flash subdevice. The sensor driver shouldn't expose a strobe source control either, that should be exposed by the flash controller driver. > > > So this raises some questions to me: > > > > > > 1) Should a "strobe signal source" be contained in MEDIA_ENT_F_CAM_SENSOR > > > or MEDIA_ENT_F_FLASH? Only in the flash controller in my opinion. > > > 2) Would it make sense to create a separate subdevice type for such > > > "strobe signal sources"? I don't see a need for that. > > > 3) Are there any ohter subdevices that provide similar "signal > > > generation" functionality (for e.g. strobe/flash, focus, mechanical > > > shutter, stabilizer, ...)? Understanding how these are or would be > > > classified could provide some common ground for our case. > > > > An external strobe signal source is almost always going to be from the sensor. > > > > OV9282 works quite nicely with flashes as it is a global shutter sensor. > > > > Rolling shutter sensors have far more complications unless they either: > > - also have an mechanical shutter so that the array can be treated as > > having a global reset and readout. > > - or it's an LED flash that is kept on from at least the start of > > exposure of the first line to the end of readout of the last line. > > > > David and Naush have more experience in the mechanics of synchronising > > flashes, shutters, and readout than I do, so I'll defer to them for > > the niggles. > > I can confirm there are many (many!) niggles syncing flash devices > with sensor readout :) > > I'll write out my thoughts and experiences at some point, but as David > mentioned in a previous email, flash support really wants to include > the AGC algorithm considerations as well as the device side (sensor > <-> flash) operations. I agree. I think the API proposed in this series is too low level. I would like something more application-friendly, making it possible to write portable applications that wouldn't require knowledge of which hardware they run on. > > > I may be missing some important libcamera context here, as I'm no user > > > of it (yet?)... sorry for that ;) > > > > > > > > P.S.: If the libcamera-devel mailing list had been included in the > > > > > public-inbox at https://lore.kernel.org/, I likely would have found it > > > > > myself. Perhaps that's a possibility for the future? ;) I'm planning to add a public-inbox instance for libcamera, but I wasn't considering getting it exposed through lore.kernel.org. libcamera isn't a kernel project, so it would feel a bit like opening pandora's box and asking for Konstantin to mirror all userspace mailing lists. > > > > > > - https://lore.kernel.org/all/20250901-ov9282-flash-strobe-v7-0-d58d5a694afc@linux.dev/ > > > > > > > > > > > > This series adds two new v4l2 controls: > > > > > > - V4L2_CID_FLASH_DURATION: "Strobe duration": This control enables > > > > > > setting a desired flash/strobe length/duration in 盜. > > > > > > - V4L2_CID_FLASH_HW_STROBE_SIGNAL: "Hardware strobe signal": This > > > > > > control enables the hardware strobe output signal of a v4l2 device. > > > > > > > > > > > > As a first user of these new controls add basic flash/strobe support > > > > > > for ov9282 sensors using their "hardware strobe output". The duration > > > > > > calculation is only interpolated from various measurements, as no > > > > > > documentation was found. > > > > > > > > > > > > Further flash/strobe-related controls as well as a migration to v4l2-cci > > > > > > helpers for ov9282 will likely be implemented in future series. > > > > > > > > > > > > All register addresses/values are based on the OV9281 datasheet v1.53 > > > > > > (january 2019). This series was tested using an ov9281 VisionComponents > > > > > > camera module. > > > > > > > > > > > > Signed-off-by: Richard Leitner <richard.leitner@linux.dev> > > > > > > > > > > > > that might add parts that would be relevant in this series. > > > > > > > > > > > > > Signed-off-by: Matthias Fend <matthias.fend@emfend.at> > > > > > > > --- > > > > > > > Matthias Fend (5): > > > > > > > libcamera: control_ids_draft: Add flash controls > > > > > > > libcamera: Add support for camera flash devices > > > > > > > Documentation: Add flash driver requirements > > > > > > > libcamera: Add flash helpers for pipeline handlers > > > > > > > rkisp1: Add support for camera flash devices > > > > > > > > > > > > > > Documentation/documentation-contents.rst | 1 + > > > > > > > Documentation/flash_driver_requirements.rst | 40 +++++ > > > > > > > Documentation/index.rst | 1 + > > > > > > > Documentation/meson.build | 1 + > > > > > > > include/libcamera/internal/camera_flash.h | 75 ++++++++ > > > > > > > include/libcamera/internal/camera_sensor.h | 2 + > > > > > > > include/libcamera/internal/flash_control.h | 23 +++ > > > > > > > src/libcamera/camera_flash.cpp | 248 ++++++++++++++++++++++++++ > > > > > > > src/libcamera/control_ids_draft.yaml | 69 +++++++ > > > > > > > src/libcamera/flash_control.cpp | 103 +++++++++++ > > > > > > > src/libcamera/meson.build | 2 + > > > > > > > src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 + > > > > > > > src/libcamera/sensor/camera_sensor_legacy.cpp | 13 ++ > > > > > > > src/libcamera/sensor/camera_sensor_raw.cpp | 13 ++ > > > > > > > 14 files changed, 596 insertions(+) > > > > > > > --- > > > > > > > base-commit: d54e5537ca0909339bb6950f3a565c9077406a3c > > > > > > > change-id: 20250827-flash-support-dd67b41a82b9
This series brings initial support for v4l2 flash devices. With these patches, v4l2 flash devices can be controlled by applications via libcamera controls. Applications therefore only require one API and do not have to worry about details such as finding the appropriate v4l2 flash device. The controls are currently quite transparent and no advanced flash sequences (pre-flash, AGC precorrection, etc.) are supported. This functionality should be easy to integrate into the various pipeline handlers and is implemented as an example for the RKSIP1 pipeline. Signed-off-by: Matthias Fend <matthias.fend@emfend.at> --- Matthias Fend (5): libcamera: control_ids_draft: Add flash controls libcamera: Add support for camera flash devices Documentation: Add flash driver requirements libcamera: Add flash helpers for pipeline handlers rkisp1: Add support for camera flash devices Documentation/documentation-contents.rst | 1 + Documentation/flash_driver_requirements.rst | 40 +++++ Documentation/index.rst | 1 + Documentation/meson.build | 1 + include/libcamera/internal/camera_flash.h | 75 ++++++++ include/libcamera/internal/camera_sensor.h | 2 + include/libcamera/internal/flash_control.h | 23 +++ src/libcamera/camera_flash.cpp | 248 ++++++++++++++++++++++++++ src/libcamera/control_ids_draft.yaml | 69 +++++++ src/libcamera/flash_control.cpp | 103 +++++++++++ src/libcamera/meson.build | 2 + src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 + src/libcamera/sensor/camera_sensor_legacy.cpp | 13 ++ src/libcamera/sensor/camera_sensor_raw.cpp | 13 ++ 14 files changed, 596 insertions(+) --- base-commit: d54e5537ca0909339bb6950f3a565c9077406a3c change-id: 20250827-flash-support-dd67b41a82b9 Best regards,