mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] rtc: twl: update TWL RTC driver
@ 2012-01-19 10:12 Venu Byravarasu
  2012-01-19 10:12 ` [PATCH 1/3] rtc: twl: Enable RTC irrespective of its prior state Venu Byravarasu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Venu Byravarasu @ 2012-01-19 10:12 UTC (permalink / raw)
  To: a.zummo, rtc-linux, linux-kernel; +Cc: swarren, Venu Byravarasu

From: Venu Byravarasu <vbyravarasu@nvidia.com>

Observed minor issues with TWL RTC driver.
Hence tried fixing them with below 3 patches.

Venu Byravarasu (3):
  rtc: twl: Enable RTC irrespective of its prior state
  rtc: twl: Simplify RTC interrupt clearing
  rtc: twl: Return correct RTC event from ISR

 drivers/rtc/rtc-twl.c |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)


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

* [PATCH 1/3] rtc: twl: Enable RTC irrespective of its prior state
  2012-01-19 10:12 [PATCH 0/3] rtc: twl: update TWL RTC driver Venu Byravarasu
@ 2012-01-19 10:12 ` Venu Byravarasu
  2012-01-19 10:12 ` [PATCH 2/3] rtc: twl: Simplify RTC interrupt clearing Venu Byravarasu
  2012-01-19 10:12 ` [PATCH 3/3] rtc: twl: Return correct RTC event from ISR Venu Byravarasu
  2 siblings, 0 replies; 4+ messages in thread
From: Venu Byravarasu @ 2012-01-19 10:12 UTC (permalink / raw)
  To: a.zummo, rtc-linux, linux-kernel; +Cc: swarren, Venu Byravarasu

From: Venu Byravarasu <vbyravarasu@nvidia.com>

As part of probe, before enabling RTC, RTC_CTRL register is read
to check if it is already running. If RTC is used by kernel alone,
then this read is not required. Even if RTC was enabled already by
boot loader, setting STOP_RTC bit again should not harm.
Hence removed unwanted read operation.

Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
---
 drivers/rtc/rtc-twl.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 20687d5..61ae1b7 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -449,19 +449,11 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
 			REG_INT_MSK_STS_A);
 	}
 
-	/* Check RTC module status, Enable if it is off */
-	ret = twl_rtc_read_u8(&rd_reg, REG_RTC_CTRL_REG);
+	dev_info(&pdev->dev, "Enabling TWL-RTC\n");
+	ret = twl_rtc_write_u8(BIT_RTC_CTRL_REG_STOP_RTC_M, REG_RTC_CTRL_REG);
 	if (ret < 0)
 		goto out1;
 
-	if (!(rd_reg & BIT_RTC_CTRL_REG_STOP_RTC_M)) {
-		dev_info(&pdev->dev, "Enabling TWL-RTC.\n");
-		rd_reg = BIT_RTC_CTRL_REG_STOP_RTC_M;
-		ret = twl_rtc_write_u8(rd_reg, REG_RTC_CTRL_REG);
-		if (ret < 0)
-			goto out1;
-	}
-
 	/* init cached IRQ enable bits */
 	ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG);
 	if (ret < 0)
-- 
1.7.1.1


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

* [PATCH 2/3] rtc: twl: Simplify RTC interrupt clearing
  2012-01-19 10:12 [PATCH 0/3] rtc: twl: update TWL RTC driver Venu Byravarasu
  2012-01-19 10:12 ` [PATCH 1/3] rtc: twl: Enable RTC irrespective of its prior state Venu Byravarasu
@ 2012-01-19 10:12 ` Venu Byravarasu
  2012-01-19 10:12 ` [PATCH 3/3] rtc: twl: Return correct RTC event from ISR Venu Byravarasu
  2 siblings, 0 replies; 4+ messages in thread
From: Venu Byravarasu @ 2012-01-19 10:12 UTC (permalink / raw)
  To: a.zummo, rtc-linux, linux-kernel; +Cc: swarren, Venu Byravarasu

From: Venu Byravarasu <vbyravarasu@nvidia.com>

For clearing RTC interrupt, programming ALARM bit only is
sufficient, as all other bits are any way not affected by
writing 0 to them.

Hence removed unwanted OR operation.

Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
---
 drivers/rtc/rtc-twl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 61ae1b7..1c85443 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -376,7 +376,7 @@ static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
 	else
 		events |= RTC_IRQF | RTC_UF;
 
-	res = twl_rtc_write_u8(rd_reg | BIT_RTC_STATUS_REG_ALARM_M,
+	res = twl_rtc_write_u8(BIT_RTC_STATUS_REG_ALARM_M,
 				   REG_RTC_STATUS_REG);
 	if (res)
 		goto out;
-- 
1.7.1.1


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

* [PATCH 3/3] rtc: twl: Return correct RTC event from ISR
  2012-01-19 10:12 [PATCH 0/3] rtc: twl: update TWL RTC driver Venu Byravarasu
  2012-01-19 10:12 ` [PATCH 1/3] rtc: twl: Enable RTC irrespective of its prior state Venu Byravarasu
  2012-01-19 10:12 ` [PATCH 2/3] rtc: twl: Simplify RTC interrupt clearing Venu Byravarasu
@ 2012-01-19 10:12 ` Venu Byravarasu
  2 siblings, 0 replies; 4+ messages in thread
From: Venu Byravarasu @ 2012-01-19 10:12 UTC (permalink / raw)
  To: a.zummo, rtc-linux, linux-kernel; +Cc: swarren, Venu Byravarasu

From: Venu Byravarasu <vbyravarasu@nvidia.com>

Following changes are made as part of this change:
1. As TWL RTC supports periodic interrupt, the correct event
should be RTC_PF instead of RTC_UF.
2. No need to initialize variable "events" to 0 & then OR it
with the event values. Hence fixing it.

Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
---
 drivers/rtc/rtc-twl.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 1c85443..a0236a0 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -357,7 +357,7 @@ out:
 
 static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
 {
-	unsigned long events = 0;
+	unsigned long events;
 	int ret = IRQ_NONE;
 	int res;
 	u8 rd_reg;
@@ -372,9 +372,9 @@ static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
 	 * by reading RTS_INTERRUPTS_REGISTER[IT_TIMER,IT_ALARM]
 	 */
 	if (rd_reg & BIT_RTC_STATUS_REG_ALARM_M)
-		events |= RTC_IRQF | RTC_AF;
+		events = RTC_IRQF | RTC_AF;
 	else
-		events |= RTC_IRQF | RTC_UF;
+		events = RTC_IRQF | RTC_PF;
 
 	res = twl_rtc_write_u8(BIT_RTC_STATUS_REG_ALARM_M,
 				   REG_RTC_STATUS_REG);
-- 
1.7.1.1


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

end of thread, other threads:[~2012-01-19 10:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-19 10:12 [PATCH 0/3] rtc: twl: update TWL RTC driver Venu Byravarasu
2012-01-19 10:12 ` [PATCH 1/3] rtc: twl: Enable RTC irrespective of its prior state Venu Byravarasu
2012-01-19 10:12 ` [PATCH 2/3] rtc: twl: Simplify RTC interrupt clearing Venu Byravarasu
2012-01-19 10:12 ` [PATCH 3/3] rtc: twl: Return correct RTC event from ISR Venu Byravarasu

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®