Lines Matching refs:pwm
8 * This driver is a complete rewrite of the former pwm-twl6030.c authorded by:
31 #include <linux/pwm.h>
69 static int twl4030_pwmled_config(struct pwm_chip *chip, struct pwm_device *pwm,
92 base = pwm->hwpwm * 2 + TWL4030_PWMA_REG;
98 dev_err(pwmchip_parent(chip), "%s: Failed to configure PWM\n", pwm->label);
103 static int twl4030_pwmled_enable(struct pwm_chip *chip, struct pwm_device *pwm)
110 dev_err(pwmchip_parent(chip), "%s: Failed to read LEDEN\n", pwm->label);
114 val |= TWL4030_LED_TOGGLE(pwm->hwpwm, TWL4030_LED_PINS);
118 dev_err(pwmchip_parent(chip), "%s: Failed to enable PWM\n", pwm->label);
124 struct pwm_device *pwm)
131 dev_err(pwmchip_parent(chip), "%s: Failed to read LEDEN\n", pwm->label);
135 val &= ~TWL4030_LED_TOGGLE(pwm->hwpwm, TWL4030_LED_PINS);
139 dev_err(pwmchip_parent(chip), "%s: Failed to disable PWM\n", pwm->label);
142 static int twl4030_pwmled_apply(struct pwm_chip *chip, struct pwm_device *pwm,
151 if (pwm->state.enabled)
152 twl4030_pwmled_disable(chip, pwm);
159 * pwm->state.period && state->duty_cycle == pwm->state.duty_cycle
162 * pwm->state might not be configured in hardware.
164 ret = twl4030_pwmled_config(chip, pwm,
169 if (!pwm->state.enabled)
170 ret = twl4030_pwmled_enable(chip, pwm);
180 static int twl6030_pwmled_config(struct pwm_chip *chip, struct pwm_device *pwm,
192 dev_err(pwmchip_parent(chip), "%s: Failed to configure PWM\n", pwm->label);
197 static int twl6030_pwmled_enable(struct pwm_chip *chip, struct pwm_device *pwm)
205 pwm->label);
214 dev_err(pwmchip_parent(chip), "%s: Failed to enable PWM\n", pwm->label);
220 struct pwm_device *pwm)
228 pwm->label);
237 dev_err(pwmchip_parent(chip), "%s: Failed to disable PWM\n", pwm->label);
240 static int twl6030_pwmled_apply(struct pwm_chip *chip, struct pwm_device *pwm,
245 if (state->polarity != pwm->state.polarity)
249 if (pwm->state.enabled)
250 twl6030_pwmled_disable(chip, pwm);
255 err = twl6030_pwmled_config(chip, pwm,
260 if (!pwm->state.enabled)
261 err = twl6030_pwmled_enable(chip, pwm);
266 static int twl6030_pwmled_request(struct pwm_chip *chip, struct pwm_device *pwm)
274 pwm->label);
283 dev_err(pwmchip_parent(chip), "%s: Failed to request PWM\n", pwm->label);
288 static void twl6030_pwmled_free(struct pwm_chip *chip, struct pwm_device *pwm)
296 pwm->label);
305 dev_err(pwmchip_parent(chip), "%s: Failed to free PWM\n", pwm->label);