From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9243C433DF for ; Mon, 27 Jul 2020 15:26:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A576C20729 for ; Mon, 27 Jul 2020 15:26:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NG2BUQJy"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="yRj+LeaS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A576C20729 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DIXSeD7QghAwOs/DE/a46xS3hVjhVvfEABMhHNcAWQ4=; b=NG2BUQJyqRFnymUs08j05iKhC oEEGc1uxnzV0Iz1ptXVBtxeVA+wj6mk/tY2AD/bdClBkEaCmps9dz1mfYLj1u+/tZPoCgLlemoi6g NE9YlpB60a/4zSwLz5M3+9ylaR/iXX87t9CvaAUhKN0M8YzWAgNqE6Gslq/45sAKYqK9EGLrLWtGP F7H8SOx8DQt/vM180UyB5kjX1Pli8kTwAJR6klZblaKh3IIXipJvdoi+3bm/EN7GE+Bvn+AcmRGMo owdgAgsCPJbvyqjZXNqw2tbiiwb+v2lNGzioGFsYMA5PA3aGTtMXDlk17P2b2D2wFWRnbNtMWd+q0 qYC2TVeYQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k04zi-0007HL-Pq; Mon, 27 Jul 2020 15:24:50 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k04zg-0007Ga-3m for linux-arm-kernel@lists.infradead.org; Mon, 27 Jul 2020 15:24:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=9vIfOIhjeocObHiDXZCLuAgghjol6nwY5lbJNZUDwNs=; b=yRj+LeaSFDkx9M/0AwgXuDtpj T5mIneCQ+Kz2fI6q+xrI1xiG2gFiIlhJn4TsnFo3pl43IcA668M2w6DCDZ0adB5YbSguNwAtpBVVx IfX7FRl0ab4WCz4vl7zD3Z87iPhtR+iWTznoAcBK4lgK/W/r4cnO3Ouhpgma+1mq78RubSHz0Ehhh ewqZuHwYw4JKdQXvVoxcW+M6355G3QoNTW22mnVELnisjCHwOzfMbSoR+VBQ2vKLPKxh7WUWvs6P+ FT0CTG3rbg+LSHKgbt0Bvri2CECLbC0NOnr3n7nfdgmvCaeRaZqYmhlLUsgW9akij+ETbiKN0qy0W 9au3JzwCA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:44848) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k04zY-00030U-Gc; Mon, 27 Jul 2020 16:24:40 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1k04zX-0003l8-DE; Mon, 27 Jul 2020 16:24:39 +0100 Date: Mon, 27 Jul 2020 16:24:39 +0100 From: Russell King - ARM Linux admin To: Alexandre Belloni Subject: Re: [PATCH v2 1/3] dt-bindings: rtc: pcf8523: add DSM pm option for battery switch-over Message-ID: <20200727152439.GK1551@shell.armlinux.org.uk> References: <20200719145028.3370-3-miguelborgesdefreitas@gmail.com> <20200720112401.4620-1-miguelborgesdefreitas@gmail.com> <20200720112401.4620-2-miguelborgesdefreitas@gmail.com> <20200723174905.GA596242@bogus> <20200723195755.GV3428@piout.net> <20200727094553.GH1551@shell.armlinux.org.uk> <20200727144938.GC239143@piout.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200727144938.GC239143@piout.net> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200727_112448_188032_034EF901 X-CRM114-Status: GOOD ( 26.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , baruch@tkos.co.il, kernel@pengutronix.de, a.zummo@towertech.it, festevam@gmail.com, s.hauer@pengutronix.de, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-imx@nxp.com, miguelborgesdefreitas@gmail.com, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jul 27, 2020 at 04:49:38PM +0200, Alexandre Belloni wrote: > On 27/07/2020 10:45:53+0100, Russell King - ARM Linux admin wrote: > > > This is but this shouldn't be a DT property as it has to be changed > > > dynamically. I'm working on an ioctl interface to change this > > > configuration. > > > > Why does it need to be changed dynamically? If the hardware components > > are not fitted to allow the RTC to be safely used without DSM, then > > why should userspace be able to disable DSM? > > For RTCs with a standby mode, you want to be able to return to standby > mode. > > That would happen for example after factory flashing in that common use > case: > - the board is manufactured > - Vbackup is installed, the RTC switches to standby mode > - the board is then booted to flash a system, Vprimary is now present, > the RTC switches to DSM. > > At this point, if the board is simply shut down, the RTC will start > draining Vbackup before leaving the factory. Instead, we want to be able > to return to standby mode until the final user switches the product on > for the first time. I don't think you're understanding what's going on with this proposed patch. The cubox-i does work today, and the RTC does survive most power-downs. There are situations where it doesn't. So, let's take your process above. - the board is manufactured - Vbackup is installed, the RTC switches to standby mode - the board is then booted to flash a system, Vprimary is now present - the board is powered down. the RTC _might_ switch over to battery if it notices the power failure in time, or it might not. A random sample of units leaving the factory have the RTC in standby mode. Others are draining the battery. I'm not saying what you propose isn't a good idea. I'm questioning why we should expose this in the generic kernel on platforms where it's likely to end up with the RTC being corrupted. Now, I question your idea that units should leave the factory without the RTC being programmed. We know that lovely systemd goes utterly bonkers if the system time is beyond INT_MAX. If the RTC leaves standby mode containing a date which we translate beyond INT_MAX, systemd will refuse to boot the system, and the user will have no way to set the correct time. The user returns the device to the supplier as faulty... -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95F53C433DF for ; Mon, 27 Jul 2020 15:24:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 734142053B for ; Mon, 27 Jul 2020 15:24:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="yRj+LeaS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729044AbgG0PYr (ORCPT ); Mon, 27 Jul 2020 11:24:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727938AbgG0PYr (ORCPT ); Mon, 27 Jul 2020 11:24:47 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAC3CC061794; Mon, 27 Jul 2020 08:24:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=9vIfOIhjeocObHiDXZCLuAgghjol6nwY5lbJNZUDwNs=; b=yRj+LeaSFDkx9M/0AwgXuDtpj T5mIneCQ+Kz2fI6q+xrI1xiG2gFiIlhJn4TsnFo3pl43IcA668M2w6DCDZ0adB5YbSguNwAtpBVVx IfX7FRl0ab4WCz4vl7zD3Z87iPhtR+iWTznoAcBK4lgK/W/r4cnO3Ouhpgma+1mq78RubSHz0Ehhh ewqZuHwYw4JKdQXvVoxcW+M6355G3QoNTW22mnVELnisjCHwOzfMbSoR+VBQ2vKLPKxh7WUWvs6P+ FT0CTG3rbg+LSHKgbt0Bvri2CECLbC0NOnr3n7nfdgmvCaeRaZqYmhlLUsgW9akij+ETbiKN0qy0W 9au3JzwCA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:44848) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k04zY-00030U-Gc; Mon, 27 Jul 2020 16:24:40 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1k04zX-0003l8-DE; Mon, 27 Jul 2020 16:24:39 +0100 Date: Mon, 27 Jul 2020 16:24:39 +0100 From: Russell King - ARM Linux admin To: Alexandre Belloni Cc: Rob Herring , miguelborgesdefreitas@gmail.com, a.zummo@towertech.it, baruch@tkos.co.il, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] dt-bindings: rtc: pcf8523: add DSM pm option for battery switch-over Message-ID: <20200727152439.GK1551@shell.armlinux.org.uk> References: <20200719145028.3370-3-miguelborgesdefreitas@gmail.com> <20200720112401.4620-1-miguelborgesdefreitas@gmail.com> <20200720112401.4620-2-miguelborgesdefreitas@gmail.com> <20200723174905.GA596242@bogus> <20200723195755.GV3428@piout.net> <20200727094553.GH1551@shell.armlinux.org.uk> <20200727144938.GC239143@piout.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200727144938.GC239143@piout.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Mon, Jul 27, 2020 at 04:49:38PM +0200, Alexandre Belloni wrote: > On 27/07/2020 10:45:53+0100, Russell King - ARM Linux admin wrote: > > > This is but this shouldn't be a DT property as it has to be changed > > > dynamically. I'm working on an ioctl interface to change this > > > configuration. > > > > Why does it need to be changed dynamically? If the hardware components > > are not fitted to allow the RTC to be safely used without DSM, then > > why should userspace be able to disable DSM? > > For RTCs with a standby mode, you want to be able to return to standby > mode. > > That would happen for example after factory flashing in that common use > case: > - the board is manufactured > - Vbackup is installed, the RTC switches to standby mode > - the board is then booted to flash a system, Vprimary is now present, > the RTC switches to DSM. > > At this point, if the board is simply shut down, the RTC will start > draining Vbackup before leaving the factory. Instead, we want to be able > to return to standby mode until the final user switches the product on > for the first time. I don't think you're understanding what's going on with this proposed patch. The cubox-i does work today, and the RTC does survive most power-downs. There are situations where it doesn't. So, let's take your process above. - the board is manufactured - Vbackup is installed, the RTC switches to standby mode - the board is then booted to flash a system, Vprimary is now present - the board is powered down. the RTC _might_ switch over to battery if it notices the power failure in time, or it might not. A random sample of units leaving the factory have the RTC in standby mode. Others are draining the battery. I'm not saying what you propose isn't a good idea. I'm questioning why we should expose this in the generic kernel on platforms where it's likely to end up with the RTC being corrupted. Now, I question your idea that units should leave the factory without the RTC being programmed. We know that lovely systemd goes utterly bonkers if the system time is beyond INT_MAX. If the RTC leaves standby mode containing a date which we translate beyond INT_MAX, systemd will refuse to boot the system, and the user will have no way to set the correct time. The user returns the device to the supplier as faulty... -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!