Lines Matching refs:pwm_chip
36 struct pwm_chip chip;
66 static inline struct hibvt_pwm_chip *to_hibvt_pwm_chip(struct pwm_chip *chip) in to_hibvt_pwm_chip()
83 static void hibvt_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) in hibvt_pwm_enable()
91 static void hibvt_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) in hibvt_pwm_disable()
99 static void hibvt_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, in hibvt_pwm_config()
117 static void hibvt_pwm_set_polarity(struct pwm_chip *chip, in hibvt_pwm_set_polarity()
131 static void hibvt_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, in hibvt_pwm_get_state()
151 static int hibvt_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, in hibvt_pwm_apply()
192 struct hibvt_pwm_chip *pwm_chip; in hibvt_pwm_probe() local
195 pwm_chip = devm_kzalloc(&pdev->dev, sizeof(*pwm_chip), GFP_KERNEL); in hibvt_pwm_probe()
196 if (pwm_chip == NULL) in hibvt_pwm_probe()
199 pwm_chip->clk = devm_clk_get(&pdev->dev, NULL); in hibvt_pwm_probe()
200 if (IS_ERR(pwm_chip->clk)) { in hibvt_pwm_probe()
202 PTR_ERR(pwm_chip->clk)); in hibvt_pwm_probe()
203 return PTR_ERR(pwm_chip->clk); in hibvt_pwm_probe()
206 pwm_chip->chip.ops = &hibvt_pwm_ops; in hibvt_pwm_probe()
207 pwm_chip->chip.dev = &pdev->dev; in hibvt_pwm_probe()
208 pwm_chip->chip.npwm = soc->num_pwms; in hibvt_pwm_probe()
209 pwm_chip->soc = soc; in hibvt_pwm_probe()
211 pwm_chip->base = devm_platform_ioremap_resource(pdev, 0); in hibvt_pwm_probe()
212 if (IS_ERR(pwm_chip->base)) in hibvt_pwm_probe()
213 return PTR_ERR(pwm_chip->base); in hibvt_pwm_probe()
215 ret = clk_prepare_enable(pwm_chip->clk); in hibvt_pwm_probe()
219 pwm_chip->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); in hibvt_pwm_probe()
220 if (IS_ERR(pwm_chip->rstc)) { in hibvt_pwm_probe()
221 clk_disable_unprepare(pwm_chip->clk); in hibvt_pwm_probe()
222 return PTR_ERR(pwm_chip->rstc); in hibvt_pwm_probe()
225 reset_control_assert(pwm_chip->rstc); in hibvt_pwm_probe()
227 reset_control_deassert(pwm_chip->rstc); in hibvt_pwm_probe()
229 ret = pwmchip_add(&pwm_chip->chip); in hibvt_pwm_probe()
231 clk_disable_unprepare(pwm_chip->clk); in hibvt_pwm_probe()
235 for (i = 0; i < pwm_chip->chip.npwm; i++) { in hibvt_pwm_probe()
236 hibvt_pwm_set_bits(pwm_chip->base, PWM_CTRL_ADDR(i), in hibvt_pwm_probe()
240 platform_set_drvdata(pdev, pwm_chip); in hibvt_pwm_probe()
247 struct hibvt_pwm_chip *pwm_chip; in hibvt_pwm_remove() local
249 pwm_chip = platform_get_drvdata(pdev); in hibvt_pwm_remove()
251 pwmchip_remove(&pwm_chip->chip); in hibvt_pwm_remove()
253 reset_control_assert(pwm_chip->rstc); in hibvt_pwm_remove()
255 reset_control_deassert(pwm_chip->rstc); in hibvt_pwm_remove()
257 clk_disable_unprepare(pwm_chip->clk); in hibvt_pwm_remove()