Merge tag 'rtc-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC updates from Alexandre Belloni: "RTC for 4.8 Cleanups: - huge cleanup of rtc-generic and char/genrtc this allowed to cleanup rtc-cmos, rtc-sh, rtc-m68k, rtc-powerpc and rtc-parisc - move mn10300 to rtc-cmos Subsystem: - fix wakealarms after hibernate - multiples fixes for rctest - simplify implementations of .read_alarm New drivers: - Maxim MAX6916 Drivers: - ds1307: fix weekday - m41t80: add wakeup support - pcf85063: add support for PCF85063A variant - rv8803: extend i2c fix and other fixes - s35390a: fix alarm reading, this fixes instant reboot after shutdown for QNAP TS-41x - s3c: clock fixes" * tag 'rtc-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (65 commits) rtc: rv8803: Clear V1F when setting the time rtc: rv8803: Stop the clock while setting the time rtc: rv8803: Always apply the I²C workaround rtc: rv8803: Fix read day of week rtc: rv8803: Remove the check for valid time rtc: rv8803: Kconfig: Indicate rx8900 support rtc: asm9260: remove .owner field for driver rtc: at91sam9: Fix missing spin_lock_init() rtc: m41t80: add suspend handlers for alarm IRQ rtc: m41t80: make it a real error message rtc: pcf85063: Add support for the PCF85063A device rtc: pcf85063: fix year range rtc: hym8563: in .read_alarm set .tm_sec to 0 to signal minute accuracy rtc: explicitly set tm_sec = 0 for drivers with minute accurancy rtc: s3c: Add s3c_rtc_{enable/disable}_clk in s3c_rtc_setfreq() rtc: s3c: Remove unnecessary call to disable already disabled clock rtc: abx80x: use devm_add_action_or_reset() rtc: m41t80: use devm_add_action_or_reset() rtc: fix a typo and reduce three empty lines to one rtc: s35390a: improve two comments in .set_alarm ...
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
#include <linux/errno.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/rtc.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/param.h>
|
||||
@@ -248,14 +249,47 @@ void __init start_cpu_itimer(void)
|
||||
per_cpu(cpu_data, cpu).it_value = next_tick;
|
||||
}
|
||||
|
||||
#if IS_ENABLED(CONFIG_RTC_DRV_GENERIC)
|
||||
static int rtc_generic_get_time(struct device *dev, struct rtc_time *tm)
|
||||
{
|
||||
struct pdc_tod tod_data;
|
||||
|
||||
memset(tm, 0, sizeof(*tm));
|
||||
if (pdc_tod_read(&tod_data) < 0)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
/* we treat tod_sec as unsigned, so this can work until year 2106 */
|
||||
rtc_time64_to_tm(tod_data.tod_sec, tm);
|
||||
return rtc_valid_tm(tm);
|
||||
}
|
||||
|
||||
static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm)
|
||||
{
|
||||
time64_t secs = rtc_tm_to_time64(tm);
|
||||
|
||||
if (pdc_tod_set(secs, 0) < 0)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct rtc_class_ops rtc_generic_ops = {
|
||||
.read_time = rtc_generic_get_time,
|
||||
.set_time = rtc_generic_set_time,
|
||||
};
|
||||
|
||||
static int __init rtc_init(void)
|
||||
{
|
||||
struct platform_device *pdev;
|
||||
|
||||
pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
|
||||
pdev = platform_device_register_data(NULL, "rtc-generic", -1,
|
||||
&rtc_generic_ops,
|
||||
sizeof(rtc_generic_ops));
|
||||
|
||||
return PTR_ERR_OR_ZERO(pdev);
|
||||
}
|
||||
device_initcall(rtc_init);
|
||||
#endif
|
||||
|
||||
void read_persistent_clock(struct timespec *ts)
|
||||
{
|
||||
|
Reference in New Issue
Block a user