-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Description
Is your feature request related to a problem? Please describe.
Recently a generic module appeared (onoff service) which fits into clock management (for limited devices) where multiple sources (clients) want to control state of the clock (service). However, currently there is no way to use that API on clock device without extending clock control API and community is reluctant to extend API's like that and expect to get mechanism which will allow to use device with external API.
Another, similar case appeared in SPI and I2C where new extension to the API which adds transaction support is discarded (#22371) because "transaction manager should become a generic module". Yet still there is no mechanism to use it with a device.
Describe the solution you'd like
I would like to see an API which will allow user to use another API (but supported by given device) as it cannot be used directly:
struct device *dev = get_device_binding(DEV_NAME);
struct onoff_client cli;
err = onoff_request(???, cli);
Something like:
struct device *dev = get_device_binding(DEV_NAME);
struct onoff_client cli;
struct onoff_service *srv = device_get_onoff_service(dev); /* Missing part */
if (srv == NULL) {
//onoff service not supported by the device
return;
}
err = onoff_request(srv, cli);
Solution should:
- take into consideration that multiple API's can be supported by a device
- perfomance
- memory constraints
To be checked it device specific API extensions (https://docs.zephyrproject.org/latest/reference/drivers/index.html#device-specific-api-extensions) could be used.
Alternative proposal #22409.