Lines Matching refs:p

60 static inline u32 brcmstb_pwm_readl(struct brcmstb_pwm *p,  in brcmstb_pwm_readl()  argument
64 return __raw_readl(p->base + offset); in brcmstb_pwm_readl()
66 return readl_relaxed(p->base + offset); in brcmstb_pwm_readl()
69 static inline void brcmstb_pwm_writel(struct brcmstb_pwm *p, u32 value, in brcmstb_pwm_writel() argument
73 __raw_writel(value, p->base + offset); in brcmstb_pwm_writel()
75 writel_relaxed(value, p->base + offset); in brcmstb_pwm_writel()
99 struct brcmstb_pwm *p = to_brcmstb_pwm(chip); in brcmstb_pwm_config() local
122 rate = (u64)clk_get_rate(p->clk) * (u64)cword; in brcmstb_pwm_config()
161 brcmstb_pwm_writel(p, cword >> 8, PWM_CWORD_MSB(channel)); in brcmstb_pwm_config()
162 brcmstb_pwm_writel(p, cword & 0xff, PWM_CWORD_LSB(channel)); in brcmstb_pwm_config()
165 value = brcmstb_pwm_readl(p, PWM_CTRL2); in brcmstb_pwm_config()
167 brcmstb_pwm_writel(p, value, PWM_CTRL2); in brcmstb_pwm_config()
170 brcmstb_pwm_writel(p, pc, PWM_PERIOD(channel)); in brcmstb_pwm_config()
171 brcmstb_pwm_writel(p, dc, PWM_ON(channel)); in brcmstb_pwm_config()
176 static inline void brcmstb_pwm_enable_set(struct brcmstb_pwm *p, in brcmstb_pwm_enable_set() argument
182 value = brcmstb_pwm_readl(p, PWM_CTRL); in brcmstb_pwm_enable_set()
192 brcmstb_pwm_writel(p, value, PWM_CTRL); in brcmstb_pwm_enable_set()
198 struct brcmstb_pwm *p = to_brcmstb_pwm(chip); in brcmstb_pwm_apply() local
206 brcmstb_pwm_enable_set(p, pwm->hwpwm, false); in brcmstb_pwm_apply()
216 brcmstb_pwm_enable_set(p, pwm->hwpwm, true); in brcmstb_pwm_apply()
234 struct brcmstb_pwm *p; in brcmstb_pwm_probe() local
237 p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); in brcmstb_pwm_probe()
238 if (!p) in brcmstb_pwm_probe()
241 p->clk = devm_clk_get(&pdev->dev, NULL); in brcmstb_pwm_probe()
242 if (IS_ERR(p->clk)) { in brcmstb_pwm_probe()
244 return PTR_ERR(p->clk); in brcmstb_pwm_probe()
247 ret = clk_prepare_enable(p->clk); in brcmstb_pwm_probe()
253 platform_set_drvdata(pdev, p); in brcmstb_pwm_probe()
255 p->chip.dev = &pdev->dev; in brcmstb_pwm_probe()
256 p->chip.ops = &brcmstb_pwm_ops; in brcmstb_pwm_probe()
257 p->chip.npwm = 2; in brcmstb_pwm_probe()
259 p->base = devm_platform_ioremap_resource(pdev, 0); in brcmstb_pwm_probe()
260 if (IS_ERR(p->base)) { in brcmstb_pwm_probe()
261 ret = PTR_ERR(p->base); in brcmstb_pwm_probe()
265 ret = pwmchip_add(&p->chip); in brcmstb_pwm_probe()
274 clk_disable_unprepare(p->clk); in brcmstb_pwm_probe()
280 struct brcmstb_pwm *p = platform_get_drvdata(pdev); in brcmstb_pwm_remove() local
282 pwmchip_remove(&p->chip); in brcmstb_pwm_remove()
283 clk_disable_unprepare(p->clk); in brcmstb_pwm_remove()
289 struct brcmstb_pwm *p = dev_get_drvdata(dev); in brcmstb_pwm_suspend() local
291 clk_disable_unprepare(p->clk); in brcmstb_pwm_suspend()
298 struct brcmstb_pwm *p = dev_get_drvdata(dev); in brcmstb_pwm_resume() local
300 clk_prepare_enable(p->clk); in brcmstb_pwm_resume()