15 #include <linux/module.h>
16 #include <linux/rtc.h>
21 #include <linux/slab.h>
23 #define DRV_VERSION "1.0"
52 val = ds1286_rtc_read(priv,
RTC_CMD);
57 ds1286_rtc_write(priv, val,
RTC_CMD);
58 spin_unlock_irqrestore(&priv->
lock, flags);
63 #ifdef CONFIG_RTC_INTF_DEV
75 val = ds1286_rtc_read(priv,
RTC_CMD);
77 ds1286_rtc_write(priv, val,
RTC_CMD);
78 spin_unlock_irqrestore(&priv->
lock, flags);
83 val = ds1286_rtc_read(priv,
RTC_CMD);
85 ds1286_rtc_write(priv, val,
RTC_CMD);
86 spin_unlock_irqrestore(&priv->
lock, flags);
95 #define ds1286_ioctl NULL
106 month = ds1286_rtc_read(priv,
RTC_MONTH);
109 "square_wave\t: %s\n",
110 (month &
RTC_EOSC) ?
"disabled" :
"enabled",
111 (month &
RTC_ESQW) ?
"disabled" :
"enabled");
124 s =
"hours and minutes match";
127 s =
"days, hours and minutes match";
135 cmd = ds1286_rtc_read(priv,
RTC_CMD);
137 "alarm_enable\t: %s\n"
140 "wdog_alarm_mask\t: %s\n"
141 "interrupt_mode\t: %s\n"
142 "INTB_mode\t: %s_active\n"
143 "interrupt_pins\t: %s\n",
144 (cmd &
RTC_TDF) ?
"yes" :
"no",
145 (cmd &
RTC_WAF) ?
"yes" :
"no",
146 (cmd &
RTC_TDM) ?
"disabled" :
"enabled",
147 (cmd &
RTC_WAM) ?
"disabled" :
"enabled",
150 (cmd &
RTC_IPSW) ?
"unswapped" :
"swapped");
155 #define ds1286_proc NULL
161 unsigned char save_control;
163 unsigned long uip_watchdog =
jiffies;
186 save_control = ds1286_rtc_read(priv,
RTC_CMD);
187 ds1286_rtc_write(priv, (save_control|RTC_TE),
RTC_CMD);
196 ds1286_rtc_write(priv, save_control,
RTC_CMD);
197 spin_unlock_irqrestore(&priv->
lock, flags);
225 unsigned char save_control;
254 save_control = ds1286_rtc_read(priv,
RTC_CMD);
257 ds1286_rtc_write(priv, yrs,
RTC_YEAR);
259 ds1286_rtc_write(priv, day,
RTC_DATE);
265 ds1286_rtc_write(priv, save_control,
RTC_CMD);
266 spin_unlock_irqrestore(&priv->
lock, flags);
284 cmd = ds1286_rtc_read(priv,
RTC_CMD);
285 spin_unlock_irqrestore(&priv->
lock, flags);
289 alm->
time.tm_sec = 0;
296 unsigned char hrs,
min,
sec;
298 hrs = alm->
time.tm_hour;
299 min = alm->
time.tm_min;
300 sec = alm->
time.tm_sec;
314 spin_lock(&priv->
lock);
317 spin_unlock(&priv->
lock);
325 .read_time = ds1286_read_time,
326 .set_time = ds1286_set_time,
327 .read_alarm = ds1286_read_alarm,
328 .set_alarm = ds1286_set_alarm,
329 .alarm_irq_enable = ds1286_alarm_irq_enable,
346 priv->
size = resource_size(res);
358 platform_set_drvdata(pdev, priv);
381 struct ds1286_priv *priv = platform_get_drvdata(pdev);
392 .name =
"rtc-ds1286",
395 .probe = ds1286_probe,