mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: jesse huang <jesse.huang@portwell.com.tw>
To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com,
	jdelvare@suse.com, linux@roeck-us.net, wim@linux-watchdog.org
Cc: linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-watchdog@vger.kernel.org, jay.chen@canonical.com
Subject: [PATCH v2 1/2] platform/x86: portwell-ec: Add suspend/resume support for watchdog
Date: Tue, 15 Jul 2025 11:51:51 +0800	[thread overview]
Message-ID: <ef9455cc-1bc3-4e6c-a445-047127cdfbc7@portwell.com.tw> (raw)
In-Reply-To: <a07d8764-ee23-4d21-a7b5-121cb8a576b9@portwell.com.tw>

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>
---

[Re-sending to fix message threading, no content changes since v2.]
---
 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

  reply	other threads:[~2025-07-15  3:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` jesse huang [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef9455cc-1bc3-4e6c-a445-047127cdfbc7@portwell.com.tw \
    --to=jesse.huang@portwell.com.tw \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jay.chen@canonical.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®