Lines Matching refs:pc
40 struct bcm2835_pwm *pc = to_bcm2835_pwm(chip); in bcm2835_pwm_request() local
43 value = readl(pc->base + PWM_CONTROL); in bcm2835_pwm_request()
46 writel(value, pc->base + PWM_CONTROL); in bcm2835_pwm_request()
53 struct bcm2835_pwm *pc = to_bcm2835_pwm(chip); in bcm2835_pwm_free() local
56 value = readl(pc->base + PWM_CONTROL); in bcm2835_pwm_free()
58 writel(value, pc->base + PWM_CONTROL); in bcm2835_pwm_free()
65 struct bcm2835_pwm *pc = to_bcm2835_pwm(chip); in bcm2835_pwm_apply() local
66 unsigned long rate = clk_get_rate(pc->clk); in bcm2835_pwm_apply()
73 dev_err(pc->dev, "failed to get clock rate\n"); in bcm2835_pwm_apply()
103 writel(period_cycles, pc->base + PERIOD(pwm->hwpwm)); in bcm2835_pwm_apply()
107 writel(val, pc->base + DUTY(pwm->hwpwm)); in bcm2835_pwm_apply()
110 val = readl(pc->base + PWM_CONTROL); in bcm2835_pwm_apply()
123 writel(val, pc->base + PWM_CONTROL); in bcm2835_pwm_apply()
137 struct bcm2835_pwm *pc; in bcm2835_pwm_probe() local
140 pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL); in bcm2835_pwm_probe()
141 if (!pc) in bcm2835_pwm_probe()
144 pc->dev = &pdev->dev; in bcm2835_pwm_probe()
146 pc->base = devm_platform_ioremap_resource(pdev, 0); in bcm2835_pwm_probe()
147 if (IS_ERR(pc->base)) in bcm2835_pwm_probe()
148 return PTR_ERR(pc->base); in bcm2835_pwm_probe()
150 pc->clk = devm_clk_get(&pdev->dev, NULL); in bcm2835_pwm_probe()
151 if (IS_ERR(pc->clk)) in bcm2835_pwm_probe()
152 return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk), in bcm2835_pwm_probe()
155 ret = clk_prepare_enable(pc->clk); in bcm2835_pwm_probe()
159 pc->chip.dev = &pdev->dev; in bcm2835_pwm_probe()
160 pc->chip.ops = &bcm2835_pwm_ops; in bcm2835_pwm_probe()
161 pc->chip.npwm = 2; in bcm2835_pwm_probe()
163 platform_set_drvdata(pdev, pc); in bcm2835_pwm_probe()
165 ret = pwmchip_add(&pc->chip); in bcm2835_pwm_probe()
172 clk_disable_unprepare(pc->clk); in bcm2835_pwm_probe()
178 struct bcm2835_pwm *pc = platform_get_drvdata(pdev); in bcm2835_pwm_remove() local
180 pwmchip_remove(&pc->chip); in bcm2835_pwm_remove()
182 clk_disable_unprepare(pc->clk); in bcm2835_pwm_remove()