linux-stable-rt/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
hctosys.c
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-at91sam9.c
rtc-bfin.c
rtc-cmos.c provide rtc_cmos platform device 2008-06-12 18:05:42 -07:00
rtc-core.h
rtc-dev.c
rtc-ds1216.c
rtc-ds1302.c
rtc-ds1307.c
rtc-ds1374.c
rtc-ds1511.c
rtc-ds1553.c
rtc-ds1672.c
rtc-ds1742.c
rtc-ep93xx.c
rtc-fm3130.c rtc: Ramtron FM3130 RTC support 2008-06-12 18:05:42 -07:00
rtc-isl1208.c
rtc-lib.c
rtc-m41t80.c
rtc-m48t59.c
rtc-m48t86.c
rtc-max6900.c
rtc-max6902.c
rtc-omap.c
rtc-pcf8563.c
rtc-pcf8583.c
rtc-pl031.c
rtc-ppc.c
rtc-proc.c
rtc-r9701.c
rtc-rs5c313.c
rtc-rs5c348.c
rtc-rs5c372.c
rtc-s3c.c
rtc-s35390a.c
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-stk17ta8.c
rtc-sysfs.c
rtc-test.c
rtc-v3020.c
rtc-vr41xx.c
rtc-x1205.c rtc-x1205: Fix alarm set 2008-07-04 10:40:05 -07:00