Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4581813rwd; Sun, 11 Jun 2023 10:17:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4UTWZKtlPIFeg0LJJGxFRxXCeH2ukPVITmYmj9LT87neNQUXCUrEpdc5+jTwTsf59JqUOI X-Received: by 2002:a17:907:c15:b0:96a:246b:c65d with SMTP id ga21-20020a1709070c1500b0096a246bc65dmr7872282ejc.12.1686503834572; Sun, 11 Jun 2023 10:17:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686503834; cv=pass; d=google.com; s=arc-20160816; b=cL9XHLBjZUG6ipjUIpvDflm8kF5QzEepQ0ujGC0npyN1FO9RmeZ32IPunQVsBgEPMJ hJExLLcYCPL7EcL5xjE15wTvCims9rOUbsV2Plj9q4YVgOwS3jkpY85Y08aenHrESES2 YuKZJkbAztvdp+p9vBSH1AexR8Zqv2ztLOyUKmdNrgNm7QLhYSva3GGu/1OpWR+g8P2U ieffaYJE14UqcuDmjXjsed9Sq2S9K+3KyYGZ9kYS2SD4RhPpCS04lCwDtflsXx2YZXYf ntT/7C0JB66LrdsDdeCY0wWa3V2O4Ocx2ZBUTSHgGE8lU8MAl30js8oyVJeo8dRj3+Ws 7e/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=9lI5vw1JC1bXenaOyug9cXMy9rdm+NJy585SBe2S2wE=; b=nhn7AMdANwEbDbGrLb108hHUdquZxHGqv8jSz99aowO0/NFAxffAbfKda9b7kva5EU gcIHTZGiHRl5i1E7RbU/xFBiViCJBfq+Zl2PMITK5cYZDA/NESGm2fApsQq9BGMqrmi6 Kjwf+l8C4aGn9L+iQ3OpEMZPJvidYkQU5NeYj4S3XddirjZJkFl64pPwjGirTVUBToBS M3NqOIAHQBjKbubj6mHxHbs0BMBZCGN9HSPVbfp+S2OZA7qRLP1Vp8zzs8BEpihR2RQP Y8Ot8R0qgWx+gdIVGHqUOXc2gomz3Ane9FTqUTy14Gb8gAPOrVjWShlvJq/kQlnrn4UC RnTg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=IWH7waIv; arc=pass (i=1 spf=pass spfdomain=siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c23-20020a170906171700b009789497a6b9si2902799eje.292.2023.06.11.10.16.47; Sun, 11 Jun 2023 10:17:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=IWH7waIv; arc=pass (i=1 spf=pass spfdomain=siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229861AbjFKQ2f (ORCPT + 99 others); Sun, 11 Jun 2023 12:28:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229579AbjFKQ2d (ORCPT ); Sun, 11 Jun 2023 12:28:33 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2077.outbound.protection.outlook.com [40.107.6.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D181DE4F; Sun, 11 Jun 2023 09:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jMMPwtGtKjDsozvFWgVbexszX+ihYOViVd/rJBJo0JmkFkAYHoqFuHhsNvCD5G/jP6Zy5WhCxqvkLZhrc+bvgixSHn1AsktQpLVGDkqmgyYW9xAMqTQ4saw4/G1+hjKYkt2A6gyZBE1H9rYQL/p9lFAKPCSSdH0t5I3kG+lRPgmbhxyJxCDGfivD05oLeK9NTUtK8r8AZdIPjnf0a6wJ2y/Pj4hi8ss1BwITVe/droFLSkhjEHIHMRfSCNDH4V2krsw5//S217IP08Dl1/84LTOuzNP3pLwyzH9sZikxlxVBcD4FbYFKWppAcHz40e6lbZi/hNErt9SXYEuMbYndIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9lI5vw1JC1bXenaOyug9cXMy9rdm+NJy585SBe2S2wE=; b=KGzwtHI71El/Iw4+yxCRahp/lFhH6EStXkwhbA015UWkfeQXDs+OUUoCybH8W+jyTNLaDbWBSH7UMlZ0x6HUJmkcG09C4knlZWwxPNw3LCX6j6RfibLs0U/PX844I/ncPqAqQYLV2gh3CixkHsf0pcgg2ynXzd1k2rtQFq3lQGmhudhzDH2KD8gKWrNkM1COwXdHaCUOkA6jcHM4jRjni3uz3Ly2Cw/EnD0thP1ZwmtDecH1TbZKwShu+QX9Fu5ffINFMfMc0sCs1p4fjQC6me1qMDhsNoC0Y8X603KytVjpG6A4r6KCUcgQosNyQgzvMU6YzJLV6zZSO1PsPyK1Qg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=siemens.com; dmarc=pass action=none header.from=siemens.com; dkim=pass header.d=siemens.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9lI5vw1JC1bXenaOyug9cXMy9rdm+NJy585SBe2S2wE=; b=IWH7waIvfxpDCUbH7l4pjBg/Aquvx0MBcaNc1AyNwaUzMn63K2Kzdqtaf1wWi2e+9sVQrnQE9TSYRPom1kro4N4RNdQ6XldLWbzs/g5FKsVUDxx3SZ7DYRc9fZyEen8CLcGNEDBihi/0dI7gp4eZNKyxPFCbfGX+Svn28wbJQ4A32eMMTEYoOZ26+7UyUHqNpmolE4JZZRpu5+2Qig4VMumft4nhuPHSpWDiUpMEsKcnYe/eqcp3VBtRTaZApRYyjeuoCDpZRLoIz9CS+nctUTr3gp4ut8blsZhEOA7qJiolLjPVtZ+f88PT15i3ZHiUpG9nj9WTB2v3/XdbEs1oew== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=siemens.com; Received: from AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:588::19) by GV1PR10MB6326.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:5e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Sun, 11 Jun 2023 16:28:27 +0000 Received: from AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM ([fe80::53c2:174a:8b13:ce94]) by AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM ([fe80::53c2:174a:8b13:ce94%3]) with mapi id 15.20.6455.037; Sun, 11 Jun 2023 16:28:27 +0000 Message-ID: <9ac4b2a5-7cc8-4fce-7ea0-61b26d6ef223@siemens.com> Date: Sun, 11 Jun 2023 18:28:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] rtc: pcf-8563: Report previously detected low-voltage via RTC_VL_BACKUP_LOW Content-Language: en-US To: Alexandre Belloni Cc: Alessandro Zummo , linux-rtc@vger.kernel.org, Linux Kernel Mailing List References: <20230610083135e40dd2f6@mail.local> <1d532c45-ee33-9729-f0ac-b59c2bec8d7d@siemens.com> <202306111511569834cac2@mail.local> From: Jan Kiszka In-Reply-To: <202306111511569834cac2@mail.local> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR2P281CA0037.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:92::6) To AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:588::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS4PR10MB6181:EE_|GV1PR10MB6326:EE_ X-MS-Office365-Filtering-Correlation-Id: 9109fe9e-212a-4403-39c1-08db6a98e252 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nb10hbGIl6DKbBhRe/7DzYpqToMfix1ZrMEwcKtSFAfCAV9/iyo4qH0Fxn7UvcXd8dstG2qSr5XtP64j+RUiwK9/o3iPJhZmQOGX/A4SyQR7cZMT8ozO1kgkkPHYmcZrvcfJyW/K5VazW+mdQYFJijXVQgQrSbwJHcVqfxKILvPNEfJZiYbXFzVCaq4RFxCdpH49U0WBtbji8HhtAsU53oGVHbsFtx66oQyYR2juWvf10+KqRKWt72ltrEvSTaJMWEJ3ZNuL/C3GU5T+HDYNY++NGeYkMYm/RuKbXzmMjUNuyek47joAI7wCms9NDKPUHdAmdkUONCsGfVgM+10tlITUBJSXyzHd+IP044iE0ZHb+x4spqQNEcLifHmD3EfVeLf/wWVfiyjRr1TTzcKuYsnW0gvlgeVFf/3n+Ra+B5/Sg+L1pMigcZqLPMpPbpK9C2WNlR43FAF4/MviZWXYPf3dU3R/5k8gXvllji0yA3uQ6w1T5Ij4tU1PfHjcTuVcmhMd8Gf3p6bDe3r1C1B5wegV9pqaOgRBWXaIFgr51wr8vJk7Z1rF7HAu/JPiTQqkTPdR3U++xE55oDrwBkyj0YIBgqe7enHNm17FlglZ3mnuvpwkOLymtdc7S+Cassl5xX1rAlkt6GXnXdylx9vL6g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(396003)(376002)(346002)(39860400002)(136003)(451199021)(83380400001)(86362001)(8676002)(44832011)(82960400001)(38100700002)(66556008)(316002)(478600001)(6916009)(31696002)(66476007)(5660300002)(4326008)(66946007)(8936002)(41300700001)(6666004)(6486002)(54906003)(2906002)(36756003)(6512007)(53546011)(186003)(26005)(6506007)(31686004)(2616005)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bzJrUitqcGtDOHRJbWt5cmwxalorOU5vbFNJdnhQajlvazArK1RsQVg3b2hL?= =?utf-8?B?cXF5SkhBNGFSZFpTUlRkTUZsdDJNcFdSc3lqbzZoNVZmN1pDTU9VMjNMcmpJ?= =?utf-8?B?Q3NUeUZqSjB0YU9BZERsQ09ZZHJQaDBkTU5NSHBZcHBsbVlPczlBZndLL28z?= =?utf-8?B?YTcrR2tFSENYN1NvcEJwMjVzekp0VkhaZnlFc2tPS2FJSDVhMDdqOGFTKzZK?= =?utf-8?B?WDVqcVdsaTdvSGhsVlFiYzlxT1hRTTIyWHVPYzRNWWFFU3VyWGJwdDd0cUdl?= =?utf-8?B?UzdyZzh5dnp4VVZKc3l4WE1CRjBWUGZPN0tDMmNwUXpCK1U3OUpqRitkQ2F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AXrCAL6+?= X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9109fe9e-212a-4403-39c1-08db6a98e252 X-MS-Exchange-CrossTenant-AuthSource: AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2023 16:28:27.0276 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aQGqhFW9XbR4uD+W7Bx7KNOudn+m8cOkD/aw1eIFhaBSbPOtHmGKLpP29QWlXrOpZBW5S1j7U0lzyyzroE0nDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR10MB6326 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11.06.23 17:11, Alexandre Belloni wrote: > 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 >>>> >>>> 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. > Nope, that could be easily avoided in software. The actual problem is that the VL bit is not settable (clear-on-write). And that means we can't do anything about losing the low battery information across reboots - but that's no difference to the situation with the existing driver. There is no "fix" for userspace as there is no standard framework to read-out the status early and retrieve it from there when the user asks for it. That's best done in the kernel. In that light, I still believe my patch is an improvement over the current situation without making anything worse. Jan -- Siemens AG, Technology Competence Center Embedded Linux