Commit graph

76 commits

Author SHA1 Message Date
Phi Bang Nguyen ba1565b46d drivers: video: csi: Rename sensor to source
The CSI can connect to either a camera sensor (as on i.MX RT10xx) or
a MIPI CSI-2 receiver (as on i.MX RT11xx). To be generic, change the
naming from sensor to source.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-05-14 20:23:15 -04:00
Phi Bang Nguyen 249159f531 drivers: video: csi: Drop pixel format config
The pixel format config is not used in the low level driver. Drop it.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-05-10 18:09:44 -04:00
Phi Bang Nguyen 46eb7e2b65 drivers: video: csi: Fix get_fmt
The CSI should always propagate the get_fmt request down to the sensor.
It should not return a format by it own unless it contains a test
pattern generator inside it.

The problem with the legacy code is that this code snippet is never
reached if the sensor could return a format. In case the sensor failed
to return a format, these codes are reached but the returned format
makes no sense and its value was not initialized.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-05-10 18:09:44 -04:00
Phi Bang Nguyen 1a40d1fd5a drivers: video: csi: Run clang format
Run clang format before making any changes

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-05-10 18:09:44 -04:00
Phi Bang Nguyen f621407d50 modules: mcux: Drop HAS_MCUX_CSI config
The HAS_MCUX_CSI (as well as all the HAS_MCUX_XXX) config was obsolete
and has been replaced by the DT_HAS_NXP_IMX_CSI_ENABLED (i.e.
DT_HAS_XXX_ENABLED). Drop it as well as all the dependencies on it.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-05-10 18:09:44 -04:00
Charles Dias bdd4e61a25 drivers: video: Add support for STM32 DCMI
Add Kconfig, DCMI driver, Yaml, and CMakeLists files

Signed-off-by: Charles Dias <charlesdias.cd@outlook.com>
2024-05-06 14:54:35 +01:00
Charles Dias fa19161527 drivers: video: ov2640: add clock rate control property
Add Clock Rate Control property to OV2640 CMOS video sensor

Signed-off-by: Charles Dias <charlesdias.cd@outlook.com>
2024-05-01 00:14:18 +02:00
Phi Bang Nguyen de29ffb033 drivers: video_common: Add aligned allocation API
For some hardwares, it is very common that some aligment on the allocated
memory is required. For example, the PxP and eLCDIF of NXP require aligned
buffers so that their performances can be optimal.

Add a new video_buffer_aligned_alloc() API for these needs.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-04-25 17:58:57 -04:00
Phi Bang Nguyen 64ca263bfd drivers: video: mt9m114: Rework to support more resolutions
Currently, the driver supports only VGA resolution while 480x272 is
needed to match with the display resolution on i.MX RT10XX family.

Also, the current framerate is very low, about 3-4 fps without doing
anything else with the image buffers (just discarding them).

Rework the driver to address the low framerate issue as well as to add
support for 480x272 and 1280x720 resolutions.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-03-26 16:16:52 -04:00
Phi Bang Nguyen f17f1d67f8 drivers: video: mt9m114: Drop unused stuffs
Drop unused register macros and coherently use major letters for
register address.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-03-26 16:16:52 -04:00
Phi Bang Nguyen c0d52e4837 drivers: video: mt9m114: Run clang format
Run clang format before making any changes

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-03-26 16:16:52 -04:00
Phi Bang Nguyen 4b8d3dbed8 drivers: video: sw_generator: Fix set_format
Add code to handle invalid formats when setting format

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-03-15 08:52:13 +01:00
Phi Bang Nguyen d1275f7fde drivers: video: sw_generator: Support XRGB32 pixel format
Add support for XRGB32 pixel format as this is useful to test camera
and display drivers on i.MX RT11xx

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-03-15 08:52:13 +01:00
Phi Bang Nguyen cd2d987e82 drivers: video: sw_generator: Fix minor macro usage
VIDEO_PATTERN_FPS should be coherently used across the entire code file.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-03-15 08:52:13 +01:00
Phi Bang Nguyen 8967236756 drivers: video: sw_generator: Fix stream_start return value
The stream_start() callback needs to return 0 for success. However, to
indicate work has been successfully scheduled, k_work_schedule() could
return either 0 (already scheduled) or 1 (newly scheduled).

