diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi index 3ebc13c0e9a99..6867b44d27809 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi @@ -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"; + }; + }; }; }; @@ -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"; + }; + }; }; }; diff --git a/drivers/video/video_mcux_smartdma.c b/drivers/video/video_mcux_smartdma.c index d9388b0951d65..bf624ecb47a18 100644 --- a/drivers/video/video_mcux_smartdma.c +++ b/drivers/video/video_mcux_smartdma.c @@ -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), \ diff --git a/dts/bindings/video/nxp,video-smartdma.yaml b/dts/bindings/video/nxp,video-smartdma.yaml index 5312f2b3bc377..0ae3d4386634c 100644 --- a/dts/bindings/video/nxp,video-smartdma.yaml +++ b/dts/bindings/video/nxp,video-smartdma.yaml @@ -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 @@ -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 diff --git a/dts/bindings/video/ovti,ov7670.yaml b/dts/bindings/video/ovti,ov7670.yaml index 4b8fa88f1170b..01ddc98493013 100644 --- a/dts/bindings/video/ovti,ov7670.yaml +++ b/dts/bindings/video/ovti,ov7670.yaml @@ -18,3 +18,7 @@ properties: receives this as an active high signal include: i2c-device.yaml + +child-binding: + child-binding: + include: video-interfaces.yaml diff --git a/samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.conf b/samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.conf index 4a604bc267ef2..2302ba1e88b9c 100644 --- a/samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.conf +++ b/samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.conf @@ -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 diff --git a/tests/drivers/build_all/video/boards/frdm_mcxn947_mcxn947_cpu0.overlay b/tests/drivers/build_all/video/boards/frdm_mcxn947_mcxn947_cpu0.overlay new file mode 100644 index 0000000000000..eb5c47dd3bd17 --- /dev/null +++ b/tests/drivers/build_all/video/boards/frdm_mcxn947_mcxn947_cpu0.overlay @@ -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 + +/ { + 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 = ; + 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"; + }; + }; + }; + }; + }; +}; diff --git a/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay b/tests/drivers/build_all/video/boards/mimxrt1170_evk_mimxrt1176_cm7.overlay similarity index 100% rename from tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay rename to tests/drivers/build_all/video/boards/mimxrt1170_evk_mimxrt1176_cm7.overlay diff --git a/tests/drivers/build_all/video/testcase.yaml b/tests/drivers/build_all/video/testcase.yaml index 88160e8721b17..57e74e801686e 100644 --- a/tests/drivers/build_all/video/testcase.yaml +++ b/tests/drivers/build_all/video/testcase.yaml @@ -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