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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>