Scroll to navigation

STRUCT PWM_OPS(9) Pulse-Width Modulation (PWM) STRUCT PWM_OPS(9)

NAME

struct_pwm_ops - PWM controller operations

SYNOPSIS

struct pwm_ops {
  int (* request) (struct pwm_chip *chip, struct pwm_device *pwm);
  void (* free) (struct pwm_chip *chip, struct pwm_device *pwm);
  int (* config) (struct pwm_chip *chip, struct pwm_device *pwm,int duty_ns, int period_ns);
  int (* set_polarity) (struct pwm_chip *chip, struct pwm_device *pwm,enum pwm_polarity polarity);
  int (* capture) (struct pwm_chip *chip, struct pwm_device *pwm,struct pwm_capture *result, unsigned long timeout);
  int (* enable) (struct pwm_chip *chip, struct pwm_device *pwm);
  void (* disable) (struct pwm_chip *chip, struct pwm_device *pwm);
  int (* apply) (struct pwm_chip *chip, struct pwm_device *pwm,struct pwm_state *state);
  void (* get_state) (struct pwm_chip *chip, struct pwm_device *pwm,struct pwm_state *state);
#ifdef CONFIG_DEBUG_FS
  void (* dbg_show) (struct pwm_chip *chip, struct seq_file *s);
#endif
  struct module * owner;
};  

MEMBERS

request
optional hook for requesting a PWM
free
optional hook for freeing a PWM
config
configure duty cycles and period length for this PWM
set_polarity
configure the polarity of this PWM
capture
capture and report PWM signal
enable
enable PWM output toggling
disable
disable PWM output toggling
apply
atomically apply a new PWM config. The state argument should be adjusted with the real hardware config (if the approximate the period or duty_cycle value, state should reflect it)
get_state
get the current PWM state. This function is only called once per PWM device when the PWM chip is registered.
dbg_show
optional routine to show contents in debugfs
owner
helps prevent removal of modules exporting active PWMs

COPYRIGHT

January 2017 Kernel Hackers Manual 4.8.