• Home
  • Raw
  • Download

Lines Matching refs:pwm

37 static inline u32 pwm_lpss_read(const struct pwm_device *pwm)  in pwm_lpss_read()  argument
39 struct pwm_lpss_chip *lpwm = to_lpwm(pwm->chip); in pwm_lpss_read()
41 return readl(lpwm->regs + pwm->hwpwm * PWM_SIZE + PWM); in pwm_lpss_read()
44 static inline void pwm_lpss_write(const struct pwm_device *pwm, u32 value) in pwm_lpss_write() argument
46 struct pwm_lpss_chip *lpwm = to_lpwm(pwm->chip); in pwm_lpss_write()
48 writel(value, lpwm->regs + pwm->hwpwm * PWM_SIZE + PWM); in pwm_lpss_write()
51 static int pwm_lpss_wait_for_update(struct pwm_device *pwm) in pwm_lpss_wait_for_update() argument
53 struct pwm_lpss_chip *lpwm = to_lpwm(pwm->chip); in pwm_lpss_wait_for_update()
54 const void __iomem *addr = lpwm->regs + pwm->hwpwm * PWM_SIZE + PWM; in pwm_lpss_wait_for_update()
72 dev_err(pwm->chip->dev, "PWM_SW_UPDATE was not cleared\n"); in pwm_lpss_wait_for_update()
77 static inline int pwm_lpss_is_updating(struct pwm_device *pwm) in pwm_lpss_is_updating() argument
79 return (pwm_lpss_read(pwm) & PWM_SW_UPDATE) ? -EBUSY : 0; in pwm_lpss_is_updating()
82 static void pwm_lpss_prepare(struct pwm_lpss_chip *lpwm, struct pwm_device *pwm, in pwm_lpss_prepare() argument
107 ctrl = pwm_lpss_read(pwm); in pwm_lpss_prepare()
113 pwm_lpss_write(pwm, ctrl); in pwm_lpss_prepare()
114 pwm_lpss_write(pwm, ctrl | PWM_SW_UPDATE); in pwm_lpss_prepare()
117 static inline void pwm_lpss_cond_enable(struct pwm_device *pwm, bool cond) in pwm_lpss_cond_enable() argument
120 pwm_lpss_write(pwm, pwm_lpss_read(pwm) | PWM_ENABLE); in pwm_lpss_cond_enable()
124 struct pwm_device *pwm, in pwm_lpss_prepare_enable() argument
129 ret = pwm_lpss_is_updating(pwm); in pwm_lpss_prepare_enable()
133 pwm_lpss_prepare(lpwm, pwm, state->duty_cycle, state->period); in pwm_lpss_prepare_enable()
134 pwm_lpss_cond_enable(pwm, lpwm->info->bypass == false); in pwm_lpss_prepare_enable()
135 ret = pwm_lpss_wait_for_update(pwm); in pwm_lpss_prepare_enable()
139 pwm_lpss_cond_enable(pwm, lpwm->info->bypass == true); in pwm_lpss_prepare_enable()
143 static int pwm_lpss_apply(struct pwm_chip *chip, struct pwm_device *pwm, in pwm_lpss_apply() argument
150 if (!pwm_is_enabled(pwm)) { in pwm_lpss_apply()
152 ret = pwm_lpss_prepare_enable(lpwm, pwm, state); in pwm_lpss_apply()
156 ret = pwm_lpss_prepare_enable(lpwm, pwm, state); in pwm_lpss_apply()
158 } else if (pwm_is_enabled(pwm)) { in pwm_lpss_apply()
159 pwm_lpss_write(pwm, pwm_lpss_read(pwm) & ~PWM_ENABLE); in pwm_lpss_apply()
166 static void pwm_lpss_get_state(struct pwm_chip *chip, struct pwm_device *pwm, in pwm_lpss_get_state() argument
178 ctrl = pwm_lpss_read(pwm); in pwm_lpss_get_state()