- 01 Sep, 2019 12 commits
-
-
Bastian Krause authored
The required OF entries were added with commit 47dd4729 ("rtc: ds1307: add OF and ACPI entries for Epson RX8130"). Cc: devicetree@vger.kernel.org Signed-off-by:
Bastian Krause <bst@pengutronix.de> Link: https://lore.kernel.org/r/20190830134755.1121-1-bst@pengutronix.deSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alejandro González authored
This patch allows userspace to set up wakeup alarms on any RTC handled by the sun6i driver, and adds the necessary PM operations to allow resuming from suspend when the configured wakeup alarm fires a IRQ. Of course, that the device actually resumes depends on the suspend state and how a particular hardware reacts to it, but that is out of scope for this patch. I've tested these changes on a Pine H64 model B, which contains a Allwinner H6 SoC, with the help of CONFIG_PM_TEST_SUSPEND kernel option. These are the interesting outputs from the kernel and commands which show that it works. As every RTC handled by this driver is largely the same, I think that it shouldn't introduce any regression on other SoCs, but I may be wrong. [ 1.092705] PM: test RTC wakeup from 'freeze' suspend [ 1.098230] PM: suspend entry (s2idle) [ 1.212907] PM: suspend devices took 0.080 seconds (The SoC freezes for some seconds) [ 3.197604] PM: resume devices took 0.104 seconds [ 3.215937] PM: suspend exit [ 1.092812] PM: test RTC wakeup from 'mem' suspend [ 1.098089] PM: suspend entry (deep) [ 1.102033] PM: suspend exit [ 1.105205] PM: suspend test failed, error -22 In any case, the RTC alarm interrupt gets fired as exptected: $ echo +5 > /sys/class/rtc/rtc0/wakealarm && sleep 5 && grep rtc /proc/interrupts 29: 1 0 0 0 GICv2 133 Level 7000000.rtc Signed-off-by:
Alejandro González <alejandro.gonzalez.correo@gmail.com> Acked-by:
Chen-Yu Tsai <wens@csie.org> Link: https://lore.kernel.org/r/20190821210056.11995-1-alejandro.gonzalez.correo@gmail.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Set the RTC range properly and use the core windowing and offsetting to (unfortunately) map back to a 1970-2069 range. Link: https://lore.kernel.org/r/20190829212547.19185-5-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
pcf8563_rtc_read_time and pcf8563_set_datetime are only used after casting dev to an i2c_client. Remove that useless indirection. Link: https://lore.kernel.org/r/20190829212547.19185-4-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
This allows further improvement of the driver. Link: https://lore.kernel.org/r/20190829212547.19185-3-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Add a compatible string for the Microcrystal RV8564. Link: https://lore.kernel.org/r/20190829212547.19185-2-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Add a compatible string for the Epson RTC8564. Link: https://lore.kernel.org/r/20190829212547.19185-1-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Wolfram Sang authored
I was about to simplify the call to i2c_unregister_device() when I realized that converting to devm_i2c_new_dummy_device() will simplify the driver a lot. So I took this approach. Signed-off-by:
Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20190830133124.21633-3-wsa+renesas@sang-engineering.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Wolfram Sang authored
I was about to simplify the call to i2c_unregister_device() when I realized that converting to devm_i2c_new_dummy_device() will simplify the driver a lot. So I took this approach. Signed-off-by:
Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20190830133124.21633-2-wsa+renesas@sang-engineering.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Biwen Li authored
Issue: - # hwclock -w hwclock: RTC_SET_TIME: Invalid argument Why: - Relative commit: 8b9f9d4d ("regmap: verify if register is writeable before writing operations"), this patch will always check for unwritable registers, it will compare reg with max_register in regmap_writeable. - The pcf85363/pcf85263 has the capability of address wrapping which means if you access an address outside the allowed range (0x00-0x2f) hardware actually wraps the access to a lower address. The rtc-pcf85363 driver will use this feature to configure the time and execute 2 actions in the same i2c write operation (stopping the clock and configure the time). However the driver has also configured the `regmap maxregister` protection mechanism that will block accessing addresses outside valid range (0x00-0x2f). How: - Split of writing regs to two parts, first part writes control registers about stop_enable and resets, second part writes RTC time and date registers. Signed-off-by:
Biwen Li <biwen.li@nxp.com> Link: https://lore.kernel.org/r/20190829021418.4607-1-biwen.li@nxp.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Call the 64bit versions of rtc_tm time conversion now that the range is enforced by the core. Link: https://lore.kernel.org/r/20190828205056.31321-2-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The SNVS is a 47-bit counter incremented at 32768Hz, it is then a 32-bit second counter. Link: https://lore.kernel.org/r/20190828205056.31321-1-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 29 Aug, 2019 1 commit
-
-
Anson Huang authored
The RTC IRQ is requested before the struct rtc_device is allocated, this may lead to a NULL pointer dereference in IRQ handler. To fix this issue, allocating the rtc_device struct before requesting the RTC IRQ using devm_rtc_allocate_device, and use rtc_register_device to register the RTC device. Signed-off-by:
Anson Huang <Anson.Huang@nxp.com> Reviewed-by:
Dong Aisheng <aisheng.dong@nxp.com> Link: https://lore.kernel.org/r/20190716071858.36750-1-Anson.Huang@nxp.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 27 Aug, 2019 3 commits
-
-
Bruno Thomsen authored
Disable watchdog registation when kernel is build without watchdog functionality, and enable watchdog core otherwise. This removes compile errors like the one below: drivers/rtc/rtc-pcf2127.o: in function `pcf2127_probe.constprop.3': rtc-pcf2127.c:(.text.unlikely+0x2c8): undefined reference to `devm_watchdog_register_device' Watchdog feature in chip will always be configured as this is safe to do in both cases and minimize code churn. Reported-by:
Hulk Robot <hulkci@huawei.com> Reported-by:
YueHaibing <yuehaibing@huawei.com> Fixes: bbc597561ce1 ("rtc: pcf2127: add watchdog feature support") Signed-off-by:
Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20190827143656.4734-1-bruno.thomsen@gmail.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Bruno Thomsen authored
Add support for integrated tamper detection function in both PCF2127 and PCF2129 chips. This patch implements the feature by adding an additional timestamp0 file to sysfs device path. This file contains seconds since epoch, if an event occurred, or is empty, if none occurred. Interface should match ISL1208 and RV3028 RTC drivers. Signed-off-by:
Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20190822131936.18772-5-bruno.thomsen@gmail.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Bruno Thomsen authored
Add partial support for the watchdog functionality of both PCF2127 and PCF2129 chips. The programmable watchdog timer is currently using a fixed clock source of 1Hz. This result in a selectable range of 1-255 seconds, which covers most embedded Linux use-cases. Clock sources of 4096Hz, 64Hz and 1/60Hz is mostly useful in MCU use-cases. Countdown timer not available when using watchdog feature. Signed-off-by:
Bruno Thomsen <bruno.thomsen@gmail.com> Acked-by:
Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20190822131936.18772-4-bruno.thomsen@gmail.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 23 Aug, 2019 7 commits
-
-
Bruno Thomsen authored
The previous fix listed bulk read of registers as root cause of accendential disabling of watchdog, since the watchdog counter register (WD_VAL) was zeroed. Fixes: 3769a375 rtc: pcf2127: bulk read only date and time registers. Tested with the same PCF2127 chip as Sean reveled root cause of WD_VAL register value zeroing was caused by reading CTRL2 register which is one of the watchdog feature control registers. So the solution is to not read the first two control registers (CTRL1 and CTRL2) in pcf2127_rtc_read_time as they are not needed anyway. Size of local buf variable is kept to allow easy usage of register defines to improve readability of code. Debug trace line was updated after CTRL1 and CTRL2 are no longer read from the chip. Also replaced magic numbers in buf access with register defines. Signed-off-by:
Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20190822131936.18772-3-bruno.thomsen@gmail.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Bruno Thomsen authored
Cleanup of defines to follow kernel coding style and increase code readability by using same register and bit define style. Change PCF2127_REG_RAM_{addr_MSB,wrt_cmd,rd_cmd} to upper case as kernel coding guide section 12 'Macros, Enums and RTL' states "Names of macros defining constants and labels in enums are capitalized". Improve readability of RAM register comment by making whole sentences. Remove parentheses from register defines as they are only used for expressions and not constants. As there are no clear style for name of registers and bits in the kernel drivers, I suggest the following for at least this driver, but hopefully also other RTC drivers. Register name should follow this convention: [chip]_REG_[reg name] 0xXX Bit name should follow this convention, so it clearly states which chip register it's part of: [chip]_BIT_[reg name]_[bit name] BIT(X) Additionally I suggest bit defines are always placed right below its corresponding register define and using an extra tab indentation for the BIT(X) part. This will visually make it easy to see that bit defines are part of the complete register definition. Rename PCF2127_OSF to PCF2127_BIT_SC_OSF and move it right below PCF2127_REG_SC. This will improve readability of bit checks as it's easy to verify that it uses the correct register. Move end of line comments above register defines as it's more like a heading for 1 register define and up to 8 bit defines or a collection of registers that are close related like timestamp split across 6 registers. Signed-off-by:
Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20190822131936.18772-2-bruno.thomsen@gmail.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Bruno Thomsen authored
This allows further improvement of the driver. Signed-off-by:
Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20190822131936.18772-1-bruno.thomsen@gmail.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Ondrej Jirman authored
RTC on H6 is mostly the same as on H5 and H3. It has slight differences mostly in features that are not yet supported by this driver. Some differences are already stated in the comments in existing code. One other difference is that H6 has extra bit in LOSC_CTRL_REG, called EXT_LOSC_EN to enable/disable external low speed crystal oscillator. It also has bit EXT_LOSC_STA in LOSC_AUTO_SWT_STA_REG, to check whether external low speed oscillator is working correctly. This patch adds support for enabling LOSC when necessary: - during reparenting - when probing the clock H6 also has capacbility to automatically reparent RTC clock from external crystal oscillator, to internal RC oscillator, if external oscillator fails. This is enabled by default. Disable it during probe. Signed-off-by:
Ondrej Jirman <megous@megous.com> Reviewed-by:
Chen-Yu Tsai <wens@csie.org> Link: https://lore.kernel.org/r/20190820151934.3860-3-megous@megous.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Ondrej Jirman authored
RTC on H6 is similar to the one on H5 SoC, but incompatible in small details. See the driver for description of differences. For example H6 RTC needs to enable the external low speed oscillator. Add new compatible for this RTC. Signed-off-by:
Ondrej Jirman <megous@megous.com> Link: https://lore.kernel.org/r/20190820151934.3860-2-megous@megous.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Biwen Li authored
For the platforms including LS1012A, LS1021A, LS1028A, LS1043A, LS1046A, LS1088A, LS208xA that has the FlexTimer module, implementing alarm functions within RTC subsystem to wakeup the system when system going to sleep (work with RCPM driver). Signed-off-by:
Biwen Li <biwen.li@nxp.com> Link: https://lore.kernel.org/r/20190813030157.48590-1-biwen.li@nxp.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Biwen Li authored
The patch adds bindings for FlexTimer Module Signed-off-by:
Biwen Li <biwen.li@nxp.com> Link: https://lore.kernel.org/r/20190813030157.48590-2-biwen.li@nxp.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 22 Aug, 2019 2 commits
-
-
Neil Armstrong authored
The Amlogic Meson GX SoCs uses a special register to store the time in seconds to wakeup after a system suspend. In order to be able to reuse the RTC wakealarm feature, this driver implements a fake RTC device which uses the system time to deduce a suspend delay. Signed-off-by:
Neil Armstrong <narmstrong@baylibre.com> [khilman: rebase to v5.3-rc, rework and modernization] Signed-off-by:
Kevin Hilman <khilman@baylibre.com> Link: https://lore.kernel.org/r/20190812232850.8016-3-khilman@kernel.orgSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Kevin Hilman authored
Add binding fo the new VRTC driver for Amlogic SoCs. The 64-bit family of SoCs only has an RTC managed by firmware, and this VRTC driver provides the simple, one-register firmware interface. Reviewed-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Kevin Hilman <khilman@baylibre.com> Link: https://lore.kernel.org/r/20190812232850.8016-2-khilman@kernel.orgSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 21 Aug, 2019 3 commits
-
-
Dan Carpenter authored
My error handling "cleanup" was totally wrong. Both the "err" and "ret" variables are required. The "err" variable holds the error codes for rv3029_eeprom_enter/exit() and the "ret" variable holds the error codes for if actual write fails. In my patch if the write failed, the function probably still returned success. Reported-by:
Tom Evans <tom.evans@motec.com.au> Fixes: 97f5b037 ("rtc: rv3029: Clean up error handling in rv3029_eeprom_write()") Signed-off-by:
Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20190817065604.GB29951@mwandaSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The rtc pointer is already checked earlier, it is not necessary to check it again. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190818215232.17320-1-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The RTC core now has error messages in case of registration failure, there is no need to have other messages in the drivers. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190818220041.17833-2-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 20 Aug, 2019 10 commits
-
-
Alexandre Belloni authored
Add a message when __rtc_register_device fails because rtc->ops is NULL. This may only happen when developing a new driver so use dev_dbg to avoid compiling it in by default. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190818220041.17833-1-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
nxp,rtc-pcf2123 is not a proper compatible strong for this RTC. The part name is only pcf2123 and is less confusing. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190819182656.29744-9-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Set the RTC range properly and use the core windowing and offsetting to (unfortunately) map back to a 1970-2069 range. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190819182656.29744-8-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
This allows further improvement of the driver. Also remove the unecessary error string as the core will already display error messages. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190819182656.29744-7-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
kfree_exit only returns ret, remove it. This also fixes the devm_regmap_init_spi error case where the probe wouldn't actually fail because ret is initialized to 0. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190819182656.29744-6-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Rename struct pcf2123_plat_data to struct pcf2123_data and pdata to pcf2123 to make the driver use a more common subsystem style. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190819182656.29744-5-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
platform_data is for platform specific data, use driver_data instead. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190819182656.29744-4-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Implement .alarm_irq_enable so it is possible to use RTC_ALM_SET, RTC_AIE_ON and RTC_AIE_OFF. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190819182656.29744-3-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Clear the flag after disabling the alarm to ensure the alarm doesn't fire between clearing the flag and disabling the alarm. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190819182656.29744-2-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The week day may not be set properly by userspace. This would result is missed alarms. Disable alarm matching on weekday. Signed-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190819182656.29744-1-alexandre.belloni@bootlin.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 13 Aug, 2019 1 commit
-
-
Stephen Boyd authored
We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: linux-rtc@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by:
Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20190730181557.90391-40-swboyd@chromium.orgSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 12 Aug, 2019 1 commit
-
-
Fuqian Huang authored
As spin_unlock_irq will enable interrupts. mxc_rtc_irq_enable is called from interrupt handler mxc_rtc_interrupt. Interrupts are enabled in interrupt handler. Use spin_lock_irqsave/spin_unlock_irqrestore instead of spin_(un)lock_irq in IRQ context to avoid this. Signed-off-by:
Fuqian Huang <huangfq.daxian@gmail.com> Link: https://lore.kernel.org/r/20190807082310.10135-1-huangfq.daxian@gmail.comSigned-off-by:
Alexandre Belloni <alexandre.belloni@bootlin.com>
-