-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
drivers: video: Introduce macro to deal with endpoints #73023
base: main
Are you sure you want to change the base?
Conversation
This needs testing after #72950 is merged. |
7bc3a35
to
3fb4e4f
Compare
Looks promising, would it make sense to have in/out type encoded/described? |
3fb4e4f
to
e23a258
Compare
I picked the first nibble to encode a custom field that will say either "IN" or "OUT" or "EITHER" or "NONE", which is showcased here: |
e23a258
to
bcddde7
Compare
This allows to reference individual endpoint through the video interface, while also allowing the "catch-all" generic enums. This defines semantics for each fields, helping driver developers know precisely how to implement every filter. Signed-off-by: Josuah Demangeon <me@josuah.net>
Apply the semantics defined in <zephyr/drivers/video.h> for specifying the endpoint so that the user can pass either the endpoint number either a generic placeholder (_ANY or _OUT). Signed-off-by: Josuah Demangeon <me@josuah.net>
bcddde7
to
5f1e281
Compare
This allows referring to one particular interface more easily from the application or drivers definitions. The generated endpoint ID is extracted from the address: the reg property from the devicetree, and encodes information about the port direction. Signed-off-by: Josuah Demangeon <me@josuah.net>
This is now rebased on top of #73009. |
@josuah : I will need sometimes to look at this closer. But does this resolve the "circular dependency" and the "chicken-egg" init order issues or this is just APIs to deal with endpoints ? So, my questions
|
With these, can we obtain a reference to the video object pointed by the remote-endpoint so that we don't need to use direct phandle references in DT (currently this method is used extensively in Zephyr) ? Yes, the various The driver would still have to do something like this to follow the remote endpoint, and then call video_dt_spec on that:
Maybe a If so, how do you handle the case that the "remote" video object is not available yet (due to the init order priority) ? As an example, the CSI driver needs to initialize before the mt9m114 camera sensor driver to provide the master clock for the sensor. But in the CSI driver, we need to obtain a reference to the mt9m114 sensor (to propagate formats, etc.) An application connecting two video ports might also face this problem, so maybe the solution is in the samples: The calls that could be recursive (get/set feed parameters, and data movement) are set from application, after everything is initialized. Is there a chance that recursive calls (get data/controls from this device that gets data/controls from this device [...]) happens during initialization? One alternative would be to have an extra ports / endpoints / remote-endpoints are not only limit to video, they are used for display and other things too. Why don't we put these things in the zephyr core instead of the video subsystem ? This makes more sense as you said. And it looks like the "ports / port / endpoint / remote-endpoint" logic is even encoded into the devicetree tool itself: |
This is part of a series of proposals for incremental changes for the Video API:
This depends on:
It introduces some way to point at devicetree objects and use them in the API.
It assumes that endpoint numbers can be passed where
enum video_endpoint_id ep
is present through the API.Example:
It is then possible to refer
vid0port0out
like this: