From nobody Sun May 24 23:29:09 2026 Received: from AM0PR02CU008.outbound.protection.outlook.com (mail-westeuropeazon11013014.outbound.protection.outlook.com [52.101.72.14]) (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 411AD351C3D; Wed, 20 May 2026 14:49:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.72.14 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779288566; cv=fail; b=tCBRgC4rckpxv6KLvTGKvmtT32PEG9P/FvJJw7mMX+e99CnKgmks7vrG07KS+N/ze/RcM2qZUsNJzVRemq6YReIz6YX/6NWfH/xW6WDBN02Fvfd5VZzh6MFw9m+QpUlhB+n2tgJ1d6vnzTlJy57AhR17xO+IXizOsKWXH0b1AEg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779288566; c=relaxed/simple; bh=M78Wql/0JQdaSGxRNUYCJrBgxTqzeOT7gx++tjUeTNQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ggpcyZhEM8hVtKMa1FJ+lz+uJkHYbuybFDBMJIy1KQzEb6Oah2EjBR92BI6Q61xNt3389FWPslYSPnN9kyqzKcFFim7vjAiNENksRvcxpYsw2fE2+h0y6kKybqDG4DquKc/DJAWGGnCN8o0Nr8Oi4e+1XmRiCEK6QxxcjUArQKM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com; spf=pass smtp.mailfrom=axis.com; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b=flqZDjCS; arc=fail smtp.client-ip=52.101.72.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=axis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b="flqZDjCS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Cs8gbhMz1h9fRxWKnMUDKIc99zpfBSzvp5yKfRBcD5uDjxWO/dvg6sEyndr3uX4VoarpXvVsXeR+Z9b4k2HqSVvdNNbhbG6YBchTeCTwiI2NYI36B7adD+w0YFApkOtUKyvKR98p5iaFBL4/zWj++0MwC2KHrlzE+5KHtpeKOBnp5qZRNC9T/YJixKsi8fN/ssJATQXWZ4LyglhzUudcBnUiHiUqgqaFzLiyl5cUhCPlngldctWR3ZWxzRIhOSFezKkbaWzDSgGQcDu4890JMklKFs+f7MxBARfH8+ZktZAcAPXDD44qPGge+K62l50LufHC2Wl72llJ7boO/z/EmA== 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=iAPqvsP0FNqkydKvgAUPmyLBa5OkrXWtwmZ0LZ/6uAU=; b=H9yMvD2IIu0xQuUemuAfaJm+rYv5VPksdBEEBhCYS1o0IgDrh8HD1aP2yw4qbyYEamYxqnoQLM77lJLhdxEIkDvbl73Nr9vhXoLX5wInAm48pK/WRC6q2V69ovYgp/Qi/2dJ4MX4QjTQw4Kch9lje3c5Xl+cxHNJujEPesNsIuGfq/C5jbIXMPaVHPZfC+AhEReslifxwK2NZUBesqOfC6XYLHgOzJeT+f2i0Dy+s2Iob5/zWasNx7vernuKOnYAkLC5Q+J0Fqitm40JO9ymeH3sdqaxw6OLrBe5xllOpUQafNvb5daGJAm5ny1XTBEZOsyWxoXhMTmH8O21v3MSQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=bootlin.com smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iAPqvsP0FNqkydKvgAUPmyLBa5OkrXWtwmZ0LZ/6uAU=; b=flqZDjCSVQLkX5w+fqf0C0GjrAyIez8aVQg8GO0jZkNHrJtl9e8bJTDSvSydKgeusCPu60kyyFTc8QYrM7N5DfNoulT7NR9TriKGkCdNeirWuCetQK/jobGiS0g7GAnl9D/tZ3BYl5bSgN0qVhNfHZw+0OEqfCcfKGmv9wMsong= Received: from DUZPR01CA0320.eurprd01.prod.exchangelabs.com (2603:10a6:10:4ba::16) by AS4PR02MB8694.eurprd02.prod.outlook.com (2603:10a6:20b:58d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.48.14; Wed, 20 May 2026 14:49:18 +0000 Received: from DU2PEPF00028D10.eurprd03.prod.outlook.com (2603:10a6:10:4ba:cafe::d8) by DUZPR01CA0320.outlook.office365.com (2603:10a6:10:4ba::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.48.16 via Frontend Transport; Wed, 20 May 2026 14:49:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DU2PEPF00028D10.mail.protection.outlook.com (10.167.242.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.25.13 via Frontend Transport; Wed, 20 May 2026 14:49:18 +0000 Received: from se-mail11w.axis.com (10.20.40.11) by se-mail11w.axis.com (10.20.40.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.39; Wed, 20 May 2026 16:49:17 +0200 Received: from se-intmail02x.se.axis.com (10.4.0.28) by se-mail11w.axis.com (10.20.40.11) with Microsoft SMTP Server id 15.2.1748.39 via Frontend Transport; Wed, 20 May 2026 16:49:17 +0200 Received: from pc62507-2516.se.axis.com (pc62507-2516.se.axis.com [10.94.180.48]) by se-intmail02x.se.axis.com (Postfix) with ESMTP id 6FFC62877; Wed, 20 May 2026 16:49:17 +0200 (CEST) Received: by pc62507-2516.se.axis.com (Postfix, from userid 13629) id 6B7F542098CB; Wed, 20 May 2026 16:49:17 +0200 (CEST) From: Fredrik M Olsson Date: Wed, 20 May 2026 16:48:53 +0200 Subject: [PATCH v2 1/3] dt-bindings: rtc: ds1307: Add epson,rx8901 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260520-ds1307-rx8901-add-v2-1-e069ea32e1db@axis.com> References: <20260520-ds1307-rx8901-add-v2-0-e069ea32e1db@axis.com> In-Reply-To: <20260520-ds1307-rx8901-add-v2-0-e069ea32e1db@axis.com> To: Alexandre Belloni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nobuhiro Iwamatsu CC: , , , Fredrik M Olsson , , Krzysztof Kozlowski , Nobuhiro Iwamatsu X-Mailer: b4 0.13.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D10:EE_|AS4PR02MB8694:EE_ X-MS-Office365-Filtering-Correlation-Id: da0662ba-8a77-44f8-be91-08deb67ef857 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700016|376014|7416014|1800799024|18002099003|22082099003|56012099003|11063799006; X-Microsoft-Antispam-Message-Info: OZCnWR7y469JrFgTMNmafTuzpbJVvtYRrbbBwRyHHgZxZDOpjqsaHa4YI4EMdPNHxJVoVtF6L9ztpf6I/1dsQYtdlElF+bJDEs3x7fWXFCN5Ba7ItNE/dJJL+Z5sD9ZdKZ8ujB43TjCfrPOrYw6Vd84Fn2dqRZhlQ0sPw2GpSqw9W86Rd9hhH6TDt8hpApkbW2Zwlc/rSewBhtTzQvX6hPEUtYdN3JY9AR1y/ZSW3xs/swBF7uNi/i6dssmaKtXNH71aA15+zmZK+qeL0CjR5UKVBl89Hrk8VKTcHK3rB3tIR/IRJNQL+KCJ4WAvrFKIx8monMOR6mO3JE389xrcXAIsEKtpzvx97ig/HndwsTY1NEqLfgKr+JTgIfgnf4yN/AZJJLatm7TtyzyLSAXel4K4t1X9B3Tu5uoK0nqi1+PEZ/jo5NSWBbow1CBDY8r4cH0ll14RcWB4yDoQinS3aUIdUa7pFVnpQdGXOraylzcMANJGFZQrTSA3vtyRaVeyP73v05Vuy/T7mTiciSUJ90Lu+B5LoKCNn0CqAP5NCcnB0C6+0bUtRtFD9mO8T94KqWwiBWPTtmP1CR7WtrX+R4H0kJsGymdc/qOkjsLI+JDGAEYL+a3h9uf5yQKdRcCPbmkqZh5jXNVAL4evarhcoUfH6aT2+UMoT1NqAYPcprNfm12ABLjlMnAL17b5ubl/FMglUKtfRKZ6FNwUgeY75wEPC3uStNFQ1n9j/GYfi4U= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700016)(376014)(7416014)(1800799024)(18002099003)(22082099003)(56012099003)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m3kpYVJJykPvSn6EmTFIuajHfnc8Mpd8ATUr96VkC9POWjpfPk6Aa5ET8RCcLAuJGpCsDK7CUd4KW76CfnnS+Ypfd1Kz26HqrarGIHSMBlhyIhYxNMIf5qx4p/YcbbmYsnHww+dYKlqc3nf+J3ozxB8NljnsaCp8TzC6szlIkofBRCf0h+c2+pzMXR8JzRxRzHYnipR5B9PdyGOXlrqni5kMjH0tyBFQkupBMj8B5T9va6mNzMZ3h9ll5/swqQAnop7IoCYxQCeBY6r654kDhN35gzvJ+hlw712sI57bwM4a8saVLZDtq/wte5dNOKBJWQlf5QB/pO0JHJ+kkgeHjKqXPwpn58b83ojcT7qwCCQ7sY+oaLqHCQLJbrhve9sZ3bsd9CHUMsRWhFQQ6yKD80crjQg+YSA3dcisQnPYDugj58gf9AXukUJQY20VwURP X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2026 14:49:18.1308 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da0662ba-8a77-44f8-be91-08deb67ef857 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF00028D10.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR02MB8694 Add compatible string epson,rx8901 for the Epson RX8901CE RTC. Acked-by: Krzysztof Kozlowski Reviewed-by: Nobuhiro Iwamatsu Signed-off-by: Fredrik M Olsson --- Documentation/devicetree/bindings/rtc/rtc-ds1307.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/rtc/rtc-ds1307.yaml b/Docume= ntation/devicetree/bindings/rtc/rtc-ds1307.yaml index 98d10e680144..9b2796804f07 100644 --- a/Documentation/devicetree/bindings/rtc/rtc-ds1307.yaml +++ b/Documentation/devicetree/bindings/rtc/rtc-ds1307.yaml @@ -31,6 +31,7 @@ properties: - epson,rx8025 - isil,isl12057 - epson,rx8130 + - epson,rx8901 =20 - items: - enum: --=20 2.43.0 From nobody Sun May 24 23:29:09 2026 Received: from MRWPR03CU001.outbound.protection.outlook.com (mail-francesouthazon11011058.outbound.protection.outlook.com [40.107.130.58]) (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 1D09B308F15; Wed, 20 May 2026 14:49:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.130.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779288565; cv=fail; b=PQ+NfHxU3rZVRT4DazTnSw5GqsS3waiPAB9l40xUv7PB+r5r/XrU12T5NHMtDGZv/7H6oHuNCQE+uJz6cwyysz7zZXHFq7V+Qd6M5AkoCPuc6fpVqxnZ4+6hL8rhiQjTkegPvFLdrXTQDhJML2TBxLu/ID2+hlFHBqglb8ZdKmw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779288565; c=relaxed/simple; bh=R5hd2r/lJ0pTaze7xYhCvmRnWTRf7JbYHG/3CMl+rb4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=izKdeCKRp1wYgIxoNVnfuVZ2feJc3xNr2p9pD1CfMs+SsvUjltGH2bSssX0wzosIvfvus0koEAvmSbvy0FZIK/9fXWBrOrEWN6xiFMf9OeskNdd2Gavwm9r37eT26DTefoRU+J0hzzEbPvSGZqEywOmoSlc+yz27zpPS8tEcdW0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com; spf=pass smtp.mailfrom=axis.com; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b=nFjbw4BS; arc=fail smtp.client-ip=40.107.130.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=axis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b="nFjbw4BS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CNqMp4v9WeFV/FA/oLMTdKN2DHB+ha8YUkEz49P6Oi+zbmB1Ybr09cLEgGSwzMndCY7Esw7lu7hk9GGu06ZKbn4uJ9OY7tvYEIRIieDScaF4ZQODYe1NDc9cJ/yS4nhanBHov32CYQJgxrz4NfOAZYRjnUyTSgilHdJjRlzEEJHMVIvjPJx1qnfiskIytwSMQqA9SibcdFi7oqQdsKugMBwHNsHItlPzIAMyf3rLKyLqDjGrJlMEYIxQbnn1Lo0GqF8A4kBH15gjQR45DYYSYx5osdLWdtrN3misGF6nYPIm6tuD0ZqcarK7xRpvyMMmLJzUMfZ/8YeT1JD7TUjBwA== 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=D1ijghcxDp7bFCPkYrH1JU0aclMhZ9XTJujYTXfVTQ8=; b=SUxyYLJyLIU/lxnvpc2pA8aKP45s9neen190VhMlzHito796+qU62YrV+35HnxI04WY/+nsy4OffN2V474gzUSgdBC8S9s5pesBQznwxAxic5DPgU/G0Zr24wDLxq+tPhmPlrJlUoj+y1iy28UHFP0AfgjQ+Q/hmrT15rTLK8NJfjiFK7nHxUHPDSz7S+ijd0a2zVIIdzGBnhW/xXg7cC4mrwwXU26PdFpkGMvYJLEo82vfzpCs2M5SMrLo9mtnBM2weEj8DnnHwgzLKUyeTw5FA6d0YhsOinRf6QsM9t3QQGqxuYlkN1XCRojBzsk3HMz5V37tmzQFDtZ1nYp4hIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=bootlin.com smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D1ijghcxDp7bFCPkYrH1JU0aclMhZ9XTJujYTXfVTQ8=; b=nFjbw4BSo/cqJvddUNIAUTNgbFr/G4sTol1JNLyM9Y0WgVXY0zE2yuKPgZ7copv7U6FwcJED+yY7TNFvhjPxMgTcY7PKjtdxn1SFC4sgn4+JzSFzGT763JO5gf0soNIRJXRtQoacKDRw48K2eWTspOJbWH6O1/Q7SQIVPW7nfxI= Received: from DUZPR01CA0311.eurprd01.prod.exchangelabs.com (2603:10a6:10:4ba::12) by VI1PR02MB6095.eurprd02.prod.outlook.com (2603:10a6:800:18e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.48.14; Wed, 20 May 2026 14:49:19 +0000 Received: from DU2PEPF00028D10.eurprd03.prod.outlook.com (2603:10a6:10:4ba:cafe::c2) by DUZPR01CA0311.outlook.office365.com (2603:10a6:10:4ba::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.48.16 via Frontend Transport; Wed, 20 May 2026 14:49:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DU2PEPF00028D10.mail.protection.outlook.com (10.167.242.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.25.13 via Frontend Transport; Wed, 20 May 2026 14:49:19 +0000 Received: from se-mail11w.axis.com (10.20.40.11) by se-mail11w.axis.com (10.20.40.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.39; Wed, 20 May 2026 16:49:17 +0200 Received: from se-intmail01x.se.axis.com (10.4.0.28) by se-mail11w.axis.com (10.20.40.11) with Microsoft SMTP Server id 15.2.1748.39 via Frontend Transport; Wed, 20 May 2026 16:49:17 +0200 Received: from pc62507-2516.se.axis.com (pc62507-2516.se.axis.com [10.94.180.48]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 6F630699; Wed, 20 May 2026 16:49:17 +0200 (CEST) Received: by pc62507-2516.se.axis.com (Postfix, from userid 13629) id 6BFC24208843; Wed, 20 May 2026 16:49:17 +0200 (CEST) From: Fredrik M Olsson Date: Wed, 20 May 2026 16:48:54 +0200 Subject: [PATCH v2 2/3] rtc: ds1307: Fix off-by-one issue with wday for rx8130 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260520-ds1307-rx8901-add-v2-2-e069ea32e1db@axis.com> References: <20260520-ds1307-rx8901-add-v2-0-e069ea32e1db@axis.com> In-Reply-To: <20260520-ds1307-rx8901-add-v2-0-e069ea32e1db@axis.com> To: Alexandre Belloni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nobuhiro Iwamatsu CC: , , , Fredrik M Olsson , X-Mailer: b4 0.13.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D10:EE_|VI1PR02MB6095:EE_ X-MS-Office365-Filtering-Correlation-Id: 21443ea9-9bf6-4d01-f4d1-08deb67ef922 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700016|22082099003|56012099003|18002099003|11063799006; X-Microsoft-Antispam-Message-Info: J4TnERVxqx4x/xgJWKCOZAJhyqR9n4XUPAELZzKKCKdf5y6AXsOv5kRbzDcKtBIpV1+cdJkvpDRjZuI9DZujY2oLujw5kTketqXYTNie4AuuDs2B4CDq4TgE+T1zA/BZsrxYYVe5ARFlFWst1KHg+PxdLDUzG90xGt3g5sPAQCSwtoo+oCjy3QKza1vtX6GzNlM9dEhuDl9IYJ38i7pkluEUcUTfUzD7wowCEdzCbTTtqAWZW8/EkpSXzrhLJlUgpQ40vNtJrG7QwEV8es+1SdbxFRccFny6v39rHM9k+NqMLGSfHCQJ5T+EyZsz8VXXWdde6FJLKek5xZiqwpRAkIZg1AdDxnkbpWe7ex9IxOVA5FxaAxnNrqK6aPDFvoLhPB9v+7N9DRh/DTtgqNWAUHg49HpScU9t2W/RZBamiE5a/mtJVHd2ZKdmKp3tXusD9V7epfF2dEQwvBYo+ZrPbx7wRidvPYpwQ4AwnmocRMwVaPyNhHJBO43o8NEvFbgq94deqBJqD5QVpaAoKqJiso/FKwvY1LyXjgOCPL/Q3SPDp7d44Uuqw/6Rc/r8PQ3FpBlgH/VgsAwKlA1yLY6GC6Ad3BOdaP/Ka2johRpfobjBDfrpY6QeLqniaMWgVO3hPJoKcCwEv6zfPe/X/X8Jnk6pALLh626oSATKXpG3V8zw8ZoT5bDQIbZsY+ZaQ/gDz6FsOZeQWcjvH2nSy5TSkzRYoo6UNnzFkWKSaKc4ILI= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(376014)(36860700016)(22082099003)(56012099003)(18002099003)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eZUn7V9KBIFZ3PoIDvNI709Tt9gxl3KRPjwp6JWMlZNyJg9bwfamkDUM6vrkywbz1FNjv2L+Rm0JyZTP2lPbncYF9WGutpzyP878JHguheVXlbwiHoQAeqtu0vRwl+O/gh8yzUV081gDoOAWd8i+jewyD7pc5wlkaL9cWhOK/np1YtXAOrjJmXuDaqrfC2NcQocRuM/V0Pd3K7ja+txg2476d7NzKQtEZfVkAXYfABJYfTJoGl7a6Pwx9Rk4Zi5T3QO8TmnlOxkZd1CiDXZcrVJKoeP214nqmGKs721ryx0JUuIyh9HSTKSGhqbtsSXJ5cLCVDwlsAIioFLCpcin00lXlzJWgk3ShDhvwjWpl0U5WjUdrMIWuVsJQTGdUzFb0pykHw8OKreAUX4nJbXzqyfiG+bmchCE93DYchcZKySiY/erpl9Mwg4b0aAq8m0r X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2026 14:49:19.4633 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 21443ea9-9bf6-4d01-f4d1-08deb67ef922 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF00028D10.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB6095 The RTC represent each weekday with a individual bit set in the WDAY register, where the 0th bit represent the first day of the week and the 6th bit represents the last day of the week. For each passed day the chip performs a rotary-left-shift by one to advance the weekday by one. The tm_wday field represent weekdays by a value in the range of 0-6. The fls() function return the bit index of the last bit set. To handle when there are no bits set it will return 0, and if the 0th bit is set it will return 1, and if the 1st bit is set it will return 2, and so on. In order to make the result of the fls() function fall into the expected range of 0-6 (instead of 1-7) this patch subtracts one from the result (which matches how the value is written in ds1307_set_time()). Fixes: 204756f016726 ("rtc: ds1307: Fix wday settings for rx8130") Reviewed-by: Nobuhiro Iwamatsu Signed-off-by: Fredrik M Olsson --- drivers/rtc/rtc-ds1307.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index 7205c59ff729..bf42c250ea7d 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c @@ -308,7 +308,7 @@ static int ds1307_get_time(struct device *dev, struct r= tc_time *t) t->tm_hour =3D bcd2bin(tmp); /* rx8130 is bit position, not BCD */ if (ds1307->type =3D=3D rx_8130) - t->tm_wday =3D fls(regs[DS1307_REG_WDAY] & 0x7f); + t->tm_wday =3D fls(regs[DS1307_REG_WDAY] & 0x7f) - 1; else t->tm_wday =3D bcd2bin(regs[DS1307_REG_WDAY] & 0x07) - 1; t->tm_mday =3D bcd2bin(regs[DS1307_REG_MDAY] & 0x3f); --=20 2.43.0 From nobody Sun May 24 23:29:09 2026 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11011064.outbound.protection.outlook.com [52.101.65.64]) (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 174FD3E9F8B; Wed, 20 May 2026 14:49:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779288568; cv=fail; b=LKIcEyNty5M+eWvht+uLtE9wJF+URZn0jcxNNjnNfpIHiayypjZ48XzghGDcXovVqqZ2gI1J3CmUefUgFZWBG1kU+lWUbJ8gAopf0SEE6LBfxxx4+ol2zKbsNz6ysNKyD4kHKDZhun15NbAIlWRCYWR5kbNKQ1kCGhe/T8lTz/Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779288568; c=relaxed/simple; bh=y5GXqcUEE/Bhx59KroqfuyDs703HrMujTvIO9zK9H4k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=NQ+i+rZK96ghivdCf2DwZHfI871MipnZaPmaQF3U4sTWtk5sZH/pAJeg1YOjZYWP1aGlIG3Ei1qx8MGWSlHqla8dk9d+vhHy5WDlTrnNFnKG0ZaVPU0+vv98zxU5xv4H288Rgsw5IzAupubiEdNDqwf0sAYyuUiS6j2PQIJvSDQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com; spf=pass smtp.mailfrom=axis.com; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b=f8Nk86zf; arc=fail smtp.client-ip=52.101.65.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=axis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b="f8Nk86zf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hbTeHfJxoAl8htwp2rGdFCdYMZHLk0zVnCF3Vbml41FHxWGTF+YGWbQwsNczHk7RViPVCk7t17bcIlxxEroBJGZ4FLYwA8mpy0MF+b9CW+wt83DJWhT6XWKydgSJQgU02GAkp2oOGaNuUckco2LvpbL0OjESbweHTAHsjoYK5RHluIt9UJwsejWuwA+zsUhhOzF492Aua4OcS6O2NdOGPIf9OZDH86mONLSNU/LTKNKFtwtK/IJNJUE5uyI61hJRa80g+TH69yyQdPH8UE7DwMw33QhgjCy71ir48rEedslTW57Q/0ef2DtsS28iWWdvKk3rNxKC2/5oBfWb9Ujkug== 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=NRaEb4NDwA5wEIo+zdNLvlUMqh6gHebeXM2Yfs/70QQ=; b=OEyWF1RCw93enmP67bcy5qEFHrSskTs95lEMN5ti0kWhsvsRZeZOzjYBoY61xLJTU5Q7+B2IJhtvgSDOW6ssmKxrwGroVk/0M9l/vOegJVfT/OqafP4iwpjOqkQ7dk8gHOY6kD9ICeNt6kmgUFJIJdGTqxr73nB/ipjZrcTxifdbADGTkKHFPTWinV5/0FUUFz5LgxXFEaaa4sbT3CNFYBXP36xhbyRsWNLKak4mGywpeJmLpArs8qNfil8z3Vq1lc9qbqJ3YLRR7jEgFxdy9ufxUccuXPzSO/LYOhWM4Vebzda4Jbt1nLMuGkBGWiGAUOLNhQFnZxZc+YQva1qSSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=bootlin.com smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NRaEb4NDwA5wEIo+zdNLvlUMqh6gHebeXM2Yfs/70QQ=; b=f8Nk86zfoT4JYGxn31n3cYs7d1vUnwqjI/JW1Dstheed1uC2yPsF0pGXhXhKBSPZPFohOrIGrZsznczoMST/iTdhoYkJQHZYkGUQuypzJQC7JiuQz+hJB2+4Zac4jePkuo1HlQ9dv5zWKikkf552ERPhXFvw/mv9O1jFN/zQ0AE= Received: from DUZPR01CA0322.eurprd01.prod.exchangelabs.com (2603:10a6:10:4ba::20) by DBBPR02MB10483.eurprd02.prod.outlook.com (2603:10a6:10:52b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.48.14; Wed, 20 May 2026 14:49:20 +0000 Received: from DU2PEPF00028D10.eurprd03.prod.outlook.com (2603:10a6:10:4ba:cafe::e8) by DUZPR01CA0322.outlook.office365.com (2603:10a6:10:4ba::20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.48.16 via Frontend Transport; Wed, 20 May 2026 14:49:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DU2PEPF00028D10.mail.protection.outlook.com (10.167.242.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.25.13 via Frontend Transport; Wed, 20 May 2026 14:49:20 +0000 Received: from se-mail10w.axis.com (10.20.40.10) by se-mail11w.axis.com (10.20.40.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.39; Wed, 20 May 2026 16:49:17 +0200 Received: from se-intmail01x.se.axis.com (10.4.0.28) by se-mail10w.axis.com (10.20.40.10) with Microsoft SMTP Server id 15.2.1748.39 via Frontend Transport; Wed, 20 May 2026 16:49:17 +0200 Received: from pc62507-2516.se.axis.com (pc62507-2516.se.axis.com [10.94.180.48]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 7563D306B; Wed, 20 May 2026 16:49:17 +0200 (CEST) Received: by pc62507-2516.se.axis.com (Postfix, from userid 13629) id 6D5DD42098C9; Wed, 20 May 2026 16:49:17 +0200 (CEST) From: Fredrik M Olsson Date: Wed, 20 May 2026 16:48:55 +0200 Subject: [PATCH v2 3/3] rtc: ds1307: Add driver for Epson RX8901CE Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260520-ds1307-rx8901-add-v2-3-e069ea32e1db@axis.com> References: <20260520-ds1307-rx8901-add-v2-0-e069ea32e1db@axis.com> In-Reply-To: <20260520-ds1307-rx8901-add-v2-0-e069ea32e1db@axis.com> To: Alexandre Belloni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nobuhiro Iwamatsu CC: , , , Fredrik M Olsson , X-Mailer: b4 0.13.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D10:EE_|DBBPR02MB10483:EE_ X-MS-Office365-Filtering-Correlation-Id: ec2858cc-d82e-4138-60b2-08deb67ef9cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700016|1800799024|11063799006|56012099003|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: 3F5fh+dCTCdSmEQrxvJwd3y4/FSZ7DKC+uycRKvFnmMPVdBY6o4zX2dja4Q3QRKFiCETXByQr17AmmMOuXAGtA2m8XNZQ0t+TreGOeqnCWw/FaklAU9t0X41RW4sfrXW8w7vxsIWhqV8cxJdoAWMPQoKdlk/CKLKWhIe6QFKPpJUqgw0ieUS4Fg19UovT417+mJ5Y9jxkX+flGIqBFH6EgoN5O/UO6j4teP8Ffy5MbuvtIob2oXOL2w/hOxFPcVoUfIe8+VfQDRD5fNb98JV03t37Y1Rn03KMN9GkAaoVr5dTLFwFCCMYSYz0NKn2RxEuTFlZ4aW8ZB14VaEh2itYREvYt4b4Uft9pNy65d01K7zf21Zf5f7U/laJMlWksT9+Qr/E3TpSJEBB8qbSO+QmNQCFIF8amE8TfyI5E6SaQk/riyxuPolaP4AAKqdhzf6PCKyfsLKjv9u9NJH6EIPDWYvyLtwH0Cx94lWJUW2ig+JkkoeyzRNjc3GiS7MtCSFx7V76R2NQpPg8q9WM6OSR58cK945B9QCSSqYNj4QaaqLgL/SNNupna8Px6+LpgVBPGMzVR86qDLJlkx9pyYvkL13X4x33ZEorMeJ/zJulfmGv5Yk5T7PTlr7vB9Gxo/C/WUsd8akS32V0Z4/gj5UooEj8slw4D/t42+Le1lNgJSFssvdM0xJnlOEQLnZG/PuVeTLSGZ/HfG9P0uGunFjHqvrhOIrxo5h2cfYkwSu1xU= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700016)(1800799024)(11063799006)(56012099003)(22082099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: h+vxVRiISPBpnBOAXcarpQpUQAaLrtP/lD59sSObcqzsYndnAzaLNmAt7R/IX/ZXrrQSUJ13ACyu6ZQP3nfUrmQBL39s0D6L+oq0yu/beyyElb1goamYgmAh5ODn85/+Zvssuhknlk59D/xmiQo0wsnmo+He5sRUmegL0n5mLZjXDdkSXY2sOzoiomRGwBnOgdL608MyDPAt1227EZfU3sK70n+MwpAIhASdG9mYh0NB7Q+4gNg65J33siH8aZXa6qpwG32e2EsCqjmMoAFf0JODCmaRXBG9+A1CgkDwIwdlknoDdcEnzRdX5w82T0VAHGWfzkoG00TEWh4bbhU9h8cTyHSFAasq6p6ie58WvY62JyFL8oax3w6DAiSZzu1olG3NnGV/Z9oJ/cXH+OI1Asj4APNBsTDpfYBaRY9id6HXK2aRikxxwkGzdqEq7j2N X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2026 14:49:20.5775 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ec2858cc-d82e-4138-60b2-08deb67ef9cd X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF00028D10.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR02MB10483 Adds support for: - Reading and writing time to/from the RTC. - Changing Backup Switch Mode (BSM) to DISABLED/DIRECT/LEVEL using the RTC_PARAM_SET ioctl. - Optionally enabling battery charging. - Reading the battery voltage low status using the RTC_VL_READ ioctl (only supported in LEVEL BSM), which also reports invalid time information if the VLF flag is set. Signed-off-by: Fredrik M Olsson --- drivers/rtc/rtc-ds1307.c | 216 +++++++++++++++++++++++++++++++++++++++++++= ++-- 1 file changed, 207 insertions(+), 9 deletions(-) diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index bf42c250ea7d..23dd104aa2be 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c @@ -9,6 +9,7 @@ */ =20 #include +#include #include #include #include @@ -48,6 +49,7 @@ enum ds_type { mcp794xx, rx_8025, rx_8130, + rx_8901, last_ds_type /* always last */ /* rs5c372 too? different address... */ }; @@ -129,6 +131,18 @@ enum ds_type { #define RX8130_REG_CONTROL1_INIEN BIT(4) #define RX8130_REG_CONTROL1_CHGEN BIT(5) =20 +#define RX8901_REG_INTF 0x0e +#define RX8901_REG_INTF_VLF BIT(1) +#define RX8901_REG_PWSW_CFG 0x37 +#define RX8901_REG_PWSW_CFG_SWSEL GENMASK(3, 2) +#define RX8901_REG_PWSW_CFG_VBATLDETEN BIT(4) +#define RX8901_REG_PWSW_CFG_INIEN BIT(6) +#define RX8901_REG_PWSW_CFG_CHGEN BIT(7) +#define RX8901_REG_BUF_INTF 0x46 +#define RX8901_REG_BUF_INTF_VBATLF BIT(3) +#define RX8901_SWSEL_PRIMARY_BACKUP 0x1 +#define RX8901_SWSEL_PRIMARY 0x2 + #define MCP794XX_REG_CONTROL 0x07 # define MCP794XX_BIT_ALM0_EN 0x10 # define MCP794XX_BIT_ALM1_EN 0x20 @@ -192,8 +206,8 @@ struct chip_desc { irq_handler_t irq_handler; const struct rtc_class_ops *rtc_ops; u16 trickle_charger_reg; - u8 (*do_trickle_setup)(struct ds1307 *, u32, - bool); + int (*do_trickle_setup)(struct ds1307 *ds1307, u32 ohms, + bool diode); /* Does the RTC require trickle-resistor-ohms to select the value of * the resistor between Vcc and Vbackup? */ @@ -216,6 +230,7 @@ static int ds1307_get_time(struct device *dev, struct r= tc_time *t) =20 if (ds1307->type =3D=3D rx_8130) { unsigned int regflag; + ret =3D regmap_read(ds1307->regmap, RX8130_REG_FLAG, ®flag); if (ret) { dev_err(dev, "%s error %d\n", "read", ret); @@ -226,6 +241,19 @@ static int ds1307_get_time(struct device *dev, struct = rtc_time *t) dev_warn_once(dev, "oscillator failed, set time!\n"); return -EINVAL; } + } else if (ds1307->type =3D=3D rx_8901) { + unsigned int regflag; + + ret =3D regmap_read(ds1307->regmap, RX8901_REG_INTF, ®flag); + if (ret) { + dev_dbg(dev, "%s error %d\n", "read", ret); + return ret; + } + + if (regflag & RX8901_REG_INTF_VLF) { + dev_warn_once(dev, "oscillator failed, set time!\n"); + return -EINVAL; + } } =20 /* read the RTC date and time registers all at once */ @@ -307,7 +335,7 @@ static int ds1307_get_time(struct device *dev, struct r= tc_time *t) tmp =3D regs[DS1307_REG_HOUR] & 0x3f; t->tm_hour =3D bcd2bin(tmp); /* rx8130 is bit position, not BCD */ - if (ds1307->type =3D=3D rx_8130) + if (ds1307->type =3D=3D rx_8130 || ds1307->type =3D=3D rx_8901) t->tm_wday =3D fls(regs[DS1307_REG_WDAY] & 0x7f) - 1; else t->tm_wday =3D bcd2bin(regs[DS1307_REG_WDAY] & 0x07) - 1; @@ -358,7 +386,7 @@ static int ds1307_set_time(struct device *dev, struct r= tc_time *t) regs[DS1307_REG_MIN] =3D bin2bcd(t->tm_min); regs[DS1307_REG_HOUR] =3D bin2bcd(t->tm_hour); /* rx8130 is bit position, not BCD */ - if (ds1307->type =3D=3D rx_8130) + if (ds1307->type =3D=3D rx_8130 || ds1307->type =3D=3D rx_8901) regs[DS1307_REG_WDAY] =3D 1 << t->tm_wday; else regs[DS1307_REG_WDAY] =3D bin2bcd(t->tm_wday + 1); @@ -422,11 +450,132 @@ static int ds1307_set_time(struct device *dev, struc= t rtc_time *t) dev_err(dev, "%s error %d\n", "write", result); return result; } + } else if (ds1307->type =3D=3D rx_8901) { + /* + * clear Voltage Loss Flag as data is available now (writing 1 + * to the other bits in the INTF register has no effect) + */ + result =3D regmap_write(ds1307->regmap, RX8901_REG_INTF, + 0xff ^ RX8901_REG_INTF_VLF); + if (result) { + dev_dbg(dev, "%s error %d\n", "write", result); + return result; + } } =20 return 0; } =20 +#ifdef CONFIG_RTC_INTF_DEV +static int rx8901_ioctl(struct device *dev, unsigned int cmd, unsigned lon= g arg) +{ + struct ds1307 *ds1307 =3D dev_get_drvdata(dev); + unsigned int regflag, tmp =3D 0; + int ret =3D 0; + + switch (cmd) { + case RTC_VL_READ: + ret =3D regmap_read(ds1307->regmap, RX8901_REG_INTF, ®flag); + if (ret) + return ret; + + if (regflag & RX8901_REG_INTF_VLF) + tmp |=3D RTC_VL_DATA_INVALID; + + ret =3D regmap_read(ds1307->regmap, RX8901_REG_BUF_INTF, ®flag); + if (ret) + return ret; + + if (regflag & RX8901_REG_BUF_INTF_VBATLF) + tmp |=3D RTC_VL_BACKUP_LOW; + + return put_user(tmp, (unsigned int __user *)arg); + default: + return -ENOIOCTLCMD; + } + return ret; +} + +static int rx8901_param_get(struct device *dev, struct rtc_param *param) +{ + struct ds1307 *ds1307 =3D dev_get_drvdata(dev); + unsigned int regflag; + int ret; + + switch (param->param) { + case RTC_PARAM_BACKUP_SWITCH_MODE: + ret =3D regmap_read(ds1307->regmap, RX8901_REG_PWSW_CFG, ®flag); + if (ret) + return ret; + + if (regflag & RX8901_REG_PWSW_CFG_INIEN) { + param->uvalue =3D RTC_BSM_LEVEL; + } else { + unsigned int swsel =3D FIELD_GET(RX8901_REG_PWSW_CFG_SWSEL, regflag); + + if (swsel =3D=3D RX8901_SWSEL_PRIMARY_BACKUP) + param->uvalue =3D RTC_BSM_DIRECT; + else + param->uvalue =3D RTC_BSM_DISABLED; + } + + break; + + default: + return -EINVAL; + } + return ret; +} + +static int rx8901_param_set(struct device *dev, struct rtc_param *param) +{ + struct ds1307 *ds1307 =3D dev_get_drvdata(dev); + unsigned int regmask; + unsigned int regval; + int ret; + + switch (param->param) { + case RTC_PARAM_BACKUP_SWITCH_MODE: + + switch (param->uvalue) { + case RTC_BSM_DISABLED: + /* Only main power supply is used */ + regmask =3D RX8901_REG_PWSW_CFG_INIEN | + RX8901_REG_PWSW_CFG_SWSEL; + regval =3D FIELD_PREP(RX8901_REG_PWSW_CFG_SWSEL, + RX8901_SWSEL_PRIMARY) | + FIELD_PREP(RX8901_REG_PWSW_CFG_INIEN, 0); + break; + case RTC_BSM_DIRECT: + /* Main and battery power supply is put in parallel (default) */ + regmask =3D RX8901_REG_PWSW_CFG_INIEN | + RX8901_REG_PWSW_CFG_SWSEL; + regval =3D FIELD_PREP(RX8901_REG_PWSW_CFG_SWSEL, + RX8901_SWSEL_PRIMARY_BACKUP) | + FIELD_PREP(RX8901_REG_PWSW_CFG_INIEN, 0); + break; + case RTC_BSM_LEVEL: + /* Enable auto power switching between main and backup power supply */ + regmask =3D RX8901_REG_PWSW_CFG_INIEN; + regval =3D FIELD_PREP(RX8901_REG_PWSW_CFG_INIEN, 1); + break; + default: + return -EINVAL; + } + ret =3D regmap_update_bits(ds1307->regmap, RX8901_REG_PWSW_CFG, regmask,= regval); + break; + default: + return -EINVAL; + } + + return ret; +} +#else +#define rx8901_ioctl NULL +#define rx8901_param_get NULL +#define rx8901_param_set NULL +#endif + static int ds1337_read_alarm(struct device *dev, struct rtc_wkalrm *t) { struct ds1307 *ds1307 =3D dev_get_drvdata(dev); @@ -533,7 +682,7 @@ static int ds1307_alarm_irq_enable(struct device *dev, = unsigned int enabled) enabled ? DS1337_BIT_A1IE : 0); } =20 -static u8 do_trickle_setup_ds1339(struct ds1307 *ds1307, u32 ohms, bool di= ode) +static int do_trickle_setup_ds1339(struct ds1307 *ds1307, u32 ohms, bool d= iode) { u8 setup =3D (diode) ? DS1307_TRICKLE_CHARGER_DIODE : DS1307_TRICKLE_CHARGER_NO_DIODE; @@ -558,7 +707,7 @@ static u8 do_trickle_setup_ds1339(struct ds1307 *ds1307= , u32 ohms, bool diode) return setup; } =20 -static u8 do_trickle_setup_rx8130(struct ds1307 *ds1307, u32 ohms, bool di= ode) +static int do_trickle_setup_rx8130(struct ds1307 *ds1307, u32 ohms, bool d= iode) { /* make sure that the backup battery is enabled */ u8 setup =3D RX8130_REG_CONTROL1_INIEN; @@ -568,6 +717,26 @@ static u8 do_trickle_setup_rx8130(struct ds1307 *ds130= 7, u32 ohms, bool diode) return setup; } =20 +static int do_trickle_setup_rx8901(struct ds1307 *ds1307, u32 ohms __alway= s_unused, bool diode) +{ + int ret; + unsigned int setup; + + ret =3D regmap_read(ds1307->regmap, RX8901_REG_PWSW_CFG, &setup); + if (ret) { + dev_err(ds1307->dev, "Failed to read PWSW_CFG register\n"); + return ret; + } + + /* Enable low battery voltage detection */ + setup |=3D RX8901_REG_PWSW_CFG_VBATLDETEN; + + if (diode) + setup |=3D RX8901_REG_PWSW_CFG_CHGEN; + + return setup; +} + static irqreturn_t rx8130_irq(int irq, void *dev_id) { struct ds1307 *ds1307 =3D dev_id; @@ -960,6 +1129,14 @@ static const struct rtc_class_ops rx8130_rtc_ops =3D { .alarm_irq_enable =3D rx8130_alarm_irq_enable, }; =20 +static const struct rtc_class_ops rx8901_rtc_ops =3D { + .read_time =3D ds1307_get_time, + .set_time =3D ds1307_set_time, + .ioctl =3D rx8901_ioctl, + .param_get =3D rx8901_param_get, + .param_set =3D rx8901_param_set, +}; + static const struct rtc_class_ops mcp794xx_rtc_ops =3D { .read_time =3D ds1307_get_time, .set_time =3D ds1307_set_time, @@ -1040,6 +1217,12 @@ static const struct chip_desc chips[last_ds_type] = =3D { .trickle_charger_reg =3D RX8130_REG_CONTROL1, .do_trickle_setup =3D &do_trickle_setup_rx8130, }, + [rx_8901] =3D { + .offset =3D 0x0, + .rtc_ops =3D &rx8901_rtc_ops, + .trickle_charger_reg =3D RX8901_REG_PWSW_CFG, + .do_trickle_setup =3D &do_trickle_setup_rx8901, + }, [m41t0] =3D { .rtc_ops =3D &m41txx_rtc_ops, }, @@ -1081,6 +1264,7 @@ static const struct i2c_device_id ds1307_id[] =3D { { "rx8025", rx_8025 }, { "isl12057", ds_1337 }, { "rx8130", rx_8130 }, + { "rx8901", rx_8901 }, { } }; MODULE_DEVICE_TABLE(i2c, ds1307_id); @@ -1158,6 +1342,10 @@ static const struct of_device_id ds1307_of_match[] = =3D { .compatible =3D "epson,rx8130", .data =3D (void *)rx_8130 }, + { + .compatible =3D "epson,rx8901", + .data =3D (void *)rx_8901 + }, { } }; MODULE_DEVICE_TABLE(of, ds1307_of_match); @@ -1292,7 +1480,7 @@ static int ds1307_nvram_write(void *priv, unsigned in= t offset, void *val, =20 /*----------------------------------------------------------------------*/ =20 -static u8 ds1307_trickle_init(struct ds1307 *ds1307, +static int ds1307_trickle_init(struct ds1307 *ds1307, const struct chip_desc *chip) { u32 ohms, chargeable; @@ -1745,7 +1933,7 @@ static int ds1307_probe(struct i2c_client *client) bool ds1307_can_wakeup_device =3D false; unsigned char regs[8]; struct ds1307_platform_data *pdata =3D dev_get_platdata(&client->dev); - u8 trickle_charger_setup =3D 0; + int trickle_charger_setup =3D 0; =20 ds1307 =3D devm_kzalloc(&client->dev, sizeof(struct ds1307), GFP_KERNEL); if (!ds1307) @@ -1781,12 +1969,15 @@ static int ds1307_probe(struct i2c_client *client) else if (pdata->trickle_charger_setup) trickle_charger_setup =3D pdata->trickle_charger_setup; =20 + if (trickle_charger_setup < 0) + return trickle_charger_setup; + if (trickle_charger_setup && chip->trickle_charger_reg) { dev_dbg(ds1307->dev, "writing trickle charger info 0x%x to 0x%x\n", trickle_charger_setup, chip->trickle_charger_reg); regmap_write(ds1307->regmap, chip->trickle_charger_reg, - trickle_charger_setup); + (u8)trickle_charger_setup); } =20 /* @@ -1990,6 +2181,13 @@ static int ds1307_probe(struct i2c_client *client) } } =20 + switch (ds1307->type) { + case rx_8901: + set_bit(RTC_FEATURE_BACKUP_SWITCH_MODE, ds1307->rtc->features); + break; + default: + } + ds1307->rtc->ops =3D chip->rtc_ops ?: &ds13xx_rtc_ops; err =3D ds1307_add_frequency_test(ds1307); if (err) --=20 2.43.0