Commit graph

300 commits

Author SHA1 Message Date
Guillaume Gautier
2a52a2b7ff drivers: stm32: replace WRITE_REG HAL macro by stm32_reg_write
For all STM32 drivers and SoC, replace the WRITE_REG macro and the
LL_xxx_WriteReg functions (defined in the STM32 HAL) by
stm32_reg_write defined in Zephyr.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-24 08:58:25 -07:00
Guillaume Gautier
a2339c9b91 drivers: stm32: replace CLEAR_BIT HAL macro by stm32_reg_clear_bits
For all STM32 drivers, replace the CLEAR_BIT macro (defined in
the STM32 HAL) by stm32_reg_clear_bits defined in Zephyr.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-24 08:58:25 -07:00
Guillaume Gautier
73e9749c68 drivers: stm32: replace SET_BIT HAL macro by stm32_reg_set_bits
For all STM32 drivers, replace the SET_BIT macro (defined in
the STM32 HAL) by stm32_reg_set_bits defined in Zephyr.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-24 08:58:25 -07:00
Josuah Demangeon
c765b99887 drivers: video: sw_generator: support test pattern CID
Add an always-on CID for enabling the test pattern, which makes
it possible to use it in tests enabling the test first enabling
the pattern.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-10-24 08:52:57 -07:00
Alain Volmat
38a21cc1a2 video: introduce video_set_compose_format helper
Some devices allow for downscale / upscale via the set_selection
compose API. When using it, it is necessary to perform a
set_selection of the compose target prior to setting the format.
In order to allow non-compose aware application to benefit from
it, introduce a helper which take care of setting the compose
prior to setting the format.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-10-23 16:03:10 -04:00
Alain Volmat
126aaf6b72 video: dcmipp: expose dcmipp caps for all 3 pipes.
Currently the DCMIPP driver rely on a Kconfig in order to
select the right sensor resolution / format to pick.
This also makes the exposure of caps easier since it can
be exposed as:
  DUMP pipe: same caps as mentioned in Kconfig
  MAIN pipe: any format supported on this pipe and resolution
             starting at sensor selected resolution down to
             64 times smaller (which is the maximum of the
             downscale)
  AUX pipe: same as MAIN except without the semi-planar and
            planar formats

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-10-23 16:03:10 -04:00
Antonino Scarpaci
54ca22a626 drivers: video: Himax HM01B0 camera sensor driver
Add Himax HM01B0 camera sensor driver.
It depends on I2C and it is required to configure the camera.

Signed-off-by: Antonino Scarpaci <antonino.scarpaci@gmail.com>
2025-10-23 10:39:41 +02:00
Hugues Fruchet
0d2f910d3d drivers: video: stm32_venc: fix coding style
Fix coding style issues in venc video driver.

Signed-off-by: Hugues Fruchet <hugues.fruchet@foss.st.com>
2025-10-22 18:06:55 -04:00
Hugues Fruchet
a186c72165 drivers: video: stm32_venc: log an error in case of hardware timeout
Log an error in case of hardware timeout.

Signed-off-by: Hugues Fruchet <hugues.fruchet@foss.st.com>
2025-10-22 18:06:55 -04:00
Hugues Fruchet
8ad4282f4c drivers: video: stm32_venc: fix return value
Avoid mixing encoder library return code and driver return value to
fix wrong value returned by enqueue() in nominal case.

Signed-off-by: Hugues Fruchet <hugues.fruchet@foss.st.com>
2025-10-22 18:06:55 -04:00
Adam BERLINGER
f97eba57d8 drivers: video: stm32_dcmipp: Initialize ISP only once
This fixes bug where stm32_dcmipp_isp_init is called multiple times.

