aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rtc.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-01-11 15:17:32 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-11 21:42:10 -0500
commitb7599587faea9403edf4d7f74e80b3c9ea217930 (patch)
treeb6049fb7006eb1fe5a3bc545c2cf7880ce079971 /drivers/char/rtc.c
parente56d5ae305b9be17edfee20740ec84257e518747 (diff)
[PATCH] Allow reading CMOS day of week register
Someone wanted access to this usually unused (and unused by Linux) value for the day of week. Existing kernels have the field in the struct but return 0 always. This updates the kernel to fill in the field. The usual case of 'not set' conveniently is 0. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/rtc.c')
-rw-r--r--drivers/char/rtc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index a7f099fb7dfe..7cac6d05d723 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -46,10 +46,10 @@
46 * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init 46 * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init
47 * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer 47 * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer
48 * CONFIG_HPET_EMULATE_RTC 48 * CONFIG_HPET_EMULATE_RTC
49 * 49 * 1.12ac Alan Cox: Allow read access to the day of week register
50 */ 50 */
51 51
52#define RTC_VERSION "1.12" 52#define RTC_VERSION "1.12ac"
53 53
54#define RTC_IO_EXTENT 0x8 54#define RTC_IO_EXTENT 0x8
55 55
@@ -1250,9 +1250,9 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1250 1250
1251 /* 1251 /*
1252 * Only the values that we read from the RTC are set. We leave 1252 * Only the values that we read from the RTC are set. We leave
1253 * tm_wday, tm_yday and tm_isdst untouched. Even though the 1253 * tm_wday, tm_yday and tm_isdst untouched. Note that while the
1254 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated 1254 * RTC has RTC_DAY_OF_WEEK, we should usually ignore it, as it is
1255 * by the RTC when initially set to a non-zero value. 1255 * only updated by the RTC when initially set to a non-zero value.
1256 */ 1256 */
1257 spin_lock_irq(&rtc_lock); 1257 spin_lock_irq(&rtc_lock);
1258 rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS); 1258 rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS);
@@ -1261,6 +1261,9 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1261 rtc_tm->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH); 1261 rtc_tm->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH);
1262 rtc_tm->tm_mon = CMOS_READ(RTC_MONTH); 1262 rtc_tm->tm_mon = CMOS_READ(RTC_MONTH);
1263 rtc_tm->tm_year = CMOS_READ(RTC_YEAR); 1263 rtc_tm->tm_year = CMOS_READ(RTC_YEAR);
1264 /* Only set from 2.6.16 onwards */
1265 rtc_tm->tm_wday = CMOS_READ(RTC_DAY_OF_WEEK);
1266
1264#ifdef CONFIG_MACH_DECSTATION 1267#ifdef CONFIG_MACH_DECSTATION
1265 real_year = CMOS_READ(RTC_DEC_YEAR); 1268 real_year = CMOS_READ(RTC_DEC_YEAR);
1266#endif 1269#endif
@@ -1275,6 +1278,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1275 BCD_TO_BIN(rtc_tm->tm_mday); 1278 BCD_TO_BIN(rtc_tm->tm_mday);
1276 BCD_TO_BIN(rtc_tm->tm_mon); 1279 BCD_TO_BIN(rtc_tm->tm_mon);
1277 BCD_TO_BIN(rtc_tm->tm_year); 1280 BCD_TO_BIN(rtc_tm->tm_year);
1281 BCD_TO_BIN(rtc_tm->tm_wday);
1278 } 1282 }
1279 1283
1280#ifdef CONFIG_MACH_DECSTATION 1284#ifdef CONFIG_MACH_DECSTATION