Lines Matching refs:pwm

32 #define TWL4030_PWM_TOGGLE(pwm, x)	((x) << (pwm))  argument
46 #define TWL6030_PWM_TOGGLE(pwm, x) ((x) << (pwm * 3)) argument
60 static int twl_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, in twl_pwm_config() argument
83 base = pwm->hwpwm * 3; in twl_pwm_config()
89 dev_err(chip->dev, "%s: Failed to configure PWM\n", pwm->label); in twl_pwm_config()
94 static int twl4030_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) in twl4030_pwm_enable() argument
103 dev_err(chip->dev, "%s: Failed to read GPBR1\n", pwm->label); in twl4030_pwm_enable()
107 val |= TWL4030_PWM_TOGGLE(pwm->hwpwm, TWL4030_PWMXCLK_ENABLE); in twl4030_pwm_enable()
111 dev_err(chip->dev, "%s: Failed to enable PWM\n", pwm->label); in twl4030_pwm_enable()
113 val |= TWL4030_PWM_TOGGLE(pwm->hwpwm, TWL4030_PWMX_ENABLE); in twl4030_pwm_enable()
117 dev_err(chip->dev, "%s: Failed to enable PWM\n", pwm->label); in twl4030_pwm_enable()
124 static void twl4030_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) in twl4030_pwm_disable() argument
133 dev_err(chip->dev, "%s: Failed to read GPBR1\n", pwm->label); in twl4030_pwm_disable()
137 val &= ~TWL4030_PWM_TOGGLE(pwm->hwpwm, TWL4030_PWMX_ENABLE); in twl4030_pwm_disable()
141 dev_err(chip->dev, "%s: Failed to disable PWM\n", pwm->label); in twl4030_pwm_disable()
143 val &= ~TWL4030_PWM_TOGGLE(pwm->hwpwm, TWL4030_PWMXCLK_ENABLE); in twl4030_pwm_disable()
147 dev_err(chip->dev, "%s: Failed to disable PWM\n", pwm->label); in twl4030_pwm_disable()
153 static int twl4030_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) in twl4030_pwm_request() argument
159 if (pwm->hwpwm == 1) { in twl4030_pwm_request()
170 dev_err(chip->dev, "%s: Failed to read PMBR1\n", pwm->label); in twl4030_pwm_request()
184 dev_err(chip->dev, "%s: Failed to request PWM\n", pwm->label); in twl4030_pwm_request()
191 static void twl4030_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) in twl4030_pwm_free() argument
197 if (pwm->hwpwm == 1) in twl4030_pwm_free()
205 dev_err(chip->dev, "%s: Failed to read PMBR1\n", pwm->label); in twl4030_pwm_free()
215 dev_err(chip->dev, "%s: Failed to free PWM\n", pwm->label); in twl4030_pwm_free()
221 static int twl6030_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) in twl6030_pwm_enable() argument
229 val |= TWL6030_PWM_TOGGLE(pwm->hwpwm, TWL6030_PWMXS | TWL6030_PWMXEN); in twl6030_pwm_enable()
230 val &= ~TWL6030_PWM_TOGGLE(pwm->hwpwm, TWL6030_PWMXR); in twl6030_pwm_enable()
234 dev_err(chip->dev, "%s: Failed to enable PWM\n", pwm->label); in twl6030_pwm_enable()
244 static void twl6030_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) in twl6030_pwm_disable() argument
252 val |= TWL6030_PWM_TOGGLE(pwm->hwpwm, TWL6030_PWMXR); in twl6030_pwm_disable()
253 val &= ~TWL6030_PWM_TOGGLE(pwm->hwpwm, TWL6030_PWMXS | TWL6030_PWMXEN); in twl6030_pwm_disable()
257 dev_err(chip->dev, "%s: Failed to disable PWM\n", pwm->label); in twl6030_pwm_disable()
261 val |= TWL6030_PWM_TOGGLE(pwm->hwpwm, TWL6030_PWMXEN); in twl6030_pwm_disable()
265 dev_err(chip->dev, "%s: Failed to disable PWM\n", pwm->label); in twl6030_pwm_disable()
269 val &= ~TWL6030_PWM_TOGGLE(pwm->hwpwm, TWL6030_PWMXEN); in twl6030_pwm_disable()
273 dev_err(chip->dev, "%s: Failed to disable PWM\n", pwm->label); in twl6030_pwm_disable()
282 static int twl4030_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, in twl4030_pwm_apply() argument
291 if (pwm->state.enabled) in twl4030_pwm_apply()
292 twl4030_pwm_disable(chip, pwm); in twl4030_pwm_apply()
297 err = twl_pwm_config(pwm->chip, pwm, state->duty_cycle, state->period); in twl4030_pwm_apply()
301 if (!pwm->state.enabled) in twl4030_pwm_apply()
302 err = twl4030_pwm_enable(chip, pwm); in twl4030_pwm_apply()
307 static int twl6030_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, in twl6030_pwm_apply() argument
316 if (pwm->state.enabled) in twl6030_pwm_apply()
317 twl6030_pwm_disable(chip, pwm); in twl6030_pwm_apply()
322 err = twl_pwm_config(pwm->chip, pwm, state->duty_cycle, state->period); in twl6030_pwm_apply()
326 if (!pwm->state.enabled) in twl6030_pwm_apply()
327 err = twl6030_pwm_enable(chip, pwm); in twl6030_pwm_apply()