Due to this issue, the sw_generator could not start streaming. Fix it.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-02-29 11:52:58 +00:00
Phi Bang Nguyen e1ade02b2b drivers: video: sw_generator: Run clang-format
Run clang-format on the file to fix indentation before making any changes

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-02-29 11:52:58 +00:00
Nick Ward 2d65acca3a drivers: gpio: use gpio_is_ready_dt helper function
Update `struct gpio_dt_spec` use with gpio_is_ready_dt()

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-08-28 08:48:35 -05:00
Fabio Baltieri 20e7c6db6c video: mcux_csi: set a dedicated init priority for video_mcux_csi
Set a dedicated priority for the video_mcux_csi instead of using the
default kernel device init priority. This allows initializing the device
in a sequence that matches the devicetree hirearchy compared to mt9m114.

Fixes the error:

ERROR: /soc/csi@402bc000 POST_KERNEL 50 <
	/soc/i2c@403f0000/mt9m114@48 POST_KERNEL 60

found using:

$ west build -p -b mimxrt1064_evk samples/subsys/video/capture \
		-DCONFIG_CHECK_INIT_PRIORITIES=y

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-19 18:00:20 +00:00
Jeronimo Agullo e64129d910 video: mt9m114: YUV pixel format support
Added YUV pixel support to mt9m114 camera

Signed-off-by: Jeronimo Agullo <jeronimoagullo97@gmail.com>
2023-05-19 15:45:50 +02:00
Michele Balistreri f87313bf0f drivers: video: change initialization order of CSI and cameras
video_mcux_csi_init, which setups the CSI pins (i.e: calls
pinctrl_apply_state) was called after mt9m114_init which tries to do i2c
communication with the camera to read the chip id. But since one of the
CSI pins is the camera master clock, doing things in this order won't
work. This PR inverts the order in which the devices are initialized.

