Commit graph

266 commits

Author SHA1 Message Date
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
Gaetan Perrot
5de04c61b6 drivers: video: fix uninitialized struct in ov2640_init()
Initialize fmt with default format and zero pitch to fix Coverity.

CID: 524780

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-06-27 10:58:43 +02:00
Alain Volmat
2d1a5b8426 video: shell: correct incorrect error return value in cmd_video_format
Correct cmd_video_format return value in case of video_shell_parse_in_out
returns a negative value.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-25 15:55:24 -10:00
Alain Volmat
c714fac300 video: shell: addition of video selection support
Add shell handling in order to interact with drivers
via the set/get_selection APIs allowing to get/set
crop / compose and get HW capabilities such as
crop bound / compose bound or native size.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-25 15:55:24 -10:00
Alain Volmat
0b9a06909e video: stm32: dcmipp: add set/get_selection handling
Add possibility to perform crop on all pipes and compose (downscale) on
pixel pipes (endpoint #1 and endpoint #2).
Rework the code in order to move the downscale control from
the set_fmt into the set_selection (compose).

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-25 15:55:24 -10:00
Benjamin Cabé
97324c93f8 drivers: video: esp32_dvp: use inclusive language
Replaced the term "master clock" by "main clock"

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-25 10:49:41 +02:00
Benjamin Cabé
4aac7c16aa drivers: video: use inclusive language
Replaced the term "master" by "primary" in video_ctrls.c/.h

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-25 10:49:41 +02:00
Alain Volmat
d9c935c00e video: gc2145: convert to multi-instance driver
Allow the driver to be instanciated multiple times.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-24 20:12:51 -10:00
Alain Volmat
96955744c6 video: gc2145: set default fmt at variable declaration
Set the default format at the moment of variable declaration
in gc2145_init function.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-24 20:12:51 -10:00
Alain Volmat
28e12468fb video: gc2145: switch to usage of video cci interface
Use video cci helper functions to access to the sensor.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-24 20:12:51 -10:00
Alain Volmat
49c5481aa5 video: gc2145: avoid odd even row switch by default
This bit would be used in order to generate several variants
of Bayer formats, however it shouldn't be enabled for YUV/RGB
formats by default.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-24 20:12:51 -10:00
Alain Volmat
8e8d7211f3 video: gc2145: fix wrong OUTPUT_FMT / SYNC_MODE macro used
Correct wrong macro GC2145_REG_OUTPUT_FMT / GC2145_REG_SYNC_MODE
being used while a different page is being accessed.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-24 20:12:51 -10:00
Alain Volmat
e511f8f44a video: gc2145: avoid useless register page change
Avoid some register page change when the right page is
already being accessible.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-24 20:12:51 -10:00
Alain Volmat
747d73c856 video: gc2145: use GC2145_REG_RESET macro for page selection
Help identify register page change by using GC2145_REG_RESET macro.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-24 20:12:51 -10:00
Alain Volmat
04480c87fe video: stm32: dcmipp: use video_get_csi_link_freq helper
Rely on video_get_csi_link_freq for getting CSI phy bitrate
informations.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-24 20:10:23 -10:00
sudarsan N
3fb0cf48f5 drivers: video: fix uninitialized struct
Zero-initialize fmt to fix Coverity.

CID:525180
CID 524760
CID 524753
CID 524781
CID 524755

Signed-off-by: sudarsan N <sudarsansamy2002@gmail.com>
2025-06-23 15:46:42 +01:00
sudarsan N
48bbbfe976 drivers: video: fix NULL dereference in mipid02_get_fmt
Category: Null pointer dereference (CWE-476)

Corrects the logic that validates the result of mipid04_get_format_desc().
Previously, the check was inverted, which could lead to a NULL pointer
dereference when accessing desc->pixelformat.

Fixes Coverity CID: 525183

Signed-off-by: sudarsan N <sudarsansamy2002@gmail.com>
2025-06-20 11:50:49 +01:00
Phi Bang Nguyen
10deca2ef6 drivers: video: Fix skipped CIDs when enumerating controls
When enumerating controls with VIDEO_CTRL_FLAG_NEXT_CTRL, if child devices
have controls with IDs lower or equal to the ones in the parent devices,
those controls will be accidentally skipped.

Fix this by resetting the query's ID and tracking of the queried device in
the query when moving to the next device in the pipeline.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-06-19 22:37:54 -07:00
Kate Wang
e2d97c7ca6 drivers: video: ov7670: update the camera init sequence
The previous initialization sequence fails to configure the module
properly. Update the sequence using the code provided by vendor.
The update is verified using the FRDM-MCXN947 SmartDMA camera case
under samples/drivers/video/capture.

Signed-off-by: Kate Wang <yumeng.wang@nxp.com>
2025-06-19 14:04:45 +02:00
Benjamin Cabé
e3a7a32334 drivers: video: mt9m114: add missing const qualifiers
Ensure that the various configuration tables are marked as const to save
on RAM usage.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 17:46:35 -04:00
Benjamin Cabé
b35ba2d40e drivers: video: adopt SHELL_HELP
Adopt SHELL_HELP macro for video_shell

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-13 10:17:08 -07:00
sudarsan N
cda6858d99 drivers: video: fix null deref in video_get_csi_link_freq()
Add null and bounds checks before accessing int_menu[ctrl.val].

CID: 525179
Fixes: #91244

Signed-off-by: sudarsan N <sudarsansamy2002@gmail.com>
2025-06-13 10:10:13 +02:00
Josuah Demangeon
a3728d71e9 drivers: video: common: avoid dead code in functions with retry
Avoid k_sleep() never being called when video_write_reg_retry() and
video_read_reg_retry() have a number of retry set to zero (default).
The default number of retries being controlled by
CONFIG_VIDEO_I2C_RETRY_NUM.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-06-13 07:36:37 +02:00
Alain Volmat
fea5c421b4 drivers: video: dcmipp: add functions for external ISP functions usage
Add weak functions and their call within the dcmipp driver so that
externally provided ISP control functions can be called by the
driver at right timing in order to perform the control of the
ISP part of the DCMIPP.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-06 10:10:58 +02:00
Alain Volmat
cd8dccf211 drivers: video: introduction of the stm32 DCMIPP driver
The STM32 Digital Camera Memory Interface Pixel Processor (DCMIPP)
is a multi-pipeline camera interface allowing to capture
and process frames from parallel or CSI interfaces depending on its
version.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-06 10:10:58 +02:00
Alain Volmat
3db7b40238 video: introduction of driver for Omnivision OV9655
This commit add support for the Omnivision OV9655 sensor,
a 1.3MPix Color SXGA (1280x1024 sensor).
Current driver only allow output of 320x240 and 160x120
resolution either in RGB565 or YUYV.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-04 15:50:24 -04:00
Alain Volmat
9c62fb8810 video: stm32: dcmi: correct typo dmci -> dcmi
DMA callback is wrongly named as dmci in the source code,
correct the name to be dcmi_dma_callback.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-04 15:50:24 -04:00
Alain Volmat
64149e4df6 video: stm32_dcmi: addition of STM32L4 DMA support
The STM32 DMA LL api differ between the STM32F7 and the STM32L4
in order to get the CHANNEL instance information.  For that
reason, enclose within preproc statements STM32F7 specific code
and add STM32L4 code related to the DMA configuration for the
DCMI peripheral.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-04 15:50:24 -04:00
Alain Volmat
b03ec6dd29 video: stm32: dcmi: fix video interface properties read
This commit fixes an error introduced by commit c0dae0c9ac
("video: stm32: dcmi: perform config based on endpoint properties")
in which incorrect instance was being access leading to usage of
the default value for pixel clock / hsync / vsync polarities and bus
width.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-04 15:50:24 -04:00
Alain Volmat
2c2b2268af video: imx335: only include gpio code if needed
Rely on DT_ANY_INST_HAS_PROP_STATUS_OKAY to only build the
gpio handling code for reset pin if this is being used by
one or more instance of the device.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-02 22:35:45 -04:00
Alain Volmat
fc6d5c4871 video: imx335: increase T4 delay post reset
Increase the T4 delay after releasing the reset of the
sensor in order to avoid getting I2C communication issues
at initialization time.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-02 22:35:45 -04:00
Alain Volmat
4e63863b46 video: ov5640: only include gpio code if needed
Rely on DT_ANY_INST_HAS_PROP_STATUS_OKAY to only build the
gpio handling code for reset and powerdown pins if this is
being used by one or more instance of the device.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-02 22:35:45 -04:00
Alain Volmat
9f81f4f7ec video: ov5640: allow usage without reset or powerdown gpios
reset and powerdown pins are optionals.

gpio_is_ready_dt should not be called in case of reset or
powerdown are not present.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-02 22:35:45 -04:00
Josuah Demangeon
a3465f8f4d drivers: video: sw_generator: convert to use the devicetree
Make the video software generator a devicetree node, which allows enabling
several instances, and select it as chosen { zephyr,camera = &... }; node.
It can be enabled via a `video-sw-generator` snippet.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-06-02 05:48:21 +02:00
Alain Volmat
5fa26d9aea video: gc2145: use VGA resolution as default
Since QVGA resolution is currently not working in CSI, use VGA
as default resolution to avoid failing during the init of the
driver.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-06-02 05:48:12 +02:00