public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] rtc: pcf50633 fixes (is rtc maintainer around?)
@ 2009-11-04 21:55 Paul Fertser
  2009-11-04 21:55 ` [PATCH 1/3] rtc: pcf50633: Fix month off-by-one error Paul Fertser
  2009-11-10 22:54 ` [PATCH 0/3] rtc: pcf50633 fixes (is rtc maintainer around?) Andrew Morton
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Fertser @ 2009-11-04 21:55 UTC (permalink / raw)
  To: Alessandro Zummo; +Cc: linux-kernel, rtc-linux

Hi,

This patch series contains (~obvious) fixes for the rtc part of pcf50633
MFD.

Unfortunately, my previous posting seemingly didn't reach the target, i
received no reply from Alessandro Zummo and also rtc-linux@googlegroups.com
ML seems to be dead or at least unsuitable (lots of spam, weird way of
viewing archives). I omitted LKML the previous time because i thought that
since these fixes are so small and not interesting there's no sense in
bothering anybody with them.

[PATCH 1/3] rtc: pcf50633: Fix month off-by-one error
[PATCH 2/3] rtc: pcf50633: consider alrm->enable in pcf50633_rtc_set_alarm
[PATCH 3/3] rtc: pcf50633: manage RTC alarm "pending" flag

TIA

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] rtc: pcf50633: Fix month off-by-one error
  2009-11-04 21:55 [PATCH 0/3] rtc: pcf50633 fixes (is rtc maintainer around?) Paul Fertser
@ 2009-11-04 21:55 ` Paul Fertser
  2009-11-04 21:55   ` [PATCH 2/3] rtc: pcf50633: consider alrm->enable in pcf50633_rtc_set_alarm Paul Fertser
  2009-11-10 22:54 ` [PATCH 0/3] rtc: pcf50633 fixes (is rtc maintainer around?) Andrew Morton
  1 sibling, 1 reply; 5+ messages in thread
From: Paul Fertser @ 2009-11-04 21:55 UTC (permalink / raw)
  To: Alessandro Zummo
  Cc: linux-kernel, rtc-linux, Rask Ingemann Lambertsen, Paul Fertser

From: Rask Ingemann Lambertsen <rask@sygehus.dk>

The PCF50633 stores a month value of 1-12, but the kernel wants 0-11.

Signed-off-by: Rask Ingemann Lambertsen <rask@sygehus.dk>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
 drivers/rtc/rtc-pcf50633.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c
index f4dd87e..77b40dd 100644
--- a/drivers/rtc/rtc-pcf50633.c
+++ b/drivers/rtc/rtc-pcf50633.c
@@ -70,7 +70,7 @@ static void pcf2rtc_time(struct rtc_time *rtc, struct pcf50633_time *pcf)
 	rtc->tm_hour = bcd2bin(pcf->time[PCF50633_TI_HOUR]);
 	rtc->tm_wday = bcd2bin(pcf->time[PCF50633_TI_WKDAY]);
 	rtc->tm_mday = bcd2bin(pcf->time[PCF50633_TI_DAY]);
-	rtc->tm_mon = bcd2bin(pcf->time[PCF50633_TI_MONTH]);
+	rtc->tm_mon = bcd2bin(pcf->time[PCF50633_TI_MONTH]) - 1;
 	rtc->tm_year = bcd2bin(pcf->time[PCF50633_TI_YEAR]) + 100;
 }
 
@@ -81,7 +81,7 @@ static void rtc2pcf_time(struct pcf50633_time *pcf, struct rtc_time *rtc)
 	pcf->time[PCF50633_TI_HOUR] = bin2bcd(rtc->tm_hour);
 	pcf->time[PCF50633_TI_WKDAY] = bin2bcd(rtc->tm_wday);
 	pcf->time[PCF50633_TI_DAY] = bin2bcd(rtc->tm_mday);
-	pcf->time[PCF50633_TI_MONTH] = bin2bcd(rtc->tm_mon);
+	pcf->time[PCF50633_TI_MONTH] = bin2bcd(rtc->tm_mon + 1);
 	pcf->time[PCF50633_TI_YEAR] = bin2bcd(rtc->tm_year % 100);
 }
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] rtc: pcf50633: consider alrm->enable in pcf50633_rtc_set_alarm
  2009-11-04 21:55 ` [PATCH 1/3] rtc: pcf50633: Fix month off-by-one error Paul Fertser
@ 2009-11-04 21:55   ` Paul Fertser
  2009-11-04 21:55     ` [PATCH 3/3] rtc: pcf50633: manage RTC alarm "pending" flag Paul Fertser
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Fertser @ 2009-11-04 21:55 UTC (permalink / raw)
  To: Alessandro Zummo
  Cc: linux-kernel, rtc-linux, Werner Almesberger, Paul Fertser

From: Werner Almesberger <werner@openmoko.org>

According to Documentation/rtc.txt, RTC_WKALM_SET sets the alarm time
and enables/disables the alarm. We implement RTC_WKALM_SET through
pcf50633_rtc_set_alarm. The enabling/disabling part was missing.

Signed-off-by: Werner Almesberger <werner@openmoko.org>
Reported-by: Michael 'Mickey' Lauer <mickey@openmoko.org>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
 drivers/rtc/rtc-pcf50633.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c
