aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds1286.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2011-03-12 03:25:53 -0500
committerGrant Likely <grant.likely@secretlab.ca>2011-03-12 03:25:53 -0500
commit9c3c8afccb6a163fd2be739f511e863eab668702 (patch)
treee587a5377ada98fed8cfa6c8ee63125361f2818a /drivers/rtc/rtc-ds1286.c
parent290293eda2c6dd368476d71433bdef07c39a6829 (diff)
parenta5abba989deceb731047425812d268daf7536575 (diff)
Merge commit 'v2.6.38-rc8' into spi/next
Conflicts: drivers/spi/pxa2xx_spi_pci.c
Diffstat (limited to 'drivers/rtc/rtc-ds1286.c')
-rw-r--r--drivers/rtc/rtc-ds1286.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c
index bf430f9091ed..60ce69600828 100644
--- a/drivers/rtc/rtc-ds1286.c
+++ b/drivers/rtc/rtc-ds1286.c
@@ -40,6 +40,26 @@ static inline void ds1286_rtc_write(struct ds1286_priv *priv, u8 data, int reg)
40 __raw_writel(data, &priv->rtcregs[reg]); 40 __raw_writel(data, &priv->rtcregs[reg]);
41} 41}
42 42
43
44static int ds1286_alarm_irq_enable(struct device *dev, unsigned int enabled)
45{
46 struct ds1286_priv *priv = dev_get_drvdata(dev);
47 unsigned long flags;
48 unsigned char val;
49
50 /* Allow or mask alarm interrupts */
51 spin_lock_irqsave(&priv->lock, flags);
52 val = ds1286_rtc_read(priv, RTC_CMD);
53 if (enabled)
54 val &= ~RTC_TDM;
55 else
56 val |= RTC_TDM;
57 ds1286_rtc_write(priv, val, RTC_CMD);
58 spin_unlock_irqrestore(&priv->lock, flags);
59
60 return 0;
61}
62
43#ifdef CONFIG_RTC_INTF_DEV 63#ifdef CONFIG_RTC_INTF_DEV
44 64
45static int ds1286_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) 65static int ds1286_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
@@ -49,22 +69,6 @@ static int ds1286_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
49 unsigned char val; 69 unsigned char val;
50 70
51 switch (cmd) { 71 switch (cmd) {
52 case RTC_AIE_OFF:
53 /* Mask alarm int. enab. bit */
54 spin_lock_irqsave(&priv->lock, flags);
55 val = ds1286_rtc_read(priv, RTC_CMD);
56 val |= RTC_TDM;
57 ds1286_rtc_write(priv, val, RTC_CMD);
58 spin_unlock_irqrestore(&priv->lock, flags);
59 break;
60 case RTC_AIE_ON:
61 /* Allow alarm interrupts. */
62 spin_lock_irqsave(&priv->lock, flags);
63 val = ds1286_rtc_read(priv, RTC_CMD);
64 val &= ~RTC_TDM;
65 ds1286_rtc_write(priv, val, RTC_CMD);
66 spin_unlock_irqrestore(&priv->lock, flags);
67 break;
68 case RTC_WIE_OFF: 72 case RTC_WIE_OFF:
69 /* Mask watchdog int. enab. bit */ 73 /* Mask watchdog int. enab. bit */
70 spin_lock_irqsave(&priv->lock, flags); 74 spin_lock_irqsave(&priv->lock, flags);
@@ -316,12 +320,13 @@ static int ds1286_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
316} 320}
317 321
318static const struct rtc_class_ops ds1286_ops = { 322static const struct rtc_class_ops ds1286_ops = {
319 .ioctl = ds1286_ioctl, 323 .ioctl = ds1286_ioctl,
320 .proc = ds1286_proc, 324 .proc = ds1286_proc,
321 .read_time = ds1286_read_time, 325 .read_time = ds1286_read_time,
322 .set_time = ds1286_set_time, 326 .set_time = ds1286_set_time,
323 .read_alarm = ds1286_read_alarm, 327 .read_alarm = ds1286_read_alarm,
324 .set_alarm = ds1286_set_alarm, 328 .set_alarm = ds1286_set_alarm,
329 .alarm_irq_enable = ds1286_alarm_irq_enable,
325}; 330};
326 331
327static int __devinit ds1286_probe(struct platform_device *pdev) 332static int __devinit ds1286_probe(struct platform_device *pdev)