Signed-off-by: Adam BERLINGER <adam.berlinger@st.com>
2025-10-21 17:23:13 +03:00
Etienne Carriere
d0c829a482 drivers: video: stm32: test HAL functions return value
Add missing test of some HAL functions return value.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2025-10-21 17:22:52 +03:00
Etienne Carriere
493993e0a6 drivers: video: stm32: don't mix HAL return value and errno
Clarify HAL return value is of type HAL_StatusTypeDef and not an
int in STM32 DCMI and DCMIPP drivers. For consistency, rename
the variable holding HAL return value from ret to hal_ret.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2025-10-21 17:22:52 +03:00
Kurt Eckhardt
eb7e332b1b video: stm32_dcmi: DMA Error recovery
On several boards, such as the Arduino Giga and
Portenta H7, they are often times setup with their
camera buffers and potentially video buffers in
SDRam.  This can lead to a significant number of
DMA errors, which currently stops the camera from
returning any additional frames.

Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
2025-10-19 20:51:20 -04:00
Kurt Eckhardt
3d11ffd849 video: stm32_dcmi: forward selection
Forward the get_selection and set_selection APIs
to the camera objects, to allow some of the
selections to be supported at the camera level.

Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
2025-10-19 20:51:20 -04:00
Kurt Eckhardt
0cbfe585df video: gc2145: support for CROP
Implements the set_selection and get_selection APIs,
if forwarded to it by a camera controller.
It uses the new messages
to allow you to set a crop window on top of the
current format window.  It also then allows you
to move this crop window around in the frame
window.

With this driver I also updated it to allow any resolution
from the displays min to max limits.
static const struct video_format_cap fmts[] = {
  GC2145_VIDEO_FORMAT_CAP_HL(128, 1600, 128, 1200,
                              VIDEO_PIX_FMT_RGB565),
GC2145_VIDEO_FORMAT_CAP_HL(128, 1600, 128, 1200,
                              VIDEO_PIX_FMT_YUYV),

When the resolution is set, it computes the scale factor.

Using the set_selection(VIDEO_SEL_TGT_CROP) allows you
define a crop window within the format window.

It clamps the ratio to a max of 3 as some other
drivers limit it saying it helps with frame rates.

Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
2025-10-19 20:51:20 -04:00
Alain Volmat
320425847e video: stm32: addition of the STM32 JPEG HW Codec support
Initial version of the support for the STM32 JPEG HW codec,
currently supporting only NV12 to JPEG without DMA support
and using SW based conversion from NV12 to MCU required
for the JPEG codec.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-10-17 22:01:44 +03:00
Zacck Osiemo
6d60beffb9 drivers: video: mcux_sdma: Reconfigure the source when getting format
Reconfigure the sensor format with the only supported format of the
sdma when getting format

Signed-off-by: Zacck Osiemo <coderv63@gmail.com>
2025-10-16 12:17:29 -04:00
Alain Volmat
3a4f17454f drivers: video: stm32-venc: depends on VIDEO_ENCODER_H264
Make the STM32 VENC driver depends on the VIDEO_ENCODER_H264
in order to be compiled only if VIDEO_ENCODER_H264 is
enabled by an application.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-10-15 17:35:25 -04:00
Alain Volmat
f556a1b908 drivers: video: add encoders related Kconfig entries
Add video subsystem related Kconfig in order to allow an
application to enable encoder support.
This is useful for platforms having several video devices
available as well as several video encoders, since it allows
to only compile / enable part of those devices depending on
their kind.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-10-15 17:35:25 -04:00
Phi Bang Nguyen
517e13cae5 drivers: video: st_mipid02: Drop caps' min_vbuf_count
The mipid02 is just a bridge driver which does not deal with memory so
should not expose caps' min_vbuf_count.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-10-10 12:53:28 -04:00
Phi Bang Nguyen
ade4e05969 drivers: video: Set format size
Receiver drivers now need to set the format's size to expose it to
the application.

Application should base on the format size to allocate buffers. The
caps' min/max_line_count (which are needed only for HWs that cannot
support the whole image frame) can hence be dropped.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-10-10 12:53:28 -04:00
Phi Bang Nguyen
21fec46971 drivers: video: Add helper to estimate format size
Add a helper to estimate format size and pitch.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-10-10 12:53:28 -04:00
Hugues Fruchet
fd1115d88f drivers: video: introduction of the stm32 venc driver
The STM32 video encoder (VENC) peripheral is a hardware
accelerator allowing to compress RGB/YUV frames into
H264 video bitstream chunks.

Signed-off-by: Hugues Fruchet <hugues.fruchet@foss.st.com>
2025-10-09 22:56:37 +03:00
Khanh Nguyen
233637f7fb drivers: video: shell: fix control name lookup
video_shell_get_ctrl_by_name() normalized the search string (`name`)
instead of the control's actual name (`cq->name`). This made the
comparison always succeed on the first control, causing incorrect
lookups at runtime.

Update the code to normalize `cq->name` before comparison so that
each control name is correctly checked against the search string.

