10 #include <linux/module.h>
11 #include <linux/rtc.h>
17 #include <linux/slab.h>
23 #define COH901331_ALARM 0x00U
25 #define COH901331_SET_TIME 0x04U
27 #define COH901331_VALID 0x08U
29 #define COH901331_CUR_TIME 0x0cU
31 #define COH901331_IRQ_EVENT 0x10U
33 #define COH901331_IRQ_MASK 0x14U
35 #define COH901331_IRQ_FORCE 0x18U
93 static int coh901331_set_mmss(
struct device *dev,
unsigned long secs)
117 static int coh901331_set_alarm(
struct device *dev,
struct rtc_wkalrm *alarm)
131 static int coh901331_alarm_irq_enable(
struct device *dev,
unsigned int enabled)
146 .read_time = coh901331_read_time,
147 .set_mmss = coh901331_set_mmss,
148 .read_alarm = coh901331_read_alarm,
149 .set_alarm = coh901331_set_alarm,
150 .alarm_irq_enable = coh901331_alarm_irq_enable,
161 platform_set_drvdata(pdev,
NULL);
184 rtap->
physize = resource_size(res);
187 "rtc-coh901331") ==
NULL)
195 if (devm_request_irq(&pdev->
dev, rtap->
irq, coh901331_interrupt, 0,
196 "RTC COH 901 331 Alarm", rtap))
200 if (IS_ERR(rtap->
clk)) {
201 ret = PTR_ERR(rtap->
clk);
207 ret = clk_prepare_enable(rtap->
clk);
209 dev_err(&pdev->
dev,
"could not enable clock\n");
210 goto out_no_clk_prepenable;
214 platform_set_drvdata(pdev, rtap);
217 if (IS_ERR(rtap->
rtc)) {
218 ret = PTR_ERR(rtap->
rtc);
225 platform_set_drvdata(pdev,
NULL);
227 out_no_clk_prepenable:
242 if (device_may_wakeup(&pdev->
dev)) {
243 enable_irq_wake(rtap->
irq);
259 if (device_may_wakeup(&pdev->
dev)) {
260 disable_irq_wake(rtap->
irq);
269 #define coh901331_suspend NULL
270 #define coh901331_resume NULL
279 clk_disable_unprepare(rtap->
clk);
284 .name =
"rtc-coh901331",
287 .remove =
__exit_p(coh901331_remove),
290 .shutdown = coh901331_shutdown,
293 static int __init coh901331_init(
void)
298 static void __exit coh901331_exit(
void)