snapd
snapd copied to clipboard
interfaces: add pwm-control interface
The pwm-control interface is similar in spirit to the gpio-control interface, allowing access to any and all pulse-width-modulation channels.
The interface is equally privileged. The only difference as compared to GPIO control is the set of permissions granted. Those are modeled after the kernel documentation referenced from a code comment.
Signed-off-by: Zygmunt Krynicki [email protected]
@degville shall I write a documentation snippet about this interface on the forum?
I just had a quick look, and my main question is what are the cases that the existing pwm interface does not cover. I see that that interface is for a single pwm per plug, but one could specify mode plugs if one needs more than one PWM. Then indeed, unless I'm mistaken, with this new interface one could enumerate and access all pwms in the system without an a priori knowledge of how many of them there are, whereas in the other interface one would just get what one asks for.
@mardy the relation between the (so far missing) pwm-control and pwm is the same as between gpio-contrl (existing) and gpio. It mainly depends on how the application was written to being with. If the app is in control of PWM on the system and wants to manage it manually, you need a -control style interface.
@degville shall I write a documentation snippet about this interface on the forum?
Yes please! I'll edit it there if needed. I think it's great to see usernames attached to the work they're responsible for.
@degville shall I write a documentation snippet about this interface on the forum?
Yes please! I'll edit it there if needed. I think it's great to see usernames attached to the work they're responsible for.
I've created https://forum.snapcraft.io/t/the-pwm-control-interface/32908 based on the documentation of the gpio-control interface.
I think both interfaces could use some technical details. I'll do another round of proposed updates to those threads to see what you think @degville
EDIT: I think the sort of thing now present on under the "developer details" section of the PWM interface is what I was thinking of.
Please hold on with merging this. I had to apply one more change for this to really work.
I totally missed the fact that sysfs is full of symlinks. I made a change that looks almost identical to what pwm does, just with a glob. I'll clean it up and send for re-review.
I'll pick this up mid next week. I have an urgent thing to address outside of the scope of snapd.
I still have a few things to do but I will push an update with the new look of the code for possible feedback.
This needs re-design to avoid the problem of symlinks and apparmor.
I think this can be closed. I don't know how to implement it correctly yet.