Signed-off-by: Khanh Nguyen <khanh.nguyen.wz@bp.renesas.com>
2025-10-09 12:41:34 -04:00
Khanh Nguyen
65bf8f9461 drivers: video: ctrls: correct assertion in video_cluster_ctrl
The function asserted `!sz && !ctrls`, which is the inverse of the
intended precondition. This caused assertion failures on valid inputs.

Update the check to `sz && ctrls` so it fails only when size is zero
or the control pointer is NULL.

Signed-off-by: Khanh Nguyen <khanh.nguyen.wz@bp.renesas.com>
2025-10-07 23:00:05 -04:00
Khanh Nguyen
6f431a423b drivers: video: ov5640: support DVP bus-width and data-shift from DTS
Add support in the OV5640 driver to configure the bus-width and
data-shift properties from devicetree when operating in DVP
(parallel) mode.

This allows the number of parallel data lines and the bit shift
to be set directly via DTS, ensuring correct configuration across
different hardware designs.

Signed-off-by: Khanh Nguyen <khanh.nguyen.wz@bp.renesas.com>
2025-10-07 23:00:05 -04:00
Khanh Nguyen
804f893e89 drivers: video: ov5640: Use CCI API helpers for register access
Replace the custom I2C read/write functions in the OV5640 driver
with the common Video CCI API helpers.

- Introduce OV5640_REG8/REG16 macros for register addressing
- Convert struct ov5640_reg to struct video_reg16
- Replace ov5640_{read,write,modify}_reg() with CCI API helpers
- Replace ov5640_write_multi_regs() with video_write_cci_multiregs16()

This aligns the OV5640 driver with other video sensor drivers
that already rely on the CCI helpers.

Signed-off-by: Khanh Nguyen <khanh.nguyen.wz@bp.renesas.com>
2025-10-07 23:00:05 -04:00
Alain Volmat
e7aa49c60b drivers: video: dcmi: correct clock_control_subsys_t cast
Correct the clock_control_subsys_t cast in calls of the
clock_control_ framework.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-10-02 16:47:53 +02:00
Alain Volmat
c927d9ee09 video: stm32: dcmipp: correct clock_control_subsys_t cast
Correct the clock_control_subsys_t cast in calls of the
clock_control_ framework.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-10-02 16:47:53 +02:00
Armin Kessler
3b3f283b3f driver: video: esp32: add set/get_frmival callbacks
forward set/get_frmival api calls to source device.

Signed-off-by: Armin Kessler <ake@espros.com>
2025-09-30 15:27:12 +03:00
Josuah Demangeon
ccaaaabba2 drivers: video: stm32_dcmi: add missing capability property
In the DCMI video driver, set the caps.min_vbuf_count field to
indicate that two buffers are needed. Fix use of un-initialized
memory breaking the samples in some situations.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-09-18 15:44:27 +01:00
Josuah Demangeon
9d10bcc140 drivers: video: esp32_dvp: add missing capability property
In the ESP32 video driver, set the caps.min_vbuf_count field to
indicate that a two buffers are enough. Fix use of un-initialized
memory breaking the samples in some situations.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-09-18 15:42:52 +01:00
Khanh Nguyen
2784257582 drivers: video: add support for Renesas RA CEU driver
Add support for the Renesas RA Capture Engine Unit (CEU),
including driver source files, Kconfig options, and DTS bindings.

- Add initial implementation of the RA CEU driver
- Add dedicated Kconfig and CMake integration
- Provide Devicetree bindings for the RA CEU
- Update module Kconfig to include the new driver

This enables image capture functionality using the CEU peripheral
on Renesas RA series MCUs.

Signed-off-by: Duy Vo <duy.vo.xc@bp.renesas.com>
Signed-off-by: Khanh Nguyen <khanh.nguyen.wz@bp.renesas.com>
2025-09-17 10:06:34 +02:00
Armin Kessler
85ad69d491 drivers: video: esp32: add selection api
Forward get/set selection to the camera source and update the driver's
video_format on set so buffer sizing and streaming follow the selected
region.

