Lines Matching refs:pdata
65 static void pic32_rtc_alarm_clk_enable(struct pic32_rtc_dev *pdata, in pic32_rtc_alarm_clk_enable() argument
70 spin_lock_irqsave(&pdata->alarm_lock, flags); in pic32_rtc_alarm_clk_enable()
72 if (!pdata->alarm_clk_enabled) { in pic32_rtc_alarm_clk_enable()
73 clk_enable(pdata->clk); in pic32_rtc_alarm_clk_enable()
74 pdata->alarm_clk_enabled = true; in pic32_rtc_alarm_clk_enable()
77 if (pdata->alarm_clk_enabled) { in pic32_rtc_alarm_clk_enable()
78 clk_disable(pdata->clk); in pic32_rtc_alarm_clk_enable()
79 pdata->alarm_clk_enabled = false; in pic32_rtc_alarm_clk_enable()
82 spin_unlock_irqrestore(&pdata->alarm_lock, flags); in pic32_rtc_alarm_clk_enable()
87 struct pic32_rtc_dev *pdata = (struct pic32_rtc_dev *)id; in pic32_rtc_alarmirq() local
89 clk_enable(pdata->clk); in pic32_rtc_alarmirq()
90 rtc_update_irq(pdata->rtc, 1, RTC_AF | RTC_IRQF); in pic32_rtc_alarmirq()
91 clk_disable(pdata->clk); in pic32_rtc_alarmirq()
93 pic32_rtc_alarm_clk_enable(pdata, false); in pic32_rtc_alarmirq()
100 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_setaie() local
101 void __iomem *base = pdata->reg_base; in pic32_rtc_setaie()
103 clk_enable(pdata->clk); in pic32_rtc_setaie()
109 clk_disable(pdata->clk); in pic32_rtc_setaie()
111 pic32_rtc_alarm_clk_enable(pdata, enabled); in pic32_rtc_setaie()
118 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_setfreq() local
119 void __iomem *base = pdata->reg_base; in pic32_rtc_setfreq()
121 clk_enable(pdata->clk); in pic32_rtc_setfreq()
127 clk_disable(pdata->clk); in pic32_rtc_setfreq()
134 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_gettime() local
135 void __iomem *base = pdata->reg_base; in pic32_rtc_gettime()
138 clk_enable(pdata->clk); in pic32_rtc_gettime()
167 clk_disable(pdata->clk); in pic32_rtc_gettime()
173 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_settime() local
174 void __iomem *base = pdata->reg_base; in pic32_rtc_settime()
178 clk_enable(pdata->clk); in pic32_rtc_settime()
185 clk_disable(pdata->clk); in pic32_rtc_settime()
192 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_getalarm() local
194 void __iomem *base = pdata->reg_base; in pic32_rtc_getalarm()
197 clk_enable(pdata->clk); in pic32_rtc_getalarm()
218 clk_disable(pdata->clk); in pic32_rtc_getalarm()
224 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_setalarm() local
226 void __iomem *base = pdata->reg_base; in pic32_rtc_setalarm()
228 clk_enable(pdata->clk); in pic32_rtc_setalarm()
236 clk_disable(pdata->clk); in pic32_rtc_setalarm()
242 struct pic32_rtc_dev *pdata = dev_get_drvdata(dev); in pic32_rtc_proc() local
243 void __iomem *base = pdata->reg_base; in pic32_rtc_proc()
246 clk_enable(pdata->clk); in pic32_rtc_proc()
252 clk_disable(pdata->clk); in pic32_rtc_proc()
265 static void pic32_rtc_enable(struct pic32_rtc_dev *pdata, int en) in pic32_rtc_enable() argument
267 void __iomem *base = pdata->reg_base; in pic32_rtc_enable()
272 clk_enable(pdata->clk); in pic32_rtc_enable()
284 clk_disable(pdata->clk); in pic32_rtc_enable()
289 struct pic32_rtc_dev *pdata = platform_get_drvdata(pdev); in pic32_rtc_remove() local
292 clk_unprepare(pdata->clk); in pic32_rtc_remove()
293 pdata->clk = NULL; in pic32_rtc_remove()
300 struct pic32_rtc_dev *pdata; in pic32_rtc_probe() local
303 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); in pic32_rtc_probe()
304 if (!pdata) in pic32_rtc_probe()
307 platform_set_drvdata(pdev, pdata); in pic32_rtc_probe()
309 pdata->alarm_irq = platform_get_irq(pdev, 0); in pic32_rtc_probe()
310 if (pdata->alarm_irq < 0) in pic32_rtc_probe()
311 return pdata->alarm_irq; in pic32_rtc_probe()
313 pdata->reg_base = devm_platform_ioremap_resource(pdev, 0); in pic32_rtc_probe()
314 if (IS_ERR(pdata->reg_base)) in pic32_rtc_probe()
315 return PTR_ERR(pdata->reg_base); in pic32_rtc_probe()
317 pdata->clk = devm_clk_get(&pdev->dev, NULL); in pic32_rtc_probe()
318 if (IS_ERR(pdata->clk)) { in pic32_rtc_probe()
320 ret = PTR_ERR(pdata->clk); in pic32_rtc_probe()
321 pdata->clk = NULL; in pic32_rtc_probe()
325 spin_lock_init(&pdata->alarm_lock); in pic32_rtc_probe()
327 pdata->rtc = devm_rtc_allocate_device(&pdev->dev); in pic32_rtc_probe()
328 if (IS_ERR(pdata->rtc)) in pic32_rtc_probe()
329 return PTR_ERR(pdata->rtc); in pic32_rtc_probe()
331 clk_prepare_enable(pdata->clk); in pic32_rtc_probe()
333 pic32_rtc_enable(pdata, 1); in pic32_rtc_probe()
337 pdata->rtc->ops = &pic32_rtcops; in pic32_rtc_probe()
338 pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; in pic32_rtc_probe()
339 pdata->rtc->range_max = RTC_TIMESTAMP_END_2099; in pic32_rtc_probe()
341 ret = rtc_register_device(pdata->rtc); in pic32_rtc_probe()
345 pdata->rtc->max_user_freq = 128; in pic32_rtc_probe()
348 ret = devm_request_irq(&pdev->dev, pdata->alarm_irq, in pic32_rtc_probe()
350 dev_name(&pdev->dev), pdata); in pic32_rtc_probe()
353 "IRQ %d error %d\n", pdata->alarm_irq, ret); in pic32_rtc_probe()
357 clk_disable(pdata->clk); in pic32_rtc_probe()
362 pic32_rtc_enable(pdata, 0); in pic32_rtc_probe()
363 clk_disable_unprepare(pdata->clk); in pic32_rtc_probe()