summary refs log tree commit diff
path: root/drivers/rtc/rtc-mpc5121.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2022-03-09 17:22:35 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2022-03-23 19:58:38 +0100
commit9597f8cc80b2044b02579961cffc6cd0d0d2f099 (patch)
tree23f5b0829fb53b2afee2bd499f2f91cff1aba4d3 /drivers/rtc/rtc-mpc5121.c
parent000bf045c69b40f5fd9aac61414cbb44f322e7c0 (diff)
downloadlinux-9597f8cc80b2044b02579961cffc6cd0d0d2f099.tar.gz
rtc: mpc5121: let the core handle the alarm resolution
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 <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-4-alexandre.belloni@bootlin.com
Diffstat (limited to 'drivers/rtc/rtc-mpc5121.c')
-rw-r--r--drivers/rtc/rtc-mpc5121.c15
1 files changed, 1 insertions, 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 */