Lines Matching refs:stmpe_pwm
28 struct stmpe_pwm { struct
34 static inline struct stmpe_pwm *to_stmpe_pwm(struct pwm_chip *chip) in to_stmpe_pwm() argument
36 return container_of(chip, struct stmpe_pwm, chip); in to_stmpe_pwm()
41 struct stmpe_pwm *stmpe_pwm = to_stmpe_pwm(chip); in stmpe_24xx_pwm_enable() local
45 ret = stmpe_reg_read(stmpe_pwm->stmpe, STMPE24XX_PWMCS); in stmpe_24xx_pwm_enable()
54 ret = stmpe_reg_write(stmpe_pwm->stmpe, STMPE24XX_PWMCS, value); in stmpe_24xx_pwm_enable()
67 struct stmpe_pwm *stmpe_pwm = to_stmpe_pwm(chip); in stmpe_24xx_pwm_disable() local
71 ret = stmpe_reg_read(stmpe_pwm->stmpe, STMPE24XX_PWMCS); in stmpe_24xx_pwm_disable()
80 ret = stmpe_reg_write(stmpe_pwm->stmpe, STMPE24XX_PWMCS, value); in stmpe_24xx_pwm_disable()
101 struct stmpe_pwm *stmpe_pwm = to_stmpe_pwm(chip); in stmpe_24xx_pwm_config() local
121 if (stmpe_pwm->stmpe->partnum == STMPE2401 || in stmpe_24xx_pwm_config()
122 stmpe_pwm->stmpe->partnum == STMPE2403) in stmpe_24xx_pwm_config()
125 ret = stmpe_set_altfunc(stmpe_pwm->stmpe, BIT(pin), in stmpe_24xx_pwm_config()
157 if (stmpe_pwm->stmpe->partnum == STMPE2401) in stmpe_24xx_pwm_config()
160 if (stmpe_pwm->stmpe->partnum == STMPE2403) in stmpe_24xx_pwm_config()
163 stmpe_pwm->last_duty = 0x00; in stmpe_24xx_pwm_config()
165 if (stmpe_pwm->stmpe->partnum == STMPE2401) in stmpe_24xx_pwm_config()
168 if (stmpe_pwm->stmpe->partnum == STMPE2403) in stmpe_24xx_pwm_config()
171 stmpe_pwm->last_duty = 0xff; in stmpe_24xx_pwm_config()
173 u8 value, last = stmpe_pwm->last_duty; in stmpe_24xx_pwm_config()
197 } else if (stmpe_pwm->stmpe->partnum == STMPE2403) { in stmpe_24xx_pwm_config()
201 } else if (stmpe_pwm->stmpe->partnum == STMPE2401) { in stmpe_24xx_pwm_config()
223 stmpe_pwm->last_duty = value; in stmpe_24xx_pwm_config()
234 ret = stmpe_reg_write(stmpe_pwm->stmpe, offset, value); in stmpe_24xx_pwm_config()
243 ret = stmpe_reg_write(stmpe_pwm->stmpe, offset, value); in stmpe_24xx_pwm_config()
296 struct stmpe_pwm *stmpe_pwm; in stmpe_pwm_probe() local
299 stmpe_pwm = devm_kzalloc(&pdev->dev, sizeof(*stmpe_pwm), GFP_KERNEL); in stmpe_pwm_probe()
300 if (!stmpe_pwm) in stmpe_pwm_probe()
303 stmpe_pwm->stmpe = stmpe; in stmpe_pwm_probe()
304 stmpe_pwm->chip.dev = &pdev->dev; in stmpe_pwm_probe()
307 stmpe_pwm->chip.ops = &stmpe_24xx_pwm_ops; in stmpe_pwm_probe()
308 stmpe_pwm->chip.npwm = 3; in stmpe_pwm_probe()
322 ret = pwmchip_add(&stmpe_pwm->chip); in stmpe_pwm_probe()