From: Emfox Zhou <emfox@debian.org>
To: Even Xu <even.xu@intel.com>, Xinpeng Sun <xinpeng.sun@intel.com>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v11 5/6] HID: intel-thc-hid: intel-ipts: handle system sleep
Date: Thu, 3 Dec 2026 10:04:14 +0800 [thread overview]
Message-ID: <20261203020433.2631656-5-emfox@debian.org> (raw)
In-Reply-To: <cover.1796215044.git.emfox@debian.org>
Take the port down before system sleep and bring it back up after
resume.
Signed-off-by: Emfox Zhou <emfox@debian.org>
---
.../hid/intel-thc-hid/intel-ipts/pci-ipts.c | 52 +++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/drivers/hid/intel-thc-hid/intel-ipts/pci-ipts.c b/drivers/hid/intel-thc-hid/intel-ipts/pci-ipts.c
index 746ef27e2..5da8cbf78 100644
--- a/drivers/hid/intel-thc-hid/intel-ipts/pci-ipts.c
+++ b/drivers/hid/intel-thc-hid/intel-ipts/pci-ipts.c
@@ -151,6 +151,57 @@ static void thc_ipts_remove(struct pci_dev *pci)
pci_clear_master(pci);
}
+static int thc_ipts_suspend(struct device *dev)
+{
+ struct thc_ipts *idev = dev_get_drvdata(dev);
+
+ thc_ipts_port_stop(idev);
+
+ return 0;
+}
+
+static int thc_ipts_resume(struct device *dev)
+{
+ struct thc_ipts *idev = dev_get_drvdata(dev);
+ int ret;
+
+ /*
+ * A restore brings the global enable back while the port is down: mask
+ * before starting.
+ */
+ thc_interrupt_enable(idev->thc, false);
+
+ ret = thc_ipts_port_start(idev);
+ if (ret)
+ thc_ipts_port_stop(idev);
+
+ return ret;
+}
+
+/*
+ * Mask as soon as configuration space is back: the line may already be
+ * asserted.
+ */
+static int thc_ipts_resume_noirq(struct device *dev)
+{
+ struct thc_ipts *idev = dev_get_drvdata(dev);
+
+ thc_interrupt_enable(idev->thc, false);
+
+ return 0;
+}
+
+static const struct dev_pm_ops thc_ipts_pm_ops = {
+ .suspend = thc_ipts_suspend,
+ .resume = thc_ipts_resume,
+ .freeze = thc_ipts_suspend,
+ .thaw = thc_ipts_resume,
+ .poweroff = thc_ipts_suspend,
+ .restore = thc_ipts_resume,
+ .resume_noirq = thc_ipts_resume_noirq,
+ .restore_noirq = thc_ipts_resume_noirq,
+};
+
static void thc_ipts_shutdown(struct pci_dev *pci)
{
struct thc_ipts *idev = pci_get_drvdata(pci);
@@ -165,6 +216,7 @@ static struct pci_driver thc_ipts_driver = {
.probe = thc_ipts_probe,
.remove = thc_ipts_remove,
.shutdown = thc_ipts_shutdown,
+ .driver.pm = pm_sleep_ptr(&thc_ipts_pm_ops),
/* Bring-up waits for the controller, up to a few seconds. */
.driver.probe_type = PROBE_PREFER_ASYNCHRONOUS,
};
next prev parent reply other threads:[~2026-12-03 2:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 2:04 [PATCH v11 0/6] HID: intel-thc-hid: intel-ipts: support THC IPTS ports Emfox Zhou
2026-12-03 2:04 ` [PATCH v11 1/6] HID: intel-thc-hid: intel-thc: expose the port operations IPTS needs Emfox Zhou
2026-12-03 2:11 ` sashiko-bot
2026-12-03 2:04 ` [PATCH v11 2/6] HID: intel-thc-hid: intel-ipts: bring up the port Emfox Zhou
2026-12-03 2:15 ` sashiko-bot
2026-12-03 2:04 ` [PATCH v11 3/6] HID: intel-thc-hid: intel-ipts: receive reports Emfox Zhou
2026-12-03 2:26 ` sashiko-bot
2026-12-03 2:04 ` [PATCH v11 4/6] HID: intel-thc-hid: intel-ipts: add the HID device Emfox Zhou
2026-12-03 2:04 ` Emfox Zhou [this message]
2026-12-03 2:04 ` [PATCH v11 6/6] HID: intel-thc-hid: intel-ipts: document the IPTS mode Emfox Zhou
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=20261203020433.2631656-5-emfox@debian.org \
--to=emfox@debian.org \
--cc=bentiss@kernel.org \
--cc=even.xu@intel.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xinpeng.sun@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.