All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	linux-rtc@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] rtc: pcf-8563: Report previously detected low-voltage via RTC_VL_BACKUP_LOW
Date: Sun, 11 Jun 2023 17:11:56 +0200	[thread overview]
Message-ID: <202306111511569834cac2@mail.local> (raw)
In-Reply-To: <1d532c45-ee33-9729-f0ac-b59c2bec8d7d@siemens.com>

On 11/06/2023 15:38:04+0200, Jan Kiszka wrote:
> On 10.06.23 10:31, Alexandre Belloni wrote:
> > Hello Jan,
> > 
> > On 09/06/2023 23:04:12+0200, Jan Kiszka wrote:
> >> From: Jan Kiszka <jan.kiszka@siemens.com>
> >>
> >> The VL bit in the seconds register remains set only until seconds are
> >> written under main power. As this often happens during boot-up after
> >> picking up a network time, make sure to preserve the low battery state
> >> across this, caching it and returning it via the RTC_VL_BACKUP_LOW bit.
> >>
> >> To permit userspace clearing this state during runtime, also implement
> >> RTC_VL_CLR that works against the cached state.
> >>
> >> This is emulating RTCs which have a battery voltage check that works
> >> under main power as well.
> >>
> > 
> > Emulating doesn't work well and I deliberately chose to not implement
> > it. For example, in your scenario, if you boot twice without using
> > VL_READ, you anyway have lost the information. This makes emulating
> > unreliabl. The fix you need is in userspace where you have to ensure you
> > read the status before setting the time.
> 
> Then let's make sure the bit is also set in the hardware register. Then
> also the reboot issue (which is practically a minor one) is solved. The
> current situation is far from optimal.

This doesn't work because then the time will be considered invalid. I'm
not sure why you don't want to fix your userspace.


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

  reply	other threads:[~2023-06-11 15:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 21:04 [PATCH] rtc: pcf-8563: Report previously detected low-voltage via RTC_VL_BACKUP_LOW Jan Kiszka
2023-06-10  8:31 ` Alexandre Belloni
2023-06-11 13:38   ` Jan Kiszka
2023-06-11 15:11     ` Alexandre Belloni [this message]
2023-06-11 16:28       ` Jan Kiszka
2023-06-11 22:16         ` Alexandre Belloni
2023-06-12  6:49           ` Jan Kiszka
2023-07-11  7:27             ` Jan Kiszka
2023-07-11 20:54               ` 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=202306111511569834cac2@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=jan.kiszka@siemens.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.