* [PATCH v1 0/3] rtc: Use named initializers for platform_device_id arrays
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-28 6:48 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Benson Leung, Guenter Roeck, linux-rtc, chrome-platform,
linux-kernel, Linus Walleij, linux-arm-kernel, Karel Balej,
Matti Vaittinen, Chanwoo Choi, Krzysztof Kozlowski,
André Draszik, linux-samsung-soc
Hello,
this series targets to use named initializers for platform_device_id
arrays. In general these are better readable for humans and more robust
to changes in the respective struct definition.
This robustness is needed as I want to do
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -610,4 +610,7 @@ struct dmi_system_id {
struct platform_device_id {
char name[PLATFORM_NAME_SIZE];
- kernel_ulong_t driver_data;
+ union {
+ kernel_ulong_t driver_data;
+ const void *driver_data_ptr;
+ };
};
which allows dropping several casts and eases porting CHERI to mainline
linux. A possible follow-up change is the following example:
diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 375565a3bddf..31b641bd8962 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -760,8 +760,7 @@ static int max77686_rtc_probe(struct platform_device *pdev)
mutex_init(&info->lock);
info->dev = &pdev->dev;
- info->drv_data = (const struct max77686_rtc_driver_data *)
- id->driver_data;
+ info->drv_data = id->driver_data_ptr;
ret = max77686_init_rtc_regmap(info);
if (ret < 0)
@@ -866,10 +865,10 @@ static SIMPLE_DEV_PM_OPS(max77686_rtc_pm_ops,
max77686_rtc_suspend, max77686_rtc_resume);
static const struct platform_device_id rtc_id[] = {
- { .name = "max77686-rtc", .driver_data = (kernel_ulong_t)&max77686_drv_data },
- { .name = "max77802-rtc", .driver_data = (kernel_ulong_t)&max77802_drv_data },
- { .name = "max77620-rtc", .driver_data = (kernel_ulong_t)&max77620_drv_data },
- { .name = "max77714-rtc", .driver_data = (kernel_ulong_t)&max77714_drv_data },
+ { .name = "max77686-rtc", .driver_data_ptr = &max77686_drv_data },
+ { .name = "max77802-rtc", .driver_data_ptr = &max77802_drv_data },
+ { .name = "max77620-rtc", .driver_data_ptr = &max77620_drv_data },
+ { .name = "max77714-rtc", .driver_data_ptr = &max77714_drv_data },
{ }
};
MODULE_DEVICE_TABLE(platform, rtc_id);
increasing readability due to less casting which also improves type safety.
Best regards
Uwe
Uwe Kleine-König (The Capable Hub) (3):
rtc: Drop unused assignment of platform_device_id driver data
rtc: ab8500: Simplify driver_data handling
rtc: Use named initializers for platform_device_id arrays
drivers/rtc/rtc-88pm886.c | 2 +-
drivers/rtc/rtc-ab8500.c | 5 ++---
drivers/rtc/rtc-bd70528.c | 8 ++++----
drivers/rtc/rtc-cros-ec.c | 4 ++--
drivers/rtc/rtc-max77686.c | 10 +++++-----
drivers/rtc/rtc-max8997.c | 4 ++--
drivers/rtc/rtc-max8998.c | 4 ++--
drivers/rtc/rtc-s5m.c | 12 ++++++------
drivers/rtc/rtc-tps6594.c | 4 ++--
9 files changed, 26 insertions(+), 27 deletions(-)
base-commit: e7d700e14934e68f86338c5610cf2ae76798b663
--
2.47.3
^ permalink raw reply
* [PATCH 4/4] rtc: s35390a: convert to dev_err_probe()
From: Balakrishnan Sambath @ 2026-05-28 3:46 UTC (permalink / raw)
To: Alexandre Belloni, Baolin Wang, Chunyan Zhang, Orson Zhai
Cc: linux-kernel, linux-rtc, Balakrishnan Sambath
In-Reply-To: <20260528-cleanup-dev-err-probe-rtc-v1-0-29dc9cb6c3f0@microchip.com>
Use dev_err_probe() in place of dev_err() and return, which
communicates the error type and helps debugging hardware issues.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/rtc/rtc-s35390a.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index a4678d7c6cf..342fd2b568a 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -479,10 +479,8 @@ static int s35390a_probe(struct i2c_client *client)
return PTR_ERR(rtc);
err_read = s35390a_read_status(s35390a, &status1);
- if (err_read < 0) {
- dev_err(dev, "error resetting chip\n");
- return err_read;
- }
+ if (err_read < 0)
+ return dev_err_probe(dev, err_read, "error resetting chip\n");
if (status1 & S35390A_FLAG_24H)
s35390a->twentyfourhour = 1;
@@ -493,16 +491,12 @@ static int s35390a_probe(struct i2c_client *client)
/* disable alarm (and maybe test mode) */
buf = 0;
err = s35390a_set_reg(s35390a, S35390A_CMD_STATUS2, &buf, 1);
- if (err < 0) {
- dev_err(dev, "error disabling alarm");
- return err;
- }
+ if (err < 0)
+ return dev_err_probe(dev, err, "error disabling alarm");
} else {
err = s35390a_disable_test_mode(s35390a);
- if (err < 0) {
- dev_err(dev, "error disabling test mode\n");
- return err;
- }
+ if (err < 0)
+ return dev_err_probe(dev, err, "error disabling test mode\n");
}
device_set_wakeup_capable(dev, 1);
--
2.34.1
^ permalink raw reply related
* [PATCH 3/4] rtc: sc27xx: convert to dev_err_probe()
From: Balakrishnan Sambath @ 2026-05-28 3:46 UTC (permalink / raw)
To: Alexandre Belloni, Baolin Wang, Chunyan Zhang, Orson Zhai
Cc: linux-kernel, linux-rtc, Balakrishnan Sambath
In-Reply-To: <20260528-cleanup-dev-err-probe-rtc-v1-0-29dc9cb6c3f0@microchip.com>
Use dev_err_probe() in place of dev_err() and return, which
communicates the error type and helps debugging hardware issues.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/rtc/rtc-sc27xx.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c
index 2b83561d4d2..2c6d4565389 100644
--- a/drivers/rtc/rtc-sc27xx.c
+++ b/drivers/rtc/rtc-sc27xx.c
@@ -574,10 +574,8 @@ static int sprd_rtc_probe(struct platform_device *pdev)
return -ENODEV;
ret = of_property_read_u32(node, "reg", &rtc->base);
- if (ret) {
- dev_err(&pdev->dev, "failed to get RTC base address\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "failed to get RTC base address\n");
rtc->irq = platform_get_irq(pdev, 0);
if (rtc->irq < 0)
@@ -592,26 +590,20 @@ static int sprd_rtc_probe(struct platform_device *pdev)
/* check if we need set the alarm interrupt */
ret = sprd_rtc_check_alarm_int(rtc);
- if (ret) {
- dev_err(&pdev->dev, "failed to check RTC alarm interrupt\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "failed to check RTC alarm interrupt\n");
/* check if RTC time values are valid */
ret = sprd_rtc_check_power_down(rtc);
- if (ret) {
- dev_err(&pdev->dev, "failed to check RTC time values\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "failed to check RTC time values\n");
ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL,
sprd_rtc_handler,
IRQF_ONESHOT | IRQF_EARLY_RESUME,
pdev->name, rtc);
- if (ret < 0) {
- dev_err(&pdev->dev, "failed to request RTC irq\n");
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(&pdev->dev, ret, "failed to request RTC irq\n");
device_init_wakeup(&pdev->dev, true);
--
2.34.1
^ permalink raw reply related
* [PATCH 2/4] rtc: moxart: convert to dev_err_probe()
From: Balakrishnan Sambath @ 2026-05-28 3:46 UTC (permalink / raw)
To: Alexandre Belloni, Baolin Wang, Chunyan Zhang, Orson Zhai
Cc: linux-kernel, linux-rtc, Balakrishnan Sambath
In-Reply-To: <20260528-cleanup-dev-err-probe-rtc-v1-0-29dc9cb6c3f0@microchip.com>
Use dev_err_probe() in place of dev_err() and return, which
communicates the error type and helps debugging hardware issues.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/rtc/rtc-moxart.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/rtc/rtc-moxart.c b/drivers/rtc/rtc-moxart.c
index 2247dd39ee4..e1766f03d73 100644
--- a/drivers/rtc/rtc-moxart.c
+++ b/drivers/rtc/rtc-moxart.c
@@ -253,26 +253,20 @@ static int moxart_rtc_probe(struct platform_device *pdev)
moxart_rtc->gpio_data = devm_gpiod_get(&pdev->dev, "rtc-data",
GPIOD_IN);
ret = PTR_ERR_OR_ZERO(moxart_rtc->gpio_data);
- if (ret) {
- dev_err(&pdev->dev, "can't get rtc data gpio: %d\n", ret);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "can't get rtc data gpio\n");
moxart_rtc->gpio_sclk = devm_gpiod_get(&pdev->dev, "rtc-sclk",
GPIOD_ASIS);
ret = PTR_ERR_OR_ZERO(moxart_rtc->gpio_sclk);
- if (ret) {
- dev_err(&pdev->dev, "can't get rtc sclk gpio: %d\n", ret);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "can't get rtc sclk gpio\n");
moxart_rtc->gpio_reset = devm_gpiod_get(&pdev->dev, "rtc-reset",
GPIOD_ASIS);
ret = PTR_ERR_OR_ZERO(moxart_rtc->gpio_reset);
- if (ret) {
- dev_err(&pdev->dev, "can't get rtc reset gpio: %d\n", ret);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "can't get rtc reset gpio\n");
spin_lock_init(&moxart_rtc->rtc_lock);
platform_set_drvdata(pdev, moxart_rtc);
@@ -280,10 +274,9 @@ static int moxart_rtc_probe(struct platform_device *pdev)
moxart_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
&moxart_rtc_ops,
THIS_MODULE);
- if (IS_ERR(moxart_rtc->rtc)) {
- dev_err(&pdev->dev, "devm_rtc_device_register failed\n");
- return PTR_ERR(moxart_rtc->rtc);
- }
+ if (IS_ERR(moxart_rtc->rtc))
+ return dev_err_probe(&pdev->dev, PTR_ERR(moxart_rtc->rtc),
+ "devm_rtc_device_register failed\n");
return 0;
}
--
2.34.1
^ permalink raw reply related
* [PATCH 1/4] rtc: palmas: convert to dev_err_probe()
From: Balakrishnan Sambath @ 2026-05-28 3:46 UTC (permalink / raw)
To: Alexandre Belloni, Baolin Wang, Chunyan Zhang, Orson Zhai
Cc: linux-kernel, linux-rtc, Balakrishnan Sambath
In-Reply-To: <20260528-cleanup-dev-err-probe-rtc-v1-0-29dc9cb6c3f0@microchip.com>
Use dev_err_probe() in place of dev_err() and return, which
communicates the error type and helps debugging hardware issues.
No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/rtc/rtc-palmas.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/drivers/rtc/rtc-palmas.c b/drivers/rtc/rtc-palmas.c
index aecada6bcf8..25fe7a8b73a 100644
--- a/drivers/rtc/rtc-palmas.c
+++ b/drivers/rtc/rtc-palmas.c
@@ -242,10 +242,8 @@ static int palmas_rtc_probe(struct platform_device *pdev)
/* Clear pending interrupts */
ret = palmas_clear_interrupts(&pdev->dev);
- if (ret < 0) {
- dev_err(&pdev->dev, "clear RTC int failed, err = %d\n", ret);
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(&pdev->dev, ret, "clear RTC int failed\n");
palmas_rtc->dev = &pdev->dev;
platform_set_drvdata(pdev, palmas_rtc);
@@ -280,10 +278,8 @@ static int palmas_rtc_probe(struct platform_device *pdev)
ret = palmas_update_bits(palmas, PALMAS_RTC_BASE, PALMAS_RTC_CTRL_REG,
PALMAS_RTC_CTRL_REG_STOP_RTC,
PALMAS_RTC_CTRL_REG_STOP_RTC);
- if (ret < 0) {
- dev_err(&pdev->dev, "RTC_CTRL write failed, err = %d\n", ret);
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(&pdev->dev, ret, "RTC_CTRL write failed\n");
palmas_rtc->irq = platform_get_irq(pdev, 0);
@@ -292,18 +288,15 @@ static int palmas_rtc_probe(struct platform_device *pdev)
&palmas_rtc_ops, THIS_MODULE);
if (IS_ERR(palmas_rtc->rtc)) {
ret = PTR_ERR(palmas_rtc->rtc);
- dev_err(&pdev->dev, "RTC register failed, err = %d\n", ret);
- return ret;
+ return dev_err_probe(&pdev->dev, ret, "RTC register failed\n");
}
ret = devm_request_threaded_irq(&pdev->dev, palmas_rtc->irq, NULL,
palmas_rtc_interrupt,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
dev_name(&pdev->dev), palmas_rtc);
- if (ret < 0) {
- dev_err(&pdev->dev, "IRQ request failed, err = %d\n", ret);
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(&pdev->dev, ret, "IRQ request failed\n");
return 0;
}
--
2.34.1
^ permalink raw reply related
* [PATCH 0/4] rtc: convert several drivers to dev_err_probe()
From: Balakrishnan Sambath @ 2026-05-28 3:46 UTC (permalink / raw)
To: Alexandre Belloni, Baolin Wang, Chunyan Zhang, Orson Zhai
Cc: linux-kernel, linux-rtc, Balakrishnan Sambath
Use dev_err_probe() in place of dev_err() and return across four rtc
drivers, which communicates the error type and helps debugging
hardware issues.
Build-tested with x86_64 allmodconfig. No functional change.
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
Balakrishnan Sambath (4):
rtc: palmas: convert to dev_err_probe()
rtc: moxart: convert to dev_err_probe()
rtc: sc27xx: convert to dev_err_probe()
rtc: s35390a: convert to dev_err_probe()
drivers/rtc/rtc-moxart.c | 25 +++++++++----------------
drivers/rtc/rtc-palmas.c | 21 +++++++--------------
drivers/rtc/rtc-s35390a.c | 18 ++++++------------
drivers/rtc/rtc-sc27xx.c | 24 ++++++++----------------
4 files changed, 30 insertions(+), 58 deletions(-)
---
base-commit: b72386864481cf7fb6153842d22561ac3032302f
change-id: 20260528-cleanup-dev-err-probe-rtc-bc44f6ccbc01
Best regards,
--
Balakrishnan Sambath <balakrishnan.s@microchip.com>
^ permalink raw reply
* [PATCH] rtc: remove unused pcap driver
From: Arnd Bergmann @ 2026-05-27 19:39 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: Arnd Bergmann, Lee Jones, linux-kernel, linux-rtc
From: Arnd Bergmann <arnd@arndb.de>
The platform was removed a few years ago, and the mfd driver
is also gone now, so it is impossible to build or use it.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/rtc/Kconfig | 7 --
drivers/rtc/Makefile | 1 -
drivers/rtc/rtc-pcap.c | 179 -----------------------------------------
3 files changed, 187 deletions(-)
delete mode 100644 drivers/rtc/rtc-pcap.c
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 364afc73f8ab..01def8231873 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1763,13 +1763,6 @@ config RTC_DRV_STMP
This driver can also be built as a module. If so, the module
will be called rtc-stmp3xxx.
-config RTC_DRV_PCAP
- tristate "PCAP RTC"
- depends on EZX_PCAP
- help
- If you say Y here you will get support for the RTC found on
- the PCAP2 ASIC used on some Motorola phones.
-
config RTC_DRV_MC13XXX
depends on MFD_MC13XXX
tristate "Freescale MC13xxx RTC"
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 6cf7e066314e..0347645b021f 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -128,7 +128,6 @@ obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o
obj-$(CONFIG_RTC_DRV_OPAL) += rtc-opal.o
obj-$(CONFIG_RTC_DRV_OPTEE) += rtc-optee.o
obj-$(CONFIG_RTC_DRV_PALMAS) += rtc-palmas.o
-obj-$(CONFIG_RTC_DRV_PCAP) += rtc-pcap.o
obj-$(CONFIG_RTC_DRV_PCF2123) += rtc-pcf2123.o
obj-$(CONFIG_RTC_DRV_PCF2127) += rtc-pcf2127.o
obj-$(CONFIG_RTC_DRV_PCF85063) += rtc-pcf85063.o
diff --git a/drivers/rtc/rtc-pcap.c b/drivers/rtc/rtc-pcap.c
deleted file mode 100644
index d6651611a0c6..000000000000
--- a/drivers/rtc/rtc-pcap.c
+++ /dev/null
@@ -1,179 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * pcap rtc code for Motorola EZX phones
- *
- * Copyright (c) 2008 guiming zhuo <gmzhuo@gmail.com>
- * Copyright (c) 2009 Daniel Ribeiro <drwyrm@gmail.com>
- *
- * Based on Motorola's rtc.c Copyright (c) 2003-2005 Motorola
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/mfd/ezx-pcap.h>
-#include <linux/rtc.h>
-#include <linux/slab.h>
-#include <linux/platform_device.h>
-
-struct pcap_rtc {
- struct pcap_chip *pcap;
- struct rtc_device *rtc;
-};
-
-static irqreturn_t pcap_rtc_irq(int irq, void *_pcap_rtc)
-{
- struct pcap_rtc *pcap_rtc = _pcap_rtc;
- unsigned long rtc_events;
-
- if (irq == pcap_to_irq(pcap_rtc->pcap, PCAP_IRQ_1HZ))
- rtc_events = RTC_IRQF | RTC_UF;
- else if (irq == pcap_to_irq(pcap_rtc->pcap, PCAP_IRQ_TODA))
- rtc_events = RTC_IRQF | RTC_AF;
- else
- rtc_events = 0;
-
- rtc_update_irq(pcap_rtc->rtc, 1, rtc_events);
- return IRQ_HANDLED;
-}
-
-static int pcap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
-{
- struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
- struct rtc_time *tm = &alrm->time;
- unsigned long secs;
- u32 tod; /* time of day, seconds since midnight */
- u32 days; /* days since 1/1/1970 */
-
- ezx_pcap_read(pcap_rtc->pcap, PCAP_REG_RTC_TODA, &tod);
- secs = tod & PCAP_RTC_TOD_MASK;
-
- ezx_pcap_read(pcap_rtc->pcap, PCAP_REG_RTC_DAYA, &days);
- secs += (days & PCAP_RTC_DAY_MASK) * SEC_PER_DAY;
-
- rtc_time64_to_tm(secs, tm);
-
- return 0;
-}
-
-static int pcap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
-{
- struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
- unsigned long secs = rtc_tm_to_time64(&alrm->time);
- u32 tod, days;
-
- tod = secs % SEC_PER_DAY;
- ezx_pcap_write(pcap_rtc->pcap, PCAP_REG_RTC_TODA, tod);
-
- days = secs / SEC_PER_DAY;
- ezx_pcap_write(pcap_rtc->pcap, PCAP_REG_RTC_DAYA, days);
-
- return 0;
-}
-
-static int pcap_rtc_read_time(struct device *dev, struct rtc_time *tm)
-{
- struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
- unsigned long secs;
- u32 tod, days;
-
- ezx_pcap_read(pcap_rtc->pcap, PCAP_REG_RTC_TOD, &tod);
- secs = tod & PCAP_RTC_TOD_MASK;
-
- ezx_pcap_read(pcap_rtc->pcap, PCAP_REG_RTC_DAY, &days);
- secs += (days & PCAP_RTC_DAY_MASK) * SEC_PER_DAY;
-
- rtc_time64_to_tm(secs, tm);
-
- return 0;
-}
-
-static int pcap_rtc_set_time(struct device *dev, struct rtc_time *tm)
-{
- struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
- unsigned long secs = rtc_tm_to_time64(tm);
- u32 tod, days;
-
- tod = secs % SEC_PER_DAY;
- ezx_pcap_write(pcap_rtc->pcap, PCAP_REG_RTC_TOD, tod);
-
- days = secs / SEC_PER_DAY;
- ezx_pcap_write(pcap_rtc->pcap, PCAP_REG_RTC_DAY, days);
-
- return 0;
-}
-
-static int pcap_rtc_irq_enable(struct device *dev, int pirq, unsigned int en)
-{
- struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
-
- if (en)
- enable_irq(pcap_to_irq(pcap_rtc->pcap, pirq));
- else
- disable_irq(pcap_to_irq(pcap_rtc->pcap, pirq));
-
- return 0;
-}
-
-static int pcap_rtc_alarm_irq_enable(struct device *dev, unsigned int en)
-{
- return pcap_rtc_irq_enable(dev, PCAP_IRQ_TODA, en);
-}
-
-static const struct rtc_class_ops pcap_rtc_ops = {
- .read_time = pcap_rtc_read_time,
- .set_time = pcap_rtc_set_time,
- .read_alarm = pcap_rtc_read_alarm,
- .set_alarm = pcap_rtc_set_alarm,
- .alarm_irq_enable = pcap_rtc_alarm_irq_enable,
-};
-
-static int __init pcap_rtc_probe(struct platform_device *pdev)
-{
- struct pcap_rtc *pcap_rtc;
- int timer_irq, alarm_irq;
- int err = -ENOMEM;
-
- pcap_rtc = devm_kzalloc(&pdev->dev, sizeof(struct pcap_rtc),
- GFP_KERNEL);
- if (!pcap_rtc)
- return err;
-
- pcap_rtc->pcap = dev_get_drvdata(pdev->dev.parent);
-
- platform_set_drvdata(pdev, pcap_rtc);
-
- pcap_rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
- if (IS_ERR(pcap_rtc->rtc))
- return PTR_ERR(pcap_rtc->rtc);
-
- pcap_rtc->rtc->ops = &pcap_rtc_ops;
- pcap_rtc->rtc->range_max = (1 << 14) * 86400ULL - 1;
-
- timer_irq = pcap_to_irq(pcap_rtc->pcap, PCAP_IRQ_1HZ);
- alarm_irq = pcap_to_irq(pcap_rtc->pcap, PCAP_IRQ_TODA);
-
- err = devm_request_irq(&pdev->dev, timer_irq, pcap_rtc_irq, 0,
- "RTC Timer", pcap_rtc);
- if (err)
- return err;
-
- err = devm_request_irq(&pdev->dev, alarm_irq, pcap_rtc_irq, 0,
- "RTC Alarm", pcap_rtc);
- if (err)
- return err;
-
- return devm_rtc_register_device(pcap_rtc->rtc);
-}
-
-static struct platform_driver pcap_rtc_driver = {
- .driver = {
- .name = "pcap-rtc",
- },
-};
-
-module_platform_driver_probe(pcap_rtc_driver, pcap_rtc_probe);
-
-MODULE_DESCRIPTION("Motorola pcap rtc driver");
-MODULE_AUTHOR("guiming zhuo <gmzhuo@gmail.com>");
-MODULE_LICENSE("GPL");
--
2.39.5
^ permalink raw reply related
* Re: [PATCH v5 02/11] dt-bindings: hwmon: Add Apple System Management Controller hwmon schema
From: Guenter Roeck @ 2026-05-25 13:33 UTC (permalink / raw)
To: James Calligeros
Cc: Sven Peter, Janne Grunau, Alyssa Rosenzweig, Neal Gompa,
Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Alexandre Belloni, Jean Delvare, Dmitry Torokhov, Jonathan Corbet,
asahi, linux-arm-kernel, devicetree, linux-kernel, linux-rtc,
linux-hwmon, linux-input, linux-doc
In-Reply-To: <20251112-macsmc-subdevs-v5-2-728e4b91fe81@gmail.com>
On Wed, Nov 12, 2025 at 09:16:48PM +1000, James Calligeros wrote:
> Apple Silicon devices integrate a vast array of sensors, monitoring
> current, power, temperature, and voltage across almost every part of
> the system. The sensors themselves are all connected to the System
> Management Controller (SMC). The SMC firmware exposes the data
> reported by these sensors via its standard FourCC-based key-value
> API. The SMC is also responsible for monitoring and controlling any
> fans connected to the system, exposing them in the same way.
>
> For reasons known only to Apple, each device exposes its sensors with
> an almost totally unique set of keys. This is true even for devices
> which share an SoC. An M1 Mac mini, for example, will report its core
> temperatures on different keys to an M1 MacBook Pro. Worse still, the
> SMC does not provide a way to enumerate the available keys at runtime,
> nor do the keys follow any sort of reasonable or consistent naming
> rules that could be used to deduce their purpose. We must therefore
> know which keys are present on any given device, and which function
> they serve, ahead of time.
>
> Add a schema so that we can describe the available sensors for a given
> Apple Silicon device in the Devicetree.
>
> Reviewed-by: Neal Gompa <neal@gompa.dev>
> Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
> Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
> ---
> .../bindings/hwmon/apple,smc-hwmon.yaml | 86 +++++++++++++++++++++++++
> .../bindings/mfd/apple,smc.yaml | 36 +++++++++++
I see that the rest of this series is going to be applied. This patch
touches bindings in mfd, which I can not apply.
With the assumption that the patch will be applied through some other tree,
presumably mfd:
Acked-by: Guenter Roeck <linux@roeck-us.net>
Guenter
> MAINTAINERS | 1 +
> 3 files changed, 123 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/hwmon/apple,smc-hwmon.yaml b/Documentation/devicetree/bindings/hwmon/apple,smc-hwmon.yaml
> new file mode 100644
> index 000000000000..2eec317bc4b3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/apple,smc-hwmon.yaml
> @@ -0,0 +1,86 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/hwmon/apple,smc-hwmon.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Apple SMC Hardware Monitoring
> +
> +description:
> + Apple's System Management Controller (SMC) exposes a vast array of
> + hardware monitoring sensors, including temperature probes, current and
> + voltage sense, power meters, and fan speeds. It also provides endpoints
> + to manually control the speed of each fan individually. Each Apple
> + Silicon device exposes a different set of endpoints via SMC keys. This
> + is true even when two machines share an SoC. The CPU core temperature
> + sensor keys on an M1 Mac mini are different to those on an M1 MacBook
> + Pro, for example.
> +
> +maintainers:
> + - James Calligeros <jcalligeros99@gmail.com>
> +
> +$defs:
> + sensor:
> + type: object
> +
> + properties:
> + apple,key-id:
> + $ref: /schemas/types.yaml#/definitions/string
> + pattern: "^[A-Za-z0-9]{4}$"
> + description: The SMC FourCC key of the desired sensor.
> + Must match the node's suffix.
> +
> + label:
> + description: Human-readable name for the sensor
> +
> + required:
> + - apple,key-id
> +
> +properties:
> + compatible:
> + const: apple,smc-hwmon
> +
> +patternProperties:
> + "^current-[A-Za-z0-9]{4}$":
> + $ref: "#/$defs/sensor"
> + unevaluatedProperties: false
> +
> + "^fan-[A-Za-z0-9]{4}$":
> + $ref: "#/$defs/sensor"
> + unevaluatedProperties: false
> +
> + properties:
> + apple,fan-minimum:
> + $ref: /schemas/types.yaml#/definitions/string
> + pattern: "^[A-Za-z0-9]{4}$"
> + description: SMC key containing the fan's minimum speed
> +
> + apple,fan-maximum:
> + $ref: /schemas/types.yaml#/definitions/string
> + pattern: "^[A-Za-z0-9]{4}$"
> + description: SMC key containing the fan's maximum speed
> +
> + apple,fan-target:
> + $ref: /schemas/types.yaml#/definitions/string
> + pattern: "^[A-Za-z0-9]{4}$"
> + description: Writeable endpoint for setting desired fan speed
> +
> + apple,fan-mode:
> + $ref: /schemas/types.yaml#/definitions/string
> + pattern: "^[A-Za-z0-9]{4}$"
> + description: Writeable key to enable/disable manual fan control
> +
> +
> + "^power-[A-Za-z0-9]{4}$":
> + $ref: "#/$defs/sensor"
> + unevaluatedProperties: false
> +
> + "^temperature-[A-Za-z0-9]{4}$":
> + $ref: "#/$defs/sensor"
> + unevaluatedProperties: false
> +
> + "^voltage-[A-Za-z0-9]{4}$":
> + $ref: "#/$defs/sensor"
> + unevaluatedProperties: false
> +
> +additionalProperties: false
> diff --git a/Documentation/devicetree/bindings/mfd/apple,smc.yaml b/Documentation/devicetree/bindings/mfd/apple,smc.yaml
> index 0410e712c900..34ce048619f5 100644
> --- a/Documentation/devicetree/bindings/mfd/apple,smc.yaml
> +++ b/Documentation/devicetree/bindings/mfd/apple,smc.yaml
> @@ -49,6 +49,9 @@ properties:
> rtc:
> $ref: /schemas/rtc/apple,smc-rtc.yaml
>
> + hwmon:
> + $ref: /schemas/hwmon/apple,smc-hwmon.yaml
> +
> additionalProperties: false
>
> required:
> @@ -89,5 +92,38 @@ examples:
> nvmem-cells = <&rtc_offset>;
> nvmem-cell-names = "rtc_offset";
> };
> +
> + hwmon {
> + compatible = "apple,smc-hwmon";
> +
> + current-ID0R {
> + apple,key-id = "ID0R";
> + label = "AC Input Current";
> + };
> +
> + fan-F0Ac {
> + apple,key-id = "F0Ac";
> + apple,fan-minimum = "F0Mn";
> + apple,fan-maximum = "F0Mx";
> + apple,fan-target = "F0Tg";
> + apple,fan-mode = "F0Md";
> + label = "Fan 1";
> + };
> +
> + power-PSTR {
> + apple,key-id = "PSTR";
> + label = "Total System Power";
> + };
> +
> + temperature-TW0P {
> + apple,key-id = "TW0P";
> + label = "WiFi/BT Module Temperature";
> + };
> +
> + voltage-VD0R {
> + apple,key-id = "VD0R";
> + label = "AC Input Voltage";
> + };
> + };
> };
> };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 51942a9a9b43..6e5e219c5fe6 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2422,6 +2422,7 @@ F: Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml
> F: Documentation/devicetree/bindings/dma/apple,admac.yaml
> F: Documentation/devicetree/bindings/gpio/apple,smc-gpio.yaml
> F: Documentation/devicetree/bindings/gpu/apple,agx.yaml
> +F: Documentation/devicetree/bindings/hwmon/apple,smc-hwmon.yaml
> F: Documentation/devicetree/bindings/i2c/apple,i2c.yaml
> F: Documentation/devicetree/bindings/input/touchscreen/apple,z2-multitouch.yaml
> F: Documentation/devicetree/bindings/interrupt-controller/apple,*
^ permalink raw reply
* [PATCH] rtc: interface: Add rtc time jump debug in rtc_timer_do_work()
From: Jinjie Ruan @ 2026-05-25 13:08 UTC (permalink / raw)
To: alexandre.belloni, linux-rtc, linux-kernel; +Cc: ruanjinjie
In virtualization environments like QEMU [1], or during hardware
clocksource anomalies, an extreme time-warp event can occur. When
the system time abruptly jumps forward, the rtc_timer_do_work() handler
falls into a prolonged processing loop to clear accumulated historical
timers via timerqueue_getnext(). Running this loop indefinitely under
the rtc->ops_lock mutex triggers a kernel softlockup, stalling
the system.
Introduce an adaptive telemetry and loop guard mechanism to enhance debug
visibility and prevent softlockups:
1. Record `start_jiffies` upon entry and leverage `time_after()` to
check if the loop has monopolized the CPU for more than 1s (HZ). If so,
the handler prints a telemetry warning, triggers a WARN stack dump, and
breaks the loop to safely yield the CPU.
2. Track the execution via a `loop_count` metric. Printing this counter
in the warning log provides vital diagnostics to distinguish
an aggressive time-warp storm (high count) from a bogged-down callback
bug (low count).
3. Utilize the kernel format specifier `%ptR` to convert the raw ktime
into a human-readable timestamp (YYYY-MM-DD HH:MM:SS), allowing
developers to instantly pinpoint the exact boundary of the time
jump in dmesg.
This non-destructive telemetry guard provides precise hardware/emulator
diagnostic visibility while ensuring core kernel availability.
[1]: https://lore.kernel.org/all/20260114013257.3500578-1-ruanjinjie@huawei.com/
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/rtc/interface.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 1906f4884a83..f6c5fd16cc4e 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -927,10 +927,12 @@ static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer)
*/
void rtc_timer_do_work(struct work_struct *work)
{
- struct rtc_timer *timer;
+ unsigned long start_jiffies = jiffies;
struct timerqueue_node *next;
- ktime_t now;
+ struct rtc_timer *timer;
struct rtc_time tm;
+ int loop_count = 0;
+ ktime_t now;
int err;
struct rtc_device *rtc =
@@ -945,6 +947,15 @@ void rtc_timer_do_work(struct work_struct *work)
}
now = rtc_tm_to_ktime(tm);
while ((next = timerqueue_getnext(&rtc->timerqueue))) {
+ loop_count++;
+
+ if (unlikely(time_after(jiffies, start_jiffies + HZ))) {
+ dev_warn(&rtc->dev, "RTC time jump (loop: %d) to %ptR.\n",
+ loop_count, &tm);
+ WARN_ON_ONCE(1);
+ break;
+ }
+
if (next->expires > now)
break;
--
2.34.1
^ permalink raw reply related
* [PATCH v5 0/7] mfd: nct6694: Refactor transport layer and add HIF (eSPI) support
From: a0282524688 @ 2026-05-25 8:20 UTC (permalink / raw)
To: tmyu0, linusw, brgl, linux, andi.shyti, lee, mkl, mailhol,
alexandre.belloni, wim
Cc: linux-kernel, linux-gpio, linux-i2c, linux-can, netdev,
linux-watchdog, linux-hwmon, linux-rtc, linux-usb, Ming Yu
From: Ming Yu <a0282524688@gmail.com>
The Nuvoton NCT6694 is a peripheral expander that provides GPIO, I2C,
CAN-FD, Watchdog, HWMON, PWM, and RTC sub-devices. Currently, the
driver only supports USB as the host transport interface.
This series refactors the NCT6694 MFD core to support multiple transport
backends and adds a new Host Interface (HIF) transport driver that
communicates over eSPI using Super-I/O shared memory.
Changes since version 4:
- Split the monolithic refactoring and HIF support patch into a series of
smaller, logical commits to improve reviewability and adhere to the
single logical change principle.
- Decoupled USB-specific data into a dedicated 'nct6694_usb_data'
structure.
- Abstracted device I/O operations by introducing 'read_msg' and
'write_msg' function pointers in the core structure.
- Renamed the existing driver to 'nct6694-usb.c' to strictly identify its
transport boundary, alongside Kconfig/Makefile updates.
- Extracted transport-agnostic device management (IRQ domain setup, IDA
initialization, and MFD cell registration) into a standalone
'nct6694-core.c' module.
- Added the 'nct6694-hif' eSPI transport driver clean on top of the new
core abstraction.
Changes since version 3:
- Remove redundant module type macro definitions from sub-device drivers
that are now provided by the shared header <linux/mfd/nct6694.h>,
fixing -Wmacro-redefined warnings.
Changes since version 2:
- Restore per-device IDA and mfd_add_hotplug_devices()/PLATFORM_DEVID_AUTO
to avoid child device ID conflicts with multiple NCT6694 chips.
- Validate irq_find_mapping() return value before dispatching IRQs.
- Check superio_enter() return value in nct6694_irq_init().
Changes since version 1:
- Reworked the Super-I/O access helpers.
Ming Yu (7):
mfd: nct6694: Move module type macros to shared header
mfd: nct6694: Refactor USB-specific data into nct6694_usb_data
mfd: nct6694: Introduce transport abstraction with function pointers
mfd: nct6694: Rename static I/O functions with _usb_ prefix
mfd: nct6694: Rename driver to nct6694-usb and update Kconfig
mfd: nct6694: Extract core device management into a separate module
mfd: nct6694: Add Host Interface (HIF) eSPI transport driver
MAINTAINERS | 2 +-
drivers/gpio/gpio-nct6694.c | 7 -
drivers/hwmon/nct6694-hwmon.c | 21 -
drivers/i2c/busses/i2c-nct6694.c | 7 -
drivers/mfd/Kconfig | 38 +-
drivers/mfd/Makefile | 4 +-
drivers/mfd/nct6694-core.c | 136 ++++++
drivers/mfd/nct6694-hif.c | 529 +++++++++++++++++++++++
drivers/mfd/{nct6694.c => nct6694-usb.c} | 185 +++-----
drivers/net/can/usb/nct6694_canfd.c | 6 -
drivers/rtc/rtc-nct6694.c | 7 -
drivers/watchdog/nct6694_wdt.c | 7 -
include/linux/mfd/nct6694.h | 63 ++-
13 files changed, 821 insertions(+), 191 deletions(-)
create mode 100644 drivers/mfd/nct6694-core.c
create mode 100644 drivers/mfd/nct6694-hif.c
rename drivers/mfd/{nct6694.c => nct6694-usb.c} (62%)
--
2.34.1
^ permalink raw reply
* [PATCH v5 1/7] mfd: nct6694: Move module type macros to shared header
From: a0282524688 @ 2026-05-25 8:17 UTC (permalink / raw)
To: Ming Yu, Linus Walleij, Bartosz Golaszewski, Guenter Roeck,
Andi Shyti, Marc Kleine-Budde, Vincent Mailhol, Alexandre Belloni,
Wim Van Sebroeck, Lee Jones
Cc: Ming Yu, linux-gpio, linux-kernel, linux-hwmon, linux-i2c,
linux-can, linux-rtc, linux-watchdog
In-Reply-To: <20260525081736.2904310-1-a0282524688@gmail.com>
From: Ming Yu <a0282524688@gmail.com>
Move NCT6694_XXX_MOD macro definitions from individual sub-device
drivers into the shared header include/linux/mfd/nct6694.h.
This is a prerequisite for supporting multiple transport interfaces
(USB, HIF) without duplicating these definitions.
No functional change.
Signed-off-by: Ming Yu <a0282524688@gmail.com>
---
Changes in v5:
- Split from the monolithic v4 patch to follow the single logical change principle.
drivers/gpio/gpio-nct6694.c | 7 -------
drivers/hwmon/nct6694-hwmon.c | 21 ---------------------
drivers/i2c/busses/i2c-nct6694.c | 7 -------
drivers/net/can/usb/nct6694_canfd.c | 6 ------
drivers/rtc/rtc-nct6694.c | 7 -------
drivers/watchdog/nct6694_wdt.c | 7 -------
include/linux/mfd/nct6694.h | 9 +++++++++
7 files changed, 9 insertions(+), 55 deletions(-)
diff --git a/drivers/gpio/gpio-nct6694.c b/drivers/gpio/gpio-nct6694.c
index a8607f0d9915..53bfc5983648 100644
--- a/drivers/gpio/gpio-nct6694.c
+++ b/drivers/gpio/gpio-nct6694.c
@@ -13,13 +13,6 @@
#include <linux/module.h>
#include <linux/platform_device.h>
-/*
- * USB command module type for NCT6694 GPIO controller.
- * This defines the module type used for communication with the NCT6694
- * GPIO controller over the USB interface.
- */
-#define NCT6694_GPIO_MOD 0xFF
-
#define NCT6694_GPIO_VER 0x90
#define NCT6694_GPIO_VALID 0x110
#define NCT6694_GPI_DATA 0x120
diff --git a/drivers/hwmon/nct6694-hwmon.c b/drivers/hwmon/nct6694-hwmon.c
index 6dcf22ca5018..581451875f2c 100644
--- a/drivers/hwmon/nct6694-hwmon.c
+++ b/drivers/hwmon/nct6694-hwmon.c
@@ -15,13 +15,6 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
-/*
- * USB command module type for NCT6694 report channel
- * This defines the module type used for communication with the NCT6694
- * report channel over the USB interface.
- */
-#define NCT6694_RPT_MOD 0xFF
-
/* Report channel */
/*
* The report channel is used to report the status of the hardware monitor
@@ -38,13 +31,6 @@
#define NCT6694_TIN_STS(x) (0x6A + (x))
#define NCT6694_FIN_STS(x) (0x6E + (x))
-/*
- * USB command module type for NCT6694 HWMON controller.
- * This defines the module type used for communication with the NCT6694
- * HWMON controller over the USB interface.
- */
-#define NCT6694_HWMON_MOD 0x00
-
/* Command 00h - Hardware Monitor Control */
#define NCT6694_HWMON_CONTROL 0x00
#define NCT6694_HWMON_CONTROL_SEL 0x00
@@ -53,13 +39,6 @@
#define NCT6694_HWMON_ALARM 0x02
#define NCT6694_HWMON_ALARM_SEL 0x00
-/*
- * USB command module type for NCT6694 PWM controller.
- * This defines the module type used for communication with the NCT6694
- * PWM controller over the USB interface.
- */
-#define NCT6694_PWM_MOD 0x01
-
/* PWM Command - Manual Control */
#define NCT6694_PWM_CONTROL 0x01
#define NCT6694_PWM_CONTROL_SEL 0x00
diff --git a/drivers/i2c/busses/i2c-nct6694.c b/drivers/i2c/busses/i2c-nct6694.c
index 1413ab6f9462..ef3329f34246 100644
--- a/drivers/i2c/busses/i2c-nct6694.c
+++ b/drivers/i2c/busses/i2c-nct6694.c
@@ -12,13 +12,6 @@
#include <linux/module.h>
#include <linux/platform_device.h>
-/*
- * USB command module type for NCT6694 I2C controller.
- * This defines the module type used for communication with the NCT6694
- * I2C controller over the USB interface.
- */
-#define NCT6694_I2C_MOD 0x03
-
/* Command 00h - I2C Deliver */
#define NCT6694_I2C_DELIVER 0x00
#define NCT6694_I2C_DELIVER_SEL 0x00
diff --git a/drivers/net/can/usb/nct6694_canfd.c b/drivers/net/can/usb/nct6694_canfd.c
index e5f7f8849a73..262b4c26c9d4 100644
--- a/drivers/net/can/usb/nct6694_canfd.c
+++ b/drivers/net/can/usb/nct6694_canfd.c
@@ -18,12 +18,6 @@
#define DEVICE_NAME "nct6694-canfd"
-/* USB command module type for NCT6694 CANfd controller.
- * This defines the module type used for communication with the NCT6694
- * CANfd controller over the USB interface.
- */
-#define NCT6694_CANFD_MOD 0x05
-
/* Command 00h - CAN Setting and Initialization */
#define NCT6694_CANFD_SETTING 0x00
#define NCT6694_CANFD_SETTING_ACTIVE_CTRL1 BIT(0)
diff --git a/drivers/rtc/rtc-nct6694.c b/drivers/rtc/rtc-nct6694.c
index 35401a0d9cf5..c06902f150c9 100644
--- a/drivers/rtc/rtc-nct6694.c
+++ b/drivers/rtc/rtc-nct6694.c
@@ -14,13 +14,6 @@
#include <linux/rtc.h>
#include <linux/slab.h>
-/*
- * USB command module type for NCT6694 RTC controller.
- * This defines the module type used for communication with the NCT6694
- * RTC controller over the USB interface.
- */
-#define NCT6694_RTC_MOD 0x08
-
/* Command 00h - RTC Time */
#define NCT6694_RTC_TIME 0x0000
#define NCT6694_RTC_TIME_SEL 0x00
diff --git a/drivers/watchdog/nct6694_wdt.c b/drivers/watchdog/nct6694_wdt.c
index bc3689bd4b6b..4c06ac105562 100644
--- a/drivers/watchdog/nct6694_wdt.c
+++ b/drivers/watchdog/nct6694_wdt.c
@@ -20,13 +20,6 @@
#define NCT6694_WDT_MAX_DEVS 2
-/*
- * USB command module type for NCT6694 WDT controller.
- * This defines the module type used for communication with the NCT6694
- * WDT controller over the USB interface.
- */
-#define NCT6694_WDT_MOD 0x07
-
/* Command 00h - WDT Setup */
#define NCT6694_WDT_SETUP 0x00
#define NCT6694_WDT_SETUP_SEL(idx) (idx ? 0x01 : 0x00)
diff --git a/include/linux/mfd/nct6694.h b/include/linux/mfd/nct6694.h
index 6eb9be2cd4a0..3c683e317aa3 100644
--- a/include/linux/mfd/nct6694.h
+++ b/include/linux/mfd/nct6694.h
@@ -8,6 +8,15 @@
#ifndef __MFD_NCT6694_H
#define __MFD_NCT6694_H
+#define NCT6694_HWMON_MOD 0x00
+#define NCT6694_PWM_MOD 0x01
+#define NCT6694_I2C_MOD 0x03
+#define NCT6694_CANFD_MOD 0x05
+#define NCT6694_WDT_MOD 0x07
+#define NCT6694_RTC_MOD 0x08
+#define NCT6694_RPT_MOD 0xFF
+#define NCT6694_GPIO_MOD NCT6694_RPT_MOD
+
#define NCT6694_VENDOR_ID 0x0416
#define NCT6694_PRODUCT_ID 0x200B
#define NCT6694_INT_IN_EP 0x81
--
2.34.1
^ permalink raw reply related
* [PATCH v4] dt-bindings: clock: via,vt8500: Convert to DT Schema
From: Udaya Kiran Challa @ 2026-05-24 15:10 UTC (permalink / raw)
To: mturquette, sboyd, robh, krzk+dt, conor+dt
Cc: skhan, me, linux-rtc, devicetree, linux-kernel,
Udaya Kiran Challa
Convert the VIA/Wondermedia VT8500 and Wondermedia WM8xxx series SoCs clock
controller binding from the legacy text format to DT schema.
Signed-off-by: Udaya Kiran Challa <challauday369@gmail.com>
---
Changelog:
Changes since v3
- Add schema select matching for via,vt8500-pmc
- Allow hyphen in node names under patternProperties
- Add dependentRequired validation for enable-reg/enable-bit
- Fix example validation against PMC schema
Link to v3:https://lore.kernel.org/all/20260524111813.39810-1-challauday369@gmail.com/
Changes since v2:
- Drop redundant description for clocks
- Disable reg property for device clocks
- Fix schema hierarchy to match actual DTS structure
Link to v2:https://lore.kernel.org/all/20260521170810.19702-1-challauday369@gmail.com/
Changes since v1:
- Add default value for divisor-mask
- Add required properties compatible and model
- Fix example node name
- Update example size cells and reg value
Link to v1:https://lore.kernel.org/all/20260520025131.17772-1-challauday369@gmail.com/
---
.../bindings/clock/via,vt8500-clock.yaml | 209 ++++++++++++++++++
.../devicetree/bindings/clock/vt8500.txt | 74 -------
2 files changed, 209 insertions(+), 74 deletions(-)
create mode 100644 Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
delete mode 100644 Documentation/devicetree/bindings/clock/vt8500.txt
diff --git a/Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml b/Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
new file mode 100644
index 000000000000..51a68df6c2f3
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
@@ -0,0 +1,209 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/via,vt8500-clock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: VIA/Wondermedia VT8500 Clock Controller
+
+maintainers:
+ - Michael Turquette <mturquette@baylibre.com>
+ - Stephen Boyd <sboyd@kernel.org>
+
+description:
+ Clock controller bindings for VIA/Wondermedia VT8500 and Wondermedia WM8xxx
+ series SoCs.
+
+select:
+ properties:
+ compatible:
+ const: via,vt8500-pmc
+
+ required:
+ - compatible
+
+properties:
+ compatible:
+ const: via,vt8500-pmc
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ type: object
+ additionalProperties: true
+
+ properties:
+ "#address-cells":
+ const: 1
+
+ "#size-cells":
+ const: 0
+
+ required:
+ - "#address-cells"
+ - "#size-cells"
+
+ patternProperties:
+ "^[a-z0-9-]+(@[0-9a-f]+)?$":
+ type: object
+
+ properties:
+ compatible:
+ enum:
+ - via,vt8500-pll-clock
+ - wm,wm8650-pll-clock
+ - wm,wm8750-pll-clock
+ - wm,wm8850-pll-clock
+ - via,vt8500-device-clock
+
+ reg:
+ maxItems: 1
+ description:
+ Offset of the PLL register within the PMC register space.
+
+ clocks:
+ maxItems: 1
+
+ "#clock-cells":
+ const: 0
+
+ enable-reg:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ Offset of the clock enable register within the PMC
+ register space.
+
+ enable-bit:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ maximum: 31
+ description:
+ Bit index controlling clock enable.
+
+ divisor-reg:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ Offset of the clock divisor register within the PMC
+ register space.
+
+ divisor-mask:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ default: 0x1f
+ description:
+ Bitmask describing the divisor field inside divisor-reg.
+
+ dependentRequired:
+ enable-reg:
+ - enable-bit
+
+ enable-bit:
+ - enable-reg
+
+ required:
+ - compatible
+ - "#clock-cells"
+
+ allOf:
+ - if:
+ properties:
+ compatible:
+ enum:
+ - via,vt8500-pll-clock
+ - wm,wm8650-pll-clock
+ - wm,wm8750-pll-clock
+ - wm,wm8850-pll-clock
+ then:
+ required:
+ - reg
+ - clocks
+
+ - if:
+ properties:
+ compatible:
+ const: via,vt8500-device-clock
+ then:
+ properties:
+ reg: false
+
+ required:
+ - clocks
+
+ anyOf:
+ - required:
+ - enable-reg
+ - enable-bit
+
+ - required:
+ - divisor-reg
+
+ additionalProperties: false
+
+required:
+ - compatible
+ - reg
+ - clocks
+
+additionalProperties: false
+
+examples:
+ - |
+ pmc@d8130000 {
+ compatible = "via,vt8500-pmc";
+ reg = <0xd8130000 0x1000>;
+
+ clocks {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ref24: ref24M {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <24000000>;
+ };
+
+ ref25: ref25M {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <25000000>;
+ };
+
+ plla: clock@200 {
+ compatible = "wm,wm8650-pll-clock";
+ #clock-cells = <0>;
+ clocks = <&ref25>;
+ reg = <0x200>;
+ };
+
+ pllb: clock@204 {
+ compatible = "wm,wm8650-pll-clock";
+ #clock-cells = <0>;
+ clocks = <&ref25>;
+ reg = <0x204>;
+ };
+
+ clkarm: arm {
+ compatible = "via,vt8500-device-clock";
+ #clock-cells = <0>;
+ clocks = <&plla>;
+ divisor-reg = <0x300>;
+ };
+
+ clkuart0: uart0 {
+ compatible = "via,vt8500-device-clock";
+ #clock-cells = <0>;
+ clocks = <&ref24>;
+ enable-reg = <0x250>;
+ enable-bit = <1>;
+ };
+
+ clksdhc: sdhc {
+ compatible = "via,vt8500-device-clock";
+ #clock-cells = <0>;
+ clocks = <&pllb>;
+ divisor-reg = <0x328>;
+ divisor-mask = <0x3f>;
+ enable-reg = <0x254>;
+ enable-bit = <18>;
+ };
+ };
+ };
diff --git a/Documentation/devicetree/bindings/clock/vt8500.txt b/Documentation/devicetree/bindings/clock/vt8500.txt
deleted file mode 100644
index 91d71cc0314a..000000000000
--- a/Documentation/devicetree/bindings/clock/vt8500.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-Device Tree Clock bindings for arch-vt8500
-
-This binding uses the common clock binding[1].
-
-[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
-
-Required properties:
-- compatible : shall be one of the following:
- "via,vt8500-pll-clock" - for a VT8500/WM8505 PLL clock
- "wm,wm8650-pll-clock" - for a WM8650 PLL clock
- "wm,wm8750-pll-clock" - for a WM8750 PLL clock
- "wm,wm8850-pll-clock" - for a WM8850 PLL clock
- "via,vt8500-device-clock" - for a VT/WM device clock
-
-Required properties for PLL clocks:
-- reg : shall be the control register offset from PMC base for the pll clock.
-- clocks : shall be the input parent clock phandle for the clock. This should
- be the reference clock.
-- #clock-cells : from common clock binding; shall be set to 0.
-
-Required properties for device clocks:
-- clocks : shall be the input parent clock phandle for the clock. This should
- be a pll output.
-- #clock-cells : from common clock binding; shall be set to 0.
-
-
-Device Clocks
-
-Device clocks are required to have one or both of the following sets of
-properties:
-
-
-Gated device clocks:
-
-Required properties:
-- enable-reg : shall be the register offset from PMC base for the enable
- register.
-- enable-bit : shall be the bit within enable-reg to enable/disable the clock.
-
-
-Divisor device clocks:
-
-Required property:
-- divisor-reg : shall be the register offset from PMC base for the divisor
- register.
-Optional property:
-- divisor-mask : shall be the mask for the divisor register. Defaults to 0x1f
- if not specified.
-
-
-For example:
-
-ref25: ref25M {
- #clock-cells = <0>;
- compatible = "fixed-clock";
- clock-frequency = <25000000>;
-};
-
-plla: plla {
- #clock-cells = <0>;
- compatible = "wm,wm8650-pll-clock";
- clocks = <&ref25>;
- reg = <0x200>;
-};
-
-sdhc: sdhc {
- #clock-cells = <0>;
- compatible = "via,vt8500-device-clock";
- clocks = <&pllb>;
- divisor-reg = <0x328>;
- divisor-mask = <0x3f>;
- enable-reg = <0x254>;
- enable-bit = <18>;
-};
--
2.43.0
^ permalink raw reply related
* Re: [PATCH v3] dt-bindings: clock: via,vt8500: Convert to DT Schema
From: Rob Herring (Arm) @ 2026-05-24 12:55 UTC (permalink / raw)
To: Udaya Kiran Challa
Cc: mturquette, conor+dt, krzk+dt, linux-kernel, skhan, devicetree,
sboyd, linux-rtc, me
In-Reply-To: <20260524111813.39810-1-challauday369@gmail.com>
On Sun, 24 May 2026 16:47:57 +0530, Udaya Kiran Challa wrote:
> Convert the VIA/Wondermedia VT8500 and Wondermedia WM8xxx series SoCs clock
> controller binding from the legacy text format to DT schema.
>
> Signed-off-by: Udaya Kiran Challa <challauday369@gmail.com>
> ---
> Changelog:
> Changes since v2:
> - Drop redundant description for clocks
> - Disable reg property for device clocks
> - Fix schema hierarchy to match actual DTS structure
>
> Link to v2:https://lore.kernel.org/all/20260521170810.19702-1-challauday369@gmail.com/
>
> Changes since v1:
> - Add default value for divisor-mask
> - Add required properties compatible and model
> - Fix example node name
> - Update example size cells and reg value
>
> Link to v1:https://lore.kernel.org/all/20260520025131.17772-1-challauday369@gmail.com/
> ---
> .../bindings/clock/via,vt8500-clock.yaml | 179 ++++++++++++++++++
> .../devicetree/bindings/clock/vt8500.txt | 74 --------
> 2 files changed, 179 insertions(+), 74 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
> delete mode 100644 Documentation/devicetree/bindings/clock/vt8500.txt
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/clock/via,vt8500-clock.example.dtb: /example-0/pmc@d8130000: failed to match any schema with compatible: ['via,vt8500-pmc']
doc reference errors (make refcheckdocs):
See https://patchwork.kernel.org/project/devicetree/patch/20260524111813.39810-1-challauday369@gmail.com
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply
* [PATCH v3] dt-bindings: clock: via,vt8500: Convert to DT Schema
From: Udaya Kiran Challa @ 2026-05-24 11:17 UTC (permalink / raw)
To: mturquette, sboyd, robh, krzk+dt, conor+dt
Cc: skhan, me, linux-rtc, devicetree, linux-kernel,
Udaya Kiran Challa
Convert the VIA/Wondermedia VT8500 and Wondermedia WM8xxx series SoCs clock
controller binding from the legacy text format to DT schema.
Signed-off-by: Udaya Kiran Challa <challauday369@gmail.com>
---
Changelog:
Changes since v2:
- Drop redundant description for clocks
- Disable reg property for device clocks
- Fix schema hierarchy to match actual DTS structure
Link to v2:https://lore.kernel.org/all/20260521170810.19702-1-challauday369@gmail.com/
Changes since v1:
- Add default value for divisor-mask
- Add required properties compatible and model
- Fix example node name
- Update example size cells and reg value
Link to v1:https://lore.kernel.org/all/20260520025131.17772-1-challauday369@gmail.com/
---
.../bindings/clock/via,vt8500-clock.yaml | 179 ++++++++++++++++++
.../devicetree/bindings/clock/vt8500.txt | 74 --------
2 files changed, 179 insertions(+), 74 deletions(-)
create mode 100644 Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
delete mode 100644 Documentation/devicetree/bindings/clock/vt8500.txt
diff --git a/Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml b/Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
new file mode 100644
index 000000000000..035925969655
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
@@ -0,0 +1,179 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/via,vt8500-clock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: VIA/Wondermedia VT8500 Clock Controller
+
+maintainers:
+ - Michael Turquette <mturquette@baylibre.com>
+ - Stephen Boyd <sboyd@kernel.org>
+
+description:
+ Clock controller bindings for VIA/Wondermedia VT8500 and Wondermedia WM8xxx
+ series SoCs.
+
+properties:
+ clocks:
+ type: object
+ additionalProperties: true
+
+ properties:
+ "#address-cells":
+ const: 1
+
+ "#size-cells":
+ const: 0
+
+ required:
+ - "#address-cells"
+ - "#size-cells"
+
+ patternProperties:
+ "^[a-z0-9]+(@[0-9a-f]+)?$":
+ type: object
+
+ properties:
+ compatible:
+ enum:
+ - via,vt8500-pll-clock
+ - wm,wm8650-pll-clock
+ - wm,wm8750-pll-clock
+ - wm,wm8850-pll-clock
+ - via,vt8500-device-clock
+
+ reg:
+ maxItems: 1
+ description:
+ Offset of the PLL register within the PMC register space.
+
+ clocks:
+ maxItems: 1
+
+ "#clock-cells":
+ const: 0
+
+ enable-reg:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ Offset of the clock enable register within the PMC
+ register space.
+
+ enable-bit:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ maximum: 31
+ description:
+ Bit index controlling clock enable.
+
+ divisor-reg:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ Offset of the clock divisor register within the PMC
+ register space.
+
+ divisor-mask:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ default: 0x1f
+ description:
+ Bitmask describing the divisor field inside divisor-reg.
+
+ required:
+ - compatible
+ - "#clock-cells"
+
+ allOf:
+ - if:
+ properties:
+ compatible:
+ enum:
+ - via,vt8500-pll-clock
+ - wm,wm8650-pll-clock
+ - wm,wm8750-pll-clock
+ - wm,wm8850-pll-clock
+ then:
+ required:
+ - reg
+ - clocks
+
+ - if:
+ properties:
+ compatible:
+ const: via,vt8500-device-clock
+ then:
+ properties:
+ reg: false
+
+ required:
+ - clocks
+
+ anyOf:
+ - required:
+ - enable-reg
+ - enable-bit
+
+ - required:
+ - divisor-reg
+
+ additionalProperties: false
+
+required:
+ - clocks
+
+additionalProperties: false
+
+examples:
+ - |
+ pmc@d8130000 {
+ compatible = "via,vt8500-pmc";
+ reg = <0xd8130000 0x1000>;
+
+ clocks {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ref24: clock-24000000 {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <24000000>;
+ };
+
+ ref25: clock-25000000 {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <25000000>;
+ };
+
+ plla: clock@200 {
+ compatible = "wm,wm8650-pll-clock";
+ #clock-cells = <0>;
+ clocks = <&ref25>;
+ reg = <0x200>;
+ };
+
+ clkarm: arm {
+ compatible = "via,vt8500-device-clock";
+ #clock-cells = <0>;
+ clocks = <&plla>;
+ divisor-reg = <0x300>;
+ };
+
+ clkuart0: uart0 {
+ compatible = "via,vt8500-device-clock";
+ #clock-cells = <0>;
+ clocks = <&ref24>;
+ enable-reg = <0x250>;
+ enable-bit = <1>;
+ };
+
+ clksdhc: sdhc {
+ compatible = "via,vt8500-device-clock";
+ #clock-cells = <0>;
+ clocks = <&plla>;
+ divisor-reg = <0x328>;
+ divisor-mask = <0x3f>;
+ enable-reg = <0x254>;
+ enable-bit = <18>;
+ };
+ };
+ };
diff --git a/Documentation/devicetree/bindings/clock/vt8500.txt b/Documentation/devicetree/bindings/clock/vt8500.txt
deleted file mode 100644
index 91d71cc0314a..000000000000
--- a/Documentation/devicetree/bindings/clock/vt8500.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-Device Tree Clock bindings for arch-vt8500
-
-This binding uses the common clock binding[1].
-
-[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
-
-Required properties:
-- compatible : shall be one of the following:
- "via,vt8500-pll-clock" - for a VT8500/WM8505 PLL clock
- "wm,wm8650-pll-clock" - for a WM8650 PLL clock
- "wm,wm8750-pll-clock" - for a WM8750 PLL clock
- "wm,wm8850-pll-clock" - for a WM8850 PLL clock
- "via,vt8500-device-clock" - for a VT/WM device clock
-
-Required properties for PLL clocks:
-- reg : shall be the control register offset from PMC base for the pll clock.
-- clocks : shall be the input parent clock phandle for the clock. This should
- be the reference clock.
-- #clock-cells : from common clock binding; shall be set to 0.
-
-Required properties for device clocks:
-- clocks : shall be the input parent clock phandle for the clock. This should
- be a pll output.
-- #clock-cells : from common clock binding; shall be set to 0.
-
-
-Device Clocks
-
-Device clocks are required to have one or both of the following sets of
-properties:
-
-
-Gated device clocks:
-
-Required properties:
-- enable-reg : shall be the register offset from PMC base for the enable
- register.
-- enable-bit : shall be the bit within enable-reg to enable/disable the clock.
-
-
-Divisor device clocks:
-
-Required property:
-- divisor-reg : shall be the register offset from PMC base for the divisor
- register.
-Optional property:
-- divisor-mask : shall be the mask for the divisor register. Defaults to 0x1f
- if not specified.
-
-
-For example:
-
-ref25: ref25M {
- #clock-cells = <0>;
- compatible = "fixed-clock";
- clock-frequency = <25000000>;
-};
-
-plla: plla {
- #clock-cells = <0>;
- compatible = "wm,wm8650-pll-clock";
- clocks = <&ref25>;
- reg = <0x200>;
-};
-
-sdhc: sdhc {
- #clock-cells = <0>;
- compatible = "via,vt8500-device-clock";
- clocks = <&pllb>;
- divisor-reg = <0x328>;
- divisor-mask = <0x3f>;
- enable-reg = <0x254>;
- enable-bit = <18>;
-};
--
2.43.0
^ permalink raw reply related
* [PATCH] dt-bindings: arm: vt8500: via,vt8500-pmc: Convert to DT Schema
From: Udaya Kiran Challa @ 2026-05-24 11:00 UTC (permalink / raw)
To: linux, robh, krzk+dt, conor+dt
Cc: skhan, me, linux-rtc, devicetree, linux-kernel,
Udaya Kiran Challa
Convert the VIA/Wondermedia VT8500 Power Management controller binding
from the legacy text format to DT schema.
Signed-off-by: Udaya Kiran Challa <challauday369@gmail.com>
---
.../bindings/arm/vt8500/via,vt8500-pmc.txt | 13 -------
.../bindings/arm/vt8500/via,vt8500-pmc.yaml | 38 +++++++++++++++++++
2 files changed, 38 insertions(+), 13 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.txt
create mode 100644 Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml
diff --git a/Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.txt b/Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.txt
deleted file mode 100644
index 521b9c7de933..000000000000
--- a/Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-VIA/Wondermedia VT8500 Power Management Controller
------------------------------------------------------
-
-Required properties:
-- compatible : "via,vt8500-pmc"
-- reg : Should contain 1 register ranges(address and length)
-
-Example:
-
- pmc@d8130000 {
- compatible = "via,vt8500-pmc";
- reg = <0xd8130000 0x1000>;
- };
diff --git a/Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml b/Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml
new file mode 100644
index 000000000000..ac603fd4efec
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/vt8500/via,vt8500-pmc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: VIA/Wondermedia VT8500 Power Management Controller
+
+maintainers:
+ - Tony Prisk <linux@prisktech.co.nz>
+
+description:
+ The VIA/Wondermedia Power Management Controller provides register access for
+ clock and power management functions on VT8500 and WM8xxx series SoCs.
+
+properties:
+ compatible:
+ const: via,vt8500-pmc
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ type: object
+ additionalProperties: true
+
+required:
+ - compatible
+ - reg
+
+additionalProperties: false
+
+examples:
+ - |
+ pmc@d8130000 {
+ compatible = "via,vt8500-pmc";
+ reg = <0xd8130000 0x1000>;
+ };
--
2.43.0
^ permalink raw reply related
* Re: [PATCH v2] dt-bindings: clock: via,vt8500: Convert to DT Schema
From: Uday Kiran @ 2026-05-23 17:45 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: mturquette, sboyd, robh, krzk+dt, conor+dt, skhan, me, linux-rtc,
devicetree, linux-kernel
In-Reply-To: <20260522-passionate-fair-jellyfish-73b2ee@quoll>
On Fri, May 22, 2026 at 12:12 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > +
> > + plla: clock@200 {
> > + compatible = "wm,wm8650-pll-clock";
> > + reg = <0x200 0x04>;
> > + clocks = <&ref25>;
> > + #clock-cells = <0>;
> > + };
> > +
> > + clksdhc: clock {
>
> Entire binding is for part of other device, so where is the rest? This
> should not be done separately from the parent. And then example goes
> only to one place.
Thanks for the review Krzysztof.
And sorry, I initially converted the legacy clock/vt8500.txt binding directly to
YAML and missed that the clock nodes are actually child nodes of the PMC
device, which already has a separate binding documented in:
Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.txt
I'll rework this by splitting the conversion into two schemas:
via,vt8500-pmc.yaml for the PMC device itself
via,vt8500-clock.yaml for the clocks child node and the PLL/device clock child
bindings
The clock binding example will retain the PMC hierarchy context, but the PMC
properties themselves will be described in the PMC schema instead of
duplicating them in the clock binding.
Regards,
Udaya Kiran Challa
^ permalink raw reply
* Re: [PATCH] rtc: pcf2127: clear the PWRMNG bits for pcf2131
From: Thomas Bonnefille @ 2026-05-22 14:16 UTC (permalink / raw)
To: alessandro.dichiara; +Cc: alexandre.belloni, linux-kernel, linux-rtc
In-Reply-To: <20251210-rtc-pcf2131-clear-pwrmng-bits-v1-1-407c1c573726@se.com>
Hello,
Has there been any update on this patch?
I'm currently interested in it and would be happy to continue the
upstreaming process if needed.
Best regards,
Thomas
^ permalink raw reply
* Re: [PATCH v2] dt-bindings: clock: via,vt8500: Convert to DT Schema
From: Krzysztof Kozlowski @ 2026-05-22 6:42 UTC (permalink / raw)
To: Udaya Kiran Challa
Cc: mturquette, sboyd, robh, krzk+dt, conor+dt, skhan, me, linux-rtc,
devicetree, linux-kernel
In-Reply-To: <20260521170810.19702-1-challauday369@gmail.com>
On Thu, May 21, 2026 at 10:37:28PM +0530, Udaya Kiran Challa wrote:
> Convert the VIA/Wondermedia VT8500 and Wondermedia WM8xxx series SoCs clock
> controller binding from the legacy text format to DT schema.
>
> Signed-off-by: Udaya Kiran Challa <challauday369@gmail.com>
> ---
> Changelog:
> Changes since v1:
> - Add default value for divisor-mask
> - Add required properties compatible and model
> - Fix example node name
> - Update example size cells and reg value
>
> Link to v1:https://lore.kernel.org/all/20260520025131.17772-1-challauday369@gmail.com/
> ---
> .../bindings/clock/via,vt8500-clock.yaml | 126 ++++++++++++++++++
> .../devicetree/bindings/clock/vt8500.txt | 74 ----------
> 2 files changed, 126 insertions(+), 74 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
> delete mode 100644 Documentation/devicetree/bindings/clock/vt8500.txt
>
> diff --git a/Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml b/Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
> new file mode 100644
> index 000000000000..9e19103866bc
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
> @@ -0,0 +1,126 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/clock/via,vt8500-clock.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: VIA/Wondermedia VT8500 Clock Controller
> +
> +maintainers:
> + - Michael Turquette <mturquette@baylibre.com>
> + - Stephen Boyd <sboyd@kernel.org>
> +
> +description: |
Do not need '|' unless you need to preserve formatting.
> + Clock controller bindings for VIA/Wondermedia VT8500 and Wondermedia WM8xxx
> + series SoCs.
> +
> +properties:
> + compatible:
> + enum:
> + - via,vt8500-pll-clock
> + - wm,wm8650-pll-clock
> + - wm,wm8750-pll-clock
> + - wm,wm8850-pll-clock
> + - via,vt8500-device-clock
> +
> + reg:
> + maxItems: 1
> + description:
> + Offset of the PLL register within the PMC register space.
> +
> + clocks:
> + maxItems: 1
> + description:
> + Parent reference clock.
Drop description
> +
> + "#clock-cells":
> + const: 0
> +
> + enable-reg:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + Offset of the clock enable register within the PMC register space.
> +
> + enable-bit:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + maximum: 31
> + description:
> + Bit index controlling clock enable.
> +
> + divisor-reg:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + Offset of the clock divisor register within the PMC register space.
> +
> + divisor-mask:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + default: 0x1f
> + description:
> + Bitmask describing the divisor field inside divisor-reg.
> +
> +required:
> + - compatible
> + - "#clock-cells"
> +
> +allOf:
> + - if:
> + properties:
> + compatible:
> + enum:
> + - via,vt8500-pll-clock
> + - wm,wm8650-pll-clock
> + - wm,wm8750-pll-clock
> + - wm,wm8850-pll-clock
> + then:
> + required:
> + - reg
> + - clocks
> +
> + - if:
> + properties:
> + compatible:
> + const: via,vt8500-device-clock
> + then:
> + required:
> + - clocks
> + anyOf:
> + - required:
> + - enable-reg
> + - enable-bit
> + - required:
> + - divisor-reg
reg: false, no?
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + / {
> + compatible = "via,wm8650";
> + model = "Wondermedia WM8650";
> +
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + ref25: clock-25000000 {
> + compatible = "fixed-clock";
> + #clock-cells = <0>;
> + clock-frequency = <25000000>;
> + };
Drop everything above
> +
> + plla: clock@200 {
> + compatible = "wm,wm8650-pll-clock";
> + reg = <0x200 0x04>;
> + clocks = <&ref25>;
> + #clock-cells = <0>;
> + };
> +
> + clksdhc: clock {
Entire binding is for part of other device, so where is the rest? This
should not be done separately from the parent. And then example goes
only to one place.
Best regards,
Krzysztof
^ permalink raw reply
* Re: [PATCH v2] dt-bindings: clock: via,vt8500: Convert to DT Schema
From: Rob Herring (Arm) @ 2026-05-21 23:32 UTC (permalink / raw)
To: Udaya Kiran Challa
Cc: linux-rtc, conor+dt, krzk+dt, mturquette, skhan, me, linux-kernel,
sboyd, devicetree
In-Reply-To: <20260521170810.19702-1-challauday369@gmail.com>
On Thu, 21 May 2026 22:37:28 +0530, Udaya Kiran Challa wrote:
> Convert the VIA/Wondermedia VT8500 and Wondermedia WM8xxx series SoCs clock
> controller binding from the legacy text format to DT schema.
>
> Signed-off-by: Udaya Kiran Challa <challauday369@gmail.com>
> ---
> Changelog:
> Changes since v1:
> - Add default value for divisor-mask
> - Add required properties compatible and model
> - Fix example node name
> - Update example size cells and reg value
>
> Link to v1:https://lore.kernel.org/all/20260520025131.17772-1-challauday369@gmail.com/
> ---
> .../bindings/clock/via,vt8500-clock.yaml | 126 ++++++++++++++++++
> .../devicetree/bindings/clock/vt8500.txt | 74 ----------
> 2 files changed, 126 insertions(+), 74 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
> delete mode 100644 Documentation/devicetree/bindings/clock/vt8500.txt
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/clock/via,vt8500-clock.example.dtb: /: failed to match any schema with compatible: ['via,wm8650']
doc reference errors (make refcheckdocs):
See https://patchwork.kernel.org/project/devicetree/patch/20260521170810.19702-1-challauday369@gmail.com
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply
* [PATCH v2] dt-bindings: clock: via,vt8500: Convert to DT Schema
From: Udaya Kiran Challa @ 2026-05-21 17:07 UTC (permalink / raw)
To: mturquette, sboyd, robh, krzk+dt, conor+dt
Cc: skhan, me, linux-rtc, devicetree, linux-kernel,
Udaya Kiran Challa
Convert the VIA/Wondermedia VT8500 and Wondermedia WM8xxx series SoCs clock
controller binding from the legacy text format to DT schema.
Signed-off-by: Udaya Kiran Challa <challauday369@gmail.com>
---
Changelog:
Changes since v1:
- Add default value for divisor-mask
- Add required properties compatible and model
- Fix example node name
- Update example size cells and reg value
Link to v1:https://lore.kernel.org/all/20260520025131.17772-1-challauday369@gmail.com/
---
.../bindings/clock/via,vt8500-clock.yaml | 126 ++++++++++++++++++
.../devicetree/bindings/clock/vt8500.txt | 74 ----------
2 files changed, 126 insertions(+), 74 deletions(-)
create mode 100644 Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
delete mode 100644 Documentation/devicetree/bindings/clock/vt8500.txt
diff --git a/Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml b/Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
new file mode 100644
index 000000000000..9e19103866bc
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
@@ -0,0 +1,126 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/via,vt8500-clock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: VIA/Wondermedia VT8500 Clock Controller
+
+maintainers:
+ - Michael Turquette <mturquette@baylibre.com>
+ - Stephen Boyd <sboyd@kernel.org>
+
+description: |
+ Clock controller bindings for VIA/Wondermedia VT8500 and Wondermedia WM8xxx
+ series SoCs.
+
+properties:
+ compatible:
+ enum:
+ - via,vt8500-pll-clock
+ - wm,wm8650-pll-clock
+ - wm,wm8750-pll-clock
+ - wm,wm8850-pll-clock
+ - via,vt8500-device-clock
+
+ reg:
+ maxItems: 1
+ description:
+ Offset of the PLL register within the PMC register space.
+
+ clocks:
+ maxItems: 1
+ description:
+ Parent reference clock.
+
+ "#clock-cells":
+ const: 0
+
+ enable-reg:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ Offset of the clock enable register within the PMC register space.
+
+ enable-bit:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ maximum: 31
+ description:
+ Bit index controlling clock enable.
+
+ divisor-reg:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ Offset of the clock divisor register within the PMC register space.
+
+ divisor-mask:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ default: 0x1f
+ description:
+ Bitmask describing the divisor field inside divisor-reg.
+
+required:
+ - compatible
+ - "#clock-cells"
+
+allOf:
+ - if:
+ properties:
+ compatible:
+ enum:
+ - via,vt8500-pll-clock
+ - wm,wm8650-pll-clock
+ - wm,wm8750-pll-clock
+ - wm,wm8850-pll-clock
+ then:
+ required:
+ - reg
+ - clocks
+
+ - if:
+ properties:
+ compatible:
+ const: via,vt8500-device-clock
+ then:
+ required:
+ - clocks
+ anyOf:
+ - required:
+ - enable-reg
+ - enable-bit
+ - required:
+ - divisor-reg
+
+additionalProperties: false
+
+examples:
+ - |
+ / {
+ compatible = "via,wm8650";
+ model = "Wondermedia WM8650";
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ ref25: clock-25000000 {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <25000000>;
+ };
+
+ plla: clock@200 {
+ compatible = "wm,wm8650-pll-clock";
+ reg = <0x200 0x04>;
+ clocks = <&ref25>;
+ #clock-cells = <0>;
+ };
+
+ clksdhc: clock {
+ compatible = "via,vt8500-device-clock";
+ clocks = <&plla>;
+ divisor-reg = <0x328>;
+ divisor-mask = <0x3f>;
+ enable-reg = <0x254>;
+ enable-bit = <18>;
+ #clock-cells = <0>;
+ };
+ };
diff --git a/Documentation/devicetree/bindings/clock/vt8500.txt b/Documentation/devicetree/bindings/clock/vt8500.txt
deleted file mode 100644
index 91d71cc0314a..000000000000
--- a/Documentation/devicetree/bindings/clock/vt8500.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-Device Tree Clock bindings for arch-vt8500
-
-This binding uses the common clock binding[1].
-
-[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
-
-Required properties:
-- compatible : shall be one of the following:
- "via,vt8500-pll-clock" - for a VT8500/WM8505 PLL clock
- "wm,wm8650-pll-clock" - for a WM8650 PLL clock
- "wm,wm8750-pll-clock" - for a WM8750 PLL clock
- "wm,wm8850-pll-clock" - for a WM8850 PLL clock
- "via,vt8500-device-clock" - for a VT/WM device clock
-
-Required properties for PLL clocks:
-- reg : shall be the control register offset from PMC base for the pll clock.
-- clocks : shall be the input parent clock phandle for the clock. This should
- be the reference clock.
-- #clock-cells : from common clock binding; shall be set to 0.
-
-Required properties for device clocks:
-- clocks : shall be the input parent clock phandle for the clock. This should
- be a pll output.
-- #clock-cells : from common clock binding; shall be set to 0.
-
-
-Device Clocks
-
-Device clocks are required to have one or both of the following sets of
-properties:
-
-
-Gated device clocks:
-
-Required properties:
-- enable-reg : shall be the register offset from PMC base for the enable
- register.
-- enable-bit : shall be the bit within enable-reg to enable/disable the clock.
-
-
-Divisor device clocks:
-
-Required property:
-- divisor-reg : shall be the register offset from PMC base for the divisor
- register.
-Optional property:
-- divisor-mask : shall be the mask for the divisor register. Defaults to 0x1f
- if not specified.
-
-
-For example:
-
-ref25: ref25M {
- #clock-cells = <0>;
- compatible = "fixed-clock";
- clock-frequency = <25000000>;
-};
-
-plla: plla {
- #clock-cells = <0>;
- compatible = "wm,wm8650-pll-clock";
- clocks = <&ref25>;
- reg = <0x200>;
-};
-
-sdhc: sdhc {
- #clock-cells = <0>;
- compatible = "via,vt8500-device-clock";
- clocks = <&pllb>;
- divisor-reg = <0x328>;
- divisor-mask = <0x3f>;
- enable-reg = <0x254>;
- enable-bit = <18>;
-};
--
2.43.0
^ permalink raw reply related
* Re: (subset) [PATCH v7 00/10] Support for Samsung S2MU005 PMIC and its sub-devices
From: Lee Jones @ 2026-05-21 16:05 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, MyungJoo Ham, Chanwoo Choi, Sebastian Reichel,
Krzysztof Kozlowski, André Draszik, Alexandre Belloni,
Jonathan Corbet, Shuah Khan, Nam Tran,
Łukasz Lebiedziński, Yassine Oudjana,
Kaustabh Chakraborty
Cc: linux-leds, devicetree, linux-kernel, linux-pm, linux-samsung-soc,
linux-rtc, linux-doc, Conor Dooley, Krzysztof Kozlowski
In-Reply-To: <20260516-s2mu005-pmic-v7-0-73f9702fb461@disroot.org>
On Sat, 16 May 2026 03:08:32 +0530, Kaustabh Chakraborty wrote:
> S2MU005 is an MFD chip manufactured by Samsung Electronics. This is
> found in various devices manufactured by Samsung and others, including
> all Exynos 7870 devices. It is known to have the following features:
>
> 1. Two LED channels with adjustable brightness for use as a torch, or a
> flash strobe.
> 2. An RGB LED with 8-bit channels. Usually programmed as a notification
> indicator.
> 3. An MUIC, which works with USB micro-B (and USB-C?). For the micro-B
> variant though, it measures the ID-GND resistance using an internal
> ADC.
> 4. A charger device, which reports if charger is online, voltage,
> resistance, etc.
>
> [...]
Applied, thanks!
[01/10] dt-bindings: leds: document Samsung S2M series PMIC flash LED device
commit: a794673949f1aa1dd948ce3ea436af48ea83d7b2
[06/10] leds: flash: add support for Samsung S2M series PMIC flash LED device
commit: f0878c58430c378c47aaece1b29484e4ae8d7faf
[07/10] leds: rgb: add support for Samsung S2M series PMIC RGB LED device
commit: 366ed7a6d22e682e6dfd4d64d8f543bc70c6b58e
[08/10] Documentation: leds: document pattern behavior of Samsung S2M series PMIC RGB LEDs
commit: 1795fd2dbe84ef4d393b69a0b2a3b371f810bde5
--
Lee Jones [李琼斯]
^ permalink raw reply
* Re: (subset) [PATCH v7 00/10] Support for Samsung S2MU005 PMIC and its sub-devices
From: Lee Jones @ 2026-05-21 16:01 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, MyungJoo Ham, Chanwoo Choi, Sebastian Reichel,
Krzysztof Kozlowski, André Draszik, Alexandre Belloni,
Jonathan Corbet, Shuah Khan, Nam Tran,
Łukasz Lebiedziński, Yassine Oudjana,
Kaustabh Chakraborty
Cc: linux-leds, devicetree, linux-kernel, linux-pm, linux-samsung-soc,
linux-rtc, linux-doc, Conor Dooley, Krzysztof Kozlowski
In-Reply-To: <20260516-s2mu005-pmic-v7-0-73f9702fb461@disroot.org>
On Sat, 16 May 2026 03:08:32 +0530, Kaustabh Chakraborty wrote:
> S2MU005 is an MFD chip manufactured by Samsung Electronics. This is
> found in various devices manufactured by Samsung and others, including
> all Exynos 7870 devices. It is known to have the following features:
>
> 1. Two LED channels with adjustable brightness for use as a torch, or a
> flash strobe.
> 2. An RGB LED with 8-bit channels. Usually programmed as a notification
> indicator.
> 3. An MUIC, which works with USB micro-B (and USB-C?). For the micro-B
> variant though, it measures the ID-GND resistance using an internal
> ADC.
> 4. A charger device, which reports if charger is online, voltage,
> resistance, etc.
>
> [...]
Applied, thanks!
[03/10] dt-bindings: mfd: add documentation for S2MU005 PMIC
commit: 12479cc3750c6b741b6d87392e393d959cf2f013
[04/10] mfd: sec: add support for S2MU005 PMIC
commit: aeff14ae7271cc3070312f894de9a4e075855d31
[05/10] mfd: sec: set DMA coherent mask
commit: ba1f536070abd595a141c683f617eed3c6e42297
--
Lee Jones [李琼斯]
^ permalink raw reply
* [PATCH v2 2/2] platform/x86: amd-pmc: Fix S0i3 wakeup with alarmtimer
From: Mario Limonciello @ 2026-05-21 4:37 UTC (permalink / raw)
To: Shyam Sundar S K, Alexandre Belloni
Cc: Hans de Goede, Ilpo Järvinen, platform-driver-x86,
linux-kernel, linux-rtc, Thomas Gleixner, Mario Limonciello
In-Reply-To: <20260521043714.1022930-1-mario.limonciello@amd.com>
It was reported that suspend-then-hibernate stopped working with modern
systemd versions on AMD Cezanne systems. The reason for this breakage
was because systemd switched to using alarmtimer instead of the wakealarm
sysfs file.
On AMD Cezanne systems, amd_pmc_verify_czn_rtc() programs a secondary
timer with the alarm time. This was introduced by
commit 59348401ebed ("platform/x86: amd-pmc: Add special handling for
timer based S0i3 wakeup"). However, this function uses rtc_read_alarm(),
which only reads the aie_timer, not the next expiring timer from the
timerqueue.
When both alarmtimer and wakealarm are active, the first expiring timer
might be the alarmtimer, but amd_pmc_verify_czn_rtc() would only see
the aie_timer, potentially missing the earlier alarm.
Switch to rtc_read_next_alarm() to read whichever timer will fire next.
Also handle -ENOENT (no alarm pending) explicitly as a non-error case.
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3591
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
drivers/platform/x86/amd/pmc/pmc.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
index 50f5784f2aa2e..8cd2db0ccaacd 100644
--- a/drivers/platform/x86/amd/pmc/pmc.c
+++ b/drivers/platform/x86/amd/pmc/pmc.c
@@ -595,9 +595,12 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
rtc_device = rtc_class_open("rtc0");
if (!rtc_device)
return 0;
- rc = rtc_read_alarm(rtc_device, &alarm);
- if (rc)
- return rc;
+ rc = rtc_read_next_alarm(rtc_device, &alarm);
+ if (rc) {
+ if (rc == -ENOENT)
+ dev_dbg(pdev->dev, "no alarm pending\n");
+ return rc == -ENOENT ? 0 : rc;
+ }
if (!alarm.enabled) {
dev_dbg(pdev->dev, "alarm not enabled\n");
return 0;
--
2.43.0
^ permalink raw reply related
* [PATCH v2 0/2] Fix S0i3 wakeup with alarmtimer
From: Mario Limonciello @ 2026-05-21 4:37 UTC (permalink / raw)
To: Shyam Sundar S K, Alexandre Belloni
Cc: Hans de Goede, Ilpo Järvinen, platform-driver-x86,
linux-kernel, linux-rtc, Thomas Gleixner, Mario Limonciello
It was reported that suspend-then-hibernate stopped working with modern
systemd versions on AMD Cezanne systems. The reason for this breakage
was because systemd switched to using alarmtimer instead of the wakealarm
sysfs file.
But really it uncovered deeper problems with how these timers work. Adjust
the code accordingly.
Mario Limonciello (2):
rtc: Add rtc_read_next_alarm() to read next expiring timer
platform/x86: amd-pmc: Fix S0i3 wakeup with alarmtimer
drivers/platform/x86/amd/pmc/pmc.c | 9 ++++---
drivers/rtc/interface.c | 40 ++++++++++++++++++++++++++++++
include/linux/rtc.h | 2 ++
3 files changed, 48 insertions(+), 3 deletions(-)
--
2.43.0
^ permalink raw reply
* [PATCH v2 1/2] rtc: Add rtc_read_next_alarm() to read next expiring timer
From: Mario Limonciello @ 2026-05-21 4:37 UTC (permalink / raw)
To: Shyam Sundar S K, Alexandre Belloni
Cc: Hans de Goede, Ilpo Järvinen, platform-driver-x86,
linux-kernel, linux-rtc, Thomas Gleixner, Mario Limonciello
In-Reply-To: <20260521043714.1022930-1-mario.limonciello@amd.com>
Add a new function rtc_read_next_alarm() that reads the next expiring
alarm from the RTC timerqueue. This is different from rtc_read_alarm(),
which only reads the aie_timer.
The wakealarm sysfs file programs the rtc->aie_timer, whereas the
alarmtimer suspend routine programs its own timer into the RTC timerqueue.
Both timers end up in the RTC's timerqueue, and the first expiring timer
is what gets armed in the hardware.
This new function allows code to query which alarm will actually fire
next, regardless of which subsystem programmed it. This is needed by
platform code that needs to program secondary timers based on the
actual next wakeup time.
Link: https://lore.kernel.org/all/87ed50z0le.ffs@tglx
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v2:
* Drop pointless variable assignments
* Add missing ":" in kdoc for returns
---
drivers/rtc/interface.c | 40 ++++++++++++++++++++++++++++++++++++++++
include/linux/rtc.h | 2 ++
2 files changed, 42 insertions(+)
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 1906f4884a834..7859be8f2a923 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -384,6 +384,46 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
return err;
}
+/**
+ * rtc_read_next_alarm - read the next expiring alarm
+ * @rtc: RTC device
+ * @alarm: storage for the alarm information
+ *
+ * Read the next expiring alarm from the RTC timerqueue. This returns
+ * the alarm that will actually fire next, which may be different from
+ * rtc_read_alarm() if multiple timers are queued (e.g., alarmtimer
+ * and wakealarm sysfs both active).
+ *
+ * Returns: 0 on success, -ENOENT if no alarm is pending, or other error.
+ */
+int rtc_read_next_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
+{
+ struct timerqueue_node *next;
+ int err;
+
+ if (!rtc || !alarm)
+ return -EINVAL;
+
+ err = mutex_lock_interruptible(&rtc->ops_lock);
+ if (err)
+ return err;
+
+ next = timerqueue_getnext(&rtc->timerqueue);
+ if (!next) {
+ err = -ENOENT;
+ goto unlock;
+ }
+
+ memset(alarm, 0, sizeof(struct rtc_wkalrm));
+ alarm->time = rtc_ktime_to_tm(next->expires);
+ alarm->enabled = 1;
+
+unlock:
+ mutex_unlock(&rtc->ops_lock);
+ return err;
+}
+EXPORT_SYMBOL_GPL(rtc_read_next_alarm);
+
int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
{
int err;
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 95da051fb155d..c09fc22819d0c 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -190,6 +190,8 @@ extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm);
int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm);
extern int rtc_read_alarm(struct rtc_device *rtc,
struct rtc_wkalrm *alrm);
+extern int rtc_read_next_alarm(struct rtc_device *rtc,
+ struct rtc_wkalrm *alrm);
extern int rtc_set_alarm(struct rtc_device *rtc,
struct rtc_wkalrm *alrm);
extern int rtc_initialize_alarm(struct rtc_device *rtc,
--
2.43.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox