Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Doug Anderson
Andrew, On Wed, Jan 14, 2015 at 2:53 PM, Andrew Morton wrote: > On Wed, 14 Jan 2015 11:44:02 -0800 Sonny Rao wrote: > >> On Wed, Jan 14, 2015 at 10:36 AM, Doug Anderson >> wrote: >> > Sonny, >> > >> >> Chris, it looks like you swapped the set and the clear of this bit, >> >> and you're

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Andrew Morton
On Wed, 14 Jan 2015 11:44:02 -0800 Sonny Rao wrote: > On Wed, Jan 14, 2015 at 10:36 AM, Doug Anderson wrote: > > Sonny, > > > >> Chris, it looks like you swapped the set and the clear of this bit, > >> and you're relying on the fact that the i2c transaction takes a > >> certain amount of time

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Sonny Rao
On Wed, Jan 14, 2015 at 10:36 AM, Doug Anderson wrote: > Sonny, > >> Chris, it looks like you swapped the set and the clear of this bit, >> and you're relying on the fact that the i2c transaction takes a >> certain amount of time after the RTC_GET_TIME BIT is set. I'm not >> sure how long it

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Doug Anderson
Chris, On Tue, Jan 13, 2015 at 6:43 PM, Chris Zhong wrote: > + /* 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 > +

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Doug Anderson
Sonny, > Chris, it looks like you swapped the set and the clear of this bit, > and you're relying on the fact that the i2c transaction takes a > certain amount of time after the RTC_GET_TIME BIT is set. I'm not > sure how long it actually takes, but why not just put in a usleep() > for the

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Sonny Rao
On Tue, Jan 13, 2015 at 6:43 PM, Chris Zhong wrote: > 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. Otherwise reading > RTC time will return a old time. If clear the GET_TIME bit after setting, > the time of

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Sonny Rao
On Wed, Jan 14, 2015 at 10:36 AM, Doug Anderson diand...@chromium.org wrote: Sonny, Chris, it looks like you swapped the set and the clear of this bit, and you're relying on the fact that the i2c transaction takes a certain amount of time after the RTC_GET_TIME BIT is set. I'm not sure how

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Doug Anderson
Andrew, On Wed, Jan 14, 2015 at 2:53 PM, Andrew Morton a...@linux-foundation.org wrote: On Wed, 14 Jan 2015 11:44:02 -0800 Sonny Rao sonny...@chromium.org wrote: On Wed, Jan 14, 2015 at 10:36 AM, Doug Anderson diand...@chromium.org wrote: Sonny, Chris, it looks like you swapped the set

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Andrew Morton
On Wed, 14 Jan 2015 11:44:02 -0800 Sonny Rao sonny...@chromium.org wrote: On Wed, Jan 14, 2015 at 10:36 AM, Doug Anderson diand...@chromium.org wrote: Sonny, Chris, it looks like you swapped the set and the clear of this bit, and you're relying on the fact that the i2c transaction takes

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Sonny Rao
On Tue, Jan 13, 2015 at 6:43 PM, Chris Zhong z...@rock-chips.com wrote: 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. Otherwise reading RTC time will return a old time. If clear the GET_TIME bit after setting,

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Doug Anderson
Sonny, Chris, it looks like you swapped the set and the clear of this bit, and you're relying on the fact that the i2c transaction takes a certain amount of time after the RTC_GET_TIME BIT is set. I'm not sure how long it actually takes, but why not just put in a usleep() for the minimum

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Doug Anderson
Chris, On Tue, Jan 13, 2015 at 6:43 PM, Chris Zhong z...@rock-chips.com wrote: + /* 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