1
0
Fork 0
alistair23-linux/drivers/rtc
Michael Hamel 471d47e322 rtc-x1205: Fix alarm set
I have discovered that the current version of rtc-x1205.c does not work
correctly when asked to set the alarm time by the RTC_WKALM_SET ioctl()
call.  This happens because the alarm registers do not behave like the
current-time registers.  They are non-volatile.  Two things go wrong:

- the X1205 requires a 10 msec delay after any attempt to write to the
  non-volatile registers.  The x1205_set_datetime() routine does the write
  as 8 single-byte writes without any delay.  Only the first write
  succeeds.  The second is NAKed because the chip is busy.

- the X1205 resets the RWEL bit after any write to the non-volatile
  registers.  This would lock out any further writes after the first even
  with a 10msec delay.

I fix this by doing a single 8-byte write and then waiting 10msec for the
chip to be ready.  A side effect of this change is that it will speed up
x1205_rtc_set_time() which uses the same code.

I have also implemented the 'enable' bit in the rtc_wkalm structure, which
the existing driver does not attempt to do.  I have modified both
x1205_rtc_set_alarm() to set the AL0E bit, and x1205_rtc_read_alarm() to
return it.

I have tested this patch on a LinkSys NSLU2 under OpenWRT, but on no other
hardware.  On the NSLU2 the X1205 correctly asserts its IRQ pin when the
alarm time matches the current time.

[akpm@linux-foundation.org: clean up over-parenthesisation]
Signed-off-by: Michael Hamel <mhamel@adi.co.nz>
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-04 10:40:05 -07:00
..
Kconfig rtc: Ramtron FM3130 RTC support 2008-06-12 18:05:42 -07:00
Makefile rtc: Ramtron FM3130 RTC support 2008-06-12 18:05:42 -07:00
class.c RTC: periodic irq fix 2007-10-16 09:43:13 -07:00
hctosys.c rtc_hctosys expects RTCs in UTC (doc) 2007-11-14 18:45:36 -08:00
interface.c rtc: rtc_read_alarm() handles wraparound 2008-07-04 10:40:04 -07:00
rtc-at32ap700x.c rtc-at32ap700x: fix bug in at32_rtc_readalarm() 2008-06-12 18:05:40 -07:00
rtc-at91rm9200.c rtc: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:17 -07:00
rtc-at91sam9.c rtc: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:17 -07:00
rtc-bfin.c Remove duplicated unlikely() in IS_ERR() 2008-04-29 08:06:25 -07:00
rtc-cmos.c provide rtc_cmos platform device 2008-06-12 18:05:42 -07:00
rtc-core.h rtc: update to class device removal patches 2007-05-08 11:15:18 -07:00
rtc-dev.c rtc-cmos alarm acts as oneshot 2008-02-06 10:41:13 -08:00
rtc-ds1216.c rtc: fix platform driver hotplug/coldplug 2008-04-11 08:06:44 -07:00
rtc-ds1302.c rtc: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:17 -07:00
rtc-ds1307.c i2c: Convert most new-style drivers to use module aliasing 2008-04-29 23:11:40 +02:00
rtc-ds1374.c rtc-ds1374: rename device to just "ds1374" 2008-06-06 11:29:10 -07:00
rtc-ds1511.c fix irq flags in rtc-ds1511 2008-05-08 10:46:55 -07:00
rtc-ds1553.c rtc: fix platform driver hotplug/coldplug 2008-04-11 08:06:44 -07:00
rtc-ds1672.c rtc: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:17 -07:00
rtc-ds1742.c rtc: fix platform driver hotplug/coldplug 2008-04-11 08:06:44 -07:00
rtc-ep93xx.c rtc: fix platform driver hotplug/coldplug 2008-04-11 08:06:44 -07:00
rtc-fm3130.c rtc: Ramtron FM3130 RTC support 2008-06-12 18:05:42 -07:00
rtc-isl1208.c i2c: Convert most new-style drivers to use module aliasing 2008-04-29 23:11:40 +02:00
rtc-lib.c rtc: rtc_time_to_tm: use unsigned arithmetic 2008-05-13 08:02:25 -07:00
rtc-m41t80.c rtc: m41t80: include <linux/kernel.h> for printk() 2008-05-13 08:02:26 -07:00
rtc-m48t59.c rtc: fix platform driver hotplug/coldplug 2008-04-11 08:06:44 -07:00
rtc-m48t86.c rtc: fix platform driver hotplug/coldplug 2008-04-11 08:06:44 -07:00
rtc-max6900.c rtc: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:17 -07:00
rtc-max6902.c rtc: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:17 -07:00
rtc-omap.c rtc: fix platform driver hotplug/coldplug 2008-04-11 08:06:44 -07:00
rtc-pcf8563.c i2c: Convert most new-style drivers to use module aliasing 2008-04-29 23:11:40 +02:00
rtc-pcf8583.c rtc-pcf8583 build fix 2008-04-28 08:58:16 -07:00
rtc-pl031.c remove asm/bitops.h includes 2007-10-19 11:53:41 -07:00
rtc-ppc.c rtc: class driver for ppc_md RTC functions 2008-06-06 11:29:13 -07:00
rtc-proc.c drivers: use non-racy method for proc entries creation (2) 2008-04-29 08:06:22 -07:00
rtc-r9701.c rtc-r9701.c: silence compiler warning 2008-02-09 23:27:01 -08:00
rtc-rs5c313.c rtc: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:17 -07:00
rtc-rs5c348.c [PATCH] rtc: Make rtc-rs5c348 driver hotplug-aware 2007-08-27 02:16:58 +01:00
rtc-rs5c372.c i2c: Convert most new-style drivers to use module aliasing 2008-04-29 23:11:40 +02:00
rtc-s3c.c rtc: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:17 -07:00
rtc-s35390a.c i2c: Match dummy devices by type 2008-05-11 20:37:06 +02:00
rtc-sa1100.c [ARM] 5109/1: Mark rtc sa1100 driver as wakeup source before registering it 2008-06-22 14:32:12 +01:00
rtc-sh.c rtc: rtc-sh: Fixup for 64-bit resources. 2008-05-08 19:51:45 +09:00
rtc-stk17ta8.c rtc: fix platform driver hotplug/coldplug 2008-04-11 08:06:44 -07:00
rtc-sysfs.c rtc: add the support for alarm time relative to current time in sysfs 2008-04-28 08:58:17 -07:00
rtc-test.c rtc: silence section mismatch warning in rtc-test 2008-04-28 08:58:16 -07:00
rtc-v3020.c rtc: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:17 -07:00
rtc-vr41xx.c rtc: fix platform driver hotplug/coldplug 2008-04-11 08:06:44 -07:00
rtc-x1205.c rtc-x1205: Fix alarm set 2008-07-04 10:40:05 -07:00