diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2018-09-11 13:31:51 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2018-09-11 13:31:51 +1000 |
commit | bb11820d5c9adbd1f9af5424e79d4615ecd2473b (patch) | |
tree | 2f4c927c84f6d330157badfb45271e39edc95ba1 | |
parent | ad39f0ee9f993b936a15d2afbc4a7742cdc36b2b (diff) | |
parent | 05a0a34418699ea2ced1fe6e081b91c0e1065690 (diff) |
Merge remote-tracking branch 'rtc/rtc-next'
-rw-r--r-- | arch/mips/Kconfig | 2 | ||||
-rw-r--r-- | drivers/char/Kconfig | 2 | ||||
-rw-r--r-- | drivers/rtc/Kconfig | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-mrst.c | 5 | ||||
-rw-r--r-- | drivers/rtc/rtc-omap.c | 28 | ||||
-rw-r--r-- | drivers/rtc/rtc-rv8803.c | 7 | ||||
-rw-r--r-- | drivers/rtc/rtc-sun6i.c | 3 | ||||
-rw-r--r-- | drivers/rtc/rtc-sysfs.c | 4 |
8 files changed, 30 insertions, 23 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 1a119fd7324d..54532f2fc27a 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -75,7 +75,7 @@ config MIPS select MODULES_USE_ELF_RELA if MODULES && 64BIT select MODULES_USE_ELF_REL if MODULES select PERF_USE_VMALLOC - select RTC_LIB if !MACH_LOONGSON64 + select RTC_LIB select SYSCTL_EXCEPTION_TRACE select VIRT_TO_BUS diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 40728491f37b..9d03b2ff5df6 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -268,7 +268,7 @@ if RTC_LIB=n config RTC tristate "Enhanced Real Time Clock Support (legacy PC RTC driver)" - depends on ALPHA || (MIPS && MACH_LOONGSON64) + depends on ALPHA ---help--- If you say Y here and create a character special file /dev/rtc with major number 10 and minor number 135 using mknod ("man mknod"), you diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 7d7be60a2413..a0f291c052bc 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -1587,7 +1587,7 @@ config RTC_DRV_MPC5121 config RTC_DRV_JZ4740 tristate "Ingenic JZ4740 SoC" - depends on MACH_INGENIC || COMPILE_TEST + depends on MIPS || COMPILE_TEST help If you say yes here you get support for the Ingenic JZ47xx SoCs RTC controllers. diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c index 1925aaf09093..daf354a6a853 100644 --- a/drivers/rtc/rtc-mrst.c +++ b/drivers/rtc/rtc-mrst.c @@ -90,7 +90,7 @@ static int mrst_read_time(struct device *dev, struct rtc_time *time) unsigned long flags; if (vrtc_is_updating()) - mdelay(20); + msleep(20); spin_lock_irqsave(&rtc_lock, flags); time->tm_sec = vrtc_cmos_read(RTC_SECONDS); @@ -261,11 +261,10 @@ static int mrst_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) static int mrst_procfs(struct device *dev, struct seq_file *seq) { - unsigned char rtc_control, valid; + unsigned char rtc_control; spin_lock_irq(&rtc_lock); rtc_control = vrtc_cmos_read(RTC_CONTROL); - valid = vrtc_cmos_read(RTC_VALID); spin_unlock_irq(&rtc_lock); seq_printf(seq, diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 323ff55cc165..320b4a520eb3 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c @@ -421,12 +421,6 @@ static struct omap_rtc *omap_rtc_power_off_rtc; * The RTC can be used to control an external PMIC via the pmic_power_en pin, * which can be configured to transition to OFF on ALARM2 events. * - * Notes: - * The two-second alarm offset is the shortest offset possible as the alarm - * registers must be set before the next timer update and the offset - * calculation is too heavy for everything to be done within a single access - * period (~15 us). - * * Called with local interrupts disabled. */ static void omap_rtc_power_off(void) @@ -434,6 +428,7 @@ static void omap_rtc_power_off(void) struct omap_rtc *rtc = omap_rtc_power_off_rtc; struct rtc_time tm; unsigned long now; + int seconds; u32 val; rtc->type->unlock(rtc); @@ -441,11 +436,13 @@ static void omap_rtc_power_off(void) val = rtc_readl(rtc, OMAP_RTC_PMIC_REG); rtc_writel(rtc, OMAP_RTC_PMIC_REG, val | OMAP_RTC_PMIC_POWER_EN_EN); - /* set alarm two seconds from now */ +again: + /* set alarm one second from now */ omap_rtc_read_time_raw(rtc, &tm); + seconds = tm.tm_sec; bcd2tm(&tm); rtc_tm_to_time(&tm, &now); - rtc_time_to_tm(now + 2, &tm); + rtc_time_to_tm(now + 1, &tm); if (tm2bcd(&tm) < 0) { dev_err(&rtc->rtc->dev, "power off failed\n"); @@ -470,14 +467,22 @@ static void omap_rtc_power_off(void) val = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG); rtc_writel(rtc, OMAP_RTC_INTERRUPTS_REG, val | OMAP_RTC_INTERRUPTS_IT_ALARM2); + + /* Retry in case roll over happened before alarm was armed. */ + if (rtc_read(rtc, OMAP_RTC_SECONDS_REG) != seconds) { + val = rtc_read(rtc, OMAP_RTC_STATUS_REG); + if (!(val & OMAP_RTC_STATUS_ALARM2)) + goto again; + } + rtc->type->lock(rtc); /* - * Wait for alarm to trigger (within two seconds) and external PMIC to + * Wait for alarm to trigger (within one second) and external PMIC to * power off the system. Add a 500 ms margin for external latencies * (e.g. debounce circuits). */ - mdelay(2500); + mdelay(1500); } static const struct rtc_class_ops omap_rtc_ops = { @@ -721,8 +726,7 @@ static int omap_rtc_probe(struct platform_device *pdev) if (of_id) { rtc->type = of_id->data; rtc->is_pmic_controller = rtc->type->has_pmic_mode && - of_property_read_bool(pdev->dev.of_node, - "system-power-controller"); + of_device_is_system_power_controller(pdev->dev.of_node); } else { id_entry = platform_get_device_id(pdev); rtc->type = (void *)id_entry->driver_data; diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c index 29fc3d210392..450a0b831a2d 100644 --- a/drivers/rtc/rtc-rv8803.c +++ b/drivers/rtc/rtc-rv8803.c @@ -615,6 +615,7 @@ static int rv8803_probe(struct i2c_client *client, static const struct i2c_device_id rv8803_id[] = { { "rv8803", rv_8803 }, + { "rx8803", rv_8803 }, { "rx8900", rx_8900 }, { } }; @@ -623,7 +624,11 @@ MODULE_DEVICE_TABLE(i2c, rv8803_id); static const struct of_device_id rv8803_of_match[] = { { .compatible = "microcrystal,rv8803", - .data = (void *)rx_8900 + .data = (void *)rv_8803 + }, + { + .compatible = "epson,rx8803", + .data = (void *)rv_8803 }, { .compatible = "epson,rx8900", diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index 2cd5a7b1a2e3..fe07310952df 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -199,8 +199,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node) if (!rtc) return; - clk_data = kzalloc(sizeof(*clk_data) + (sizeof(*clk_data->hws) * 2), - GFP_KERNEL); + clk_data = kzalloc(struct_size(clk_data, hws, 2), GFP_KERNEL); if (!clk_data) { kfree(rtc); return; diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c index f1ff30ade534..9746c32eee2e 100644 --- a/drivers/rtc/rtc-sysfs.c +++ b/drivers/rtc/rtc-sysfs.c @@ -338,8 +338,8 @@ int rtc_add_groups(struct rtc_device *rtc, const struct attribute_group **grps) new_cnt = old_cnt + add_cnt + 1; groups = devm_kcalloc(&rtc->dev, new_cnt, sizeof(*groups), GFP_KERNEL); - if (IS_ERR_OR_NULL(groups)) - return PTR_ERR(groups); + if (!groups) + return -ENOMEM; memcpy(groups, rtc->dev.groups, old_cnt * sizeof(*groups)); memcpy(groups + old_cnt, grps, add_cnt * sizeof(*groups)); groups[old_cnt + add_cnt] = NULL; |