public inbox for linux-input@vger.kernel.org
 help / color / mirror / Atom feed
From: Even Xu <even.xu@intel.com>
To: bentiss@kernel.org, jikos@kernel.org
Cc: srinivas.pandruvada@linux.intel.com, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, Even Xu <even.xu@intel.com>,
	Rui Zhang <rui1.zhang@intel.com>
Subject: [PATCH] Hid: Intel-thc-hid: Intel-quickspi: Improve power management for touch devices
Date: Wed, 18 Mar 2026 11:25:47 +0800	[thread overview]
Message-ID: <20260318032547.839686-1-even.xu@intel.com> (raw)

Enhance power management with two key improvements:
1. Hibernate support: Send POWER_OFF command when entering hibernate
   mode.
2. Conditional sleep commands: Only send POWER_SLEEP/POWER_ON commands
   during system suspend/resume when the touch device is not configured
   as a wake source, preserving Wake-on-Touch (WoT) functionality. This
   ensures proper power states while maintaining expected wake behavior.

Signed-off-by: Even Xu <even.xu@intel.com>
Tested-by: Rui Zhang <rui1.zhang@intel.com>
---
 .../intel-thc-hid/intel-quickspi/pci-quickspi.c  | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
index b6a69995692c..f669235f1883 100644
--- a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
+++ b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
@@ -753,9 +753,11 @@ static int quickspi_suspend(struct device *device)
 	if (!qsdev)
 		return -ENODEV;
 
-	ret = quickspi_set_power(qsdev, HIDSPI_SLEEP);
-	if (ret)
-		return ret;
+	if (!device_may_wakeup(qsdev->dev)) {
+		ret = quickspi_set_power(qsdev, HIDSPI_SLEEP);
+		if (ret)
+			return ret;
+	}
 
 	ret = thc_interrupt_quiesce(qsdev->thc_hw, true);
 	if (ret)
@@ -794,9 +796,8 @@ static int quickspi_resume(struct device *device)
 	if (ret)
 		return ret;
 
-	ret = quickspi_set_power(qsdev, HIDSPI_ON);
-	if (ret)
-		return ret;
+	if (!device_may_wakeup(qsdev->dev))
+		return quickspi_set_power(qsdev, HIDSPI_ON);
 
 	return 0;
 }
@@ -855,6 +856,9 @@ static int quickspi_poweroff(struct device *device)
 	if (!qsdev)
 		return -ENODEV;
 
+	/* Ignore the return value as platform will be poweroff soon */
+	quickspi_set_power(qsdev, HIDSPI_OFF);
+
 	ret = thc_interrupt_quiesce(qsdev->thc_hw, true);
 	if (ret)
 		return ret;
-- 
2.40.1


             reply	other threads:[~2026-03-18  3:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18  3:25 Even Xu [this message]
2026-03-27 12:32 ` [PATCH] Hid: Intel-thc-hid: Intel-quickspi: Improve power management for touch devices Jiri Kosina

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=20260318032547.839686-1-even.xu@intel.com \
    --to=even.xu@intel.com \
    --cc=bentiss@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rui1.zhang@intel.com \
    --cc=srinivas.pandruvada@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox