Philipp Rosenberger
15f57b3e31
rtc: pcf2127: Run a OTP refresh if not done before
...
The datasheet of the PCF2127 states, it is recommended to process an OTP
refresh once the power is up and the oscillator is operating stable. The
OTP refresh takes less than 100 ms to complete.
Signed-off-by: Philipp Rosenberger <p.rosenberger@kunbus.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210118085752.5759-3-p.rosenberger@kunbus.com
2021-01-26 00:27:06 +01:00
Philipp Rosenberger
b9ac079abe
rtc: pcf2127: Disable Power-On Reset Override
...
To resume normal operation after a total power loss (no or empty
battery) the "Power-On Reset Override (PORO)" facility needs to be
disabled.
The register reset value sets the PORO enabled and the data sheet
recommends setting it to disabled for normal operation.
From what I've seen on the PCF2127 and PCF2129 there is no event
generated at the interrupt pin (INT), as long the PORO bit is set. This
behavior is not documented in the manual.
Signed-off-by: Philipp Rosenberger <p.rosenberger@kunbus.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210118085752.5759-2-p.rosenberger@kunbus.com
2021-01-26 00:26:16 +01:00
Dmitry Osipenko
454ba154a6
rtc: tps65910: Support wakeup-source property
...
TPS65910 is a PMIC MFD device and RTC is one of its functions. The
wakeup-source DT property is specified for the parent MFD device and we
need to use this property for the RTC in order to allow to use RTC alarm
for waking up system from suspend by default, instead of requiring user
to enable wakeup manually via sysfs.
Tested-by: Peter Geis <pgwipeout@gmail.com >
Tested-by: Matt Merhar <mattmerhar@protonmail.com >
Signed-off-by: Dmitry Osipenko <digetx@gmail.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210120211603.18555-1-digetx@gmail.com
2021-01-25 23:57:24 +01:00
Alexandre Belloni
f66e7f2d32
rtc: stm32: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210119220653.677750-14-alexandre.belloni@bootlin.com
2021-01-25 23:46:17 +01:00
Alexandre Belloni
31247546b4
rtc: rx8025: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210119220653.677750-13-alexandre.belloni@bootlin.com
2021-01-25 23:46:17 +01:00
Alexandre Belloni
2dbbedb9b3
rtc: rx8010: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210119220653.677750-12-alexandre.belloni@bootlin.com
2021-01-25 23:46:17 +01:00
Alexandre Belloni
2a5654fe2b
rtc: rv3029: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210119220653.677750-11-alexandre.belloni@bootlin.com
2021-01-25 23:46:17 +01:00
Alexandre Belloni
a82430fd2d
rtc: pcf2123: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210119220653.677750-10-alexandre.belloni@bootlin.com
2021-01-25 23:46:17 +01:00
Alexandre Belloni
cc92301784
rtc: mcp795: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210119220653.677750-9-alexandre.belloni@bootlin.com
2021-01-25 23:46:17 +01:00
Alexandre Belloni
06c6e32167
rtc: m41t80: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210119220653.677750-8-alexandre.belloni@bootlin.com
2021-01-25 23:46:17 +01:00
Alexandre Belloni
92e2c3e61d
rtc: hym8563: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210119220653.677750-7-alexandre.belloni@bootlin.com
2021-01-25 23:46:17 +01:00
Alexandre Belloni
3aa7eaf238
rtc: ds3232: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210119220653.677750-6-alexandre.belloni@bootlin.com
2021-01-25 23:46:17 +01:00
Alexandre Belloni
811c791660
rtc: ds1685: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Acked-by: Joshua Kinard <kumba@gentoo.org >
Link: https://lore.kernel.org/r/20210119220653.677750-5-alexandre.belloni@bootlin.com
2021-01-25 23:46:17 +01:00
Alexandre Belloni
5923819274
rtc: ds1307: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210119220653.677750-4-alexandre.belloni@bootlin.com
2021-01-25 23:46:17 +01:00
Alexandre Belloni
d57949bb3c
rtc: ds1305: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210119220653.677750-3-alexandre.belloni@bootlin.com
2021-01-25 23:46:16 +01:00
Alexandre Belloni
3fbd293c16
rtc: asm9260: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210119220653.677750-2-alexandre.belloni@bootlin.com
2021-01-25 23:46:16 +01:00
Alexandre Belloni
de490e0580
rtc: ac100: use rtc_lock/rtc_unlock
...
Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210125221402.1958484-1-alexandre.belloni@bootlin.com
2021-01-25 23:45:37 +01:00
Andy Shevchenko
c5158358df
rtc: mrst: Remove driver for deprecated platform
...
Intel Moorestown and Medfield are quite old Intel Atom based
32-bit platforms, which were in limited use in some Android phones,
tablets and consumer electronics more than eight years ago.
There are no bugs or problems ever reported outside from Intel
for breaking any of that platforms for years. It seems no real
users exists who run more or less fresh kernel on it. The commit
05f4434bc1 ("ASoC: Intel: remove mfld_machine") also in align
with this theory.
Due to above and to reduce a burden of supporting outdated drivers
we remove the support of outdated platforms completely.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Acked-by: Linus Walleij <linus.walleij@linaro.org >
2021-01-25 20:05:31 +02:00
Arnd Bergmann
2f58f5eea8
rtc: remove ste ab3100 driver
...
The ST-Ericsson U300 platform is getting removed, so this driver is no
longer needed.
Cc: Linus Walleij <linus.walleij@linaro.org >
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Reviewed-by: Linus Walleij <linus.walleij@linaro.org >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210120154158.1860736-4-arnd@kernel.org
2021-01-23 14:57:21 +01:00
Arnd Bergmann
dd2d3b4003
rtc: remove ste coh901 driver
...
The ST-Ericsson U300 platform is getting removed, so this driver is no
longer needed.
Cc: Linus Walleij <linus.walleij@linaro.org >
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Reviewed-by: Linus Walleij <linus.walleij@linaro.org >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210120154158.1860736-3-arnd@kernel.org
2021-01-23 14:57:21 +01:00
Arnd Bergmann
9d0735519f
rtc: remove sirfsoc driver
...
The CSR SiRF prima2/atlas platforms are getting removed, so this driver
is no longer needed.
Cc: Barry Song <baohua@kernel.org >
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Acked-by: Barry Song <baohua@kernel.org >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210120154158.1860736-2-arnd@kernel.org
2021-01-23 14:57:21 +01:00
Alexandre Belloni
12b1ef321a
rtc: tps65910: remove tps65910_rtc_ops_noirq
...
Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of
having a supplementary struct rtc_class_ops without alarm callbacks.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-18-alexandre.belloni@bootlin.com
2021-01-16 23:19:27 +01:00
Alexandre Belloni
45909e5cda
rtc: rv8803: constify rv8803_rtc_ops
...
Use RTC_FEATURE_ALARM to signal to the core whether alarms are available
instead of changing the global struct rtc_class_ops, allowing to make it
const.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-17-alexandre.belloni@bootlin.com
2021-01-16 23:19:27 +01:00
Alexandre Belloni
19588d50a2
rtc: rv3032: constify rv3032_rtc_ops
...
Use RTC_FEATURE_ALARM to signal to the core whether alarms are available
instead of changing the global struct rtc_class_ops, allowing to make it
const.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-16-alexandre.belloni@bootlin.com
2021-01-16 23:19:27 +01:00
Alexandre Belloni
9476b67bf9
rtc: rv3029: constify rv3029_rtc_ops
...
Use RTC_FEATURE_ALARM to signal to the core whether alarms are available
instead of changing the global struct rtc_class_ops, allowing to make it
const.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-15-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Alexandre Belloni
0f7695691b
rtc: rv3028: constify rv3028_rtc_ops
...
Use RTC_FEATURE_ALARM to signal to the core whether alarms are available
instead of changing the global struct rtc_class_ops, allowing to make it
const.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-14-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Alexandre Belloni
50f97e919f
rtc: opal: constify opal_rtc_ops
...
Use RTC_FEATURE_ALARM to signal to the core whether alarms are available
instead of changing the global struct rtc_class_ops, allowing to make it
const.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-13-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Alexandre Belloni
3948a86682
rtc: m41t80: constify m41t80_rtc_ops
...
Use RTC_FEATURE_ALARM to signal to the core whether alarms are available
instead of changing the global struct rtc_class_ops, allowing to make it
const.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-12-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Alexandre Belloni
732b7341b1
rtc: pcf85363: drop a struct rtc_class_ops
...
Merge both struct rtc_class_ops in a single one and use RTC_FEATURE_ALARM
to signal to the core whether alarms are available.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-11-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Alexandre Belloni
aaaea29cb1
rtc: rx8010: drop a struct rtc_class_ops
...
Merge both struct rtc_class_ops in a single one and use RTC_FEATURE_ALARM
to signal to the core whether alarms are available.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-10-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Alexandre Belloni
d4eaffe28b
rtc: pcf85063: remove pcf85063_rtc_ops_alarm
...
Move the alarm callbacks in pcf85063_rtc_ops and use RTC_FEATURE_ALARM to
signal to the core whether alarms are available instead of having a
supplementary struct rtc_class_ops without alarm callbacks.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-9-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Alexandre Belloni
25cbe9c8d9
rtc: pcf2127: remove pcf2127_rtc_alrm_ops
...
Move the alarm callbacks in pcf2127_rtc_ops and use RTC_FEATURE_ALARM to
signal to the core whether alarms are available instead of having a
supplementary struct rtc_class_ops without alarm callbacks.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-8-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Alexandre Belloni
e53ad0841c
rtc: m48t59: remove m48t02_rtc_ops
...
Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of
having a supplementary struct rtc_class_ops without alarm callbacks.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-7-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Alexandre Belloni
b0d42defe1
rtc: mv: remove mv_rtc_alarm_ops
...
Move the alarm callbacks in mv_rtc_ops and clear RTC_FEATURE_ALARM to
signal that alarms are not available instead of having a supplementary
struct rtc_class_ops.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-6-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Alexandre Belloni
30f5bd537f
rtc: cmos: remove cmos_rtc_ops_no_alarm
...
Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of
having a supplementary struct rtc_class_ops with a NULL .set_alarm.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-5-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Alexandre Belloni
95151801ed
rtc: armada38x: remove armada38x_rtc_ops_noirq
...
Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of
having a supplementary struct rtc_class_ops with a NULL .set_alarm.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-4-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Alexandre Belloni
d9b0dd54a1
rtc: pl031: use RTC_FEATURE_ALARM
...
Clear RTC_FEATURE_ALARM instead of setting set_alarm, read_alarm and
alarm_irq_enable to NULL.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Acked-by: Linus Walleij <linus.walleij@linaro.org >
Link: https://lore.kernel.org/r/20210110231752.1418816-3-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Alexandre Belloni
7ae41220ef
rtc: introduce features bitfield
...
Introduce a bitfield to allow the drivers to announce the available
features for an RTC.
The main use case would be to better handle alarms, that could be present
or not or have a minute resolution or may need a correct week day to be set.
Use the newly introduced RTC_FEATURE_ALARM bit to then test whether alarms
are available instead of relying on the presence of ops->set_alarm.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110231752.1418816-2-alexandre.belloni@bootlin.com
2021-01-16 23:19:26 +01:00
Bartosz Golaszewski
3be95d2774
rtc: s5m: check the return value of s5m8767_rtc_init_reg()
...
This function can fail if regmap operations fail so check its return
value in probe().
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210114102219.23682-4-brgl@bgdev.pl
2021-01-16 23:19:12 +01:00
Bartosz Golaszewski
7db7ad0817
rtc: s5m: use devm_i2c_new_dummy_device()
...
Use the managed variant of i2c_new_dummy_device() to shrink code and
remove the goto label. We can drop the remove callback now too.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210114102219.23682-3-brgl@bgdev.pl
2021-01-16 23:19:12 +01:00
Bartosz Golaszewski
1f0cbda3b4
rtc: s5m: select REGMAP_I2C
...
The rtc-s5m uses the I2C regmap but doesn't select it in Kconfig so
depending on the configuration the build may fail. Fix it.
Fixes: 959df7778b ("rtc: Enable compile testing for Maxim and Samsung drivers")
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210114102219.23682-2-brgl@bgdev.pl
2021-01-16 23:19:12 +01:00
Alexandre Belloni
1bf3e6cce8
rtc: opal: set range
...
It is a BCD RTC with 4 digits for the year.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210110224606.1414307-1-alexandre.belloni@bootlin.com
2021-01-13 00:35:37 +01:00
Thomas Bogendoerfer
446667df28
rtc: tx4939: Remove driver
...
CPU support for TX49xx is getting removed, so remove rtc driver for it.
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20210105140305.141401-9-tsbogend@alpha.franken.de
2021-01-13 00:31:52 +01:00
Arnd Bergmann
def8550f54
rtc: rx6110: fix build against modular I2C
...
With CONFIG_I2C=m, the #ifdef section is disabled, as shown
by this warning:
drivers/rtc/rtc-rx6110.c:314:12: error: unused function 'rx6110_probe' [-Werror,-Wunused-function]
Change the driver to use IS_ENABLED() instead, which works
for both module and built-in subsystems.
Fixes: afa819c2c6 ("rtc: rx6110: add i2c support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201230145938.3254459-1-arnd@kernel.org
2021-01-12 23:47:46 +01:00
Guixiong Wei
121f54efc3
rtc: pm8xxx: Read ALARM_EN and update to alarm enabled status
...
ALARM_EN status is retained in PMIC register after device shutdown
if poweron_alarm is enabled. Read it to make sure the driver has
consistent value with the register status.
Signed-off-by: Guixiong Wei <guixiong@codeaurora.org >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/1608809337-18852-1-git-send-email-guixiong@codeaurora.org
2021-01-12 23:46:46 +01:00
Linus Torvalds
f4a2f7866f
Merge tag 'rtc-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
...
Pull RTC updates from Alexandre Belloni:
"Subsystem:
- Remove nvram ABI. There was no complaints about the deprecation for
the last 3 years.
- Improve RTC device allocation and registration
- Now available for ARCH=um
Drivers:
- at91rm9200: correction and sam9x60 support
- ds1307: improve ACPI support
- mxc: now DT only
- pcf2127: watchdog support now needs the reset-source property
- pcf8523: set range
- rx6110: i2c support"
* tag 'rtc-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (43 commits)
rtc: pcf2127: only use watchdog when explicitly available
dt-bindings: rtc: add reset-source property
rtc: fix RTC removal
rtc: s3c: Remove dead code related to periodic tick handling
rtc: s3c: Disable all enable (RTC, tick) bits in the probe
rtc: ep93xx: Fix NULL pointer dereference in ep93xx_rtc_read_time
rtc: test: remove debug message
rtc: mxc{,_v2}: enable COMPILE_TEST
rtc: enable RTC framework on ARCH=um
rtc: pcf8523: use BIT
rtc: pcf8523: set range
rtc: pcf8523: switch to devm_rtc_allocate_device
rtc: destroy mutex when releasing the device
rtc: shrink devm_rtc_allocate_device()
rtc: rework rtc_register_device() resource management
rtc: nvmem: emit an error message when nvmem registration fails
rtc: add devm_ prefix to rtc_nvmem_register()
rtc: nvmem: remove nvram ABI
Documentation: list RTC devres helpers in devres.rst
rtc: omap: use devm_pinctrl_register()
...
2020-12-20 10:12:06 -08:00
Uwe Kleine-König
71ac13457d
rtc: pcf2127: only use watchdog when explicitly available
...
Most boards using the pcf2127 chip (in my bubble) don't make use of the
watchdog functionality and the respective output is not connected. The
effect on such a board is that there is a watchdog device provided that
doesn't work.
So only register the watchdog if the device tree has a "reset-source"
property.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
[RV: s/has-watchdog/reset-source/]
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201218101054.25416-3-rasmus.villemoes@prevas.dk
2020-12-19 01:57:44 +01:00
Alexandre Belloni
f70cc33029
rtc: fix RTC removal
...
Since the rtc_register_device, removing an RTC device will end with a
refcount_t: underflow; use-after-free warning since put_device is called
twice in the device tear down path.
Fixes: fdcfd85433 ("rtc: rework rtc_register_device() resource management")
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Link: https://lore.kernel.org/r/20201205231449.610980-1-alexandre.belloni@bootlin.com
2020-12-16 00:33:33 +01:00
Thomas Gleixner
69eca258c8
ntp: Make the RTC sync offset less obscure
...
The current RTC set_offset_nsec value is not really intuitive to
understand.
tsched twrite(t2.tv_sec - 1) t2 (seconds increment)
The offset is calculated from twrite based on the assumption that t2 -
twrite == 1s. That means for the MC146818 RTC the offset needs to be
negative so that the write happens 500ms before t2.
It's easier to understand when the whole calculation is based on t2. That
avoids negative offsets and the meaning is obvious:
t2 - twrite: The time defined by the chip when seconds increment
after the write.
twrite - tsched: The time for the transport to the point where the chip
is updated.
==> set_offset_nsec = t2 - tsched
ttransport = twrite - tsched
tRTCinc = t2 - twrite
==> set_offset_nsec = ttransport + tRTCinc
tRTCinc is a chip property and can be obtained from the data sheet.
ttransport depends on how the RTC is connected. It is close to 0 for
directly accessible RTCs. For RTCs behind a slow bus, e.g. i2c, it's the
time required to send the update over the bus. This can be estimated or
even calibrated, but that's a different problem.
Adjust the implementation and update comments accordingly.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201206220542.263204937@linutronix.de
2020-12-11 10:40:53 +01:00
Thomas Gleixner
33e62e8323
ntp, rtc: Move rtc_set_ntp_time() to ntp code
...
rtc_set_ntp_time() is not really RTC functionality as the code is just a
user of RTC. Move it into the NTP code which allows further cleanups.
Requested-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201206220542.166871172@linutronix.de
2020-12-11 10:40:52 +01:00