Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

Using PWMs with the sysfs interface

The PWM core sysfs root path is /sys/class/pwm/. It is the user space way to manage PWM devices. Each PWM controller/chip added to the system creates a pwmchipN directory entry under the sysfs root path, where N is the base of the PWM chip. The directory contains the following files:

  • npwm: This is a read-only file, printing the number of PWM channels that the chip supports
  • Export: This is a write-only file, allowing you to export a PWM channel for use with sysfs (this functionality is equivalent to the GPIO sysfs interface)
  • Unexport: This unexports a PWM channel from sysfs (write-only)

The PWM channels are numbered using an index from 0 to pwm<n-1>. These numbers are local to the chip. Each PWM channel ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content