Lines Matching refs: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()
202 struct dwc_pwm *dwc; in dwc_pwm_probe() local
205 dwc = devm_kzalloc(&pci->dev, sizeof(*dwc), GFP_KERNEL); in dwc_pwm_probe()
206 if (!dwc) in dwc_pwm_probe()
225 dwc->base = pcim_iomap_table(pci)[0]; in dwc_pwm_probe()
226 if (!dwc->base) { in dwc_pwm_probe()
231 pci_set_drvdata(pci, dwc); in dwc_pwm_probe()
233 dwc->chip.dev = dev; in dwc_pwm_probe()
234 dwc->chip.ops = &dwc_pwm_ops; in dwc_pwm_probe()
235 dwc->chip.npwm = DWC_TIMERS_TOTAL; in dwc_pwm_probe()
237 ret = pwmchip_add(&dwc->chip); in dwc_pwm_probe()
249 struct dwc_pwm *dwc = pci_get_drvdata(pci); in dwc_pwm_remove() local
254 pwmchip_remove(&dwc->chip); in dwc_pwm_remove()
261 struct dwc_pwm *dwc = pci_get_drvdata(pdev); in dwc_pwm_suspend() local
265 if (dwc->chip.pwms[i].state.enabled) { in dwc_pwm_suspend()
267 i, dwc->chip.pwms[i].label); in dwc_pwm_suspend()
270 dwc->ctx[i].cnt = dwc_pwm_readl(dwc, DWC_TIM_LD_CNT(i)); in dwc_pwm_suspend()
271 dwc->ctx[i].cnt2 = dwc_pwm_readl(dwc, DWC_TIM_LD_CNT2(i)); in dwc_pwm_suspend()
272 dwc->ctx[i].ctrl = dwc_pwm_readl(dwc, DWC_TIM_CTRL(i)); in dwc_pwm_suspend()
281 struct dwc_pwm *dwc = pci_get_drvdata(pdev); in dwc_pwm_resume() local
285 dwc_pwm_writel(dwc, dwc->ctx[i].cnt, DWC_TIM_LD_CNT(i)); in dwc_pwm_resume()
286 dwc_pwm_writel(dwc, dwc->ctx[i].cnt2, DWC_TIM_LD_CNT2(i)); in dwc_pwm_resume()
287 dwc_pwm_writel(dwc, dwc->ctx[i].ctrl, DWC_TIM_CTRL(i)); in dwc_pwm_resume()