mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: "Mukund JB." <mukundjb@esntechnologies.co.in>
Cc: Dave Jones <davej@redhat.com>, linux-kernel@vger.kernel.org
Subject: PATCH:  day of week (RE: Kernel interrupts disable at user level - RIGHT/ WRONG - Help)
Date: Wed, 21 Dec 2005 00:00:52 +0000	[thread overview]
Message-ID: <1135123252.25010.33.camel@localhost.localdomain> (raw)
In-Reply-To: <3AEC1E10243A314391FE9C01CD65429B2232A4@mail.esn.co.in>

On Maw, 2005-12-20 at 14:32 +0530, Mukund JB. wrote:
> >  > I tried the /dev/rtc but I don't get it there.
> > 
> > Use /dev/nvram instead.
> > 
> > 		Dave
> 
> /dev/nvram does not give the cpomplete CMOS details. A part of RTC & date, tine and other info will be missing.


What Dave should have said is use /dev/nvram as well.

>From /dev/rtc you get registers 0-9 except as you said 6
>From /dev/nvram you get A+

The lack of day of week is odd but fixable. The struct tm already has a
field for tm_wday (day of week) so we can fill it in. Whether it is
valid is another question.

What do people thing about this ?

Signed-off-by: Alan Cox <alan@redhat.com>

--- drivers/char/rtc.c~	2005-12-20 23:40:34.912559808 +0000
+++ drivers/char/rtc.c	2005-12-20 23:51:16.428034632 +0000
@@ -46,10 +46,10 @@
  *      1.11a   Daniele Bellucci: Audit create_proc_read_entry in rtc_init
  *	1.12	Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer
  *		CONFIG_HPET_EMULATE_RTC
- *
+ *	1.12ac	Alan Cox: Allow read access to the day of week register
  */
 
-#define RTC_VERSION		"1.12"
+#define RTC_VERSION		"1.12ac"
 
 #define RTC_IO_EXTENT	0x8
 
@@ -1250,9 +1250,9 @@
 
 	/*
 	 * Only the values that we read from the RTC are set. We leave
-	 * tm_wday, tm_yday and tm_isdst untouched. Even though the
-	 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
-	 * by the RTC when initially set to a non-zero value.
+	 * tm_wday, tm_yday and tm_isdst untouched. Note that while the
+	 * RTC has RTC_DAY_OF_WEEK, we should usually ignore it, as it is
+	 * only updated by the RTC when initially set to a non-zero value.
 	 */
 	spin_lock_irq(&rtc_lock);
 	rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS);
@@ -1261,6 +1261,9 @@
 	rtc_tm->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH);
 	rtc_tm->tm_mon = CMOS_READ(RTC_MONTH);
 	rtc_tm->tm_year = CMOS_READ(RTC_YEAR);
+	/* Only set from 2.6.16 onwards */
+	rtc_tm->tm_wday = CMOS_READ(RTC_DAY_OF_WEEK);
+	
 #ifdef CONFIG_MACH_DECSTATION
 	real_year = CMOS_READ(RTC_DEC_YEAR);
 #endif
@@ -1275,6 +1278,7 @@
 		BCD_TO_BIN(rtc_tm->tm_mday);
 		BCD_TO_BIN(rtc_tm->tm_mon);
 		BCD_TO_BIN(rtc_tm->tm_year);
+		BCD_TO_BIN(rtc_tm->tm_wday);
 	}
 
 #ifdef CONFIG_MACH_DECSTATION


  reply	other threads:[~2005-12-21  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-20  9:02 Kernel interrupts disable at user level - RIGHT/ WRONG - Help Mukund JB.
2005-12-21  0:00 ` Alan Cox [this message]
2005-12-24 20:58   ` PATCH: day of week (RE: Kernel interrupts disable at user level - RIGHT/ WRONG - Help) Jan Engelhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1135123252.25010.33.camel@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mukundjb@esntechnologies.co.in \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®