Lines Matching full:pc

76 	struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip);  in pwm_mediatek_clk_enable()  local
79 ret = clk_prepare_enable(pc->clk_top); in pwm_mediatek_clk_enable()
83 ret = clk_prepare_enable(pc->clk_main); in pwm_mediatek_clk_enable()
87 ret = clk_prepare_enable(pc->clk_pwms[pwm->hwpwm]); in pwm_mediatek_clk_enable()
94 clk_disable_unprepare(pc->clk_main); in pwm_mediatek_clk_enable()
96 clk_disable_unprepare(pc->clk_top); in pwm_mediatek_clk_enable()
104 struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip); in pwm_mediatek_clk_disable() local
106 clk_disable_unprepare(pc->clk_pwms[pwm->hwpwm]); in pwm_mediatek_clk_disable()
107 clk_disable_unprepare(pc->clk_main); in pwm_mediatek_clk_disable()
108 clk_disable_unprepare(pc->clk_top); in pwm_mediatek_clk_disable()
121 struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip); in pwm_mediatek_config() local
133 if (pc->soc->has_ck_26m_sel) in pwm_mediatek_config()
134 writel(0, pc->regs + PWM_CK_26M_SEL); in pwm_mediatek_config()
138 do_div(resolution, clk_get_rate(pc->clk_pwms[pwm->hwpwm])); in pwm_mediatek_config()
154 if (pc->soc->pwm45_fixup && pwm->hwpwm > 2) { in pwm_mediatek_config()
164 pwm_mediatek_writel(pc, pwm->hwpwm, PWMCON, BIT(15) | clkdiv); in pwm_mediatek_config()
165 pwm_mediatek_writel(pc, pwm->hwpwm, reg_width, cnt_period); in pwm_mediatek_config()
166 pwm_mediatek_writel(pc, pwm->hwpwm, reg_thres, cnt_duty); in pwm_mediatek_config()
175 struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip); in pwm_mediatek_enable() local
183 value = readl(pc->regs); in pwm_mediatek_enable()
185 writel(value, pc->regs); in pwm_mediatek_enable()
192 struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip); in pwm_mediatek_disable() local
195 value = readl(pc->regs); in pwm_mediatek_disable()
197 writel(value, pc->regs); in pwm_mediatek_disable()
234 struct pwm_mediatek_chip *pc; in pwm_mediatek_probe() local
241 chip = devm_pwmchip_alloc(&pdev->dev, soc->num_pwms, sizeof(*pc)); in pwm_mediatek_probe()
244 pc = to_pwm_mediatek_chip(chip); in pwm_mediatek_probe()
246 pc->soc = soc; in pwm_mediatek_probe()
248 pc->regs = devm_platform_ioremap_resource(pdev, 0); in pwm_mediatek_probe()
249 if (IS_ERR(pc->regs)) in pwm_mediatek_probe()
250 return PTR_ERR(pc->regs); in pwm_mediatek_probe()
252 pc->clk_pwms = devm_kmalloc_array(&pdev->dev, soc->num_pwms, in pwm_mediatek_probe()
253 sizeof(*pc->clk_pwms), GFP_KERNEL); in pwm_mediatek_probe()
254 if (!pc->clk_pwms) in pwm_mediatek_probe()
257 pc->clk_top = devm_clk_get(&pdev->dev, "top"); in pwm_mediatek_probe()
258 if (IS_ERR(pc->clk_top)) in pwm_mediatek_probe()
259 return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk_top), in pwm_mediatek_probe()
262 pc->clk_main = devm_clk_get(&pdev->dev, "main"); in pwm_mediatek_probe()
263 if (IS_ERR(pc->clk_main)) in pwm_mediatek_probe()
264 return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk_main), in pwm_mediatek_probe()
272 pc->clk_pwms[i] = devm_clk_get(&pdev->dev, name); in pwm_mediatek_probe()
273 if (IS_ERR(pc->clk_pwms[i])) in pwm_mediatek_probe()
274 return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk_pwms[i]), in pwm_mediatek_probe()