• Home
  • Raw
  • Download

Lines Matching refs:pc

73 	struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip);  in pwm_mediatek_clk_enable()  local
76 ret = clk_prepare_enable(pc->clk_top); in pwm_mediatek_clk_enable()
80 ret = clk_prepare_enable(pc->clk_main); in pwm_mediatek_clk_enable()
84 ret = clk_prepare_enable(pc->clk_pwms[pwm->hwpwm]); in pwm_mediatek_clk_enable()
91 clk_disable_unprepare(pc->clk_main); in pwm_mediatek_clk_enable()
93 clk_disable_unprepare(pc->clk_top); in pwm_mediatek_clk_enable()
101 struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip); in pwm_mediatek_clk_disable() local
103 clk_disable_unprepare(pc->clk_pwms[pwm->hwpwm]); in pwm_mediatek_clk_disable()
104 clk_disable_unprepare(pc->clk_main); in pwm_mediatek_clk_disable()
105 clk_disable_unprepare(pc->clk_top); in pwm_mediatek_clk_disable()
124 struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip); in pwm_mediatek_config() local
137 do_div(resolution, clk_get_rate(pc->clk_pwms[pwm->hwpwm])); in pwm_mediatek_config()
153 if (pc->soc->pwm45_fixup && pwm->hwpwm > 2) { in pwm_mediatek_config()
163 pwm_mediatek_writel(pc, pwm->hwpwm, PWMCON, BIT(15) | clkdiv); in pwm_mediatek_config()
164 pwm_mediatek_writel(pc, pwm->hwpwm, reg_width, cnt_period); in pwm_mediatek_config()
165 pwm_mediatek_writel(pc, pwm->hwpwm, reg_thres, cnt_duty); in pwm_mediatek_config()
174 struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip); in pwm_mediatek_enable() local
182 value = readl(pc->regs); in pwm_mediatek_enable()
184 writel(value, pc->regs); in pwm_mediatek_enable()
191 struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip); in pwm_mediatek_disable() local
194 value = readl(pc->regs); in pwm_mediatek_disable()
196 writel(value, pc->regs); in pwm_mediatek_disable()
210 struct pwm_mediatek_chip *pc; in pwm_mediatek_probe() local
215 pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL); in pwm_mediatek_probe()
216 if (!pc) in pwm_mediatek_probe()
219 pc->soc = of_device_get_match_data(&pdev->dev); in pwm_mediatek_probe()
222 pc->regs = devm_ioremap_resource(&pdev->dev, res); in pwm_mediatek_probe()
223 if (IS_ERR(pc->regs)) in pwm_mediatek_probe()
224 return PTR_ERR(pc->regs); in pwm_mediatek_probe()
226 pc->clk_pwms = devm_kcalloc(&pdev->dev, pc->soc->num_pwms, in pwm_mediatek_probe()
227 sizeof(*pc->clk_pwms), GFP_KERNEL); in pwm_mediatek_probe()
228 if (!pc->clk_pwms) in pwm_mediatek_probe()
231 pc->clk_top = devm_clk_get(&pdev->dev, "top"); in pwm_mediatek_probe()
232 if (IS_ERR(pc->clk_top)) { in pwm_mediatek_probe()
234 PTR_ERR(pc->clk_top)); in pwm_mediatek_probe()
235 return PTR_ERR(pc->clk_top); in pwm_mediatek_probe()
238 pc->clk_main = devm_clk_get(&pdev->dev, "main"); in pwm_mediatek_probe()
239 if (IS_ERR(pc->clk_main)) { in pwm_mediatek_probe()
241 PTR_ERR(pc->clk_main)); in pwm_mediatek_probe()
242 return PTR_ERR(pc->clk_main); in pwm_mediatek_probe()
245 for (i = 0; i < pc->soc->num_pwms; i++) { in pwm_mediatek_probe()
250 pc->clk_pwms[i] = devm_clk_get(&pdev->dev, name); in pwm_mediatek_probe()
251 if (IS_ERR(pc->clk_pwms[i])) { in pwm_mediatek_probe()
253 name, PTR_ERR(pc->clk_pwms[i])); in pwm_mediatek_probe()
254 return PTR_ERR(pc->clk_pwms[i]); in pwm_mediatek_probe()
258 platform_set_drvdata(pdev, pc); in pwm_mediatek_probe()
260 pc->chip.dev = &pdev->dev; in pwm_mediatek_probe()
261 pc->chip.ops = &pwm_mediatek_ops; in pwm_mediatek_probe()
262 pc->chip.base = -1; in pwm_mediatek_probe()
263 pc->chip.npwm = pc->soc->num_pwms; in pwm_mediatek_probe()
265 ret = pwmchip_add(&pc->chip); in pwm_mediatek_probe()
276 struct pwm_mediatek_chip *pc = platform_get_drvdata(pdev); in pwm_mediatek_remove() local
278 return pwmchip_remove(&pc->chip); in pwm_mediatek_remove()