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
197 pwm_chip = devm_kzalloc(&pdev->dev, sizeof(*pwm_chip), GFP_KERNEL); in hibvt_pwm_probe()
198 if (pwm_chip == NULL) in hibvt_pwm_probe()
201 pwm_chip->clk = devm_clk_get(&pdev->dev, NULL); in hibvt_pwm_probe()
202 if (IS_ERR(pwm_chip->clk)) { in hibvt_pwm_probe()
204 PTR_ERR(pwm_chip->clk)); in hibvt_pwm_probe()
205 return PTR_ERR(pwm_chip->clk); in hibvt_pwm_probe()
208 pwm_chip->chip.ops = &hibvt_pwm_ops; in hibvt_pwm_probe()
209 pwm_chip->chip.dev = &pdev->dev; in hibvt_pwm_probe()
210 pwm_chip->chip.base = -1; in hibvt_pwm_probe()
211 pwm_chip->chip.npwm = soc->num_pwms; in hibvt_pwm_probe()
212 pwm_chip->chip.of_xlate = of_pwm_xlate_with_flags; in hibvt_pwm_probe()
213 pwm_chip->chip.of_pwm_n_cells = 3; in hibvt_pwm_probe()
214 pwm_chip->soc = soc; in hibvt_pwm_probe()
217 pwm_chip->base = devm_ioremap_resource(&pdev->dev, res); in hibvt_pwm_probe()
218 if (IS_ERR(pwm_chip->base)) in hibvt_pwm_probe()
219 return PTR_ERR(pwm_chip->base); in hibvt_pwm_probe()
221 ret = clk_prepare_enable(pwm_chip->clk); in hibvt_pwm_probe()
225 pwm_chip->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); in hibvt_pwm_probe()
226 if (IS_ERR(pwm_chip->rstc)) { in hibvt_pwm_probe()
227 clk_disable_unprepare(pwm_chip->clk); in hibvt_pwm_probe()
228 return PTR_ERR(pwm_chip->rstc); in hibvt_pwm_probe()
231 reset_control_assert(pwm_chip->rstc); in hibvt_pwm_probe()
233 reset_control_deassert(pwm_chip->rstc); in hibvt_pwm_probe()
235 ret = pwmchip_add(&pwm_chip->chip); in hibvt_pwm_probe()
237 clk_disable_unprepare(pwm_chip->clk); in hibvt_pwm_probe()
241 for (i = 0; i < pwm_chip->chip.npwm; i++) { in hibvt_pwm_probe()
242 hibvt_pwm_set_bits(pwm_chip->base, PWM_CTRL_ADDR(i), in hibvt_pwm_probe()
246 platform_set_drvdata(pdev, pwm_chip); in hibvt_pwm_probe()
253 struct hibvt_pwm_chip *pwm_chip; in hibvt_pwm_remove() local
255 pwm_chip = platform_get_drvdata(pdev); in hibvt_pwm_remove()
257 reset_control_assert(pwm_chip->rstc); in hibvt_pwm_remove()
259 reset_control_deassert(pwm_chip->rstc); in hibvt_pwm_remove()
261 clk_disable_unprepare(pwm_chip->clk); in hibvt_pwm_remove()
263 return pwmchip_remove(&pwm_chip->chip); in hibvt_pwm_remove()