Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4403075rwd; Sun, 11 Jun 2023 07:00:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ65HwgOGFJGcDJuQl8M9fgem5zMSPMY8L8pwmlNWjnUgevDAL6ArbeYKlY++rGgquA1xf02 X-Received: by 2002:aa7:d290:0:b0:510:e80f:fa4e with SMTP id w16-20020aa7d290000000b00510e80ffa4emr3200803edq.1.1686491999781; Sun, 11 Jun 2023 06:59:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686491999; cv=pass; d=google.com; s=arc-20160816; b=iDvxXtnNhh6YqJrVse+D//sUqw4r/RwnyS2Gqio5kxy0GuoKUtVycM1te1pXFDZUdx /5S05SGQZeq6t+DfolbASZ0RlcyW7oa5KMalHZNZUKvOKmqFz41PAWi71Sj2RgNt0riW 0W36lXrxqBe/gUUnE1mNosOwBKAQxnmLxwmwaVPbkbT/fmQwUQeFIbJid15UQGRBc6Ar YyOQOCdtN/BE0QdXEM3u1kC9blWnB++L5EMvvNiulMqtUMwnszAq618a8basg1OuwZnX SNROvl2uKFQ+drjoJ5egizZ2PW9AhLCw4qfKvztS6JLIwPch6mc0vSy/zzHzaIAmFgac vfUw== 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=CfvqGS3cdY7Scl7lDwT/lmts5FMWe0DbOFU/+7PHq2I=; b=c57nO5TVX+oY1Wz7NXa3tZJZflUsohYsl9ooQ5Tsk5EX+wIfNVDRAkw77nPka38XuA MpBTI6UbOP0d6TAI3ldwo2UPGAJ8/djLJ5CueJHGJowsyQo47Vi3ayvKMNy5PGmk6V9K /DtWUZhMSl2UB2retaSrJTJSGLAcMH95cvoRQELjqHuVwSkC7UkBRJRSe3AwkZAao9JS kBetDIvnOreq+pN6Jpyn1TumWeguWQKf7vAeAtlrczxybC2pyU0e3SeDIpd5sxpHETbg HLFRr74YSQ/a8Z3TIGj6+t+aO6qEyIUcZQMzntVkHxQqQ535oLbExG22WUtiAK9W2XbB eeZw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=wSE4w4Ge; 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 v9-20020a1709060b4900b009738d042995si3964586ejg.813.2023.06.11.06.59.33; Sun, 11 Jun 2023 06:59:59 -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=wSE4w4Ge; 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 S230087AbjFKNiQ (ORCPT + 99 others); Sun, 11 Jun 2023 09:38:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjFKNiO (ORCPT ); Sun, 11 Jun 2023 09:38:14 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2066.outbound.protection.outlook.com [40.107.105.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCCFBB8; Sun, 11 Jun 2023 06:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jN8t7/7kV5Aj/JizONmPLMvuqQ9So/5lTE/FZI5WBOUgUD2E4C8OvmiB3bm/6UNcgiJSNDd+NiK/Tmz8f4oenNrUdXYroqn43cPhVqb9UZb4qnJxyyKjiwcLIqcY0g0vYDsLvh3I7DfQxGzYZptws2tvCEUDRMsYBe807kaJmW1r10p9NZCD0xoleCWyyoapZiyCem2Gma/Yi5F4tj/RfMbSkxryJrXk+yY3e9zfH8XopOupkvJtsqLgDKOVo5sAOxoNyrEKJbCqQEzQWNmTj3n0k9RnKX6Sv1OdxNTfM2nC8TylVK6z/Nul4UlfT/W/CBNsSqdpn7f3J8fw9HrQQg== 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=CfvqGS3cdY7Scl7lDwT/lmts5FMWe0DbOFU/+7PHq2I=; b=cIjdifKhz/xg/gHZzpKWRiwm2RNFVrXceYD2tuUzrSetxvuQF/fRT/6v8+uGkCcNwaXV2rHPS5VjXvcYz2obndAz5YHuIy9px40qBnUTrz7c1XCQm2zD1szLq3fHKh2jufYyoYv+ZLuWW9dTCgBGE3ZhwVH9JmAPcOaj6KXIunXRxJr0PjExU67fUVfPuPo1ytVZ4if3MRec1UJsCKRZz/51bzm3yfPGUcl4ScvEYYOb1lUNva9pWNcSVlocp5WpfLK8VFAsEk+0b82VUhZHiE6WOqIeIr6bF4+aGjERj672edYro9etEAjSvIVP8yStDkT4ZZFiNWT1P/Hfl4KIeA== 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=CfvqGS3cdY7Scl7lDwT/lmts5FMWe0DbOFU/+7PHq2I=; b=wSE4w4Ge3t+l9dXEzPllAM4QzNI0E+ydn8sO7mHqxTCMLtsZV5jC4WJVSkJYy6kyp+e57Dr5LSTs1mH3oGpwNEOI3Gq/LYziMmOdXx4/+pCpjWA+3yDeKYVpkmWKEcJF3zPtKLtMATLojAiRz5ojjlz5oSOcZPfJAtrJMf64CI2+erThy+3x3qmqNFwXW5+IiEVEmO/Aa9dd7NFMwh6IXs5C2rAnFHtjxXP74O9ZyQt9XPLqzxnGT8/TBoIfpdLrt+bvv+NV76ukpjz6rNbjo75cCaHyPIVoTEwSlfK+hzJlUKDacrON+5Lzeri/MF8Ni2u8bTcaYt2m8KT7qT64Xg== 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 AS2PR10MB7048.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:594::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.42; Sun, 11 Jun 2023 13:38:10 +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 13:38:10 +0000 Message-ID: <1d532c45-ee33-9729-f0ac-b59c2bec8d7d@siemens.com> Date: Sun, 11 Jun 2023 15:38:04 +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> From: Jan Kiszka In-Reply-To: <20230610083135e40dd2f6@mail.local> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR2P281CA0106.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9c::18) To AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:588::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS4PR10MB6181:EE_|AS2PR10MB7048:EE_ X-MS-Office365-Filtering-Correlation-Id: 26eae13e-4e60-47d2-1e67-08db6a811850 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fK+Ek5VsZBT+DLmd7DCMfFIfqvEWHwd7qXuI8oZTgJ9GDWLsvM+VEKKuHw8ZCE+bN69rY7TrMod/yfQ/A12vyQi6xcfrt+0dSfFqvqku/Rs/sATzlO/z+WTIQAf8/2pt4GhF8imhZEDodtqcpXh/O2ANXtQ18orpkM05AAkHyDLnQDZTJ0ANDtPkqtD6Awr0ne9pqqKVCcAHd4R9zrzqbWTtGx4bPq3xOFGZ361gvVOkfw0aoG6hfbR7CSUFvRMcT5ryRQKZ+wsCxtyP/TLG6dDQOVtmJ/IZWDnvxurU2asbzm0cd+dNesvEXjEtoIP5MshuI4duW1ws1QoTXRbQK9KzvN4dzEQ0cK04QZrYpbypkjtcss8yEVyhUHNZfYpBATE5BbS0Fu/SV6twtqjppS4HsgIr3hUtMu5FudAcOHulUE7mjrHThmQoUfIDXlNwO9EMMQJbrs6StjQF3wfdBw7Tsr5myC6Y0y/H2EGSAGepT3niM3VJs0ezXlw42uU6oQbEKCBK2DnuIieQONj2w3wETA1c5XHcWqNnQBKU7V2bR2TyztHLbzPZnhlyCQAiIkkuCq2+TspQca+lxYBPHmoR60ceyriLqAk6XEY8hIlaKSHUWb24sbUtRbNfQ6ISHWdtYyb/gdTKA3lQg2WKGw== 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)(396003)(366004)(39860400002)(346002)(136003)(376002)(451199021)(8936002)(44832011)(8676002)(5660300002)(31686004)(6916009)(4326008)(66556008)(66946007)(66476007)(316002)(54906003)(2906002)(41300700001)(6666004)(478600001)(6486002)(26005)(53546011)(6512007)(6506007)(36756003)(83380400001)(186003)(82960400001)(2616005)(31696002)(86362001)(38100700002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UHY3VE4xS3ZSbWQza2VxK3N4L3IyUDloS2NXd3FPVlZjNlVwdTVJWDRvUjll?= =?utf-8?B?VzI3T08xS0prN0dSMmg0cGphSjdsTW1SdjBaOHZuTCtaNmM2aDMza1J5RGgw?= =?utf-8?B?QmNzdDdPNHFwc2JidC9qMlJITzlwOVJCd1FMVEE3WHFiK1FhSEtDc3IrYzBk?= =?utf-8?B?eENyaEFOeFh1NWszRWVuQXhWY1graWw3U09SQ1Z5UG8xTHJ3SEpEVFA3YWlP?= =?utf-8?B?Q1FsZVRFTTg4UFYzQURXaTVzcGNkbXZ6ZkRLZG1zaSt6SkVKWUM4RWdJTXh1?= =?utf-8?B?aDBJeWN4RHNtdEYveFJneG11aTI4TXgrY0dic204akU1OFh1N29XQUlKb3VO?= =?utf-8?B?akwzQlExRjgwSzErTnh0VVR6MWRYb0xyQnpJ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Exchange-CrossTenant-Network-Message-Id: 26eae13e-4e60-47d2-1e67-08db6a811850 X-MS-Exchange-CrossTenant-AuthSource: AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2023 13:38:09.7438 (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: u9/cmUrhMfWOhBbGh1DKq2/ThEZcwJFJ6YLr1BKbr718t6E4ejTMFkBrNfnAiN0xkdkethtU88Ox507zSBRELw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR10MB7048 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 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. Jan -- Siemens AG, Technology Competence Center Embedded Linux