Commit graph

235 commits

Author SHA1 Message Date
Josuah Demangeon
21da345382 drivers: video: introduce video_bits_per_pixel(pixelformat) helper
This was present in the form of video_pix_fmt_bpp() inside ST and NXP
drivers, and was returning the number of bytes, which does not allow
support for 10-bits, 4-bits or non-byte aligned video formats.
The helper leverages the VIDEO_PIX_FMT_*_BITS macros.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-01-24 03:22:31 +01:00
Ibrahim Abdalkader
2a6e5902cc drivers: video: gc2145: Add support for a PWDN pin.
Add support for power-down pin. Some modules require this pin
to enable the power supply.

Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
2025-01-17 16:36:22 +01:00
Jeronimo Agullo
b69004c1b4 drivers: video: mt9m114: Add vertical and horizontal flip control
Add set_ctrl function API for vertical and horizontal flip control
modifying the camera read mode

Signed-off-by: Jeronimo Agullo <jeronimoagullo97@gmail.com>
2024-12-12 11:08:00 +01:00
Jeronimo Agullo
ef2b0fc73e drivers: video: mt9m114: update mt9m114_modify_reg to any register length
Update mt9m114_modify_reg to support 8, 16 and 32 bits registers

Signed-off-by: Jeronimo Agullo <jeronimoagullo97@gmail.com>
2024-12-12 11:08:00 +01:00
Armin Kessler
1baf93b1d1 drivers: video: Add timeout tovideo_buffer_alloc
This PR fixes a blocking call to video_buffer_alloc in case of memory
shortage by addign a timeout parameter to the API.

Signed-off-by: Armin Kessler <ake@espros.com>
2024-12-10 20:39:57 +01:00
Phi Bang Nguyen
ab6141c140 drivers: video: Use endpoint DT helpers
Drop the driver-defined macros to use the endpoint DT helpers instead.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-12-06 22:23:31 +01:00
Josuah Demangeon
9e908b1b72 drivers: video: add emulated Imager driver and RX driver
Add a new implementation of a test pattern generator, with the same
architecture as real drivers: split receiver core and
I2C-controlled sub-device, with changes of video format in
"zephyr,emul-imager" leads to different data produced by
"zephyr,emul-rx".

Signed-off-by: Josuah Demangeon <me@josuah.net>
2024-12-05 20:00:21 -05:00
Josuah Demangeon
46a262ffe6 drivers: video: common: Add utilities to seek frmival/caps structures
Introduce a video_get_format_index() utility to help finding a caps
entry out of a given format. Introduce several utilities to seek and
apply frame intervals.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2024-12-05 20:00:21 -05:00
Pieter De Gendt
47ed71ad1d drivers: video: Place API into iterable section
Add wrapper DEVICE_API macro to all video_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 23:04:22 +01:00
Trung Hieu Le
ecd6c616f5 drivers: video: ov5640: Fix bug out-of-bound buffer read
Fix the out of bound buffer read by checking the lower-bound index
in the ov5640_enum_frmival function.

Signed-off-by: Trung Hieu Le <trunghieu.le@nxp.com>
2024-11-29 21:46:24 +01:00
Josuah Demangeon
217f053ccd drivers: video: controls: rename controls to Linux-like names
This uses Linux V4L2 controls as a reference to give names to the
CIDs. Apply the renaming down to the drivers that use them.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2024-11-27 10:31:54 +01:00
Trung Hieu Le
2ff984a888 drivers: video: sw_generator: Disable the driver if a real camera presents
Do not enable the video sw generator if a real camera is present. This
helps to save some spaces and to avoid unrelated code going
into the built image.

Signed-off-by: Trung Hieu Le <trunghieu.le@nxp.com>
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-11-25 17:42:49 +01:00
Martino Facchin
054d60fb1c video: gc2145: fix set_fmt()
Trivial fix for bound check

Signed-off-by: Martino Facchin <m.facchin@arduino.cc>
2024-11-22 13:04:22 -06:00
Phi Bang Nguyen
5e41249ddf drivers: video: csi: Add NXP copyright
The CSI is an NXP IP and the driver has been very much changed
by NXP, so add NXP copyright to it.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-25 08:54:57 +02:00
Phi Bang Nguyen
a738613dcf drivers: video: csi: Increase init priority
The CSI needs to be initialized BEFORE the camera sensor to provide
clock to the camera sensor. It is now possible to do so as direct
reference to the sensor via phandle is now removed. There will be
no check failure on the init order anymore when compiling.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-25 08:54:57 +02:00
Phi Bang Nguyen
59e253ed4a drivers: video: csi: Drop source device phandle reference
The peer remote device "source_dev" can be retrieved from the
remote-endpoint-label. Direct reference via phandle is not needed.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-25 08:54:57 +02:00
Phi Bang Nguyen
1dd96ba9f9 drivers: video: csi: Remove obsolete comment
Remove the obsolete comment about the init order of the CSI and the
camera sensors (e.g. mt9m114) which is not true anymore.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-25 08:54:57 +02:00
Trung Hieu Le
5bbaffe7c3 drivers: video: csi: Add support for changing frame rate
Add support for changing frame rate

