On 04/07/2017 at 10:55:52 +0200, Fabien Lahoudere wrote:
> On Thu, 2017-06-29 at 09:56 +0200, Alexandre Belloni wrote:
> > On 26/06/2017 at 11:51:13 +0200, Fabien Lahoudere wrote:
> > > > Actually, after reading the datasheet, I realize it is only POC that is
> > > > reset to 0 after reading so isinvalid is not needed. Just read status1
> > > > and look for BLD instead of caching it.
> > > > 
> > > 
> > > isinvalid is also used in s35390a_set_datetime. So if I remove it how can 
> > > I detect that time
> > > setting
> > > failed?
> > > 
> > 
> > If it fails, simply don't reset BLD so it is still set when reading the
> > time.
> > 
> 
> In BLD section, datasheet says "When this flag is "1", be sure to initialize."
> So I think we need those flags.
> 

No, you don't. If BLD is set, return -EINVAL in read_time, initialize
the RTC in set_time and that is it. You'll always know when power failed
and you'll always initialize at the correct time (i.e before really
caring about the date/time).

> > > > I think it is probably worth separating s35390a_reset() into two
> > > > functions. One that does the initialization and another one that reads
> > > > status1 and immediately doest the initialization when POC is set. If BLD
> > > > is set, then we can wait for set_time to happen before initializing.
> > > > 
> > 
> > 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups 
"rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rtc-linux+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to