Lines Matching refs:ip
57 static void iproc_pwmc_enable(struct iproc_pwmc *ip, unsigned int channel) in iproc_pwmc_enable() argument
61 value = readl(ip->base + IPROC_PWM_CTRL_OFFSET); in iproc_pwmc_enable()
63 writel(value, ip->base + IPROC_PWM_CTRL_OFFSET); in iproc_pwmc_enable()
69 static void iproc_pwmc_disable(struct iproc_pwmc *ip, unsigned int channel) in iproc_pwmc_disable() argument
73 value = readl(ip->base + IPROC_PWM_CTRL_OFFSET); in iproc_pwmc_disable()
75 writel(value, ip->base + IPROC_PWM_CTRL_OFFSET); in iproc_pwmc_disable()
84 struct iproc_pwmc *ip = to_iproc_pwmc(chip); in iproc_pwmc_get_state() local
88 value = readl(ip->base + IPROC_PWM_CTRL_OFFSET); in iproc_pwmc_get_state()
100 rate = clk_get_rate(ip->clk); in iproc_pwmc_get_state()
107 value = readl(ip->base + IPROC_PWM_PRESCALE_OFFSET); in iproc_pwmc_get_state()
113 value = readl(ip->base + IPROC_PWM_PERIOD_OFFSET(pwm->hwpwm)); in iproc_pwmc_get_state()
117 value = readl(ip->base + IPROC_PWM_DUTY_CYCLE_OFFSET(pwm->hwpwm)); in iproc_pwmc_get_state()
126 struct iproc_pwmc *ip = to_iproc_pwmc(chip); in iproc_pwmc_apply() local
130 rate = clk_get_rate(ip->clk); in iproc_pwmc_apply()
163 iproc_pwmc_disable(ip, pwm->hwpwm); in iproc_pwmc_apply()
166 value = readl(ip->base + IPROC_PWM_PRESCALE_OFFSET); in iproc_pwmc_apply()
169 writel(value, ip->base + IPROC_PWM_PRESCALE_OFFSET); in iproc_pwmc_apply()
172 writel(period, ip->base + IPROC_PWM_PERIOD_OFFSET(pwm->hwpwm)); in iproc_pwmc_apply()
173 writel(duty, ip->base + IPROC_PWM_DUTY_CYCLE_OFFSET(pwm->hwpwm)); in iproc_pwmc_apply()
176 value = readl(ip->base + IPROC_PWM_CTRL_OFFSET); in iproc_pwmc_apply()
183 writel(value, ip->base + IPROC_PWM_CTRL_OFFSET); in iproc_pwmc_apply()
186 iproc_pwmc_enable(ip, pwm->hwpwm); in iproc_pwmc_apply()
199 struct iproc_pwmc *ip; in iproc_pwmc_probe() local
204 ip = devm_kzalloc(&pdev->dev, sizeof(*ip), GFP_KERNEL); in iproc_pwmc_probe()
205 if (!ip) in iproc_pwmc_probe()
208 platform_set_drvdata(pdev, ip); in iproc_pwmc_probe()
210 ip->chip.dev = &pdev->dev; in iproc_pwmc_probe()
211 ip->chip.ops = &iproc_pwm_ops; in iproc_pwmc_probe()
212 ip->chip.npwm = 4; in iproc_pwmc_probe()
214 ip->base = devm_platform_ioremap_resource(pdev, 0); in iproc_pwmc_probe()
215 if (IS_ERR(ip->base)) in iproc_pwmc_probe()
216 return PTR_ERR(ip->base); in iproc_pwmc_probe()
218 ip->clk = devm_clk_get(&pdev->dev, NULL); in iproc_pwmc_probe()
219 if (IS_ERR(ip->clk)) { in iproc_pwmc_probe()
221 PTR_ERR(ip->clk)); in iproc_pwmc_probe()
222 return PTR_ERR(ip->clk); in iproc_pwmc_probe()
225 ret = clk_prepare_enable(ip->clk); in iproc_pwmc_probe()
232 value = readl(ip->base + IPROC_PWM_CTRL_OFFSET); in iproc_pwmc_probe()
234 for (i = 0; i < ip->chip.npwm; i++) { in iproc_pwmc_probe()
239 writel(value, ip->base + IPROC_PWM_CTRL_OFFSET); in iproc_pwmc_probe()
241 ret = pwmchip_add(&ip->chip); in iproc_pwmc_probe()
244 clk_disable_unprepare(ip->clk); in iproc_pwmc_probe()
252 struct iproc_pwmc *ip = platform_get_drvdata(pdev); in iproc_pwmc_remove() local
254 pwmchip_remove(&ip->chip); in iproc_pwmc_remove()
256 clk_disable_unprepare(ip->clk); in iproc_pwmc_remove()