Signed-off-by: Michele Balistreri <michele@bitgamma.com>
2023-05-17 15:08:31 -05:00
Henrik Brix Andersen c41dd36de2 drivers: kconfig: unify menuconfig title strings
Unify the drivers/*/Kconfig menuconfig title strings to the format
"<class> [(acronym)] [bus] drivers".

Including both the full name of the driver class and an acronym makes
menuconfig more user friendly as some of the acronyms are less well-known
than others. It also improves Kconfig search, both via menuconfig and via
the generated Kconfig documentation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-28 15:06:06 +02:00
Andrei Emeltchenko c626070ae6 drivers: mt9m114: Fix value type
Fixes value type conversion from uint16_t to uint32_t.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-14 15:12:22 +00:00
Gerard Marull-Paretas 178bdc4afc include: add missing zephyr/irq.h include
Change automated searching for files using "IRQ_CONNECT()" API not
including <zephyr/irq.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-17 22:57:39 +09:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Kumar Gala baaf904885 video: Move to using select in Kconfig for I2C bus
Move to using select I2C' instead of 'depends on'
(see commit df81fef944 for more
 details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-14 09:05:36 -05:00
Kumar Gala f6013818ec drivers: video: Update drivers to use devicetree Kconfig symbol
Update video drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 09:39:49 -07:00
Kumar Gala 0b5b74da82 drivers: video: video_mcux_csi: Use phandle for devicetree sensor ref
Replace sensor_label property in devicetree with just a sensor phandle
property.  This is more generic and allows driver to use DEVICE_DT_GET
instead of device_get_binding.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:27 +02:00
Kumar Gala 927d6b620d video: ov2640: cleanup unused struct fields
When we moved to gpio_dt_spec forgot to remove the older
fields used for gpio related access.  Remove them as they
are used by the driver anymore.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-06 10:50:01 +02:00
Kumar Gala d200321767 video: mcux_csi: Set driver Kconfig default based on devicetree
Change Kconfig default to be based on if the devicetree has the
nxp,imx-csi driver enabled.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 14:56:33 -05:00
Kumar Gala 51c7777529 drivers: video: ov2640: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:39:37 +00:00
Kumar Gala 32d27153ba drivers: video: ov2640: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:39:37 +00:00
Kumar Gala 745752a374 drivers: video: ov7725: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:39:20 +00:00
Kumar Gala 0d245c90ef drivers: video: ov7725: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:39:20 +00:00
Kumar Gala d29c8a45ff drivers: video: mt9m114: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:38:55 +00:00
Tom Burdick 88ca215eed i2c: Update API terminology
Updates the API and types to match updated I2C terminology. Replaces master
with controller and slave with target.

Updates all drivers to match the changed macros, types, and API signatures.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-06-29 17:51:31 +02:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Daniel DeGrasse 108188312d drivers: video: video_mcux_csi: enable pinctrl
Enable pinctrl for mcux_csi video driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Nazar Kazakov f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Nazar Kazakov 9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Gerard Marull-Paretas 01430da395 drivers: video: ov2640: remove deprecated PM macro
Use NULL if no PM is available.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Robert Szczepanski 55e3c732d0 drivers: video: ov2640: add driver for ov2640 image sensor
This adds the driver for Omnivision OV2640 image sensor.

The driver provides support for 10 different resolutions in range from
160x120 to 1600x1200 in both JPEG and RGB565 pixel formats. There are
also mutliple configuration options, e.g. hflip, vflip, saturation and
brightness control.

Signed-off-by: Robert Szczepanski <rszczepanski@antmicro.com>
2021-08-17 09:18:38 -04:00
Gerard Marull-Paretas 8b79a7ec6e drivers: video: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:39 -04:00
Loic Poulain fd777c39ad drivers: video: sw_generator: Fix missing parameter
k_work_cancel_delayable_sync requires a second parameter for state
synchronization.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2021-04-10 07:52:30 -04:00
Loic Poulain ffd3d42569 drivers: video: Conversion of k_work API
Replace deprecated API with the recommended alternative.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2021-04-09 11:55:59 -04:00
Frank Li e80506b754 drivers: video: ov7725: add sensor driver for ov7725
This patch adds the driver for Omnivision OV7725
Color CMOS VGA Sensor.

The driver currently provides a simple capture
function, the output format only provides
RGB565,640x480.

Signed-off-by: Frank Li <lgl88911@163.com>
2021-01-06 08:33:38 -06:00
Kumar Gala 19ecf1f19f drivers: video: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:00:43 -05:00
Kumar Gala f3a33b4fdc drivers: video: Convert drivers to new DT device macros
Convert video drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-16 12:18:02 -05:00
Peter Bigot 54d8c40340 drivers: video_common: fix build errors on mimxrt1064_evk
Add a missing keyword in a variable declaration and correct the type
in a missed declaration.  Also use a more appropriate upper bound in a
loop.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-15 11:22:22 +01:00
Jacob Siverskog 393e9d4a28 drivers: video: fix potential NULL pointer dereference
this bug was introduced when transitioning to k_heap usage.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2020-12-11 08:18:42 -06:00
Andy Ross fcd392f6ce kernel: subsys: lib: drivers: Use k_heap instead of z_mem_pool wrappers
Use the core k_heap API pervasively within our tree instead of the
z_mem_pool wrapper that provided compatibility with the older mempool
implementation.

Almost all of this is straightforward swapping of one alloc/free call
for another.  In a few cases where code was holding onto an old-style
"mem_block" a local compatibility struct with a single field has been
swapped in to keep the invasiveness of the changes down.

Note that not all the relevant changes in this patch have in-tree test
coverage, though I validated that it all builds.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-07 21:50:14 -05:00