summaryrefslogtreecommitdiff
path: root/drivers/rtc
AgeCommit message (Collapse)AuthorFilesLines
2025-06-24rtc: pcf2127: add missing semicolon after statementHugo Villeneuve1-1/+1
Replace comma with semicolon at the end of the statement when setting config.max_register. Fixes: fd28ceb4603f ("rtc: pcf2127: add variant-specific configuration structure") Cc: stable@vger.kernel.org Cc: Elena Popa <elena.popa@nxp.com> Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20250529202923.1552560-1-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-24rtc: pcf2127: fix SPI command byte for PCF2131Elena Popa1-0/+5
PCF2131 was not responding to read/write operations using SPI. PCF2131 has a different command byte definition, compared to PCF2127/29. Added the new command byte definition when PCF2131 is detected. Fixes: afc505bf9039 ("rtc: pcf2127: add support for PCF2131 RTC") Cc: stable@vger.kernel.org Signed-off-by: Elena Popa <elena.popa@nxp.com> Acked-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20250530104001.957977-1-elena.popa@nxp.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-24rtc: cmos: use spin_lock_irqsave in cmos_interruptMateusz Jończyk1-4/+6
cmos_interrupt() can be called in a non-interrupt context, such as in an ACPI event handler (which runs in an interrupt thread). Therefore, usage of spin_lock(&rtc_lock) is insecure. Use spin_lock_irqsave() / spin_unlock_irqrestore() instead. Before a misguided commit 6950d046eb6e ("rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ") the cmos_interrupt() function used spin_lock_irqsave(). That commit changed it to spin_lock() and broke locking, which was partially fixed in commit 13be2efc390a ("rtc: cmos: Disable irq around direct invocation of cmos_interrupt()") That second commit did not take account of the ACPI fixed event handler pathway, however. It introduced local_irq_disable() workarounds in cmos_check_wkalrm(), which can cause problems on PREEMPT_RT kernels and are now unnecessary. Add an explicit comment so that this change will not be reverted by mistake. Cc: stable@vger.kernel.org Fixes: 6950d046eb6e ("rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ") Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Tested-by: Chris Bainbridge <chris.bainbridge@gmail.com> Reported-by: Chris Bainbridge <chris.bainbridge@gmail.com> Closes: https://lore.kernel.org/all/aDtJ92foPUYmGheF@debian.local/ Link: https://lore.kernel.org/r/20250607210608.14835-1-mat.jonczyk@o2.pl Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-24rtc: s5m: replace open-coded read/modify/write registers with regmap helpersAndré Draszik1-21/+7
Instead of the open-coded read/modify/write sequence, we can simply use the regmap helpers regmap_set_bits() and regmap_update_bits() respectively. This makes the code easier to read, and avoids extra work in case the underlying bus supports updating bits via struct regmap_bus::reg_update_bits() directly (which is the case for S2MPG10 on gs101 where this driver communicates via ACPM). Signed-off-by: André Draszik <andre.draszik@linaro.org> Link: https://lore.kernel.org/r/20250409-s2mpg10-v4-31-d66d5f39b6bf@linaro.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-24rtc: s5m: replace regmap_update_bits with regmap_clear/set_bitsAndré Draszik1-6/+4
The regmap_clear_bits() and regmap_set_bits() helper macros state the intention a bit more obviously. Use those. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: André Draszik <andre.draszik@linaro.org> Link: https://lore.kernel.org/r/20250409-s2mpg10-v4-30-d66d5f39b6bf@linaro.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-24rtc: s5m: switch to devm_device_init_wakeupAndré Draszik1-1/+5
To release memory allocated by device_init_wakeup(true), drivers have to call device_init_wakeup(false) in error paths and unbind. Switch to the new devres managed version devm_device_init_wakeup() to plug this memleak. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: André Draszik <andre.draszik@linaro.org> Link: https://lore.kernel.org/r/20250409-s2mpg10-v4-29-d66d5f39b6bf@linaro.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-24rtc: s5m: fix a typo: peding -> pendingAndré Draszik1-3/+3
Fix this minor typo, and adjust the a related incorrect alignment to avoid a checkpatch error. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: André Draszik <andre.draszik@linaro.org> Link: https://lore.kernel.org/r/20250409-s2mpg10-v4-28-d66d5f39b6bf@linaro.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-24rtc: s5m: add support for S2MPG10 RTCAndré Draszik1-0/+60
Add support for Samsung's S2MPG10 PMIC RTC, which is similar to the existing PMIC RTCs supported by this driver. S2MPG10 doesn't use I2C, so we expect the core driver to have created a regmap for us. Additionally, it can be used for doing a cold-reset. If requested to do so (via DT), S2MPG10 is programmed with a watchdog configuration that will perform a full power cycle upon watchdog expiry. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: André Draszik <andre.draszik@linaro.org> Link: https://lore.kernel.org/r/20250409-s2mpg10-v4-27-d66d5f39b6bf@linaro.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-24rtc: s5m: prepare for external regmapAndré Draszik1-36/+45
The Samsung S2MPG10 PMIC is not connected via I2C as this driver assumes, hence this driver's current approach of creating an I2C-based regmap doesn't work for it, and this driver should use the regmap provided by the parent (core) driver instead for that PMIC. To prepare this driver for s2mpg support, restructure the code to only create a regmap if one isn't provided by the parent. No functional changes, since the parent doesn't provide a regmap for any of the PMICs currently supported by this driver. Having this change separate will simply make the addition of S2MPG10 support more self-contained, without additional restructuring. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: André Draszik <andre.draszik@linaro.org> Link: https://lore.kernel.org/r/20250409-s2mpg10-v4-26-d66d5f39b6bf@linaro.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-24rtc: s5m: cache device type during probeAndré Draszik1-4/+6
platform_get_device_id() is called mulitple times during probe to retrieve the device type. This makes the code harder to read than necessary. Just get the type once, which also trims the lengths of the lines involved. Signed-off-by: André Draszik <andre.draszik@linaro.org> Link: https://lore.kernel.org/r/20250409-s2mpg10-v4-25-d66d5f39b6bf@linaro.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-08treewide, timers: Rename from_timer() to timer_container_of()Ingo Molnar2-2/+2
Move this API to the canonical timer_*() namespace. [ tglx: Redone against pre rc1 ] Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/aB2X0jCKQO56WdMt@gmail.com
2025-06-02rtc: mt6359: Add mt6357 supportAlexandre Mergnat1-0/+1
The MT6357 PMIC contains the same RTC as MT6358 which allows to add support for it trivially by just complementing the list of compatibles. Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Tested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://lore.kernel.org/r/20250428-rtc-mt6357-v1-1-31f673b0a723@baylibre.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-02rtc: test: Test date conversion for dates starting in 1900Uwe Kleine-König1-5/+5
While the RTC framework intends to only handle dates after 1970 for consumers, time conversion must also work for earlier dates to cover e.g. storing dates beyond an RTC's range_max. This is most relevant for the rtc-mt6397 driver that has range_min = RTC_TIMESTAMP_BEGIN_1900; range_max = mktime64(2027, 12, 31, 23, 59, 59); and so needs working support for timestamps in 1900 starting in less than three years. So shift the tested interval of timestamps to also cover years 1900 to 1970. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> Link: https://lore.kernel.org/r/20250428-enable-rtc-v4-5-2b2f7e3f9349@baylibre.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-02rtc: test: Also test time and wday outcome of rtc_time64_to_tm()Uwe Kleine-König1-5/+13
To cover calculation of the time and wday in the rtc kunit test also check tm_hour, tm_min, tm_sec and tm_wday of the rtc_time calculated by rtc_time64_to_tm(). There are no surprises, the two tests making use of rtc_time64_to_tm_test_date_range() continue to succeed. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> Link: https://lore.kernel.org/r/20250428-enable-rtc-v4-4-2b2f7e3f9349@baylibre.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-02rtc: test: Emit the seconds-since-1970 value instead of days-since-1970Uwe Kleine-König1-4/+1
This is easier to handle because you can just consult date(1) to convert between a seconds-since-1970 value and a date string: $ date --utc -d @3661 Thu Jan 1 01:01:01 AM UTC 1970 $ date -d "Jan 1 12:00:00 AM UTC 1900" +%s -2208988800 The intended side effect is that this prepares the test for dates before 1970. The division of a negative value by 86400 doesn't result in the desired days-since-1970 value as e.g. secs=-82739 should map to days=-1. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> Link: https://lore.kernel.org/r/20250428-enable-rtc-v4-3-2b2f7e3f9349@baylibre.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-02rtc: Fix offset calculation for .start_secs < 0Alexandre Mergnat1-1/+1
The comparison rtc->start_secs > rtc->range_max has a signed left-hand side and an unsigned right-hand side. So the comparison might become true for negative start_secs which is interpreted as a (possibly very large) positive value. As a negative value can never be bigger than an unsigned value the correct representation of the (mathematical) comparison rtc->start_secs > rtc->range_max in C is: rtc->start_secs >= 0 && rtc->start_secs > rtc->range_max Use that to fix the offset calculation currently used in the rtc-mt6397 driver. Fixes: 989515647e783 ("rtc: Add one offset seconds to expand RTC range") Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://lore.kernel.org/r/20250428-enable-rtc-v4-2-2b2f7e3f9349@baylibre.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-02rtc: Make rtc_time64_to_tm() support dates before 1970Alexandre Mergnat1-5/+19
Conversion of dates before 1970 is still relevant today because these dates are reused on some hardwares to store dates bigger than the maximal date that is representable in the device's native format. This prominently and very soon affects the hardware covered by the rtc-mt6397 driver that can only natively store dates in the interval 1900-01-01 up to 2027-12-31. So to store the date 2028-01-01 00:00:00 to such a device, rtc_time64_to_tm() must do the right thing for time=-2208988800. Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://lore.kernel.org/r/20250428-enable-rtc-v4-1-2b2f7e3f9349@baylibre.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-02rtc: pcf8563: fix wrong alarm registerTroy Mitchell1-1/+1
When the regmap framework was introduced to this driver, the PCF8563_REG_AMN register within the set_alarm function was incorrectly changed to PCF8563_REG_SC. The PCF8563_REG_SC register is the seconds register. This caused alarm values to be written to the seconds register when an alarm was set. Which means the alarm would not trigger as expected and the seconds register would be overwritten with an incorrect value. Signed-off-by: Troy Mitchell <troymitchell988@gmail.com> Link: https://lore.kernel.org/r/20250531-pcf8563-fix-alarm-v2-1-cac4b1716167@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-02rtc: rzn1: support input frequencies other than 32768HzWolfram Sang1-12/+46
When using the SCMP mode instead of SUBU, this RTC can also support other input frequencies than 32768Hz. Also, upcoming SoCs will only support SCMP. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20250526095801.35781-8-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-06-02rtc: rzn1: Disable controller before initializationWolfram Sang1-0/+10
Datasheet says that the controller must be disabled before setting up either SUBU or SCMP. This did not matter so far because the driver only supported SUBU which was the default, too. It is good practice to follow datasheet recommendations, though. It will also be needed because SCMP mode will be added in a later patch. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20250526095801.35781-7-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-26rtc: m41t80: reduce verbosityAlexandre Belloni1-9/+9
The driver currently uses dev_err for messages that have a very low probability of being read by the user as the error will probably never happen and the systems with the RTC probably don't have any user able to read the message. Moreover, the only user action after getting this message is the restart the action so drop the level to dev_dbg. Link: https://lore.kernel.org/r/20250525222153.1472917-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-26rtc: m41t80: kickstart ocillator upon failureA. Niyas Ahamed Mydeen1-20/+48
The ocillator on the m41t62 (and other chips of this type) needs a kickstart upon a failure; the RTC read routine will notice the oscillator failure and fail reads. This is added in the RTC write routine; this allows the system to know that the time in the RTC is accurate. This is following the procedure described in section 3.11 of "https://www.st.com/resource/en/datasheet/m41t62.pdf" Signed-off-by: A. Niyas Ahamed Mydeen <nmydeen@mvista.com> Reviewed-by: Corey Minyard <cminyard@mvista.com> Link: https://lore.kernel.org/r/20250402120546.336657-2-nmydeen@mvista.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-26rtc: s32g: add NXP S32G2/S32G3 SoC supportCiprian Marian Costea3-0/+397
Add a RTC driver for NXP S32G2/S32G3 SoCs. RTC tracks clock time during system suspend. It can be a wakeup source for the S32G2/S32G3 SoC based boards. The RTC module from S32G2/S32G3 is not battery-powered and it is not kept alive during system reset. Co-developed-by: Bogdan Hamciuc <bogdan.hamciuc@nxp.com> Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@nxp.com> Co-developed-by: Ghennadi Procopciuc <Ghennadi.Procopciuc@nxp.com> Signed-off-by: Ghennadi Procopciuc <Ghennadi.Procopciuc@nxp.com> Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Tested-by: Enric Balletbo i Serra <eballetbo@kernel.org> Link: https://lore.kernel.org/r/20250403103346.3064895-3-ciprianmarian.costea@oss.nxp.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-25rtc: loongson: Add missing alarm notifications for ACPI RTC eventsLiu Dalin1-0/+8
When an application sets and enables an alarm on Loongson RTC devices, the alarm notification fails to propagate to userspace because the ACPI event handler omits calling rtc_update_irq(). As a result, processes waiting via select() or poll() on RTC device files fail to receive alarm notifications. The ACPI interrupt is also triggered multiple times. In loongson_rtc_handler, we need to clear TOY_MATCH0_REG to resolve this issue. Fixes: 09471d8f5b39 ("rtc: loongson: clear TOY_MATCH0_REG in loongson_rtc_isr()") Fixes: 1b733a9ebc3d ("rtc: Add rtc driver for the Loongson family chips") Signed-off-by: Liu Dalin <liudalin@kylinsec.com.cn> Reviewed-by: Binbin Zhou <zhoubinbin@loongson.cn> Link: https://lore.kernel.org/r/20250509084416.7979-1-liudalin@kylinsec.com.cn Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-25rtc: sophgo: add rtc support for Sophgo CV1800 SoCJingbao Qiu3-0/+231
Implement the RTC driver for CV1800, which able to provide time alarm. Signed-off-by: Jingbao Qiu <qiujingbao.dlmu@gmail.com> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> Link: https://lore.kernel.org/r/20250507195626.502240-1-alexander.sverdlin@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-25rtc: stm32: drop unused module aliasJohan Hovold1-1/+0
The driver only support OF probe so drop the unused platform module alias. Fixes: 4e64350f42e2 ("rtc: add STM32 RTC driver") Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20250423130318.31244-8-johan+linaro@kernel.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-25rtc: s3c: drop unused module aliasJohan Hovold1-1/+0
The driver only support OF probe so drop the unused platform module alias. Fixes: ae05c95074e0 ("rtc: s3c: add s3c_rtc_data structure to use variant data instead of s3c_cpu_type") Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Fixes: 0d297df03890 ("ARM: s3c: simplify platform code") Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20250423130318.31244-7-johan+linaro@kernel.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-25rtc: pm8xxx: drop unused module aliasJohan Hovold1-1/+0
The driver only support OF probe so drop the unused platform module alias. Fixes: 5a418558cdae ("rtc: pm8xxx: add support for devicetree") Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20250423130318.31244-6-johan+linaro@kernel.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-25rtc: jz4740: drop unused module aliasJohan Hovold1-1/+0
The driver only support OF probe so drop the unused platform module alias. Fixes: 24e1f2c9383e ("rtc: ingenic: Only support probing from devicetree") Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Acked-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20250423130318.31244-5-johan+linaro@kernel.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-25rtc: da9063: drop unused module aliasJohan Hovold1-1/+0
The driver only support OF probe so drop the unused platform module alias. Fixes: 80ca3277bc7f ("rtc: da9063: Add DA9062 RTC capability to DA9063 RTC driver") Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20250423130318.31244-4-johan+linaro@kernel.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-25rtc: cpcap: drop unused module aliasJohan Hovold1-1/+0
The driver only supports OF probe so drop the unused platform module alias. Fixes: dd3bf50b35e3 ("rtc: cpcap: new rtc driver") Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com> Link: https://lore.kernel.org/r/20250423130318.31244-3-johan+linaro@kernel.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-25rtc: at91rm9200: drop unused module aliasJohan Hovold1-1/+0
The driver only support OF probe so drop the unused platform module alias. Fixes: 288d9cf1764a ("rtc: at91rm9200: use of_device_get_match_data()") Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20250423130318.31244-2-johan+linaro@kernel.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-25rtc: pm8xxx: fix uefi offset lookupJohan Hovold1-5/+12
On many Qualcomm platforms the PMIC RTC control and time registers are read-only so that the RTC time can not be updated. Instead an offset needs be stored in some machine-specific non-volatile memory, which a driver can take into account. On platforms where the offset is stored in a Qualcomm specific UEFI variable the variables are also accessed in a non-standard way, which means that the OS cannot assume that the variable service is available by the time the driver probes. Use the new 'qcom,uefi-rtc-info' property to determine whether to probe defer until the UEFI offset becomes available so that the offset can be used also when the RTC driver is built in or when a dependency of the UEFI variable driver is built as a module (e.g. the driver for the SCM interconnects). Fixes: bba38b874886 ("rtc: pm8xxx: add support for uefi offset") Reported-by: Rob Clark <robdclark@gmail.com> Link: https://lore.kernel.org/lkml/CAF6AEGsfke=x0p1b2-uNX6DuQfRyEjVbJaxTbVLDT2YvSkGJbg@mail.gmail.com/ Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/20250423075143.11157-3-johan+linaro@kernel.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-25rtc: amlogic: Do not enable by default during compile testingKrzysztof Kozlowski1-1/+1
Enabling the compile test should not cause automatic enabling of all drivers, but only allow to choose to compile them. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20250417074640.81363-1-krzysztof.kozlowski@linaro.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-05-25rtc: interface: silence KMSAN warningAlexandre Belloni1-1/+1
KMSAN complains that alarm->time can be used uninitialized. Pass 0 to trace_rtc_read_alarm in case it has not been set. Link: https://lore.kernel.org/r/20250408144203.3869821-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-04-08rtc: da9063: simplify irq managementWolfram Sang1-24/+6
The code for enabling and disabling the irq is so similar that it can easily be handled by one function. Like in most other RTC drivers. Save the duplicated code and one layer of indirection. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250320102218.10781-2-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-04-08rtc: rzn1: clear interrupts on removeWolfram Sang1-0/+5
It is good practice to clear running interrupts before removing the driver. This is not really a bugfix because on current systems RuntimePM will disable the module clock, so interrupts won't be initiated. The dependency on that behaviour is subtle, though. Better be self-contained and clean up when removing. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250312100105.36767-2-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-04-08rtc: sh: minor fixes to adhere to coding styleWolfram Sang1-19/+19
Use the BIT macro, use curly braces for else-blocks, don't split strings over multiple lines, annotate the lock, update copyright. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250227134256.9167-18-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-04-08rtc: sh: use local variables in probe() for mapping IOWolfram Sang1-11/+8
No need to store the resource for the registers in the per-device struct because we only need it during probe. Remove some unneeded unlikely() while here and correct the type of 'regsize'. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250227134256.9167-17-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-04-08rtc: sh: remove useless wrapper functionWolfram Sang1-6/+2
The wrapper to enable interrupts is so thin that we can use it directly. Also gets rid of an 'inline' which doesn't make sense here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250227134256.9167-16-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-04-08rtc: sh: simplify irq setup after refactoringWolfram Sang1-66/+17
We only need the alarm_irq handler. That means we can remove everything related to periodic_irq and carry_irq. Also, the shared handler can go since we only we need the alarm interrupt in any case. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250227134256.9167-15-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-04-08rtc: sh: remove periodic interrupt handlingWolfram Sang1-69/+0
Because periodic interrupts are emulated by the RTC core, the PIE handling code can simply go away now. And with it the custom proc-file. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250227134256.9167-14-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-04-08rtc: sh: only disable carry interrupts in probe()Wolfram Sang1-22/+4
With old, custom UIE handling removed, we can now disable the carry interrupt in probe() and leave it like this. No further handling is required. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250227134256.9167-13-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-04-08rtc: sh: remove update interrupt handlingWolfram Sang1-47/+1
Since commit e428c6a2772b ("RTC: Clean out UIE icotl implementations"), the flag for UIE cannot be set anymore. Because UIE is now handled via regular alarms and a timerqueue by the RTC core, the UIE handling code can simply go away now. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250227134256.9167-12-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-04-08rtc: sh: assign correct interrupts with DTWolfram Sang1-3/+9
The DT bindings for this driver define the interrupts in the order as they are numbered in the interrupt controller. The old platform_data, however, listed them in a different order. So, for DT based platforms, they are mixed up. Assign them specifically for DT, so we can keep the bindings stable. After the fix, 'rtctest' passes again on the Renesas Genmai board (RZ-A1 / R7S72100). Fixes: dab5aec64bf5 ("rtc: sh: add support for rza series") Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20250227134256.9167-11-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-04-05treewide: Switch/rename to timer_delete[_sync]()Thomas Gleixner2-3/+3
timer_delete[_sync]() replaces del_timer[_sync](). Convert the whole tree over and remove the historical wrapper inlines. Conversion was done with coccinelle plus manual fixups where necessary. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org>
2025-04-04Merge tag 'rtc-6.15' of ↵Linus Torvalds34-766/+637
git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux Pull RTC updates from Alexandre Belloni: "We see a net reduction of the number of lines of code thanks to the removal of a now unused driver and a testing tool that is not used anymore. Apart from this, the max31335 driver gets support for a new part number and pm8xxx gets UEFI support. Core: - setdate is removed as it has better replacements - skip alarms with a second resolution when we know the RTC doesn't support those. Subsystem: - remove unnecessary private struct members - use devm_pm_set_wake_irq were relevant Drivers: - ds1307: stop disabling alarms on probe for DS1337, DS1339, DS1341 and DS3231 - max31335: add max31331 support - pcf50633 is removed as support for the related SoC has been removed - pcf85063: properly handle POR failures" * tag 'rtc-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (50 commits) rtc: remove 'setdate' test program selftest: rtc: skip some tests if the alarm only supports minutes rtc: mt6397: drop unused defines rtc: pcf85063: replace dev_err+return with return dev_err_probe rtc: pcf85063: do a SW reset if POR failed rtc: max31335: Add driver support for max31331 dt-bindings: rtc: max31335: Add max31331 support rtc: cros-ec: Avoid a couple of -Wflex-array-member-not-at-end warnings dt-bindings: rtc: pcf2127: Reference spi-peripheral-props.yaml rtc: rzn1: implement one-second accuracy for alarms rtc: pcf50633: Remove rtc: pm8xxx: implement qcom,no-alarm flag for non-HLOS owned alarm rtc: pm8xxx: mitigate flash wear rtc: pm8xxx: add support for uefi offset dt-bindings: rtc: qcom-pm8xxx: document qcom,no-alarm flag rtc: rv3032: drop WADA rtc: rv3032: fix EERD location rtc: pm8xxx: switch to devm_device_init_wakeup rtc: pm8xxx: fix possible race condition rtc: mpfs: switch to devm_device_init_wakeup ...
2025-04-01rtc: pcf85063: replace dev_err+return with return dev_err_probeMaud Spierings1-4/+2
Replace the dev_err plus return combo with return dev_err_probe() this actually communicates the error type when it occurs and helps debugging hardware issues. Signed-off-by: Maud Spierings <maudspierings@gocontroll.com> Link: https://lore.kernel.org/r/20250304-rtc_dev_err_probe-v1-1-9dcc042ad17e@gocontroll.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-04-01rtc: pcf85063: do a SW reset if POR failedLukas Stockmann1-1/+18
Power-on Reset has a documented issue in PCF85063, refer to its datasheet, section "Software reset": "There is a low probability that some devices will have corruption of the registers after the automatic power-on reset if the device is powered up with a residual VDD level. It is required that the VDD starts at zero volts at power up or upon power cycling to ensure that there is no corruption of the registers. If this is not possible, a reset must be initiated after power-up (i.e. when power is stable) with the software reset command" Trigger SW reset if there is an indication that POR has failed. Link: https://www.nxp.com/docs/en/data-sheet/PCF85063A.pdf Signed-off-by: Lukas Stockmann <lukas.stockmann@siemens.com> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com> Link: https://lore.kernel.org/r/20250120093451.30778-1-alexander.sverdlin@siemens.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-04-01rtc: max31335: Add driver support for max31331PavithraUdayakumar-adi1-43/+122
MAX31331 is an ultra-low-power, I2C Real-Time Clock RTC. Signed-off-by: PavithraUdayakumar-adi <pavithra.u@analog.com> Link: https://lore.kernel.org/r/20250217-add_support_max31331_fix_8-v1-2-16ebcfc02336@analog.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>