Lines Matching refs:pdata
73 static void pic32_rtc_alarm_clk_enable(struct pic32_rtc_dev *pdata, in pic32_rtc_alarm_clk_enable() argument
78 spin_lock_irqsave(&pdata->alarm_lock, flags); in pic32_rtc_alarm_clk_enable()
80 if (!pdata->alarm_clk_enabled) { in pic32_rtc_alarm_clk_enable()
81 clk_enable(pdata->clk); in pic32_rtc_alarm_clk_enable()
82 pdata->alarm_clk_enabled = true; in pic32_rtc_alarm_clk_enable()
85 if (pdata->alarm_clk_enabled) { in pic32_rtc_alarm_clk_enable()
86 clk_disable(pdata->clk); in pic32_rtc_alarm_clk_enable()
87 pdata->alarm_clk_enabled = false; in pic32_rtc_alarm_clk_enable()
90 spin_unlock_irqrestore(&pdata->alarm_lock, flags); in pic32_rtc_alarm_clk_enable()
95 struct pic32_rtc_dev *pdata = (struct pic32_rtc_dev *)id; in pic32_rtc_alarmirq() local
97 clk_enable(pdata->clk); in pic32_rtc_alarmirq()
98 rtc_update_irq(pdata->rtc, 1, RTC_AF | RTC_IRQF); in pic32_rtc_alarmirq()
99 clk_disable(pdata->clk); in pic32_rtc_alarmirq()
101 pic32_rtc_alarm_clk_enable(pdata, false); in pic32_rtc_alarmirq()
108 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_setaie() local
109 void __iomem *base = pdata->reg_base; in pic32_rtc_setaie()
111 clk_enable(pdata->clk); in pic32_rtc_setaie()
117 clk_disable(pdata->clk); in pic32_rtc_setaie()
119 pic32_rtc_alarm_clk_enable(pdata, enabled); in pic32_rtc_setaie()
126 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_setfreq() local
127 void __iomem *base = pdata->reg_base; in pic32_rtc_setfreq()
129 clk_enable(pdata->clk); in pic32_rtc_setfreq()
135 clk_disable(pdata->clk); in pic32_rtc_setfreq()
142 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_gettime() local
143 void __iomem *base = pdata->reg_base; in pic32_rtc_gettime()
146 clk_enable(pdata->clk); in pic32_rtc_gettime()
177 clk_disable(pdata->clk); in pic32_rtc_gettime()
183 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_settime() local
184 void __iomem *base = pdata->reg_base; in pic32_rtc_settime()
196 clk_enable(pdata->clk); in pic32_rtc_settime()
203 clk_disable(pdata->clk); in pic32_rtc_settime()
210 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_getalarm() local
212 void __iomem *base = pdata->reg_base; in pic32_rtc_getalarm()
215 clk_enable(pdata->clk); in pic32_rtc_getalarm()
239 clk_disable(pdata->clk); in pic32_rtc_getalarm()
245 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_setalarm() local
247 void __iomem *base = pdata->reg_base; in pic32_rtc_setalarm()
249 clk_enable(pdata->clk); in pic32_rtc_setalarm()
260 clk_disable(pdata->clk); in pic32_rtc_setalarm()
266 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_proc() local
267 void __iomem *base = pdata->reg_base; in pic32_rtc_proc()
270 clk_enable(pdata->clk); in pic32_rtc_proc()
276 clk_disable(pdata->clk); in pic32_rtc_proc()
289 static void pic32_rtc_enable(struct pic32_rtc_dev *pdata, int en) in pic32_rtc_enable() argument
291 void __iomem *base = pdata->reg_base; in pic32_rtc_enable()
296 clk_enable(pdata->clk); in pic32_rtc_enable()
308 clk_disable(pdata->clk); in pic32_rtc_enable()
313 struct pic32_rtc_dev *pdata = platform_get_drvdata(pdev); in pic32_rtc_remove() local
316 clk_unprepare(pdata->clk); in pic32_rtc_remove()
317 pdata->clk = NULL; in pic32_rtc_remove()
324 struct pic32_rtc_dev *pdata; in pic32_rtc_probe() local
328 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); in pic32_rtc_probe()
329 if (!pdata) in pic32_rtc_probe()
332 platform_set_drvdata(pdev, pdata); in pic32_rtc_probe()
334 pdata->alarm_irq = platform_get_irq(pdev, 0); in pic32_rtc_probe()
335 if (pdata->alarm_irq < 0) { in pic32_rtc_probe()
337 return pdata->alarm_irq; in pic32_rtc_probe()
341 pdata->reg_base = devm_ioremap_resource(&pdev->dev, res); in pic32_rtc_probe()
342 if (IS_ERR(pdata->reg_base)) in pic32_rtc_probe()
343 return PTR_ERR(pdata->reg_base); in pic32_rtc_probe()
345 pdata->clk = devm_clk_get(&pdev->dev, NULL); in pic32_rtc_probe()
346 if (IS_ERR(pdata->clk)) { in pic32_rtc_probe()
348 ret = PTR_ERR(pdata->clk); in pic32_rtc_probe()
349 pdata->clk = NULL; in pic32_rtc_probe()
353 spin_lock_init(&pdata->alarm_lock); in pic32_rtc_probe()
355 clk_prepare_enable(pdata->clk); in pic32_rtc_probe()
357 pic32_rtc_enable(pdata, 1); in pic32_rtc_probe()
361 pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, in pic32_rtc_probe()
364 if (IS_ERR(pdata->rtc)) { in pic32_rtc_probe()
365 ret = PTR_ERR(pdata->rtc); in pic32_rtc_probe()
369 pdata->rtc->max_user_freq = 128; in pic32_rtc_probe()
372 ret = devm_request_irq(&pdev->dev, pdata->alarm_irq, in pic32_rtc_probe()
374 dev_name(&pdev->dev), pdata); in pic32_rtc_probe()
377 "IRQ %d error %d\n", pdata->alarm_irq, ret); in pic32_rtc_probe()
381 clk_disable(pdata->clk); in pic32_rtc_probe()
386 pic32_rtc_enable(pdata, 0); in pic32_rtc_probe()
387 clk_disable_unprepare(pdata->clk); in pic32_rtc_probe()