mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 23:05:25 -04:00
Merge tag 'rtc-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC updates from Alexandre Belloni:
"We see a net reduction of the number of lines of code thanks to the
removal of a now unused driver and a testing tool that is not used
anymore. Apart from this, the max31335 driver gets support for a new
part number and pm8xxx gets UEFI support.
Core:
- setdate is removed as it has better replacements
- skip alarms with a second resolution when we know the RTC doesn't
support those.
Subsystem:
- remove unnecessary private struct members
- use devm_pm_set_wake_irq were relevant
Drivers:
- ds1307: stop disabling alarms on probe for DS1337, DS1339, DS1341
and DS3231
- max31335: add max31331 support
- pcf50633 is removed as support for the related SoC has been removed
- pcf85063: properly handle POR failures"
* tag 'rtc-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (50 commits)
rtc: remove 'setdate' test program
selftest: rtc: skip some tests if the alarm only supports minutes
rtc: mt6397: drop unused defines
rtc: pcf85063: replace dev_err+return with return dev_err_probe
rtc: pcf85063: do a SW reset if POR failed
rtc: max31335: Add driver support for max31331
dt-bindings: rtc: max31335: Add max31331 support
rtc: cros-ec: Avoid a couple of -Wflex-array-member-not-at-end warnings
dt-bindings: rtc: pcf2127: Reference spi-peripheral-props.yaml
rtc: rzn1: implement one-second accuracy for alarms
rtc: pcf50633: Remove
rtc: pm8xxx: implement qcom,no-alarm flag for non-HLOS owned alarm
rtc: pm8xxx: mitigate flash wear
rtc: pm8xxx: add support for uefi offset
dt-bindings: rtc: qcom-pm8xxx: document qcom,no-alarm flag
rtc: rv3032: drop WADA
rtc: rv3032: fix EERD location
rtc: pm8xxx: switch to devm_device_init_wakeup
rtc: pm8xxx: fix possible race condition
rtc: mpfs: switch to devm_device_init_wakeup
...
This commit is contained in:
1
tools/testing/selftests/rtc/.gitignore
vendored
1
tools/testing/selftests/rtc/.gitignore
vendored
@@ -1,3 +1,2 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
rtctest
|
||||
setdate
|
||||
|
||||
@@ -4,8 +4,6 @@ LDLIBS += -lrt -lpthread -lm
|
||||
|
||||
TEST_GEN_PROGS = rtctest
|
||||
|
||||
TEST_GEN_PROGS_EXTENDED = setdate
|
||||
|
||||
TEST_FILES := settings
|
||||
|
||||
include ../lib.mk
|
||||
|
||||
@@ -29,6 +29,7 @@ enum rtc_alarm_state {
|
||||
RTC_ALARM_UNKNOWN,
|
||||
RTC_ALARM_ENABLED,
|
||||
RTC_ALARM_DISABLED,
|
||||
RTC_ALARM_RES_MINUTE,
|
||||
};
|
||||
|
||||
FIXTURE(rtc) {
|
||||
@@ -88,7 +89,7 @@ static void nanosleep_with_retries(long ns)
|
||||
}
|
||||
}
|
||||
|
||||
static enum rtc_alarm_state get_rtc_alarm_state(int fd)
|
||||
static enum rtc_alarm_state get_rtc_alarm_state(int fd, int need_seconds)
|
||||
{
|
||||
struct rtc_param param = { 0 };
|
||||
int rc;
|
||||
@@ -103,6 +104,10 @@ static enum rtc_alarm_state get_rtc_alarm_state(int fd)
|
||||
if ((param.uvalue & _BITUL(RTC_FEATURE_ALARM)) == 0)
|
||||
return RTC_ALARM_DISABLED;
|
||||
|
||||
/* Check if alarm has desired granularity */
|
||||
if (need_seconds && (param.uvalue & _BITUL(RTC_FEATURE_ALARM_RES_MINUTE)))
|
||||
return RTC_ALARM_RES_MINUTE;
|
||||
|
||||
return RTC_ALARM_ENABLED;
|
||||
}
|
||||
|
||||
@@ -227,9 +232,11 @@ TEST_F(rtc, alarm_alm_set) {
|
||||
SKIP(return, "Skipping test since %s does not exist", rtc_file);
|
||||
ASSERT_NE(-1, self->fd);
|
||||
|
||||
alarm_state = get_rtc_alarm_state(self->fd);
|
||||
alarm_state = get_rtc_alarm_state(self->fd, 1);
|
||||
if (alarm_state == RTC_ALARM_DISABLED)
|
||||
SKIP(return, "Skipping test since alarms are not supported.");
|
||||
if (alarm_state == RTC_ALARM_RES_MINUTE)
|
||||
SKIP(return, "Skipping test since alarms has only minute granularity.");
|
||||
|
||||
rc = ioctl(self->fd, RTC_RD_TIME, &tm);
|
||||
ASSERT_NE(-1, rc);
|
||||
@@ -295,9 +302,11 @@ TEST_F(rtc, alarm_wkalm_set) {
|
||||
SKIP(return, "Skipping test since %s does not exist", rtc_file);
|
||||
ASSERT_NE(-1, self->fd);
|
||||
|
||||
alarm_state = get_rtc_alarm_state(self->fd);
|
||||
alarm_state = get_rtc_alarm_state(self->fd, 1);
|
||||
if (alarm_state == RTC_ALARM_DISABLED)
|
||||
SKIP(return, "Skipping test since alarms are not supported.");
|
||||
if (alarm_state == RTC_ALARM_RES_MINUTE)
|
||||
SKIP(return, "Skipping test since alarms has only minute granularity.");
|
||||
|
||||
rc = ioctl(self->fd, RTC_RD_TIME, &alarm.time);
|
||||
ASSERT_NE(-1, rc);
|
||||
@@ -357,7 +366,7 @@ TEST_F_TIMEOUT(rtc, alarm_alm_set_minute, 65) {
|
||||
SKIP(return, "Skipping test since %s does not exist", rtc_file);
|
||||
ASSERT_NE(-1, self->fd);
|
||||
|
||||
alarm_state = get_rtc_alarm_state(self->fd);
|
||||
alarm_state = get_rtc_alarm_state(self->fd, 0);
|
||||
if (alarm_state == RTC_ALARM_DISABLED)
|
||||
SKIP(return, "Skipping test since alarms are not supported.");
|
||||
|
||||
@@ -425,7 +434,7 @@ TEST_F_TIMEOUT(rtc, alarm_wkalm_set_minute, 65) {
|
||||
SKIP(return, "Skipping test since %s does not exist", rtc_file);
|
||||
ASSERT_NE(-1, self->fd);
|
||||
|
||||
alarm_state = get_rtc_alarm_state(self->fd);
|
||||
alarm_state = get_rtc_alarm_state(self->fd, 0);
|
||||
if (alarm_state == RTC_ALARM_DISABLED)
|
||||
SKIP(return, "Skipping test since alarms are not supported.");
|
||||
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/* Real Time Clock Driver Test
|
||||
* by: Benjamin Gaignard (benjamin.gaignard@linaro.org)
|
||||
*
|
||||
* To build
|
||||
* gcc rtctest_setdate.c -o rtctest_setdate
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <linux/rtc.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
static const char default_time[] = "00:00:00";
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int fd, retval;
|
||||
struct rtc_time new, current;
|
||||
const char *rtc, *date;
|
||||
const char *time = default_time;
|
||||
|
||||
switch (argc) {
|
||||
case 4:
|
||||
time = argv[3];
|
||||
/* FALLTHROUGH */
|
||||
case 3:
|
||||
date = argv[2];
|
||||
rtc = argv[1];
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "usage: rtctest_setdate <rtcdev> <DD-MM-YYYY> [HH:MM:SS]\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
fd = open(rtc, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
perror(rtc);
|
||||
exit(errno);
|
||||
}
|
||||
|
||||
sscanf(date, "%d-%d-%d", &new.tm_mday, &new.tm_mon, &new.tm_year);
|
||||
new.tm_mon -= 1;
|
||||
new.tm_year -= 1900;
|
||||
sscanf(time, "%d:%d:%d", &new.tm_hour, &new.tm_min, &new.tm_sec);
|
||||
|
||||
fprintf(stderr, "Test will set RTC date/time to %d-%d-%d, %02d:%02d:%02d.\n",
|
||||
new.tm_mday, new.tm_mon + 1, new.tm_year + 1900,
|
||||
new.tm_hour, new.tm_min, new.tm_sec);
|
||||
|
||||
/* Write the new date in RTC */
|
||||
retval = ioctl(fd, RTC_SET_TIME, &new);
|
||||
if (retval == -1) {
|
||||
perror("RTC_SET_TIME ioctl");
|
||||
close(fd);
|
||||
exit(errno);
|
||||
}
|
||||
|
||||
/* Read back */
|
||||
retval = ioctl(fd, RTC_RD_TIME, ¤t);
|
||||
if (retval == -1) {
|
||||
perror("RTC_RD_TIME ioctl");
|
||||
exit(errno);
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n\nCurrent RTC date/time is %d-%d-%d, %02d:%02d:%02d.\n",
|
||||
current.tm_mday, current.tm_mon + 1, current.tm_year + 1900,
|
||||
current.tm_hour, current.tm_min, current.tm_sec);
|
||||
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user