Chapter 13. Pulse-Width Modulation (PWM)

Table of Contents

enum pwm_polarity — polarity of a PWM signal
struct pwm_args — board-dependent PWM arguments
struct pwm_device — PWM channel object
pwm_get_state — retrieve the current PWM state
struct pwm_ops — PWM controller operations
struct pwm_chip — abstract a PWM controller
pwm_config — change a PWM device configuration
pwm_set_polarity — configure the polarity of a PWM signal
pwm_enable — start a PWM output toggling
pwm_disable — stop a PWM output toggling
pwm_set_chip_data — set private chip data for a PWM
pwm_get_chip_data — get private chip data for a PWM
pwmchip_add_with_polarity — register a new PWM chip
pwmchip_add — register a new PWM chip
pwmchip_remove — remove a PWM chip
pwm_request — request a PWM device
pwm_request_from_chip — request a PWM device relative to a PWM chip
pwm_free — free a PWM device
pwm_apply_state — atomically apply a new state to a PWM device
pwm_adjust_config — adjust the current PWM config to the PWM arguments
of_pwm_get — request a PWM via the PWM framework
pwm_get — look up and request a PWM device
pwm_put — release a PWM device
devm_pwm_get resource managed pwm_get
devm_of_pwm_get resource managed of_pwm_get
devm_pwm_put resource managed pwm_put
pwm_can_sleep — report whether PWM access will sleep

Pulse-width modulation is a modulation technique primarily used to control power supplied to electrical devices.

The PWM framework provides an abstraction for providers and consumers of PWM signals. A controller that provides one or more PWM signals is registered as struct pwm_chip. Providers are expected to embed this structure in a driver-specific structure. This structure contains fields that describe a particular chip.

A chip exposes one or more PWM signal sources, each of which exposed as a struct pwm_device. Operations can be performed on PWM devices to control the period, duty cycle, polarity and active state of the signal.

Note that PWM devices are exclusive resources: they can always only be used by one consumer at a time.