Signed-off-by: Trung Hieu Le <trunghieu.le@nxp.com>
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-25 08:54:57 +02:00
Phi Bang Nguyen
29f38b81e2 include: video: Add an utility function to get bytes per pixel
As getting bytes per pixel of a pixel format is a very common operation,
add an utility function for it instead of repeating the same codes in
different drivers.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-25 08:54:57 +02:00
Trung Hieu Le
8053b722af drivers: video: mipi_csi2rx: Add support for changing frame rate
Add support for changing frame rate.

Signed-off-by: Trung Hieu Le <trunghieu.le@nxp.com>
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-25 08:54:57 +02:00
Trung Hieu Le
a182394725 drivers: video: mipi_csi2rx: Set clocks according to pixel rate
Instead of fixing csi2rx clock frequencies, set them according to the
pixel rate got from the camera sensor.

Signed-off-by: Trung Hieu Le <trunghieu.le@nxp.com>
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-25 08:54:57 +02:00
Farah Fliss
a40505148c drivers: video: mipi_csi2rx: Add set_ctrl callback
Add set_ctrl callback to propagate controls to the sensor.

Signed-off-by: Farah Fliss <farah.fliss@nxp.com>
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-25 08:54:57 +02:00
Phi Bang Nguyen
f82b0d5681 drivers: video: mipi_csi2rx: Drop sensor device phandle reference
The peer remote device "sensor_dev" can be retrieved from the
remote-endpoint-label. Direct reference via phandle is not needed.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-25 08:54:57 +02:00
Phi Bang Nguyen
901f022cdb drivers: video: mipi_csi2rx: Get data lanes number from devicetree
Get number of data lanes from device tree instead of hard-coding it.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-25 08:54:57 +02:00
Armin Kessler
9564a3b431 drivers: video: esp32s3: Add set_signal video api function
This PR implements the set_signal callback from the video API.
A signal registered on VIDEO_EP_OUT raises once a new image has
been received completely.

Signed-off-by: Armin Kessler <ake@espros.com>
2024-10-16 10:00:01 +02:00
Emilio Benavente
82a192c8a9 boards: nxp: Removing CONFIG_PINCTRL from the boards defconfig
The Drivers using Pinctrl should be turning Pinctrl on
this should not be the responsibility of the board. This
commit removes CONFIG_PINCTRL from the boards side for nxp boards.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2024-10-15 19:09:45 -04:00
Daniel DeGrasse
d2df15a0e9 drivers: video: video_mcux_smartdma: add SMARTDMA video driver
Add SMARTDMA video driver. This driver uses the SMARTDMA engine as a
parallel camera interface, which can read QVGA frames from a camera
device. Due to SRAM constraints, the video driver divides the camera
stream into multiple horizontal video buffers as it streams them back to
an application.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-10-15 04:10:50 -04:00
Daniel DeGrasse
f386cc26fa drivers: video: ov7670: improve resolution init code
Improve resolution init code for OV7670 driver, to properly program the
full set of registers needed to realize a given output resolution. The
settings for these registers are based on those used in the MCUX SDK
driver, which are derived from the resolution register settings given in
the OV7670 programming guide, with a different configuration for the
CLKSRC and DBLV registers used for the input clock.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-10-15 04:10:50 -04:00
Daniel DeGrasse
561198ac75 drivers: video: handle line_offset field
Since all video drivers in tree use a full frame, their video buffers
will always start at a line_offset of 0 within the frame.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-10-15 04:10:50 -04:00
Daniel DeGrasse
ec6ffc8b33 drivers: video: update video drivers to handle min/max line count
Update existing video drivers to handle the min/max line count field
within the video_caps structure. All drivers work with full frames
currently, so use the special LINE_COUNT_HEIGHT value to indicate this.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-10-15 04:10:50 -04:00
Phi Bang Nguyen
6acad9bd91 include: drivers: video: Remove unused video-controls header
Remove the unnecessary video-controls header included in video.h.
Drivers, applications should explicitly include it when needed.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-11 09:27:38 +02:00
Trung Hieu Le
fc90c9f824 drivers: video: ov5640: Add support for changing frame rate
Add support for changing frame rate

Signed-off-by: Trung Hieu Le <trunghieu.le@nxp.com>
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-10 10:08:09 +02:00
Farah Fliss
863b43be46 drivers: video: ov5640: Add some controls
Add some controls:
- hue
- saturation
- brightness
- contrast
- gain
- hflip
- vflip
- power line frequency filter
- pixel rate (read-only) which is needed for changing frame rate

