Skip to contentSkip to conversation

Hid: Intel-thc-hid: Intel-quickspi: Improve power management for touch devices

PATCH Applied Even Xu 2 participants 2 messages Mar 18 – Mar 27

Subsystems (2)
lore
Share & tools
lore

Even Xu

author maintainer
#0 lore raw

PATCH 1/1 Hid: Intel-thc-hid: Intel-quickspi: Improve power management for touch devices

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.

---
 .../intel-thc-hid/intel-quickspi/pci-quickspi.c  | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c +10 -6
index b6a69995692c..f669235f1883 100644
@@ -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;
Signature · 1 line
2.40.1
maintainer Applied
#1 lore raw
Quoted 10 lines · Even Xu

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.

Applied to hid.git#for-7.1/intel-thc, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs