mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] platform/x86: portwell-ec: Add watchdog suspend/resume and hwmon
@ 2025-07-14 10:52 Yen-Chi Huang
  2025-07-15  3:51 ` [PATCH v2 1/2] platform/x86: portwell-ec: Add suspend/resume support for watchdog jesse huang
  2025-07-15  3:56 ` [PATCH v2 2/2] platform/x86: portwell-ec: Add hwmon support for voltage and temperature Yen-Chi Huang
  0 siblings, 2 replies; 6+ messages in thread
From: Yen-Chi Huang @ 2025-07-14 10:52 UTC (permalink / raw)
  To: hdegoede, ilpo.jarvinen, jdelvare, linux, wim
  Cc: linux-kernel, platform-driver-x86, linux-hwmon, linux-watchdog,
	jay.chen, jesse.huang

Add suspend/resume support for watchdog and hwmon monitoring functionality
to the Portwell EC driver, enabling better power management and sensor
reporting.

Tested on Portwell NANO-6064.

--
V2:

- Added watchdog mailing list to Cc.

Patch 1/2:
  - unchanged

Patch 2/2:
  - Removed `msb_reg` from `struct pwec_hwmon_data`
  - Updated `pwec_read16_stable()` to assume MSB follows LSB
  - Moved `hwmon_channel_info` to per-board data and assigned it to `.info` at runtime
  - Replaced the `pwec_board_data[]` array with a standalone struct
  - Replaced literal `1000` with `MILLIDEGREE_PER_DEGREE`
  - Removed unused include and sorted header includes

Yen-Chi Huang (2):
  platform/x86: portwell-ec: Add suspend/resume support for watchdog
  platform/x86: portwell-ec: Add hwmon support for voltage and temperature

 drivers/platform/x86/portwell-ec.c | 196 ++++++++++++++++++++++++++++-
 1 file changed, 194 insertions(+), 2 deletions(-)

-- 
2.34.1

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH v2 1/2] platform/x86: portwell-ec: Add suspend/resume support for watchdog
@ 2025-07-14 10:55 Yen-Chi Huang
  0 siblings, 0 replies; 6+ messages in thread
From: Yen-Chi Huang @ 2025-07-14 10:55 UTC (permalink / raw)
  To: hdegoede, ilpo.jarvinen, jdelvare, linux, wim
  Cc: linux-kernel, platform-driver-x86, linux-hwmon, linux-watchdog,
	jay.chen, jesse.huang

Portwell EC does not disable the watchdog during suspend. To avoid unwanted
resets, this patch adds suspend and resume callbacks (pwec_suspend() and
pwec_resume()) to the driver.

The watchdog is stopped in pwec_suspend() and restarted in pwec_resume() if
it was active before suspend.

Signed-off-by: Yen-Chi Huang <jesse.huang@portwell.com.tw>
---
 drivers/platform/x86/portwell-ec.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/platform/x86/portwell-ec.c b/drivers/platform/x86/portwell-ec.c
index 8b788822237b..a68522aaa3fa 100644
--- a/drivers/platform/x86/portwell-ec.c
+++ b/drivers/platform/x86/portwell-ec.c
@@ -245,11 +245,29 @@ static int pwec_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static int pwec_suspend(struct platform_device *pdev, pm_message_t message)
+{
+	if (watchdog_active(&ec_wdt_dev))
+		return pwec_wdt_stop(&ec_wdt_dev);
+
+	return 0;
+}
+
+static int pwec_resume(struct platform_device *pdev)
+{
+	if (watchdog_active(&ec_wdt_dev))
+		return pwec_wdt_start(&ec_wdt_dev);
+
+	return 0;
+}
+
 static struct platform_driver pwec_driver = {
 	.driver = {
 		.name = "portwell-ec",
 	},
 	.probe = pwec_probe,
+	.suspend = pm_ptr(pwec_suspend),
+	.resume = pm_ptr(pwec_resume),
 };
 
 static struct platform_device *pwec_dev;
-- 
2.34.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-24  8:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-14 10:52 [PATCH v2 0/2] platform/x86: portwell-ec: Add watchdog suspend/resume and hwmon Yen-Chi Huang
2025-07-15  3:51 ` [PATCH v2 1/2] platform/x86: portwell-ec: Add suspend/resume support for watchdog jesse huang
2025-07-15  3:56 ` [PATCH v2 2/2] platform/x86: portwell-ec: Add hwmon support for voltage and temperature Yen-Chi Huang
2025-07-21 13:56   ` Ilpo Järvinen
2025-07-24  8:34     ` Yen-Chi Huang
2025-07-14 10:55 [PATCH v2 1/2] platform/x86: portwell-ec: Add suspend/resume support for watchdog Yen-Chi Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®