index 77b40dd..33a10c4 100644
--- a/drivers/rtc/rtc-pcf50633.c
+++ b/drivers/rtc/rtc-pcf50633.c
@@ -245,8 +245,9 @@ static int pcf50633_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	ret = pcf50633_write_block(rtc->pcf, PCF50633_REG_RTCSCA,
 				PCF50633_TI_EXTENT, &pcf_tm.time[0]);
 
-	if (!alarm_masked)
+	if (!alarm_masked || alrm->enabled)
 		pcf50633_irq_unmask(rtc->pcf, PCF50633_IRQ_ALARM);
+	rtc->alarm_enabled = alrm->enabled;
 
 	return ret;
 }
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] rtc: pcf50633: manage RTC alarm "pending" flag
  2009-11-04 21:55   ` [PATCH 2/3] rtc: pcf50633: consider alrm->enable in pcf50633_rtc_set_alarm Paul Fertser
@ 2009-11-04 21:55     ` Paul Fertser
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Fertser @ 2009-11-04 21:55 UTC (permalink / raw)
  To: Alessandro Zummo
  Cc: linux-kernel, rtc-linux, Werner Almesberger, Paul Fertser

From: Werner Almesberger <werner@openmoko.org>

This patch adds setting and clearing of the "pending" flag of the
RTC alarm. The semantics follow the UEFI specification 2.2 available
at http://www.uefi.org/specs/, i.e., the "pending" flag is cleared
by disabling the alarm, but not by any other condition (such as the
passing of time, a successful wakeup, or setting of a new alarm.)

Signed-off-by: Werner Almesberger <werner@openmoko.org>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
 drivers/rtc/rtc-pcf50633.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c
index 33a10c4..8669815 100644
--- a/drivers/rtc/rtc-pcf50633.c
+++ b/drivers/rtc/rtc-pcf50633.c
@@ -58,6 +58,7 @@ struct pcf50633_time {
 struct pcf50633_rtc {
 	int alarm_enabled;
 	int second_enabled;
+	int alarm_pending;
 
 	struct pcf50633 *pcf;
 	struct rtc_device *rtc_dev;
@@ -209,6 +210,7 @@ static int pcf50633_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	rtc = dev_get_drvdata(dev);
 
 	alrm->enabled = rtc->alarm_enabled;
+	alrm->pending = rtc->alarm_pending;
 
 	ret = pcf50633_read_block(rtc->pcf, PCF50633_REG_RTCSCA,
 				PCF50633_TI_EXTENT, &pcf_tm.time[0]);
@@ -244,6 +246,8 @@ static int pcf50633_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	/* Returns 0 on success */
 	ret = pcf50633_write_block(rtc->pcf, PCF50633_REG_RTCSCA,
 				PCF50633_TI_EXTENT, &pcf_tm.time[0]);
+	if (!alrm->enabled)
+		rtc->alarm_pending = 0;
 
 	if (!alarm_masked || alrm->enabled)
 		pcf50633_irq_unmask(rtc->pcf, PCF50633_IRQ_ALARM);
@@ -268,6 +272,7 @@ static void pcf50633_rtc_irq(int irq, void *data)
 	switch (irq) {
 	case PCF50633_IRQ_ALARM:
 		rtc_update_irq(rtc->rtc_dev, 1, RTC_AF | RTC_IRQF);
+		rtc->alarm_pending = 1;
 		break;
 	case PCF50633_IRQ_SECOND:
 		rtc_update_irq(rtc->rtc_dev, 1, RTC_UF | RTC_IRQF);
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] rtc: pcf50633 fixes (is rtc maintainer around?)
  2009-11-04 21:55 [PATCH 0/3] rtc: pcf50633 fixes (is rtc maintainer around?) Paul Fertser
  2009-11-04 21:55 ` [PATCH 1/3] rtc: pcf50633: Fix month off-by-one error Paul Fertser
@ 2009-11-10 22:54 ` Andrew Morton
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2009-11-10 22:54 UTC (permalink / raw)
  To: Paul Fertser; +Cc: Alessandro Zummo, linux-kernel, rtc-linux

On Thu,  5 Nov 2009 00:55:14 +0300
Paul Fertser <fercerpav@gmail.com> wrote:

> [PATCH 1/3] rtc: pcf50633: Fix month off-by-one error
> [PATCH 2/3] rtc: pcf50633: consider alrm->enable in pcf50633_rtc_set_alarm
> [PATCH 3/3] rtc: pcf50633: manage RTC alarm "pending" flag

I queued 1 and 2 for 2.6.32 (but not 2.6.31.x or earlier).
I queued 3 for 2.6.33.

If that was inappropriate then please let me know, with the reasons.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-11-10 22:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04 21:55 [PATCH 0/3] rtc: pcf50633 fixes (is rtc maintainer around?) Paul Fertser
2009-11-04 21:55 ` [PATCH 1/3] rtc: pcf50633: Fix month off-by-one error Paul Fertser
2009-11-04 21:55   ` [PATCH 2/3] rtc: pcf50633: consider alrm->enable in pcf50633_rtc_set_alarm Paul Fertser
2009-11-04 21:55     ` [PATCH 3/3] rtc: pcf50633: manage RTC alarm "pending" flag Paul Fertser
2009-11-10 22:54 ` [PATCH 0/3] rtc: pcf50633 fixes (is rtc maintainer around?) Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox