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>
Add set_ctrl function API for vertical and horizontal flip control
modifying the camera read mode
Signed-off-by: Jeronimo Agullo <jeronimoagullo97@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>