On Tue, Jun 11, 2013 at 10:38:59AM -0700, H Hartley Sweeten wrote: > Add a simple sysfs interface to the generic PWM framework. > > /sys/class/pwm/ > `-- pwmchipN/ for each PWM chip > |-- export (w/o) ask the kernel to export a PWM channel > |-- npwm (r/o) number of PWM channels in this PWM chip > |-- pwmX/ for each exported PWM channel > | |-- duty_cycle (r/w) duty cycle (in nanoseconds) > | |-- enable (r/w) enable/disable PWM > | |-- period (r/w) period (in nanoseconds) > | `-- polarity (r/w) polarity of PWM (normal/inversed) > `-- unexport (w/o) return a PWM channel to the kernel > > Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> > Cc: Thierry Reding <thierry.reding@xxxxxxxxx> > Cc: Lars Poeschel <poeschel@xxxxxxxxxxx> > Cc: Ryan Mallon <rmallon@xxxxxxxxx> > Cc: Rob Landley <rob@xxxxxxxxxxx> > --- > v5: * rename the 'duty' attribute to 'duty_cycle' > * make the Kconfig option hidden and enabled when CONFIG_SYSFS > is enabled > * use sysfs_streq() in pwm_polarity_store() > v4: * address a number of issues pointed out by Thierry Reding > - fix some typos and wording issues in the Documentation > - rename the new source file to sysfs.c > - rename some of the variables in sysfs.c to clarify them > - fix the period store so it does not change the duty cycle > - change the polarity attribute to use a string representation > - add a warning message is the pwmchip_sysfs_export() fails > v3: * fix an issue with the export/unexport of the PWM chip > v2: * add API documentation and update Documentation/pwm.txt > * fix some issues pointed out by Ryan Mallon > * add the pwm attributes to dev.groups so they are created > when the device is registered for the exported PWM > v1: * Based on previous work by Lars Poecshel Applied, thanks. Thierry
Attachment:
pgp_WxDlB08SZ.pgp
Description: PGP signature