Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp601445pxp; Wed, 9 Mar 2022 08:55:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJybmSfXSRzVON4YNhVmDx2ZYBd3rE1b5KJJ+eoC3MXek/FgWC+ndCgS/EWxTy/tuKXOvM4U X-Received: by 2002:a17:902:7296:b0:14b:4bc6:e81 with SMTP id d22-20020a170902729600b0014b4bc60e81mr576113pll.132.1646844926011; Wed, 09 Mar 2022 08:55:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646844926; cv=none; d=google.com; s=arc-20160816; b=XpEwWK0iZ7p0YI4UCuapzWDzUALa+qQS0v6/gOMzV2W/60RQI7wnYFIbKdNtJ4G0kN uJhqJ43uOjE2FylqL465Z4l9niE85cvJ7BfDrccwl3DQ4jWSx83/Vh86YzD79Raa921I 02/uW1sNF3DRPPqcC0ipFZPZuV+CXvTZKQbZK44Hn3iXM1qhgc+MrWuF5J6ALIIDVvI7 BEtaqr+ENIs7LZhpXi/UZ96A8MCmhh+OudhaP7/aQiT8Svzf/3a+J/ONh5zynynwrYFr iDEPPt8uc2gjbYGh7yYxh1N8DMjFICT8ujAVdiXfzSxeAqVdNFX8Wq1TJfML7abHQMxX R3Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NOlnjRHH1Pg0SxcAT/bRjwNg7mPNtt7xa8173YuzdBo=; b=YabuWYJgblihc+T/YYMdZ50yJRWvmExLzEZ+GuG0P4hwPhs0gD0XCdY1CIjG5LdVfy ixC1nB2yYZdpFr92hiafyFdt655f97Yh5XCmupNVC9431knJH9FPOk/qqT/dW0e4Ym92 9t81m/I49RvqIN/z8TxGh++WC0ZH9QoLfZ7rUe4yL+2FzOf4MT81rm+rhB4sw4WT0+XA hs5GbPgugD85SqqarqGWVdecJfyqK9N1caMP0vByHk5FmazuTiEs9Z7wJKM6IEcJ6xTz R1Cmb5q5/iDHPqU2vbjR1/rGoy/tP/qjbN/TmBSgy4kpENOnXb9Dv0b0WtdimmltM/Ba xYmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="eVchWAd/"; 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=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m10-20020a17090a730a00b001bf57214400si5453518pjk.115.2022.03.09.08.55.09; Wed, 09 Mar 2022 08:55:25 -0800 (PST) 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=@bootlin.com header.s=gm1 header.b="eVchWAd/"; 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=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235797AbiCIQfh (ORCPT + 99 others); Wed, 9 Mar 2022 11:35:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236615AbiCIQaE (ORCPT ); Wed, 9 Mar 2022 11:30:04 -0500 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [IPv6:2001:4b98:dc4:8::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA1A2B0EAF; Wed, 9 Mar 2022 08:23:19 -0800 (PST) Received: (Authenticated sender: alexandre.belloni@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 5C349240018; Wed, 9 Mar 2022 16:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646842997; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NOlnjRHH1Pg0SxcAT/bRjwNg7mPNtt7xa8173YuzdBo=; b=eVchWAd/VoUMSm31LMHNxSpEy/d9UeDv2CRwtceSCxBocAI3kUmaua1HekR1zcpUOALaW/ jt+uVpd8oNRb/8oyzQnZiyt/y4HaNAAJEvafm8m2wUmyw6Djig7xSm5u9QXR5jsuBmWwOF 4I4qSZ8SggfC4CUVzFoEfDlvxeKF5sfMV2JhpmcODs0n0w9+c+B7JmIph3dcOOIfVdxwlB VlHQkdHpYRmUDjcg0AIbY5ee7hzTX+b0JAPBTNuQolxLmO0TPRlPlgXal/avikActk0EnI Dpi5u+2bIN9UInFJE0ssGl+m6Ko6yIlEOQRaibxDPrAdeQNGWZSMWd3TAf9a3g== From: Alexandre Belloni To: Alessandro Zummo , Alexandre Belloni Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/29] rtc: mpc5121: let the core handle the alarm resolution Date: Wed, 9 Mar 2022 17:22:35 +0100 Message-Id: <20220309162301.61679-4-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220309162301.61679-1-alexandre.belloni@bootlin.com> References: <20220309162301.61679-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Set RTC_FEATURE_ALARM_RES_MINUTE, so the core knows alarms have a resolution of a minute. Also, the core will properly round down the alarm instead of up. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-mpc5121.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c index bb2ea9bc56f2..6bd9779da3c6 100644 --- a/drivers/rtc/rtc-mpc5121.c +++ b/drivers/rtc/rtc-mpc5121.c @@ -210,20 +210,6 @@ static int mpc5121_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev); struct mpc5121_rtc_regs __iomem *regs = rtc->regs; - /* - * the alarm has no seconds so deal with it - */ - if (alarm->time.tm_sec) { - alarm->time.tm_sec = 0; - alarm->time.tm_min++; - if (alarm->time.tm_min >= 60) { - alarm->time.tm_min = 0; - alarm->time.tm_hour++; - if (alarm->time.tm_hour >= 24) - alarm->time.tm_hour = 0; - } - } - alarm->time.tm_mday = -1; alarm->time.tm_mon = -1; alarm->time.tm_year = -1; @@ -349,6 +335,7 @@ static int mpc5121_rtc_probe(struct platform_device *op) } rtc->rtc->ops = &mpc5200_rtc_ops; + set_bit(RTC_FEATURE_ALARM_RES_MINUTE, rtc->rtc->features); rtc->rtc->uie_unsupported = 1; rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_0000; rtc->rtc->range_max = 65733206399ULL; /* 4052-12-31 23:59:59 */ -- 2.35.1