Signed-off-by: Farah Fliss <farah.fliss@nxp.com>
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-10 10:08:09 +02:00
Phi Bang Nguyen
c1980c2806 drivers: video: ov5640: Add support for test patterns
Add support for 4 test pattern modes:
- Color bar
- Color bar rolling
- Square
- Square rolling

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-10 10:08:09 +02:00
Phi Bang Nguyen
865032103b drivers: video: ov5640: Some minor fixes and optimizations
Add some minor fixes and optimizations:

- Fix coding style
- Rename some variables
- Use the array variable size directly instead of defining a macro

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
Signed-off-by: Trung Hieu Le <trunghieu.le@nxp.com>
2024-10-10 10:08:09 +02:00
Phi Bang Nguyen
ecd4c43026 drivers: video-controls: Rename colorbar to test pattern
Color bar is one type of test patterns. Rename it to
VIDEO_CID_CAMERA_TEST_PATTERN to be more generic.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-10-10 10:08:09 +02:00
Lucas Tamborrino
6c99888bfe drivers: video: esp32: Fix unused variables
Fix build warning for unused variables.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2024-10-01 09:51:46 +02:00
Josuah Demangeon
1596ee0415 drivers: video: gc2145: set_fmt: branch on failure rather than success
This aims to make the code more linear by having the for loop
validates the input format rather than search for a match.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2024-09-28 11:30:08 -05:00
Josuah Demangeon
9174cb75e9 drivers: video: gc2145: return 0 at the end of functions
After the error code is checked to be zero, it is possible to return 0
explicitly to help with readability. Also, when available, forward the
return code from the failing function instead of a locally chosen error
code like -EIO.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2024-09-28 11:30:08 -05:00
Josuah Demangeon
81f5725839 drivers: video: gc2145: check format compatibility before applying
While applying the format, the pixel format and drv_data->fmt were set
immediately, and the resolution was set only if it had a matching
entry on the "caps".

This commit makes sure the requested format matches the caps before
applying the format as well as drv_data->fmt. This does not guards
against partial failure (i.e. only pixelformat set and not
resolution).

Signed-off-by: Josuah Demangeon <me@josuah.net>
2024-09-28 11:30:08 -05:00
Phi Bang Nguyen
16fc8f84fc drivers: video_sw_generator: Add support to change frame rate
Add code to to set / get / enumerate frame rates (intervals).

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-09-24 14:23:56 -05:00
Lucas Tamborrino
43cc36f4bc drivers: video: Add SMH option for video buffer
This commit enables the user to choose whether to
allocate the video buffer from the video heap pool
or use a memory region with specific extra capabilities,
such as being cacheable/non-cacheable or using external
memory.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2024-09-23 18:12:20 -04:00
Felipe Neves
591b7d380b drivers: video: gc2145: add resolution support
Add VGA and QVGA resolution support to enable
usage of gc2145 sensor by smaller ram capable devices.

Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
2024-09-20 15:18:13 -05:00
Felipe Neves
c24e8a3820 drivers: video: gc2145: fixes the prefix
of the compatible driver, use galaxycore
instead of gc.

Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
2024-09-17 20:10:31 -04:00
Armin Kessler
2ba893e0cb drivers: video: esp32s3
Add the missing calls to the sensors`video_stream_start()`
and `video_stream_stop()` functions.

Signed-off-by: Armin Kessler <ake@espros.com>
2024-09-17 17:45:27 +01:00
Felipe Neves
a372220ade video: esp32_dvp: change default log level
to the recent CONFIG_VIDEO_LOG_LEVEL option.

Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
2024-09-16 20:17:26 +02:00
Felipe Neves
35c0cc7bf1 video: gc2145: add GC2145 sensor
support and basic controls.

Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
2024-09-12 13:02:18 -04:00
Armin Kessler
576fc209c4 drivers: video: esp32s3: add support for cam interface
Adding support for the esp32s3 LCD_CAM peripheral.

Signed-off-by: Armin Kessler <ake@espros.com>
2024-09-06 11:26:59 -04:00
Josuah Demangeon
0ac91da3a4 drivers: video: introduce CONFIG_VIDEO_LOG_LEVEL
Zephyr drivers have typically one log level defined per class. The video
drivers were making exception. This adds the missing log level for video
drivers.

Since all headers had to be modified, this also:

- Update the log initialization to the new syntax from 5e34681

- Sort the #include list to something like #41543

Signed-off-by: Josuah Demangeon <me@josuah.net>
2024-09-05 13:11:35 -05:00
Erwan Gouriou
d13f9d9b9b drivers: stm32: Select PINCTRL when required
Select PINCTRL subsystem by drivers which require it.
Prevent the need from enabling this symbol at board or soc level.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2024-09-03 14:40:55 +01:00