Skip to content

drivers: video: Migrate ov7670 and smartdma to use video interfaces binding #88323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ nxp_8080_touch_panel_i2c: &flexcomm2_lpi2c2 {
reset-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
pwdn-gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>;
reg = <0x21>;

port {
ov7670_ep_out: endpoint {
remote-endpoint-label = "sdma_ep_in";
};
};
};
};

Expand All @@ -112,10 +118,15 @@ nxp_8080_touch_panel_i2c: &flexcomm2_lpi2c2 {
compatible = "nxp,video-smartdma";
pinctrl-0 = <&pinmux_smartdma_camera>;
pinctrl-names = "default";
sensor = <&ov7670>;
vsync-pin = <4>;
hsync-pin = <11>;
pclk-pin = <5>;

port {
sdma_ep_in: endpoint {
remote-endpoint-label = "ov7670_ep_out";
};
};
};
};

Expand Down
4 changes: 2 additions & 2 deletions drivers/video/video_mcux_smartdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,13 @@ static DEVICE_API(video, nxp_video_sdma_api) = {
.flush = nxp_video_sdma_flush
};

#define SOURCE_DEV(inst) DEVICE_DT_GET(DT_INST_PHANDLE(inst, sensor))
#define SOURCE_DEV(inst) DEVICE_DT_GET(DT_NODE_REMOTE_DEVICE(DT_INST_ENDPOINT_BY_ID(inst, 0, 0)))

#define NXP_VIDEO_SDMA_INIT(inst) \
PINCTRL_DT_INST_DEFINE(inst); \
const struct nxp_video_sdma_config sdma_config_##inst = { \
.dma_dev = DEVICE_DT_GET(DT_INST_PARENT(inst)), \
.sensor_dev = SOURCE_DEV(n), \
.sensor_dev = SOURCE_DEV(inst), \
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \
.vsync_pin = DT_INST_PROP(inst, vsync_pin), \
.hsync_pin = DT_INST_PROP(inst, hsync_pin), \
Expand Down
8 changes: 4 additions & 4 deletions dts/bindings/video/nxp,video-smartdma.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ compatible: "nxp,video-smartdma"
include: [base.yaml, pinctrl-device.yaml]

properties:
sensor:
required: true
type: phandle
description: phandle of connected sensor device
vsync-pin:
required: true
type: int
Expand All @@ -27,3 +23,7 @@ properties:
type: int
description: |
GPIO0 pin index to use for PCLK input. Only pins 0-15 may be used.

child-binding:
child-binding:
include: video-interfaces.yaml
4 changes: 4 additions & 0 deletions dts/bindings/video/ovti,ov7670.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ properties:
receives this as an active high signal

include: i2c-device.yaml

child-binding:
child-binding:
include: video-interfaces.yaml
3 changes: 0 additions & 3 deletions samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=40000
CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=2
# Workaround for issue where SDMA driver needs to start before camera, so that
# clock output will be generated for camera device
CONFIG_CHECK_INIT_PRIORITIES=n
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright 2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*
* Names in this file should be chosen in a way that won't conflict
* with real-world devicetree nodes, to allow these tests to run on
* (and be extended to test) real hardware.
*/

#include <zephyr/dt-bindings/video/video-interfaces.h>

/ {
test {
#address-cells = <1>;
#size-cells = <1>;

test_gpio: gpio@deadbeef {
compatible = "vnd,gpio";
gpio-controller;
reg = <0xdeadbeef 0x1000>;
#gpio-cells = <0x2>;
};

test_flexcomm7_lpi2c7: lpi2c@11112222 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "nxp,lpi2c";
reg = <0x11112222 0x1000>;
clocks = <&syscon MCUX_FLEXCOMM7_CLK>;
clock-frequency = <I2C_BITRATE_STANDARD>;
test_ov7670: ov7670@1 {
compatible = "ovti,ov7670";
reset-gpios = <&test_gpio 19 GPIO_ACTIVE_HIGH>;
pwdn-gpios = <&test_gpio 18 GPIO_ACTIVE_HIGH>;
reg = <0x1>;

port {
test_ov7670_ep_out: endpoint {
remote-endpoint-label = "test_sdma_ep_in";
};
};
};
};

test_smartdma: smartdma@22223333 {
compatible = "nxp,smartdma";
reg = <0x22223333 0x1000>;
interrupt-parent = <&nvic>;
interrupts = <0 0>;
program-mem = <0x4000000>;
#dma-cells = <0>;
test_video_sdma: video-sdma {
compatible = "nxp,video-smartdma";
pinctrl-0 = <&pinmux_smartdma_camera>;
pinctrl-names = "default";
vsync-pin = <4>;
hsync-pin = <11>;
pclk-pin = <5>;

port {
test_sdma_ep_in: endpoint {
remote-endpoint-label = "test_ov7670_ep_out";
};
};
};
};
};
};
3 changes: 3 additions & 0 deletions tests/drivers/build_all/video/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ tests:
platform_allow:
- mimxrt1170_evk/mimxrt1176/cm7
- mimxrt1170_evk@B/mimxrt1176/cm7
drivers.video.mcux_smartdma.build:
platform_allow:
- frdm_mcxn947/mcxn947/cpu0