Lines Matching refs:pwm
48 static unsigned int clps711x_get_duty(struct pwm_device *pwm, unsigned int v) in clps711x_get_duty() argument
51 return DIV_ROUND_CLOSEST(v * 0xf, pwm_get_period(pwm)); in clps711x_get_duty()
54 static int clps711x_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) in clps711x_pwm_request() argument
63 pwm_set_period(pwm, DIV_ROUND_CLOSEST(NSEC_PER_SEC, freq)); in clps711x_pwm_request()
68 static int clps711x_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, in clps711x_pwm_config() argument
74 if (period_ns != pwm_get_period(pwm)) in clps711x_pwm_config()
77 duty = clps711x_get_duty(pwm, duty_ns); in clps711x_pwm_config()
78 clps711x_pwm_update_val(priv, pwm->hwpwm, duty); in clps711x_pwm_config()
83 static int clps711x_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) in clps711x_pwm_enable() argument
88 duty = clps711x_get_duty(pwm, pwm_get_duty_cycle(pwm)); in clps711x_pwm_enable()
89 clps711x_pwm_update_val(priv, pwm->hwpwm, duty); in clps711x_pwm_enable()
94 static void clps711x_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) in clps711x_pwm_disable() argument
98 clps711x_pwm_update_val(priv, pwm->hwpwm, 0); in clps711x_pwm_disable()