+ rtc-rk808-fix-the-rtc-time-reading-issue.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: drivers/rtc/rtc-rk808.c: fix rtc time reading issue
has been added to the -mm tree.  Its filename is
     rtc-rk808-fix-the-rtc-time-reading-issue.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/rtc-rk808-fix-the-rtc-time-reading-issue.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/rtc-rk808-fix-the-rtc-time-reading-issue.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Chris Zhong <zyw@xxxxxxxxxxxxxx>
Subject: drivers/rtc/rtc-rk808.c: fix rtc time reading issue

After we set the GET_TIME bit, the rtc time can't be read immediately.  We
should wait up to 31.25 us, about one cycle of 32khz.  Otherwise reading
RTC time will return a old time.  If we clear the GET_TIME bit after
setting, the time of i2c transfer is certainly more than 31.25us.

Doug said:

: I think we are safe.  At 400kHz (the max speed of this part) each bit can
: be transferred no faster than 2.5us.  In order to do a valid i2c
: transaction we need to _at least_ write the address of the device and the
: data onto the bus, which is 16 bits.  16 * 2.5us = 40us.  That's above the
: 31.25us

Signed-off-by: Chris Zhong <zyw@xxxxxxxxxxxxxx>
Reviewed-by: Doug Anderson <dianders@xxxxxxxxxxxx>
Cc: Sonny Rao <sonnyrao@xxxxxxxxxxxx>
Cc: Heiko Stübner <heiko@xxxxxxxxx>
Cc: Alessandro Zummo <a.zummo@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/rtc/rtc-rk808.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff -puN drivers/rtc/rtc-rk808.c~rtc-rk808-fix-the-rtc-time-reading-issue drivers/rtc/rtc-rk808.c
--- a/drivers/rtc/rtc-rk808.c~rtc-rk808-fix-the-rtc-time-reading-issue
+++ a/drivers/rtc/rtc-rk808.c
@@ -67,15 +67,20 @@ static int rk808_rtc_readtime(struct dev
 	/* Force an update of the shadowed registers right now */
 	ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
 				 BIT_RTC_CTRL_REG_RTC_GET_TIME,
-				 0);
+				 BIT_RTC_CTRL_REG_RTC_GET_TIME);
 	if (ret) {
 		dev_err(dev, "Failed to update bits rtc_ctrl: %d\n", ret);
 		return ret;
 	}
 
+	/* After we set the GET_TIME bit, the rtc time couldn't be read
+	 * immediately, we should wait up to 31.25 us, about one cycle of
+	 * 32khz. If we clear the GET_TIME bit here, the time of i2c transfer
+	 * certainly more than 31.25us.
+	 */
 	ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
 				 BIT_RTC_CTRL_REG_RTC_GET_TIME,
-				 BIT_RTC_CTRL_REG_RTC_GET_TIME);
+				 0);
 	if (ret) {
 		dev_err(dev, "Failed to update bits rtc_ctrl: %d\n", ret);
 		return ret;
_

Patches currently in -mm which might be from zyw@xxxxxxxxxxxxxx are

rtc-rk808-fix-the-rtc-time-reading-issue.patch
rtc-rk808-fix-the-rtc-time-reading-issue-fix.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux