PWM APIs

This topic provides details for the PWM APIs.

pwmchip_add

Synopsis
int pwmchip_add(struct pwm_chip *chip)
Description Registers a new PWM chip.
Parameter
  • chip: The PWM chip to register
Return
  • Success: 0
  • Failure: Error code

pwm_get

Synopsis
struct pwm_device *pwm_get(struct device *dev, const char *con_id)
Description Looks up and requests a PWM device.
Parameter
  • dev: The device for the PWM consumer
  • con_id: The consumer ID (name)
Return
  • Success: The pointer to the requested PWM device
  • Failure: Error code

pwm_put

Synopsis
void pwm_put(struct pwm_device *pwm)
Description Releases a PWM device.
Parameter
  • pwm: The PWM device to release
Return None

pwm_apply_state

Synopsis
int pwm_apply_state(struct pwm_device *pwm, const struct pwm_state *state)
Description Applies a new state to a PWM device atomically.
Parameter
  • pwm: The PWM device to release
  • state: The The new state to apply to the PWM device.
Return
  • Success: 0
  • Failure: Error code