From patchwork Tue Apr 9 19:59:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 10892277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 752FB17E1 for ; Tue, 9 Apr 2019 20:00:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CE0026E98 for ; Tue, 9 Apr 2019 20:00:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50EC82892C; Tue, 9 Apr 2019 20:00:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SUSPICIOUS_RECIPS autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DFBA02890B for ; Tue, 9 Apr 2019 20:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=4U8wSi2hhohNrNpfHbdkRiFpVjccYH+pujVpTygoiiI=; b=tIsFNvLq0d8EOX IQ5W7dKIbAdDXYTvNYfIvuCOQpEyDvICnjrD/kvEb+f3rM1fqEEmAWKJMPCPssTv9tzlxtwLvpyTs DEnNzov7FxiYAuA72OWctUVawYYVWgVE6OtPj8xrC4U9bxSRhRBoICiYVvZ0bBFuGBGfdUkIL9A+J AaZBDjIi9e56QYIlIpjq4ZvwrFmKRKQO/01D6sGTDuC1Jlhg7VVHzMzlzr+twM7yZo7cVE79Q/97j ucgxCtq3B5CgASJi8hwg1qqBh+/b5eGSS/HWXu1WSlsw6P1TdUTs72Q8DBNIpbvV76kRadcK/YDjt OvMIDBVwdPqv7kla8M9A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwuh-0004uX-A3; Tue, 09 Apr 2019 20:00:11 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwud-0003lh-5m for linux-arm-kernel@lists.infradead.org; Tue, 09 Apr 2019 20:00:08 +0000 X-Originating-IP: 90.66.53.80 Received: from localhost (lfbn-1-3034-80.w90-66.abo.wanadoo.fr [90.66.53.80]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 24E81E0003; Tue, 9 Apr 2019 19:59:57 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org Subject: [PATCH 1/3] rtc: ab3100: set range Date: Tue, 9 Apr 2019 21:59:43 +0200 Message-Id: <20190409195945.20725-1-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190409_130007_371554_467C928B X-CRM114-Status: GOOD ( 11.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Linus Walleij , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The ab3100 has a 48bit counter running at 65536 Hz (despite one of the comment). The max value is then (2^48 - 1)/2^16 == 2^32 - 1. Signed-off-by: Alexandre Belloni Reviewed-by: Linus Walleij --- drivers/rtc/rtc-ab3100.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c index 821ff52a2222..f73a3707b897 100644 --- a/drivers/rtc/rtc-ab3100.c +++ b/drivers/rtc/rtc-ab3100.c @@ -228,15 +228,17 @@ static int __init ab3100_rtc_probe(struct platform_device *pdev) /* Ignore any error on this write */ } - rtc = devm_rtc_device_register(&pdev->dev, "ab3100-rtc", - &ab3100_rtc_ops, THIS_MODULE); - if (IS_ERR(rtc)) { - err = PTR_ERR(rtc); - return err; - } + rtc = devm_rtc_allocate_device(&pdev->dev); + if (IS_ERR(rtc)) + return PTR_ERR(rtc); + + rtc->ops = &ab3100_rtc_ops; + /* 48bit counter at (AB3100_RTC_CLOCK_RATE * 2) */ + rtc->range_max = U32_MAX; + platform_set_drvdata(pdev, rtc); - return 0; + return rtc_register_device(rtc); } static struct platform_driver ab3100_rtc_driver = { From patchwork Tue Apr 9 19:59:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 10892365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D9E513B5 for ; Tue, 9 Apr 2019 20:00:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8399028571 for ; Tue, 9 Apr 2019 20:00:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 772542892D; Tue, 9 Apr 2019 20:00:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SUSPICIOUS_RECIPS autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 201C328571 for ; Tue, 9 Apr 2019 20:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ELTkVYBhXqO8u7fcQMLlR0H8iHwv0Mtd4+zENpwOSFs=; b=eB4SRpDIaBQI5G r4Mrbv+vF6sj1uD+R20YzEBK5hNtynCgGpNRHxLcs6oUIzimvz/lxjly8jZSDoHex30XnKym3cF1T 6c0q3iiW66SLPU8C5/Vf3q0QcZU8jdTB/iR0/Yt/OGsI3s1jN/oA+PKD6fLOdJawRTS15h0ujdT0Y S/kGH8yzuan2JNd57tcdemxerD2upCRHXXQMkQxihTVKvs2MHMf0ggy5bVbKS/JPdb4PnpDfU+2xJ rY69CzvGJuOymjMpOrrtjME07RnKCFVTztXaPPRnbQwguSz8lPqoA6ziBGsr+F+NxK7907LJ0CFSc jTPVa9m1fdfxkHCpABNA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwvA-0005PG-Iu; Tue, 09 Apr 2019 20:00:40 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwv8-0005Of-Q1 for linux-arm-kernel@bombadil.infradead.org; Tue, 09 Apr 2019 20:00:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type: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=AEoMgGCKQpRWSF+ToWun/Ij6QjJBnE6dT0yqLtmkUKs=; b=iHkc+Wgb5A4KEoAGx2fbyYKFt1 Gx3EhtpjJXLp/oZLq7f+kSBXeZMJwmQ+gg+4DMUVKX2wsi1SnLeXaH7eS5ZVZ9gsHaA47XJNa5FBs TDtZBGKL8UbT3At8C+CdcDAi8ySjmooYMSRKc9kKa+43duyjcSjKsBnVlZ07m7ONYYBM51wMPZYlr OvJzrAhylOHIMhl112FvAccHNuC15Kc4FD674BzQO7PHLw89deNsJg/uk7NrwFgVNKKyfhg2Rn8BF XybSsuA8Yc7WF5cwtLHA7GxqHVhkKqqfknQaP1wd6d9liGDl2UqlJrtSylMpzSnOIu+9N6x7H3RU+ 1TZNf0NA==; Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwv5-0000xV-Dl for linux-arm-kernel@lists.infradead.org; Tue, 09 Apr 2019 20:00:37 +0000 X-Originating-IP: 90.66.53.80 Received: from localhost (lfbn-1-3034-80.w90-66.abo.wanadoo.fr [90.66.53.80]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 3315C40003; Tue, 9 Apr 2019 20:00:03 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org Subject: [PATCH 2/3] rtc: ab3100: use .set_time Date: Tue, 9 Apr 2019 21:59:44 +0200 Message-Id: <20190409195945.20725-2-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190409195945.20725-1-alexandre.belloni@bootlin.com> References: <20190409195945.20725-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190409_210035_558625_928A203B X-CRM114-Status: GOOD ( 11.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Linus Walleij , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use .set_time instead of the deprecated .set_mmss64. Signed-off-by: Alexandre Belloni Reviewed-by: Linus Walleij --- drivers/rtc/rtc-ab3100.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c index f73a3707b897..ecf3f1494c13 100644 --- a/drivers/rtc/rtc-ab3100.c +++ b/drivers/rtc/rtc-ab3100.c @@ -43,12 +43,12 @@ /* * RTC clock functions and device struct declaration */ -static int ab3100_rtc_set_mmss(struct device *dev, time64_t secs) +static int ab3100_rtc_set_time(struct device *dev, struct rtc_time *tm) { u8 regs[] = {AB3100_TI0, AB3100_TI1, AB3100_TI2, AB3100_TI3, AB3100_TI4, AB3100_TI5}; unsigned char buf[6]; - u64 hw_counter = secs * AB3100_RTC_CLOCK_RATE * 2; + u64 hw_counter = rtc_tm_to_time64(tm) * AB3100_RTC_CLOCK_RATE * 2; int err = 0; int i; @@ -192,7 +192,7 @@ static int ab3100_rtc_irq_enable(struct device *dev, unsigned int enabled) static const struct rtc_class_ops ab3100_rtc_ops = { .read_time = ab3100_rtc_read_time, - .set_mmss64 = ab3100_rtc_set_mmss, + .set_time = ab3100_rtc_set_time, .read_alarm = ab3100_rtc_read_alarm, .set_alarm = ab3100_rtc_set_alarm, .alarm_irq_enable = ab3100_rtc_irq_enable, From patchwork Tue Apr 9 19:59:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 10892313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8FB7017E0 for ; Tue, 9 Apr 2019 20:00:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7351F28935 for ; Tue, 9 Apr 2019 20:00:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67CB52893C; Tue, 9 Apr 2019 20:00:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SUSPICIOUS_RECIPS autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AE8C528935 for ; Tue, 9 Apr 2019 20:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aNnuRW+MAWl8Hh42tG0BQsiTXiuE0vE0bl0nIzZ3GeU=; b=E3ncISRKWWNAAY yChHvt8j+ne1KaDdrrZA7cSmd2z5U+dqC6hHe1/07d7NPfpxPH6mdDnWQp3NKbGKTG1P3W7O+QJmK Q0G5vLFuinYlACEf6ynoPPjZ64H+0z64CTQP0E9Zuh/4H/nixBKMm0zD/sR7/SkjZ5LOo0pnuvYzR dc7ViMhlP2zNVlxTKgenfXGfRXLqAZL4HOVvRy0wG0LsPHwe8c8FNS5CHAe6uj3bsC2sFzbZKFuJz Qg9hYdi8wk5rIcfA8yMgsnEnxHpEkTFDOA8yis6AXs47rTIroUZKRYjZHUbv6Qrts51Weo8EDo5vO jsk/9xZqOwP0fc8HCHDA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwur-000560-Dg; Tue, 09 Apr 2019 20:00:21 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDwul-0004wC-4s for linux-arm-kernel@lists.infradead.org; Tue, 09 Apr 2019 20:00:17 +0000 X-Originating-IP: 90.66.53.80 Received: from localhost (lfbn-1-3034-80.w90-66.abo.wanadoo.fr [90.66.53.80]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id B838040012; Tue, 9 Apr 2019 20:00:05 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org Subject: [PATCH 3/3] rtc: ab3100: convert to SPDX identifier Date: Tue, 9 Apr 2019 21:59:45 +0200 Message-Id: <20190409195945.20725-3-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190409195945.20725-1-alexandre.belloni@bootlin.com> References: <20190409195945.20725-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190409_130015_596520_5827658D X-CRM114-Status: GOOD ( 10.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Linus Walleij , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use SPDX-License-Identifier instead of the custom license line. Signed-off-by: Alexandre Belloni Reviewed-by: Linus Walleij --- drivers/rtc/rtc-ab3100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c index ecf3f1494c13..2ed6def90975 100644 --- a/drivers/rtc/rtc-ab3100.c +++ b/drivers/rtc/rtc-ab3100.c @@ -1,6 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2007-2009 ST-Ericsson AB - * License terms: GNU General Public License (GPL) version 2 * RTC clock driver for the AB3100 Analog Baseband Chip * Author: Linus Walleij */