public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Cc: "Bruno Thomsen" <bruno.thomsen@gmail.com>,
	"Per Nørgaard Christensen" <per.christensen@prevas.dk>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: battery switch-over detection on pcf2127
Date: Wed, 6 May 2020 00:14:46 +0200	[thread overview]
Message-ID: <20200505221446.GX34497@piout.net> (raw)
In-Reply-To: <62944a2d-f593-5a98-34be-f1f86ac6111c@prevas.dk>

On 05/05/2020 23:01:19+0200, Rasmus Villemoes wrote:
> Thanks for the quick replies, both. Unfortunately, being able to read BF
> from linux is not relevant to us - all the handling happens early in the
> bootloader (including clearing BF, so that we can detect that the
> previous boot failed only because of power fail - hence whether the
> linux driver clears BF or not is not relevant). We really just want
> linux to not touch the bits in CTRL3 at all.
> 

Well, in that case, Linux doesn't touch the BF bit anymore unless
userspace uses the ioctls so you should be ok using it from your
bootloader.

> Hm, wait. Re-reading the above suggests that BF can get set even if BTSE
> is not, and a quick experiment shows that is true - I must have misread
> the data sheet. While I think that's fine for now (currently I only
> print the time of last switch-over as a diagnostic), I did have some use
> case in mind for comparing that timestamp to the current time and make
> decisions based on that. But until I figure out exactly what I want to
> use it for, and until we actually upgrade to 5.4+, there's no rush.
> 

Configuring the timestamps is something else I want to do but I still
didn't finish to design the proper interface.

It is definitively on the todo list.

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

      reply	other threads:[~2020-05-05 22:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 19:54 battery switch-over detection on pcf2127 Rasmus Villemoes
2020-05-05 20:07 ` Alexandre Belloni
2020-05-05 20:38   ` Bruno Thomsen
2020-05-05 21:01     ` Rasmus Villemoes
2020-05-05 22:14       ` Alexandre Belloni [this message]

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=20200505221446.GX34497@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=bruno.thomsen@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=per.christensen@prevas.dk \
    --cc=rasmus.villemoes@prevas.dk \
    /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