Signed-off-by: Armin Kessler <ake@espros.com>
2025-09-12 14:03:45 +01:00
Alain Volmat
a5bc5fa57d video: stm32: dcmipp: add (semi)planar support
Add support for NV12/NV21, NV16/NV61 and YUV420/YVU420
(semi)planar formats which can be output by the main #1 pipe.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-09-11 14:17:23 +01:00
Alain Volmat
0c81a6bf91 video: stm32: dcmipp: make isp handling depends on pixel pipes
ISP is part of the pixel pipes hence it doesn't make any sense to
try to call ISP external handlers if the DCMIPP doesn't have pixel
pipes available.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-09-11 14:17:23 +01:00
Phi Bang Nguyen
2bfa1869d1 drivers: video: dcmipp: Define video device for each pipe
Define a video device for each pipe instead for the main dcmipp device
since the pipe is the device that communicates with application
(zephyr,camera chosen node), not the dcmipp device.

This helps to enable camera controls as well.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-09-10 10:27:28 +01:00
Phi Bang Nguyen
ca030fbf88 drivers: video: stm32_dcmipp: Use normal child nodes for pipes
The pipe nodes are not video interfaces. Describe them as normal child
nodes instead of using port/endpoint.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-09-10 10:27:28 +01:00
Phi Bang Nguyen
caa9c8c83a drivers: video: stm32_dcmipp: Fix a typo on driver instance name
The driver instance variable name is inst, not n.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-09-10 10:27:28 +01:00
Erwan Gouriou
47de4d1d9e drivers: stm32: Make use of new GET_INSTANCE DMA macro
Use the new macro and factorize code when possible.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-09-03 11:03:31 +02:00
Erwan Gouriou
67d2281ffe drivers: stm32: Keep DMA stream offset handling internal to driver
In HAL based stm32 drivers, dma handling is done internally to HAL.
Though, in order to avoid a dma_config() call is done to ensure stream
will be set as busy in zephyr dma driver to avoid potential resource
sharing conflict.
This dma_config() call was done while taking into account
STM32_DMA_STREAM_OFFSET, which is wrong as it will prevent zephyr dma
driver to set the right stream as busy.
Fix this in impacted drivers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-09-03 11:03:31 +02:00
Alain Volmat
54c939a069 drivers: video: stm32: dcmi: ensure RESET is selected
stm32 dcmi driver requires a reset control hence ensure that
CONFIG_RESET is properly selected to allow proper build.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-08-18 17:49:28 +02:00
Alain Volmat
4542ab9677 drivers: video: stm32: dcmipp: ensure RESET/PINCTRL are selected
stm32 dcmipp driver requires a reset control and pinctrl
(depending on the configuration) hence ensure that
CONFIG_RESET and CONFIG_PINCTRL are properly selected to allow
proper build.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-08-18 17:49:28 +02:00
Phi Bang Nguyen
086bdae37e drivers: video: sw_generator: Fix min buffers count
The driver needs at least one buffer to be able to start.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-08-10 22:09:01 +03:00
sudarsan N
9e7e58fb54 video: common: fix formatting for heap define to fit CI line length
Wrap K_HEAP_DEFINE to fit within 100-character CI limit and apply
consistent spacing.This is a formatting-only change.

Signed-off-by: sudarsan N <sudarsansamy2002@gmail.com>
2025-07-11 15:54:09 -05:00
sudarsan N
af76ac8b9b video: common: prevent divide-by-zero video_closest_frmival_stepwise()
Adds an assertion and runtime log to ensure 'step' is not zero before
using it in division,preventing undefined behavior without modifying
 the public API.

Avoids a signature change (void → int) to preserve API stability for
Zephyr 4.2.A more complete solution can be proposed for 4.3.

CID: 444378

Signed-off-by: sudarsan N <sudarsansamy2002@gmail.com>
2025-07-11 15:54:09 -05:00
Josuah Demangeon
e0b706b6c6 drivers: video: stm32_dcmipp: move video/ header directory to drivers/
During #89407 a driver-specific header stm32_dcmipp.h got introduced to
support new functionnalities not yet covered by video APIs.
Move this header into a new <include/zephyr/drivers/video/> include
direcctory like what other driver classes do.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-07-09 09:42:43 -05:00
Pieter De Gendt
696442fab0 drivers: video: Place device APIs in linker sections
Use DEVICE_API macro to place driver API instances into a linker section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-06-27 10:09:32 -05:00
Josuah Demangeon
a1ef239249 drivers: video: dcmi: fix DMA channel configuration
Commit 64149e4df6 added an "#if defined()"
for configuring DMA channels differently depending on SOC family of the
STM32 HAL, but did not include the STM32H7 family in the same group as
STM32F7. Fix it by adding the STM32H7 in the same #ifdef filter.

Fixes #92015

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-06-27 10:00:35 -05:00