Lines Matching full:pc
39 struct bcm2835_pwm *pc = to_bcm2835_pwm(chip); in bcm2835_pwm_request() local
42 value = readl(pc->base + PWM_CONTROL); in bcm2835_pwm_request()
45 writel(value, pc->base + PWM_CONTROL); in bcm2835_pwm_request()
52 struct bcm2835_pwm *pc = to_bcm2835_pwm(chip); in bcm2835_pwm_free() local
55 value = readl(pc->base + PWM_CONTROL); in bcm2835_pwm_free()
57 writel(value, pc->base + PWM_CONTROL); in bcm2835_pwm_free()
64 struct bcm2835_pwm *pc = to_bcm2835_pwm(chip); in bcm2835_pwm_apply() local
84 max_period = DIV_ROUND_UP_ULL((u64)U32_MAX * NSEC_PER_SEC + NSEC_PER_SEC / 2, pc->rate) - 1; in bcm2835_pwm_apply()
90 period_cycles = DIV_ROUND_CLOSEST_ULL(state->period * pc->rate, NSEC_PER_SEC); in bcm2835_pwm_apply()
96 writel(period_cycles, pc->base + PERIOD(pwm->hwpwm)); in bcm2835_pwm_apply()
99 val = DIV_ROUND_CLOSEST_ULL(state->duty_cycle * pc->rate, NSEC_PER_SEC); in bcm2835_pwm_apply()
100 writel(val, pc->base + DUTY(pwm->hwpwm)); in bcm2835_pwm_apply()
103 val = readl(pc->base + PWM_CONTROL); in bcm2835_pwm_apply()
116 writel(val, pc->base + PWM_CONTROL); in bcm2835_pwm_apply()
131 struct bcm2835_pwm *pc; in bcm2835_pwm_probe() local
134 chip = devm_pwmchip_alloc(dev, 2, sizeof(*pc)); in bcm2835_pwm_probe()
137 pc = to_bcm2835_pwm(chip); in bcm2835_pwm_probe()
139 pc->base = devm_platform_ioremap_resource(pdev, 0); in bcm2835_pwm_probe()
140 if (IS_ERR(pc->base)) in bcm2835_pwm_probe()
141 return PTR_ERR(pc->base); in bcm2835_pwm_probe()
143 pc->clk = devm_clk_get_enabled(dev, NULL); in bcm2835_pwm_probe()
144 if (IS_ERR(pc->clk)) in bcm2835_pwm_probe()
145 return dev_err_probe(dev, PTR_ERR(pc->clk), in bcm2835_pwm_probe()
148 ret = devm_clk_rate_exclusive_get(dev, pc->clk); in bcm2835_pwm_probe()
153 pc->rate = clk_get_rate(pc->clk); in bcm2835_pwm_probe()
154 if (!pc->rate) in bcm2835_pwm_probe()
161 platform_set_drvdata(pdev, pc); in bcm2835_pwm_probe()
172 struct bcm2835_pwm *pc = dev_get_drvdata(dev); in bcm2835_pwm_suspend() local
174 clk_disable_unprepare(pc->clk); in bcm2835_pwm_suspend()
181 struct bcm2835_pwm *pc = dev_get_drvdata(dev); in bcm2835_pwm_resume() local
183 return clk_prepare_enable(pc->clk); in bcm2835_pwm_resume()