The PWM consumer interface
The consumer is the device that actually uses PWM channels. A PWM channel is represented in the kernel as an instance of the struct pwm_device
structure:
struct pwm_device { const char *label; unsigned long flags; unsigned int hwpwm; unsigned int pwm; struct pwm_chip *chip; void *chip_data; unsigned int period; /* in nanoseconds */ unsigned int duty_cycle; /* in nanoseconds */ enum pwm_polarity polarity; };
label
: This is the name of the PWM deviceflags
: This represents the flags associated with the PWM devicehwpw
: This is a relative index of the PWM device, local to the chippwm
: This is the system global index of the PWM devicechip
: This is a PWM chip, the controller providing the PWM devicechip_data
: This is chip-private data associated with the PWM device
From kernel v4.7, the structure has changed to:
struct pwm_device { const char *label; unsigned long flags; unsigned int hwpwm; unsigned int pwm; struct...