Commit Graph
2 Commits
Author SHA1 Message Date
Lee Jones 1a366fe915 pwm: sysfs: Add PWM capture support
Allow a user to read PWM capture results from sysfs. To start a capture
and read the result, simply read the file:

  $ cat $PWMCHIP/capture

The output format is "<period> <duty cycle>".

Signed-off-by: Lee Jones <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
2016-06-10 16:01:40 +02:00
H Hartley Sweeten 76abbdde2d pwm: Add sysfs interface
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

Based on work by Lars Poeschel.

Signed-off-by: H Hartley Sweeten <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Lars Poeschel <[email protected]>
Cc: Ryan Mallon <[email protected]>
Cc: Rob Landley <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
2013-06-21 11:32:51 +02:00