linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Dylan Howey <Dylan.Howey@tennantco.com>
Cc: "a.zummo@towertech.it" <a.zummo@towertech.it>,
	"linux-rtc@vger.kernel.org" <linux-rtc@vger.kernel.org>
Subject: Re: [PATCH 1/2] Port rtc-pcf2123 to regmap
Date: Thu, 2 May 2019 22:55:16 +0200	[thread overview]
Message-ID: <20190502205516.GD22550@piout.net> (raw)
In-Reply-To: <20190502174518.GA12323@tennantco.com>

On 02/05/2019 17:45:24+0000, Dylan Howey wrote:
> As I'm working on this I've run across some other issues:
> 
> * Driver does not do a software reset on init. Datasheet recommends doing
>   this as this will clear any interrupts and alarm flags. The fix would
>   presumably be to add a call to pcf2123_reset in the init, but...
> 

It recommends doing a software reset after power-on in that case, it
refers to the power-on of the RTC, not the platform. You shouldn't do a
software reset as this will break time keeping, the offset and reading
alarms that may have been starting the platform.

> * pcf2123_reset stops the RTC for no apparent reason. Result is that the
>   time is invalid after a call to pcf2123_reset, which requires the time
>   to be set again manually. The fix would be to delete the stop commands.
> 

Using the software reset will render the time invalid anyway as this
will set the OS bit in the seconds register (see Table 7.
Register reset values).

> * I don't think pcf2123_read_offset is working correctly. In the case of
>   a coarse offset the value is not being sign extended. So a negative
>   offset read will not be correct if the coarse bit is set (result would
>   be a positive number being returned if this is true). I need to look
>   into this some more. The fix would be to sign extend first, then if
>   coarse bit is set multiply the result by 2.
> 

As the comment says, it is properly extended because after shifting,
bits [6:0] become bit [7:1].

> Not sure if I'll fix these issues right now. Also this RTC does have the 
> ability to do periodic interrupts but the feature has not been implemented
> in this driver. So I'll leave uie_unsupported set for now.
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2019-05-02 20:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26 19:37 [PATCH 1/2] Port rtc-pcf2123 to regmap Howey, Dylan
2019-04-26 19:37 ` [PATCH 2/2] Add alarm support to rtc-pcf2123 Howey, Dylan
2019-04-27 13:11   ` Alexandre Belloni
2019-04-27 13:00 ` [PATCH 1/2] Port rtc-pcf2123 to regmap Alexandre Belloni
2019-04-29 15:09   ` Howey, Dylan
2019-04-30  9:22     ` Alexandre Belloni
2019-05-02 17:45       ` Dylan Howey
2019-05-02 20:55         ` Alexandre Belloni [this message]
2019-05-03 13:30           ` Dylan Howey
2019-06-19 13:16             ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190502205516.GD22550@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=Dylan.Howey@tennantco.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-rtc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).