Commit graph

17 commits

Author SHA1 Message Date
Phi Bang Nguyen
2b46cc0b78 drivers: video: Introduce video device structure
Introduce a new video device structure representing a device in a
video pipeline. Each video device embeds a pointer to its "source"
device and other "video" characteristics.

This structure give the video framework an access to all video features
of the device and a hierachical view of the video pipeline that the
device belongs to.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-04-21 20:03:31 +02:00
Josuah Demangeon
5e799193fc drivers: video: gc2145: Add Chip ID 0x2145
The Chip ID field of the GC2145 was assumed to be 0x2155, but sensors
with Chip ID 0x2145 are still present. Rework how chip IDs verification
is done slightly and add support for both.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-04-02 05:30:19 +02:00
Ibrahim Abdalkader
b887cc4db5 drivers: video: gc2145: Fix video_format_cap array.
video_format_cap needs to be terminated with a NULL entry
to allow looping over the formats.

Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
2025-03-12 02:28:40 +01:00
Ibrahim Abdalkader
e6c5f4d6aa drivers: video: gc2145: Fix output format.
- Fix analog mode register address.
- Fix output format register update.

Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
2025-02-12 12:24:03 +01:00
Phi Bang Nguyen
b341d9d6a4 video: Merge video_stream_start/stop driver APIs
The video_stream_start/stop() APIs are counter-symetric and have
the same function signature. Also, the implementation logic for
those driver APIs is generally the same. Merge them to save memory
and code lines.

For the sake of simplicity, still keep the user APIs to preserve
backward compatibility with downstream applications.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2025-02-11 07:43:58 +01:00
Benjamin Cabé
3f81c69b2b drivers: gc2145: fix integer underflow in retry logic
Properly stop retrying instead of underflowing uint8_t
fixes CID-487682 and CID-487631

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-01-28 23:43:21 +01:00
Ibrahim Abdalkader
2924a99cd1 drivers: video: gc2145: Add support for YUV format.
Can be used to get a fast grayscale image.

Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
2025-01-27 11:02:44 +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
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
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
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
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
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
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