summaryrefslogtreecommitdiff
path: root/drivers/rtc
AgeCommit message (Collapse)AuthorFilesLines
2024-03-22Merge tag 'rtc-6.9' of ↵Linus Torvalds8-254/+150
git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux Pull RTC updates from Alexandre Belloni: "Subsytem: - rtc_class is now const Drivers: - ds1511: cleanup, set date and time range and alarm offset limit - max31335: fix interrupt handler - pcf8523: improve suspend support" * tag 'rtc-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (28 commits) MAINTAINER: Include linux-arm-msm for Qualcomm RTC patches dt-bindings: rtc: zynqmp: Add support for Versal/Versal NET SoCs rtc: class: make rtc_class constant dt-bindings: rtc: abx80x: Improve checks on trickle charger constraints MAINTAINERS: adjust file entry in ARM/Mediatek RTC DRIVER rtc: nct3018y: fix possible NULL dereference rtc: max31335: fix interrupt status reg rtc: mt6397: select IRQ_DOMAIN instead of depending on it dt-bindings: rtc: abx80x: convert to yaml rtc: m41t80: Use the unified property API get the wakeup-source property dt-bindings: at91rm9260-rtt: add sam9x7 compatible dt-bindings: rtc: convert MT7622 RTC to the json-schema dt-bindings: rtc: convert MT2717 RTC to the json-schema rtc: pcf8523: add suspend handlers for alarm IRQ rtc: ds1511: set alarm offset limit rtc: ds1511: set range rtc: ds1511: drop inline/noinline hints rtc: ds1511: rename pdata rtc: ds1511: implement ds1511_rtc_read_alarm properly rtc: ds1511: remove partial alarm support ...
2024-03-08rtc: class: make rtc_class constantRicardo B. Marliere2-9/+14
Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the rtc_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net> Link: https://lore.kernel.org/r/20240305-class_cleanup-abelloni-v1-1-944c026137c8@marliere.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-08rtc: nct3018y: fix possible NULL dereferenceAlexandre Belloni1-3/+3
alarm_enable and alarm_flag are allowed to be NULL but will be dereferenced later by the dev_dbg call. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Closes: https://lore.kernel.org/r/202305180042.DEzW1pSd-lkp@intel.com/ Link: https://lore.kernel.org/r/20240229222127.1878176-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: max31335: fix interrupt status regAntoniu Miclaus1-1/+1
Fix the register value comparison in the `max31335_volatile_reg` function for the interrupt status register. MAX31335_STATUS1 macro definition corresponds to the actual interrupt status register. Fixes: dedaf03b99d6 ("rtc: max31335: add driver support") Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20240219091616.24480-1-antoniu.miclaus@analog.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: mt6397: select IRQ_DOMAIN instead of depending on itRandy Dunlap1-1/+2
IRQ_DOMAIN is a hidden (not user visible) symbol. Users cannot set it directly thru "make *config", so drivers should select it instead of depending on it if they need it. Relying on it being set for a dependency is risky. Consistently using "select" or "depends on" can also help reduce Kconfig circular dependency issues. Therefore, change the use of "depends on" for IRQ_DOMAIN to "select" for RTC_DRV_MT6397. Fixes: 04d3ba70a3c9 ("rtc: mt6397: add IRQ domain dependency") Cc: Arnd Bergmann <arnd@arndb.de> Cc: Eddie Huang <eddie.huang@mediatek.com> Cc: Sean Wang <sean.wang@mediatek.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@lists.infradead.org Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: linux-rtc@vger.kernel.org Cc: Marc Zyngier <maz@kernel.org> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: Peter Rosin <peda@axentia.se> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Link: https://lore.kernel.org/r/20240213050258.6167-1-rdunlap@infradead.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: m41t80: Use the unified property API get the wakeup-source propertyCurtis Klein1-4/+1
This allows both ACPI and Device Tree systems to specify the m41t80 as a wakeup-source. Signed-off-by: Curtis Klein <curtis.klein@hpe.com> Link: https://lore.kernel.org/r/20240222011129.79241-1-curtis.klein@hpe.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: pcf8523: add suspend handlers for alarm IRQAlexandre Belloni1-0/+25
Ensure the RTC is able to wake up the system from suspend. Link: https://lore.kernel.org/r/20240227211833.1820800-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: set alarm offset limitAlexandre Belloni1-0/+1
The ds1511 can only support alarms up to a month in the future (which we currently limit to 28 days). Link: https://lore.kernel.org/r/20240227231356.1840523-2-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: set rangeAlexandre Belloni1-0/+1
The ds1511 leap year calculation fails in 2100. Link: https://lore.kernel.org/r/20240227231356.1840523-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: drop inline/noinline hintsAlexandre Belloni1-3/+3
There is no reason to not let the compiler optimise those functions as it wants. Link: https://lore.kernel.org/r/20240227230431.1837717-12-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: rename pdataAlexandre Belloni1-29/+29
pdata is not actually about patform_data, rename it to something local to the driver. Link: https://lore.kernel.org/r/20240227230431.1837717-11-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: implement ds1511_rtc_read_alarm properlyAlexandre Belloni1-22/+9
ds1511_rtc_read_alarm was useless as it is only called at boot time so the alarm members of pdata have not yet been set. Read the actual registers so there is a chance to get a meaningful value. Then, drop the alarm related members of pdata as they are not used anymore. Link: https://lore.kernel.org/r/20240227230431.1837717-10-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: remove partial alarm supportAlexandre Belloni1-8/+4
The RTC core will always provide an alarm with all its members set, it is not necessary to support partial alarms. Link: https://lore.kernel.org/r/20240227230431.1837717-9-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: let the core know when alarm are not supportedAlexandre Belloni1-15/+9
Instead of failing function calls, let the core know alarms are not supported so it can fail early and avoid unnecessary calls. Link: https://lore.kernel.org/r/20240227230431.1837717-8-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: remove ds1511_rtc_update_alarmAlexandre Belloni1-29/+23
ds1511_rtc_update_alarm is called twice but one of the call is overkill as it only has to enable or disable the alarm instead of updating all the alarm registers. Merge it in its main call site and introduce a new finction to enable or disable the alarm. Link: https://lore.kernel.org/r/20240227230431.1837717-7-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: remove incomplete UIE supportAlexandre Belloni1-13/+5
There is no way to enable UIE in the driver, drop RTC_UF support. Link: https://lore.kernel.org/r/20240227230431.1837717-6-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: fix function definitionAlexandre Belloni1-16/+8
Use proper style for function definition. Link: https://lore.kernel.org/r/20240227230431.1837717-5-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: drop useless enumAlexandre Belloni1-71/+49
Use regular defines for register offsets instead of the enum that doesn't bring any benefit. Link: https://lore.kernel.org/r/20240227230431.1837717-4-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: drop dead codeAlexandre Belloni1-44/+0
The watchdog part of the code is not reachable and should be reimplemented properly as a watchdog driver. Link: https://lore.kernel.org/r/20240227230431.1837717-3-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: drop useless computationAlexandre Belloni1-12/+1
All the callers of ds1511_rtc_set_time will use the same epoch for tm_year which is defined as the number of years minus 1900 since POSIX.1-2001. Link: https://lore.kernel.org/r/20240227230431.1837717-2-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-03-01rtc: ds1511: drop useless checksAlexandre Belloni1-12/+0
The RTC core will always pass a valid rtc_tm, it is unnecessary to check the validity of its members, especially with an open coded version of rtc_valid_tm(). Link: https://lore.kernel.org/r/20240227230431.1837717-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-02-28rtc: test: Fix invalid format specifier.David Gow1-1/+1
'days' is a s64 (from div_s64), and so should use a %lld specifier. This was found by extending KUnit's assertion macros to use gcc's __printf attribute. Fixes: 1d1bb12a8b18 ("rtc: Improve performance of rtc_time64_to_tm(). Add tests.") Signed-off-by: David Gow <davidgow@google.com> Tested-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Justin Stitt <justinstitt@google.com> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-01-18rtc: nuvoton: Compatible with NCT3015Y-R and NCT3018Y-RMia Lin1-6/+46
The NCT3015Y-R and NCT3018Y-R use the same datasheet but have different topologies as follows. - Topology (Only 1st i2c can set TWO bit and HF bit) In NCT3015Y-R, rtc 1st i2c is connected to a host CPU rtc 2nd i2c is connected to a BMC In NCT3018Y-R, rtc 1st i2c is connected to a BMC rtc 2nd i2c is connected to a host CPU In order to be compatible with NCT3015Y-R and NCT3018Y-R, - In probe, If part number is NCT3018Y-R, only set HF bit to 24-Hour format. Else, do nothing - In set_time, If part number is NCT3018Y-R && TWO bit is 0, change TWO bit to 1, and restore TWO bit after updating time. Signed-off-by: Mia Lin <mimi05633@gmail.com> Link: https://lore.kernel.org/r/20231113103807.1036978-2-mimi05633@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-18rtc: da9063: Use dev_err_probe()Biju Das1-25/+17
Replace dev_err()->dev_err_probe() to simpilfy probe(). Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20240105145344.204453-4-biju.das.jz@bp.renesas.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-18rtc: da9063: Use device_get_match_data()Biju Das1-5/+1
Replace of_match_node()->device_get_match_data() for the data associated with device match. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20240105145344.204453-3-biju.das.jz@bp.renesas.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-18rtc: da9063: Make IRQ as optionalBiju Das1-18/+22
On some platforms (eg: RZ/{G2UL,Five} SMARC EVK), there is no IRQ populated by default. Add irq optional support. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20240105145344.204453-2-biju.das.jz@bp.renesas.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-18rtc: max31335: Fix comparison in max31335_volatile_reg()Nathan Chancellor1-1/+1
Clang warns (or errors with CONFIG_WERROR=y): drivers/rtc/rtc-max31335.c:211:36: error: use of logical '||' with constant operand [-Werror,-Wconstant-logical-operand] 211 | if (reg == MAX31335_TEMP_DATA_MSB || MAX31335_TEMP_DATA_LSB) | ^ ~~~~~~~~~~~~~~~~~~~~~~ drivers/rtc/rtc-max31335.c:211:36: note: use '|' for a bitwise operation 211 | if (reg == MAX31335_TEMP_DATA_MSB || MAX31335_TEMP_DATA_LSB) | ^~ | | 1 error generated. This clearly should be a comparison against reg. Fix the comparison so that max31335_volatile_reg() does not always return true. Closes: https://github.com/ClangBuiltLinux/linux/issues/1980 Fixes: dedaf03b99d6 ("rtc: max31335: add driver support") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20240117-rtc-max3133-fix-comparison-v1-1-91e98b29d564@kernel.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-18rtc: max31335: use regmap_update_bits_checkAlexandre Belloni1-7/+5
Simplify the IRQ handler by using regmap_update_bits_check. Reviewed-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Link: https://lore.kernel.org/r/20240115232215.273374-2-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-18rtc: max31335: remove unecessary lockingAlexandre Belloni1-11/+3
There is no race condition when accessing MAX31335_STATUS1 because it is always about clearing the alarm interrupt bit. Reviewed-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Link: https://lore.kernel.org/r/20240115232215.273374-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-16rtc: max31335: add driver supportAntoniu Miclaus3-0/+721
RTC driver for MAX31335 ±2ppm Automotive Real-Time Clock with Integrated MEMS Resonator. Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Link: https://lore.kernel.org/r/20231120120114.48657-2-antoniu.miclaus@analog.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-16rtc: rv8803: add wakeup-source supportAlexandre Belloni1-2/+5
The RV8803 can be wired directly to a PMIC that can wake up an SoC without the CPU getting interrupts. Link: https://lore.kernel.org/r/20240108004357.602918-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-16rtc: ac100: remove misuses of kernel-docRandy Dunlap1-2/+2
Prevent kernel-doc warnings by changing "/**" to common comment format "/*" in non-kernel-doc comments: drivers/rtc/rtc-ac100.c:103: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Clock controls for 3 clock output pins drivers/rtc/rtc-ac100.c:382: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * RTC related bits Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Chen-Yu Tsai <wens@csie.org> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: <linux-rtc@vger.kernel.org> Link: https://lore.kernel.org/r/20240114231320.31437-1-rdunlap@infradead.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-08rtc: class: Remove usage of the deprecated ida_simple_xx() APIChristophe JAILLET1-1/+1
ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove(). This is less verbose. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/4f2c049cb09d46fed336e22445c71988b4f340d6.1702962419.git.christophe.jaillet@wanadoo.fr Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-08rtc: ma35d1: remove hardcoded UIE supportAlexandre Belloni1-20/+0
Let the core handle UIE instead of enabling it forcefully at probe which means the RTC will generate an interrupt every second even when nobody cares. Link: https://lore.kernel.org/r/20231217225831.48581-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-08rtc: rv8803: Add power management supportStefan Eichenberger1-0/+29
Add power management support to the driver. This allows a SoC to wake from suspend using the nINT provided by the RTC. Only register it as a wakeup device if the interrupt is provided and handled. Signed-off-by: Stefan Eichenberger <eichest@gmail.com> Link: https://lore.kernel.org/r/20231122181611.164792-1-eichest@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-08rtc: ds3232: avoid unused-const-variable warningAkinobu Mita1-2/+2
Fix the following warning when CONFIG_I2C is not set but CONFIG_SPI_MASTER is set. warning: 'ds3232_pm_ops' defined but not used [-Wunused-const-variable=] 'ds3232_pm_ops' is only used by rtc-ds3232 i2c driver, so move the device PM callbacks inside #if IS_ENABLED(CONFIG_I2C). Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202311172325.33tTniaJ-lkp@intel.com/ Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Link: https://lore.kernel.org/r/20231118092200.829808-1-akinobu.mita@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-08rtc: lpc24xx: add missing dependencyAntoniu Miclaus1-0/+1
The driver depends on COMMON_CLK. Add the dependency in Kconfig. Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Link: https://lore.kernel.org/r/20231114114532.37840-1-antoniu.miclaus@analog.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-01-08rtc: tps6594: Add driver for TPS6594 RTCEsteban Blanc3-0/+467
TPS6594 PMIC is a MFD. This patch adds support for the RTC found inside TPS6594 family of PMIC. Alarm is also supported. Signed-off-by: Esteban Blanc <eblanc@baylibre.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Tested-by: Thomas Richard <thomas.richard@bootlin.com> Link: https://lore.kernel.org/r/20231107094701.2223486-1-eblanc@baylibre.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-12-18rtc: Add driver for Nuvoton ma35d1 rtc controllerJacky Huang3-0/+336
The ma35d1 rtc controller provides real-time and calendar messaging capabilities. It supports programmable time tick and alarm match interrupts. The time and calendar messages are expressed in BCD format. This driver supports the built-in rtc controller of the ma35d1. It enables setting and reading the rtc time and configuring and reading the rtc alarm. Signed-off-by: Jacky Huang <ychuang3@nuvoton.com> Link: https://lore.kernel.org/r/20230925070251.28-4-ychuang570808@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-12-18rtc: Extend timeout for waiting for UIP to clear to 1sMario Limonciello2-2/+2
Specs don't say anything about UIP being cleared within 10ms. They only say that UIP won't occur for another 244uS. If a long NMI occurs while UIP is still updating it might not be possible to get valid data in 10ms. This has been observed in the wild that around s2idle some calls can take up to 480ms before UIP is clear. Adjust callers from outside an interrupt context to wait for up to a 1s instead of 10ms. Cc: <stable@vger.kernel.org> # 6.1.y Fixes: ec5895c0f2d8 ("rtc: mc146818-lib: extract mc146818_avoid_UIP") Reported-by: Carsten Hatger <xmb8dsv4@gmail.com> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217626 Tested-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Reviewed-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Acked-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20231128053653.101798-5-mario.limonciello@amd.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-12-18rtc: Add support for configuring the UIP timeout for RTC readsMario Limonciello2-11/+32
The UIP timeout is hardcoded to 10ms for all RTC reads, but in some contexts this might not be enough time. Add a timeout parameter to mc146818_get_time() and mc146818_get_time_callback(). If UIP timeout is configured by caller to be >=100 ms and a call takes this long, log a warning. Make all callers use 10ms to ensure no functional changes. Cc: <stable@vger.kernel.org> # 6.1.y Fixes: ec5895c0f2d8 ("rtc: mc146818-lib: extract mc146818_avoid_UIP") Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Tested-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Reviewed-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Acked-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Link: https://lore.kernel.org/r/20231128053653.101798-4-mario.limonciello@amd.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-12-18rtc: Adjust failure return code for cmos_set_alarm()Mario Limonciello1-2/+2
When mc146818_avoid_UIP() fails to return a valid value, this is because UIP didn't clear in the timeout period. Adjust the return code in this case to -ETIMEDOUT. Tested-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Reviewed-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Acked-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Cc: <stable@vger.kernel.org> Fixes: cdedc45c579f ("rtc: cmos: avoid UIP when reading alarm time") Fixes: cd17420ebea5 ("rtc: cmos: avoid UIP when writing alarm time") Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20231128053653.101798-3-mario.limonciello@amd.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-12-18rtc: mc146818-lib: Adjust failure return code for mc146818_get_time()Mario Limonciello1-1/+1
mc146818_get_time() calls mc146818_avoid_UIP() to avoid fetching the time while RTC update is in progress (UIP). When this fails, the return code is -EIO, but actually there was no IO failure. The reason for the return from mc146818_avoid_UIP() is that the UIP wasn't cleared in the time period. Adjust the return code to -ETIMEDOUT to match the behavior. Tested-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Reviewed-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Acked-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Cc: <stable@vger.kernel.org> Fixes: 2a61b0ac5493 ("rtc: mc146818-lib: refactor mc146818_get_time") Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20231128053653.101798-2-mario.limonciello@amd.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-11-17rtc: cmos: Use ACPI alarm for non-Intel x86 systems tooMario Limonciello1-6/+12
Intel systems > 2015 have been configured to use ACPI alarm instead of HPET to avoid s2idle issues. Having HPET programmed for wakeup causes problems on AMD systems with s2idle as well. One particular case is that the systemd "SuspendThenHibernate" feature doesn't work properly on the Framework 13" AMD model. Switching to using ACPI alarm fixes the issue. Adjust the quirk to apply to AMD/Hygon systems from 2021 onwards. This matches what has been tested and is specifically to avoid potential risk to older systems. Cc: <stable@vger.kernel.org> # 6.1+ Reported-by: <alvin.zhuge@gmail.com> Reported-by: <renzhamin@gmail.com> Closes: https://github.com/systemd/systemd/issues/24279 Reported-by: Kelvie Wong <kelvie@kelvie.ca> Closes: https://community.frame.work/t/systemd-suspend-then-hibernate-wakes-up-after-5-minutes/39392 Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20231106162310.85711-1-mario.limonciello@amd.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-11-06Merge tag 'rtc-6.7' of ↵Linus Torvalds15-46/+396
git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux Pull RTC updates from Alexandre Belloni: "There is a new driver for the RTC of the Mstar SSD202D SoC. The rtc7301 driver gains support for byte addresses to support the USRobotics USR8200. Then we have many non user visible changes and typo fixes. Summary: Subsytem: - convert platform drivers to remove_new - prevent modpost warnings for unremovable platform drivers New driver: - Mstar SSD202D Drivers: - brcmstb-waketimer: support level alarm_irq - ep93xx: add DT support - rtc7301: support byte-addressed IO" * tag 'rtc-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (28 commits) dt-bindings: rtc: Add Mstar SSD202D RTC rtc: Add support for the SSD202D RTC rtc: at91rm9200: annotate at91_rtc_remove with __exit again dt-bindings: rtc: microcrystal,rv3032: Document wakeup-source property dt-bindings: rtc: pcf8523: Convert to YAML dt-bindings: rtc: mcp795: move to trivial-rtc rtc: ep93xx: add DT support for Cirrus EP93xx dt-bindings: rtc: Add Cirrus EP93xx dt-bindings: rtc: pcf2123: convert to YAML rtc: efi: fixed typo in efi_procfs() rtc: omap: Use device_get_match_data() rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call rtc: rtc7301: Support byte-addressed IO rtc: rtc7301: Rewrite bindings in schema rtc: sh: Convert to platform remove callback returning void rtc: pxa: Convert to platform remove callback returning void rtc: mv: Convert to platform remove callback returning void rtc: imxdi: Convert to platform remove callback returning void rtc: at91rm9200: Convert to platform remove callback returning void rtc: pcap: Drop no-op remove function ...
2023-10-21nvmem: add explicit config option to read old syntax fixed OF cellsRafał Miłecki1-0/+1
Binding for fixed NVMEM cells defined directly as NVMEM device subnodes has been deprecated. It has been replaced by the "fixed-layout" NVMEM layout binding. New syntax is meant to be clearer and should help avoiding imprecise bindings. NVMEM subsystem already supports the new binding. It should be a good idea to limit support for old syntax to existing drivers that actually support & use it (we can't break backward compatibility!). That way we additionally encourage new bindings & drivers to ignore deprecated binding. It wasn't clear (to me) if rtc and w1 code actually uses old syntax fixed cells. I enabled them to don't risk any breakage. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> [for meson-{efuse,mx-efuse}.c] Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> [for mtk-efuse.c, nvmem/core.c, nvmem-provider.h] Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> [MT8192, MT8195 Chromebooks] Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> [for microchip-otpc.c] Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com> [SAMA7G5-EK] Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20231020105545.216052-3-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-16rtc: Add support for the SSD202D RTCRomain Perier3-0/+261
Newer SigmaStar SSD202D SoCs contain a Real Time Clock, capable of running while the system is sleeping (battery powered), this is not the case with the other RTC on older SoCs. This adds basic support for this RTC block. Signed-off-by: Romain Perier <romain.perier@gmail.com> Co-developed-by: Daniel Palmer <daniel@0x0f.com> Signed-off-by: Daniel Palmer <daniel@0x0f.com> Link: https://lore.kernel.org/r/20230913151606.69494-2-romain.perier@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-16rtc: at91rm9200: annotate at91_rtc_remove with __exit againAlexandre Belloni1-1/+1
Having the driver as a builtin after dropping the __exit annotation results in: >> drivers/rtc/rtc-at91rm9200.c:561:13: warning: 'at91_rtc_remove' defined but not used [-Wunused-function] 561 | static void at91_rtc_remove(struct platform_device *pdev) | ^~~~~~~~~~~~~~~ Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202310160705.vlElNOGb-lkp@intel.com/ Link: https://lore.kernel.org/r/20231016041816.246426-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-16rtc: ep93xx: add DT support for Cirrus EP93xxNikita Shubin1-0/+8
Add OF ID match table. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me> Link: https://lore.kernel.org/r/20230915-ep93xx-v4-14-a1d779dcec10@maquefel.me Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-16rtc: efi: fixed typo in efi_procfs()Maxim Korotkov1-1/+1
After the first check of the value of the "eft" variable it does not change, it is obvious that a copy-paste error was made here and the value of variable "alm" should be checked here. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 501385f2a783 ("rtc: efi: add efi_procfs in efi_rtc_ops") Signed-off-by: Maxim Korotkov <korotkov.maxim.s@gmail.com> Link: https://lore.kernel.org/r/20231006090444.306729-1-korotkov.maxim.s@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>