Skip to content

video: dcmi: add endpoint usage in dcmi & update dma property in dtsi #89627

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 11 commits into from
May 14, 2025
Merged
74 changes: 9 additions & 65 deletions dts/bindings/video/st,stm32-dcmi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,21 @@ description: |

&dcmi {
status = "okay";
sensor = <&ov2640>;
pinctrl-0 = <&dcmi_hsync_pa4 &dcmi_pixclk_pa6 &dcmi_vsync_pb7
&dcmi_d0_pc6 &dcmi_d1_pc7 &dcmi_d2_pe0 &dcmi_d3_pe1
&dcmi_d4_pe4 &dcmi_d5_pd3 &dcmi_d6_pe5 &dcmi_d7_pe6>;
pinctrl-names = "default";
bus-width = <8>;
hsync-active = <0>;
vsync-active = <0>;
pixelclk-active = <1>;
capture-rate = <1>;
Copy link
Contributor

@ngphibang ngphibang May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems analogy with the camera framerate ? Would you support of changing framerate with the video API after removing this propperty ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I only removed it from the example, it is still present in the bindings itself. However it is optional and within the driver I took care of having DT_PROP_OR with a default to 1, aka no frame skip. So since this is the default (and actually quite natural), I thought it is simply not necessary to mention it here.

Regarding the already started work, sorry, I wasn't aware about it hence I did that. Sure I can add the remaining bits within the build_all tests.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I just had a look at the PR #85452 now so I understand better your point. The DCMI IP is actually capable of frame dropping. The capture-rate mentioned here is actually more like a drop rate. 1 means keep 1/1 frames (aka all), 2 means keep 1 frame out of 2 and 4 would mean keep 1 frame out of 4.
So, basically, it would be possible to map this on the framerate API by first checking the framerate up the pipeline to figure out (if possible) the source framerate (might have to go quite far there might be a bridge or so in the middle), and then compute the rate between the framerate expected by the caller compared to the framerate of the source. Not an impossible thing. I can give it a shot, however again, I will only be able to blindly check it since I don't have currently a working setup with the DCMI on it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @avolmat-st. Thanks for your contribution.

@ngphibang, it's ok for me to continue with this PR instead of #85452. :-)

I tested this PR with the west build -p -b stm32h7b3i_dk --shield st_b_cams_omv_mb1683 samples/drivers/video/capture_to_lvgl/ and worked!

dmas = <&dma1 0 75 (STM32_DMA_PERIPH_TO_MEMORY | STM32_DMA_PERIPH_NO_INC |
STM32_DMA_MEM_INC | STM32_DMA_PERIPH_8BITS | STM32_DMA_MEM_32BITS |
STM32_DMA_PRIORITY_HIGH) STM32_DMA_FIFO_1_4>;

port {
dcmi_ep_in: endpoint {
remote-endpoint = <&ov2640_ep_out>;
remote-endpoint-label = "ov2640_ep_out";
bus-width = <8>;
hsync-active = <0>;
vsync-active = <0>;
pclk-sample = <1>;
};
};
};
Expand All @@ -40,64 +38,6 @@ properties:
interrupts:
required: true

sensor:
required: true
type: phandle
description: phandle of connected sensor device

bus-width:
type: int
required: true
enum:
- 8
- 10
- 12
- 14
default: 8
description: |
Number of data lines actively used, valid for the parallel busses.

hsync-active:
type: int
required: true
enum:
- 0
- 1
description: |
Polarity of horizontal synchronization (DCMI_HSYNC_Polarity).
0 Horizontal synchronization active Low.
1 Horizontal synchronization active High.

For example, if DCMI_HSYNC_Polarity is programmed active high:
When HSYNC is low, the data is valid.
When HSYNC is high, the data is not valid (horizontal blanking).

vsync-active:
type: int
required: true
enum:
- 0
- 1
description: |
Polarity of vertical synchronization (DCMI_VSYNC_Polarity).
0 Vertical synchronization active Low.
1 Vertical synchronization active High.

For example, if DCMI_VSYNC_Polarity is programmed active high:
When VSYNC is low, the data is valid.
When VSYNC is high, the data is not valid (vertical blanking).

pixelclk-active:
type: int
required: true
enum:
- 0
- 1
description: |
Polarity of pixel clock (DCMI_PIXCK_Polarity).
0 Pixel clock active on Falling edge.
1 Pixel clock active on Rising edge.

capture-rate:
type: int
enum:
Expand All @@ -122,3 +62,7 @@ properties:
dmas = <&dma1 0 75 (STM32_DMA_PERIPH_TO_MEMORY | STM32_DMA_PERIPH_NO_INC |
STM32_DMA_MEM_INC | STM32_DMA_PERIPH_8BITS | STM32_DMA_MEM_32BITS |
STM32_DMA_PRIORITY_HIGH) STM32_DMA_FIFO_1_4>;

child-binding:
child-binding:
include: video-interfaces.yaml