Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1200915ybj; Tue, 5 May 2020 15:17:14 -0700 (PDT) X-Google-Smtp-Source: APiQypKBJaOdJPJ14k5PrmvpfvOP24A97FK/b6SprWuvpXYNlFVt/8cbtDHDNcXItyh0X5JPOHjz X-Received: by 2002:a17:906:405a:: with SMTP id y26mr4686579ejj.31.1588717034375; Tue, 05 May 2020 15:17:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588717034; cv=none; d=google.com; s=arc-20160816; b=eELCOCcu69v4kEySw8ItbrpT4yf3rcBEBDGmtoQd+u5S51hQA8/ldlIWnS3g0zuGlu DjuBGzPfIluG1eOt16d1n2gYhq33HS1mSeDsT6G84rnyfA35kkAGjOTt79r59RCjLoPL JTslCRvugRED7txoPNv0AAraM0pOy8Xt2j0yMYaJV/bvNnCxCGWRbg1Bfeo2DrntkmHe VhaG/MOcJEqHKm224MfutYrnYGEC8cGWRlLJ3ta7BNhGwsetSNdaMiam1/JhO5MaGmGL MVw0zTRH1ps+96FjlYFjjrzixUhNv17zjb08SIKRVYMhuJtKTCzNQsCRIeJ5kD+s7WuH GsCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=qoJnhWxT/XbW0n29NGMeA6Na8wXYm4MqjSWdjLfEB3A=; b=jvyh6Y8FSPYP1YLpQ+ya0tUiKL3JqChKOqwklf0+OvVZyIOrSzbPITkPZ0t6T8QMfz XrioiKocD/oyZDt4WDMW9JeeVWeIitVop2wG70e7tKZHV62MvzDFBc0Hwnhx4nsvuesi 1JzPHFqmSfwMkLzXOEJ2rt4Y3vwz5E3Y8xzD4BqRHSObXbgz+uh8CFeab05CuByGQO4G cC5y+Yli/yv9+KNK+iw9SPvc8+tkLaCS3DBu3cOF3whI2j02qto0WUawL+qzfnRUyXWd KOp1j61dyYykUmdeDV1BsnAUUc/t77auO81ZA6RcBUU3ilccfxH8GZ/crcRgLN67pqEv eTvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn6si2059474edb.514.2020.05.05.15.16.51; Tue, 05 May 2020 15:17:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729524AbgEEWOt (ORCPT + 99 others); Tue, 5 May 2020 18:14:49 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:49857 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727089AbgEEWOs (ORCPT ); Tue, 5 May 2020 18:14:48 -0400 Received: from localhost (lfbn-lyo-1-9-35.w86-202.abo.wanadoo.fr [86.202.105.35]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay12.mail.gandi.net (Postfix) with ESMTPSA id A7F6F200003; Tue, 5 May 2020 22:14:46 +0000 (UTC) Date: Wed, 6 May 2020 00:14:46 +0200 From: Alexandre Belloni To: Rasmus Villemoes Cc: Bruno Thomsen , Per =?iso-8859-1?Q?N=F8rgaard?= Christensen , LKML Subject: Re: battery switch-over detection on pcf2127 Message-ID: <20200505221446.GX34497@piout.net> References: <20200505200744.GV34497@piout.net> <62944a2d-f593-5a98-34be-f1f86ac6111c@prevas.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <62944a2d-f593-5a98-34be-f1f86ac6111c@prevas.dk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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