Lines Matching full:dwc

60 static inline u32 dwc_pwm_readl(struct dwc_pwm *dwc, u32 offset)  in dwc_pwm_readl()  argument
62 return readl(dwc->base + offset); in dwc_pwm_readl()
65 static inline void dwc_pwm_writel(struct dwc_pwm *dwc, u32 value, u32 offset) in dwc_pwm_writel() argument
67 writel(value, dwc->base + offset); in dwc_pwm_writel()
70 static void __dwc_pwm_set_enable(struct dwc_pwm *dwc, int pwm, int enabled) in __dwc_pwm_set_enable() argument
74 reg = dwc_pwm_readl(dwc, DWC_TIM_CTRL(pwm)); in __dwc_pwm_set_enable()
81 dwc_pwm_writel(dwc, reg, DWC_TIM_CTRL(pwm)); in __dwc_pwm_set_enable()
84 static int __dwc_pwm_configure_timer(struct dwc_pwm *dwc, in __dwc_pwm_configure_timer() argument
116 __dwc_pwm_set_enable(dwc, pwm->hwpwm, false); in __dwc_pwm_configure_timer()
124 dwc_pwm_writel(dwc, low, DWC_TIM_LD_CNT(pwm->hwpwm)); in __dwc_pwm_configure_timer()
125 dwc_pwm_writel(dwc, high, DWC_TIM_LD_CNT2(pwm->hwpwm)); in __dwc_pwm_configure_timer()
134 dwc_pwm_writel(dwc, ctrl, DWC_TIM_CTRL(pwm->hwpwm)); in __dwc_pwm_configure_timer()
139 __dwc_pwm_set_enable(dwc, pwm->hwpwm, state->enabled); in __dwc_pwm_configure_timer()
147 struct dwc_pwm *dwc = to_dwc_pwm(chip); in dwc_pwm_apply() local
155 return __dwc_pwm_configure_timer(dwc, pwm, state); in dwc_pwm_apply()
158 __dwc_pwm_set_enable(dwc, pwm->hwpwm, false); in dwc_pwm_apply()
169 struct dwc_pwm *dwc = to_dwc_pwm(chip); in dwc_pwm_get_state() local
174 state->enabled = !!(dwc_pwm_readl(dwc, in dwc_pwm_get_state()
177 duty = dwc_pwm_readl(dwc, DWC_TIM_LD_CNT(pwm->hwpwm)); in dwc_pwm_get_state()
182 period = dwc_pwm_readl(dwc, DWC_TIM_LD_CNT2(pwm->hwpwm)); in dwc_pwm_get_state()
203 struct dwc_pwm *dwc; in dwc_pwm_alloc() local
205 dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL); in dwc_pwm_alloc()
206 if (!dwc) in dwc_pwm_alloc()
209 dwc->chip.dev = dev; in dwc_pwm_alloc()
210 dwc->chip.ops = &dwc_pwm_ops; in dwc_pwm_alloc()
211 dwc->chip.npwm = DWC_TIMERS_TOTAL; in dwc_pwm_alloc()
213 dev_set_drvdata(dev, dwc); in dwc_pwm_alloc()
214 return dwc; in dwc_pwm_alloc()
220 struct dwc_pwm *dwc; in dwc_pwm_probe() local
223 dwc = dwc_pwm_alloc(dev); in dwc_pwm_probe()
224 if (!dwc) in dwc_pwm_probe()
241 dwc->base = pcim_iomap_table(pci)[0]; in dwc_pwm_probe()
242 if (!dwc->base) { in dwc_pwm_probe()
247 ret = devm_pwmchip_add(dev, &dwc->chip); in dwc_pwm_probe()
267 struct dwc_pwm *dwc = pci_get_drvdata(pdev); in dwc_pwm_suspend() local
271 if (dwc->chip.pwms[i].state.enabled) { in dwc_pwm_suspend()
273 i, dwc->chip.pwms[i].label); in dwc_pwm_suspend()
276 dwc->ctx[i].cnt = dwc_pwm_readl(dwc, DWC_TIM_LD_CNT(i)); in dwc_pwm_suspend()
277 dwc->ctx[i].cnt2 = dwc_pwm_readl(dwc, DWC_TIM_LD_CNT2(i)); in dwc_pwm_suspend()
278 dwc->ctx[i].ctrl = dwc_pwm_readl(dwc, DWC_TIM_CTRL(i)); in dwc_pwm_suspend()
287 struct dwc_pwm *dwc = pci_get_drvdata(pdev); in dwc_pwm_resume() local
291 dwc_pwm_writel(dwc, dwc->ctx[i].cnt, DWC_TIM_LD_CNT(i)); in dwc_pwm_resume()
292 dwc_pwm_writel(dwc, dwc->ctx[i].cnt2, DWC_TIM_LD_CNT2(i)); in dwc_pwm_resume()
293 dwc_pwm_writel(dwc, dwc->ctx[i].ctrl, DWC_TIM_CTRL(i)); in dwc_pwm_resume()
309 .name = "pwm-dwc",