snapd icon indicating copy to clipboard operation
snapd copied to clipboard

interfaces: add pwm-control interface

Open zyga opened this issue 2 years ago • 9 comments

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]

zyga avatar Nov 23 '22 17:11 zyga

@degville shall I write a documentation snippet about this interface on the forum?

zyga avatar Nov 23 '22 18:11 zyga

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 avatar Nov 23 '22 19:11 mardy

@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.

zyga avatar Nov 23 '22 20:11 zyga

@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 avatar Nov 24 '22 14:11 degville

@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.

zyga avatar Nov 30 '22 08:11 zyga

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.

zyga avatar Dec 02 '22 19:12 zyga

I'll pick this up mid next week. I have an urgent thing to address outside of the scope of snapd.

zyga avatar Dec 09 '22 18:12 zyga

I still have a few things to do but I will push an update with the new look of the code for possible feedback.

zyga avatar Dec 14 '22 10:12 zyga

This needs re-design to avoid the problem of symlinks and apparmor.

zyga avatar Mar 07 '24 13:03 zyga

I think this can be closed. I don't know how to implement it correctly yet.

zyga avatar May 31 '24 14:05 zyga