From nobody Sat Nov 23 20:42:14 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2107.outbound.protection.outlook.com [40.107.22.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 681551A00D1; Mon, 11 Nov 2024 15:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.107 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731339739; cv=fail; b=KI7c4h8cNm+Zj7WafQ6Z3COpy6xIwuRWnjbjjyk1KwlN2YtARXY440yEOcc7e6oI+gk3ujCs+ovijYa0Zfclxu0U0h9TwmPltG7OiyDsN4ZeaaX40Q/2+1Kch5HjE9Q+R4rAmR0pfppoSKjBkeuG9L2EKai6cMtBGrrc/RBTuJQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731339739; c=relaxed/simple; bh=kzh/FvD+sgQ1Ulj0p831AGtdz5II/UlAYJk4dDs+ckU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=i/B/o0OT/W0aay4TsfyrtzAJAfX0Thh2fTgBLncXHF/d9w6Wq7u5sVPHazDtJoUfi7HeMWu+KXzsw0H5fJfH1yrYPsqP+7/ExA8HKI4wtIQzjrLm23F0nOjCo7GbiIlBlcJ1hWRq5VjNpMUC/zqkF/wXQNcll/CLchzv8r+OdNU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kunbus.com; spf=pass smtp.mailfrom=kunbus.com; dkim=pass (1024-bit key) header.d=kunbus.com header.i=@kunbus.com header.b=qqmuWuzU; arc=fail smtp.client-ip=40.107.22.107 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kunbus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kunbus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kunbus.com header.i=@kunbus.com header.b="qqmuWuzU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FsEhJkixyNyxgVlpQh825rMSOA26toN9XgvxI5ug9qX0b/zitAksX/V67XkYk0g8Z9Ex+K84otJ4iDc1rjJvHtLbcDNnOMvbrUvRTlTeuzEGJKpIbj/lyOd2oiiOUJS2gDLa8ibtk6JOq8Qk5nuLmPV9GKI1FfZzFElXKADPnIs8C1Xtd4O64KR1twVCqSk6iO6csUiXlIKy08O8MvgwfsYjsMtvaJRyH4iUCVqDvgNASR5P83EfJsr4EyuCpr1NLpM2NAdOuLcHTavcUnx+mDdV5mAA1B55tG9G8fd4mYAhQnnNG8lOtfaxAhN4S6YPfobIyh1DTzoWEaQ50kpvBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=IBwozDiUGyxWl0PurQJhwHBzn+GsyRVrQI2TOZA3aAY=; b=qp1YSCOR2GoY6/xTWrFYC/V8lH6+U8ISr9/8Y9EOaqiWiSvVjZtFwzRdlTlH1DvlXBewr8k7LEq2M9nmxvaE1WrNJpOb5i76GT7M/njMXDbblSMLYp8VkIUy5UTSHbTWAGskuiUS7wZA5piCOERNyILO5hS/iFKKqb3yK3LwBNnRx4ds/GoBYI+Byf12THYQudu2BUZ7oYLRbOOQXMTQlJ0uWxiA+HFrC+Ev3Df1SQYMoW0RoaUdEDWNrwVWaLKwWp5+WNJYug1nnD2oAgOoPzbKmGy6fuB2wUYD8lvkgbKNIIjBG1AYm9jZGPPH8Io3xTheEkZUQ+RBnjKMleNHLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kunbus.com; dmarc=pass action=none header.from=kunbus.com; dkim=pass header.d=kunbus.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kunbus.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IBwozDiUGyxWl0PurQJhwHBzn+GsyRVrQI2TOZA3aAY=; b=qqmuWuzUI28GJ82WOfs3UwRc6/m2PYg7I5oV+Q7/mqHaKJXjhezxkOJ9hz0UoHUCintS8TnvkjTtijQkXxsbkzWMSBJ3CfWSHWopacTjudKexySkEt2xIIkpW/FEzpn/bBwyhK5ewZfsefwCDqVPNgQdrkMJDvFZwLGmlcsK7H0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kunbus.com; Received: from AM0P193MB0738.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:160::8) by DU2P193MB2001.EURP193.PROD.OUTLOOK.COM (2603:10a6:10:2f9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Mon, 11 Nov 2024 15:42:13 +0000 Received: from AM0P193MB0738.EURP193.PROD.OUTLOOK.COM ([fe80::2398:d74:da85:f90]) by AM0P193MB0738.EURP193.PROD.OUTLOOK.COM ([fe80::2398:d74:da85:f90%3]) with mapi id 15.20.8137.027; Mon, 11 Nov 2024 15:42:13 +0000 From: Philipp Rosenberger To: Alexandre Belloni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Lino Sanfilippo , =?UTF-8?q?Thomas=20B=C3=B6hler?= , Hugo Villeneuve , Philipp Rosenberger Subject: [PATCH v3 1/2] dt-bindings: rtc: pcf2127: Add nxp,battery-backed flag Date: Mon, 11 Nov 2024 16:41:43 +0100 Message-Id: <20241111154144.163604-2-p.rosenberger@kunbus.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241111154144.163604-1-p.rosenberger@kunbus.com> References: <20241111154144.163604-1-p.rosenberger@kunbus.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR0P281CA0057.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::14) To AM0P193MB0738.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:160::8) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0P193MB0738:EE_|DU2P193MB2001:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a80ab09-3147-43f0-21c8-08dd0267696e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?otGPgqK5kK/UmVRZjTXtNiQBHAWWUFkvhTt+12GCjC4fT5gX9v1S+Jr4wfRR?= =?us-ascii?Q?oGpe9/DerEPoQdWnhcNOotPvMuk1EJHnJ94NjaKjsHCDhrIa/Yto997akD1c?= =?us-ascii?Q?eeEf2pAufP0KPO7g2QS1hjsrEuE7swLoA/AyT2ZMrq8Vr8SDoXxo8594AzOQ?= =?us-ascii?Q?8RgPp9tiFVI1Y4H25UUWuNVOJprcxe03ffSA7BhjCCf4uGtcSWjh/XJuPEqT?= =?us-ascii?Q?O1QMRezLrr8g+TPe2c8bzB6gEizadKWIpk5pTMevj6pXiXLqh9fxriqNaPFZ?= =?us-ascii?Q?6fS9d0zYted/fyZv3A9jcrIUCAWPR7HQngH+1qPWPnVO88Oe5+RufRYKFG6j?= =?us-ascii?Q?IUR4HhWoUE5wAS/RTZeMaHExrnElhlxo9grE0VyjUAfIfoWDknHM7C/7M/b1?= =?us-ascii?Q?HRNwh8eVeMuvoCmJFIn2bCy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?BoRBIj+yAUXVmJrkkSOvHQm++zJ75Tz3Z2Ec2S1hOIblx+xnvliTILOxcSWd?= =?us-ascii?Q?lLr3aLs=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0P193MB0738.EURP193.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?YnE05HOcVQVqGYAM30sr0DJ1+pRzRAGo8LwpC68VOCrDcH6WTLpfPp//cAbP?= =?us-ascii?Q?C7jvzRB5MCpFNcePATV6nj4s50xPth/S1WmcSXeq7FI+fVDpGVRKBWP2gLAn?= =?us-ascii?Q?mY+XNHJ2IQ9rDHsrmuFwlROPdTw77JwJx3x641qzbp46biAHDiWayzpNORc6?= =?us-ascii?Q?EGjEa7IHj30jQDOKKstEXmf7iiiCzCwMdrQW6tYuY+6EFGwjsUCO0VInA2/P?= =?us-ascii?Q?j1DRkcRqWsK3PSR2EuozWklWmWxQU4gZLDzp9vmcyhdTvib01pgq6O3J9fYI?= =?us-ascii?Q?vV90UZM22lPgUb+6GrAAK4Bj9BLXXo/TZWRdGdWeO2uJYB2Pdo9D4uACbJUV?= =?us-ascii?Q?B3i2yIZV2vpSGVEaseY0R7Ya23bNnMxyl3zgtZsfjS8TnIKtsWTosu3Ck1dj?= =?us-ascii?Q?Q1BSVM5cfDcD/U7AjguvYid0wSAY+0IqJPGS4L5YiWUFA4Q4357bT5mJqvTT?= =?us-ascii?Q?1VitOFZ3RybbouaujBJyM44kieA/O/voqeO2Q/XNQb9HE8CZXWcBWUWM+XEQ?= =?us-ascii?Q?P6I8q6hzI6MbaLCGsS/r0Rq8X4FJMDX4jF/auUHR97LssWa4MZOntXtC5OtP?= =?us-ascii?Q?wV76c3rygO+d5j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?= =?us-ascii?Q?SwWeslXLDM/VK3w6JEqptkwiGlRH2NQQk2lUg3nKQsUM3QgDZWsLKlP+DWiu?= =?us-ascii?Q?6A1kwzz3skIdY4mYWNVZ5muaZrezI5jBrvZGoURK3OJ2lbvw5May/9UhkIMf?= =?us-ascii?Q?kQ=3D=3D?= X-OriginatorOrg: kunbus.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a80ab09-3147-43f0-21c8-08dd0267696e X-MS-Exchange-CrossTenant-AuthSource: AM0P193MB0738.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 15:42:13.1603 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: aaa4d814-e659-4b0a-9698-1c671f11520b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PRrzmWVnSiJ1uepv7IbSBWDFnRazLJfU/CEQuDB6X/Xpo6kFfX7qt0Ditzsj47tGDYELlc/ZzXPQZdAqwnZ8e7Lm7uLfH8pC6qeZM4VGf3I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2P193MB2001 Content-Type: text/plain; charset="utf-8" This commit introduces the nxp,battery-backed property to the nxp,pcf2127 Device Tree bindings. This flag indicates that the RTC is battery-backed and forces the driver to enable the battery switch-over function, but only if no other mode is already configured. With the PCF2131, the battery switch-over is disabled by default. If the battery switch-over is not enabled by the bootloader or firmware, this property ensures that the RTC can function correctly when powered by the battery. Signed-off-by: Philipp Rosenberger --- Documentation/devicetree/bindings/rtc/nxp,pcf2127.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/rtc/nxp,pcf2127.yaml b/Docum= entation/devicetree/bindings/rtc/nxp,pcf2127.yaml index 2d9fe5a75b06..87ba16346fb4 100644 --- a/Documentation/devicetree/bindings/rtc/nxp,pcf2127.yaml +++ b/Documentation/devicetree/bindings/rtc/nxp,pcf2127.yaml @@ -30,6 +30,13 @@ properties: =20 reset-source: true =20 + nxp,battery-backed: + description: | + Indicates that the RTC is battery-backed. This property forces + the driver to enable the battery switch-over function, but only if + no other mode is already configured. + $ref: /schemas/types.yaml#/definitions/flag + required: - compatible - reg --=20 2.39.5 From nobody Sat Nov 23 20:42:14 2024 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2107.outbound.protection.outlook.com [40.107.22.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 811661A256C; Mon, 11 Nov 2024 15:42:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.107 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731339741; cv=fail; b=FDqWFz4fXi8PMfMuhuS/Dq1+ICQg2Agv2ujiI7Zg57Sx+hAA+HD/zzni1TNNchgnV30+uEbwb3jXHdNw7LTPIx55lMmWBvQFWoTeriAIZoX0+Za1Yo+Krfq/acof0PP6ynBY5vxuv+TGU20EWveD7EhqUGEtmyMjv9q6TpIeDqQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731339741; c=relaxed/simple; bh=1SnFy6TTdvPqfDYnfJBYg+pDShPshxI5E4f6DlMNubI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=gA7w53f1CWxDmbI85bMn9AzDGnp8bC9kH9Svkj59E6nvmkhDE4P4XDpcglzmOu1fF/6NUWInw01PwrZY6z8JUW+cSMgRqpVabvjoXO5jt4ny2Y6gfVsMMbTqrdBDQA7nwfsRjV9PUD+KVx3QqyhGGCP1iYL3if9FD3euPqxjy0w= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kunbus.com; spf=pass smtp.mailfrom=kunbus.com; dkim=pass (1024-bit key) header.d=kunbus.com header.i=@kunbus.com header.b=n3ZLUShD; arc=fail smtp.client-ip=40.107.22.107 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kunbus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kunbus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kunbus.com header.i=@kunbus.com header.b="n3ZLUShD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dcAIy8aSFdMMmmm6tH2E+sXvubsbm15gas/wM8R8jnsb3n6UZv15tIWCp5vblVp2REKSvvvzbmc0OjfbnoKG0qUXMiBIySRDn6+46/aDX+zlaqjocFKLRLL1BQ1/SjhHr9tKDajVAgKS8l3KH1NpEfW/XQ+qNW7yUAFRwZPB3IrOH/ZaR0hXp39IXS9B5iBqgyMRQMXyZ+BvvKNT2WoGXNr4q9W3VBAsSFIu8rlW7FLcRewED9kw0PHjop5QMicrZjcUk54B+3Qc9IbtkkOFPxzNN/z4dpVYtG+a/d7gOEgclbE67WSai4AXXtN+r1baUTSdjz1m5rt89eVevc/UrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=f63B5JOKrvdcXbkhImjbRlYFhi1/csih1RaZvC9Bntw=; b=lAdu692qqpCssQWrgETarZLGdsfMZeUZdYpuqNEuVe4Tc2G5so0oKrkoawjje8gkEz/heCO0FK3jG7nMCFdJNkQJkHaCmBczkqwMUkbbddCsUXzb6Csds7A/osYZwxGkc9KFAKR4yxqTPJirKu+ynzgKRmqBMIvqNfusmLPtU9osyeJ7MsT7PRlL+d2AuCn9EeYex+c5cRlqDNawm2egzpQ8ZVsxG6pR2aNBwPgbRaQFESkJyWJ4yPn0Azb+fdMw+7E1ofLKyvgLjNPL4syimjmXUJZkiR6fnwr87dD//hVMiviVDzP1jHmUdUA82BFMO4rqxzKmaLDqB9eXrLLyxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kunbus.com; dmarc=pass action=none header.from=kunbus.com; dkim=pass header.d=kunbus.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kunbus.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f63B5JOKrvdcXbkhImjbRlYFhi1/csih1RaZvC9Bntw=; b=n3ZLUShDRjJ5AUDhz4TTSxylDiB/mIIktv6DMnyEC8vX5j5pKMv/8mf3hTY2Bw8kG0ZdXAS4uBNgmHnRcqUuT7dVC0fq3SKfFgqQem52H7BNsliaySGfyi0nORjqZRXTmhV1OsKLeqqM1nofgoB5FgD6XUH5q879DG7UtdDrdl4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kunbus.com; Received: from AM0P193MB0738.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:160::8) by DU2P193MB2001.EURP193.PROD.OUTLOOK.COM (2603:10a6:10:2f9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Mon, 11 Nov 2024 15:42:14 +0000 Received: from AM0P193MB0738.EURP193.PROD.OUTLOOK.COM ([fe80::2398:d74:da85:f90]) by AM0P193MB0738.EURP193.PROD.OUTLOOK.COM ([fe80::2398:d74:da85:f90%3]) with mapi id 15.20.8137.027; Mon, 11 Nov 2024 15:42:14 +0000 From: Philipp Rosenberger To: Alexandre Belloni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Lino Sanfilippo , =?UTF-8?q?Thomas=20B=C3=B6hler?= , Hugo Villeneuve , Philipp Rosenberger Subject: [PATCH v3 2/2] rtc: pcf2127: Add 'nxp,battery-switchover' DT property to enable battery switch-over Date: Mon, 11 Nov 2024 16:41:44 +0100 Message-Id: <20241111154144.163604-3-p.rosenberger@kunbus.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241111154144.163604-1-p.rosenberger@kunbus.com> References: <20241111154144.163604-1-p.rosenberger@kunbus.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR0P281CA0057.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::14) To AM0P193MB0738.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:160::8) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0P193MB0738:EE_|DU2P193MB2001:EE_ X-MS-Office365-Filtering-Correlation-Id: a9ecd425-9b1a-45d9-04f2-08dd02676a44 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?L/tiiNUCJhMtoVnz7r3nIHtbeUYATPNp8UcBXK8t6sTkYLV8TvKCwhPxBxlU?= =?us-ascii?Q?B+ENeAmDoww5nu+nh+/rfzSJ3Y3jxdZZH9NNv7eV4GWlv6p8tcH9mLqoR9I9?= =?us-ascii?Q?buhYClUpzlGmIZVEXEDoLXoQVWHRGN5dsjZ6Bif4/MTpbPPod8ZxhQWcBNQ3?= =?us-ascii?Q?S0ohHUiaNFRWUx/59nQcGY4G9baf8VN8ph3yfvHaOBxLFeURefWWd5Lcsia/?= =?us-ascii?Q?ZcV09nE3XMCkDkaGLBcl+VyRhb4Fow16GSfX0MhzF7IC2bRyBMqTKTIgpJc/?= =?us-ascii?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yDYq?= =?us-ascii?Q?v2QOwzMqU9uNMyPaOAYnCG9VJYAhLEb08EdVkysdlB9b8k+FHG3dgvgeSfgf?= =?us-ascii?Q?FvDxPyP7zdWZWx5GJ7oa/m7k0fZGPPKuvA4P1v1REUoN5oqOhClXNVr2gQwA?= =?us-ascii?Q?e3/IKRisqVpXZI8k0111rECqHhg4cX9gSR0pvyqFTA/EvX2L2a561wdmTvbT?= =?us-ascii?Q?aGwL5uA=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0P193MB0738.EURP193.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Wg/ZjUszibnZEf/rnt5QujQ0T1u2JAMkjowkB8tsCniMa0JwyOWc/EC8Kqgp?= =?us-ascii?Q?nmRI76aLf9bG7PjKQ2TPFo8wMerSlBK9Ax0YNVuoTLV5bPYTUSzIdx1h9xP0?= =?us-ascii?Q?KwSexy4np/VVTh4WK9JCTetKsezjPL0+8oeZ3J4R3a9Ki7tPvc2HUBFDxcgL?= =?us-ascii?Q?xC9B4CxRf5IIyKEobkoi0xMdjEp3rsD8CHqftwTu1JS2VpleNw3Q4H7233+o?= =?us-ascii?Q?yR2u0RK8YNE1MUSxaL0w9S2OPVXJw2xO7cdy7MBpG6PBdw0QtNyFk1ONv4Rz?= =?us-ascii?Q?pJcCrl544n3xe7NpdBQI392ZOWpmFmzFeJnCnoj5214R2juqeVONWMCb/HcC?= =?us-ascii?Q?d+zwhnX23/MfkD5+Pd/8Gp6QbPdzpMLg9tdxf8p6ajI/P+YkaMw572cPen7G?= =?us-ascii?Q?8e7EixY6EOuyiFMUzy2AwquxhcZ0LJAIuOcGcSmbPAnik5zOjDtOit6j8kDM?= =?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quLkuG2zyW6l6ZR8f49qh0?= =?us-ascii?Q?HyIz0Try9cIhbWL6cqW9GKmw6gGdB++17A/TU0xMTKMRc1s4jq1mlC/Y0nw2?= =?us-ascii?Q?eu4NQhZelpVQ5zTbeQI6813HS0grgrSafF28NoShmAIvubWMfrWNV1c8kfx1?= =?us-ascii?Q?8gQvvUG0eGt/KZNlgZ3FTUlLZNR1IZSOP/sJBrKiLucKFOGYuu2fa+sv5lu7?= =?us-ascii?Q?vc7u+Pyc4kN1AR5cmuTnPXiZ01ey7oRsx7zvu3ZM1h0fKh61NCE7pLKCPZal?= =?us-ascii?Q?1g=3D=3D?= X-OriginatorOrg: kunbus.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9ecd425-9b1a-45d9-04f2-08dd02676a44 X-MS-Exchange-CrossTenant-AuthSource: AM0P193MB0738.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 15:42:14.5807 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: aaa4d814-e659-4b0a-9698-1c671f11520b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wFPTvCZg51ELHOAaRZ17a8tF2AASmKcLq+Dg1TLnVoMqIAXoMITBgZMER6WpK9Uo+K05FRkWWHiDayTiAvnot8QaplBTkULVr+rU13frbtk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2P193MB2001 Content-Type: text/plain; charset="utf-8" The PCF2127, PCF2129, and PCA2129 RTCs have the battery switch-over function enabled by default. However, the newer PCF2131 RTC has the opposite default behavior, requiring explicit enablement for battery backup. Add support for the `nxp,battery-backed` device tree property to enable bat= tery switch-over in standard mode for the rtc-pcf2127 driver. If this property i= s set and no battery switch-over mode is already configured, the driver will enab= le standard mode; otherwise, existing configurations remain unchanged. Signed-off-by: Philipp Rosenberger --- drivers/rtc/rtc-pcf2127.c | 76 +++++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 15 deletions(-) diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c index 9c04c4e1a49c..c80e31fec134 100644 --- a/drivers/rtc/rtc-pcf2127.c +++ b/drivers/rtc/rtc-pcf2127.c @@ -48,6 +48,7 @@ #define PCF2127_BIT_CTRL3_BLF BIT(2) #define PCF2127_BIT_CTRL3_BF BIT(3) #define PCF2127_BIT_CTRL3_BTSE BIT(4) +#define PCF2127_BIT_CTRL3_PWRMNG_MASK (BIT(5) | BIT(6) | BIT(7)) /* Time and date registers */ #define PCF2127_REG_TIME_BASE 0x03 #define PCF2127_BIT_SC_OSF BIT(7) @@ -529,6 +530,64 @@ static int pcf2127_watchdog_init(struct device *dev, s= truct pcf2127 *pcf2127) return devm_watchdog_register_device(dev, &pcf2127->wdd); } =20 +static int pcf2127_battery_init(struct device *dev, struct pcf2127 *pcf212= 7) +{ + unsigned int ctrl3; + unsigned int pwrmng; + int ret; + + /* + * Disable battery low/switch-over timestamp and interrupts. + * Clear battery interrupt flags which can block new trigger events. + * Note: This is the default chip behaviour but added to ensure + * correct tamper timestamp and interrupt function. + */ + ret =3D regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL3, + PCF2127_BIT_CTRL3_BTSE | + PCF2127_BIT_CTRL3_BIE | + PCF2127_BIT_CTRL3_BLIE, 0); + if (ret) { + dev_err(dev, "%s: interrupt config (ctrl3) failed\n", + __func__); + return ret; + } + + if (!device_property_read_bool(dev, "nxp,battery-backed")) + return 0; + + ret =3D regmap_read(pcf2127->regmap, PCF2127_REG_CTRL3, &ctrl3); + if (ret) { + dev_err(dev, "%s: read ctrl3 faild\n", __func__); + return ret; + } + + /* + * Don't touch the PWRNMNG bits if any kind of battery switch-over is + * enabled. The PWRMNG values 0-2 use the battery switch-over standard + * mode, while values 3-5 use direct switching mode. + * Only values 6 and 7 have the battery switch-over function disabled. + */ + pwrmng =3D (PCF2127_BIT_CTRL3_PWRMNG_MASK & ctrl3) >> 5; + if (pwrmng < 6) + return 0; + + /* + * Enable battery switch-over function in standard mode. + * Enable battery low detection function. + * Enable extra power fail detection function (PCF2127 only). + */ + ret =3D regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL3, + PCF2127_BIT_CTRL3_PWRMNG_MASK, 0); + if (ret) { + dev_err(dev, + "%s: battery switch-over config (ctrl3) failed\n", + __func__); + return ret; + } + + return 0; +} + /* Alarm */ static int pcf2127_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *a= lrm) { @@ -1224,22 +1283,9 @@ static int pcf2127_probe(struct device *dev, struct = regmap *regmap, } =20 pcf2127_watchdog_init(dev, pcf2127); - - /* - * Disable battery low/switch-over timestamp and interrupts. - * Clear battery interrupt flags which can block new trigger events. - * Note: This is the default chip behaviour but added to ensure - * correct tamper timestamp and interrupt function. - */ - ret =3D regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL3, - PCF2127_BIT_CTRL3_BTSE | - PCF2127_BIT_CTRL3_BIE | - PCF2127_BIT_CTRL3_BLIE, 0); - if (ret) { - dev_err(dev, "%s: interrupt config (ctrl3) failed\n", - __func__); + ret =3D pcf2127_battery_init(dev, pcf2127); + if (ret < 0) return ret; - } =20 /* * Enable timestamp functions 1 to 4. --=20 2.39.5