-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
video: dcmi: add endpoint usage in dcmi & update dma property in dtsi #89627
Conversation
Sadly I do not have the HW to test it right now so I have only been able to compile test it. Could someone having those setup perform a sanity check that I didn't broke anything ? |
fd75c83
to
1edadce
Compare
cc @CharlesDias so that he is aware of this to avoid duplicate work. I think part of this has been started in #85452 but this one is more complete. Could you add an overlay and test case in video's build_all tests as well so that the DCMI driver can get in the CI (#85178) ? Thanks ! |
hsync-active = <0>; | ||
vsync-active = <0>; | ||
pixelclk-active = <1>; | ||
capture-rate = <1>; |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
frmival set/get/enum support added and simply tested using a stm32l4r9i using the video shell. Last commit adds a testcase within test/drivers/build_all/video in order to test build the dcmi. For that purpose I am using one of the board and its shield so that dcmi get enabled and thus build. I ran this with twister and it seems to build, however couldn't figure out how to see the full log and really ensure that dcmi get enabled in this configuration. @ngphibang is that what you were expecting regarding the testcase ? I saw that in case of the NXP board there is an overlay within the build_all folder, it seems to me that if really shield get enabled then it should be enough to enable the build of the driver no ? |
Yes, the driver get built by just adding the shield as an extra args in the test case as you did (if we have only one The NXP's case is a bit different. We have CSI which is common on 2 platforms, and if I remember well, when I did:
It didn't get built because "platform" is not taken into account. I didn't know why. Another reason is that I see this in the
So, I supposed that for CI testing, we should declare "fake" nodes to avoid conflicting with real-world device tree node, and so, should not use the real shield (?). So, to simplify things for two above reasons, I made the overlay. I am not expert in test, so if you find some thing, I am willing to learn. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very nice to me ! Thank you for doing the migration of the driver.
Waiting for your finding on the build_all video test (to see if overlay is the right thing to do or the simple extra args).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
Update the bindings of the stm32-dcmi driver rely on properties described within the endpoints and already detailed within the video-interfaces.yaml. With that, several properties located at the node root are now moved into the port / endpoint: sensor -> endpoint: remote-endpoint-label vsync-active -> endpoint: vsync-active hsync-active -> endpoint: hsync-active pixelclk-active -> endpoint: pclk-sample bus-width -> endpoint: bus-width Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Perform sensor interface properties parsing based on values retrieved via the endpoint rather than the root of the node. Use DT_PROP_OR to ensure proper configuration of optional settings. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Update overlay following usage of video-interfaces based endpoint properties by the dcmi driver. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Update overlay following usage of video-interfaces based endpoint properties by the dcmi driver. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Update overlay following usage of video-interfaces based endpoint properties by the dcmi driver. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Usage of dma is mandatory for the dcmi and this property is tightly coupled with the soc itself since the configuration of the dma depends on the source/destination, and the request line is also fixed for an ip. Instead of having to always have the dma property part of the board or shield dts/overlay, add the dma property into the dcmi node of the stm32h7.dtsi. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
With the addition of the dma property within the soc dtsi, it is no more necessary to add it within the board dts. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
This commit mainly correct the get/set format handling and how DCMI format is stored within the driver. struct video_format within the data structure is used to store the format. Reworked way to handle get format to avoid calling the sensor set_fmt whenever performing the get_fmt. Slightly adjusted code to as much as possible reuse return values provided by functions. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Implement the video API frame interval handling in order to control the framerate of capture. This allow to remove the capture-rate DT property as well. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Add a testcase for building the stm32 dcmi driver on all currently supported platforms / shields. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
1de5a6a
to
9f4fc29
Compare
PR rebased to correct merge conflict |
Add note regarding the move of the video/dcmi driver to the usage of endpoint based video-interfaces bindings. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
9f4fc29
to
dba3ba4
Compare
migration-guide message formatting update. |
|
This PR update the DCMI driver / bindings and all users of this driver in order to rely on the video-interfaces bindings rather that having its own properties.
In a second step, considering that the DMA settings are closely linked to the IP itself and the way it is connected internally, I propose to move the dma property from within the board dts into the dtsi so that each board / shield overlay do not have to copy again the same property. As a matter of fact the dcmi driver is also setting most of the DMA settings from within the driver itself.