Skip to contentSkip to conversation

Add wake-on-touch feature support for THC

PATCH In review Even Xu 2 participants 5 messages May 14, 2025 – Jun 10, 2025

Subsystems (2)
lore
Share & tools
lore

Even Xu

author maintainer
#0 lore raw

cover Add wake-on-touch feature support for THC

Wake-on-Touch (WoT) feature gives system the capability to wake from sleep state by user touch event, it depends on platform providing Wake GPIO through ACPI resource.

This patch set adds wake-on-touch feature support for QuickSPI driver and QuickI2C driver.

Even Xu (3):
HID: Intel-thc-hid: Intel-thc: Add Wake-on-Touch support
HID: Intel-thc-hid: Intel-quickspi: Enable Wake-on-Touch feature
HID: Intel-thc-hid: Intel-quicki2c: Enable Wake-on-Touch feature

 drivers/hid/intel-thc-hid/Makefile            |  1 +
 .../intel-quicki2c/pci-quicki2c.c             | 14 +++
 .../intel-quickspi/pci-quickspi.c             | 15 +++
 .../intel-thc-hid/intel-thc/intel-thc-dev.h   |  4 +
 .../intel-thc-hid/intel-thc/intel-thc-wot.c   | 94 +++++++++++++++++++
 .../intel-thc-hid/intel-thc/intel-thc-wot.h   | 26 +++++
 6 files changed, 154 insertions(+)
 create mode 100644 drivers/hid/intel-thc-hid/intel-thc/intel-thc-wot.c
 create mode 100644 drivers/hid/intel-thc-hid/intel-thc/intel-thc-wot.h
Signature · 1 line
2.40.1
author maintainer
#1 lore raw

PATCH 1/3 HID: Intel-thc-hid: Intel-thc: Add Wake-on-Touch support

Wake-on-Touch (WoT) feature gives system the capability to wake from sleep state by user touch event, it requires platform providing wake GPIO through ACPI resource.

Intel UEFI provides a user setting to enable or disable THC device WoT feature. If it's enabled, UEFI assigns an additional wake GPIO resource to THC device ACPI configuration, facilitating system wakeup.

This patch provides helper APIs for THC device driver to query wake GPIO resource, enable WoT feature and unconfigure WoT.

APIs added:
- thc_wot_config(): Query and configure wake-on-touch feature.
- thc_wot_unconfig(): Unconfig wake-on-touch feature.

---
 drivers/hid/intel-thc-hid/Makefile            |  1 +
 .../intel-thc-hid/intel-thc/intel-thc-dev.h   |  4 +
 .../intel-thc-hid/intel-thc/intel-thc-wot.c   | 94 +++++++++++++++++++
 .../intel-thc-hid/intel-thc/intel-thc-wot.h   | 26 +++++
 4 files changed, 125 insertions(+)
 create mode 100644 drivers/hid/intel-thc-hid/intel-thc/intel-thc-wot.c
 create mode 100644 drivers/hid/intel-thc-hid/intel-thc/intel-thc-wot.h
drivers/hid/intel-thc-hid/Makefile +1 -0
index 6f762d87af07..f1182253b5b7 100644
@@ -8,6 +8,7 @@
 obj-$(CONFIG_INTEL_THC_HID) += intel-thc.o
 intel-thc-objs += intel-thc/intel-thc-dev.o
 intel-thc-objs += intel-thc/intel-thc-dma.o
+intel-thc-objs += intel-thc/intel-thc-wot.o
 
 obj-$(CONFIG_INTEL_QUICKSPI) += intel-quickspi.o
 intel-quickspi-objs += intel-quickspi/pci-quickspi.o
drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.h +4 -0
index 8666e2362e32..0db435335e24 100644
@@ -9,6 +9,7 @@
 #include <linux/workqueue.h>
 
 #include "intel-thc-dma.h"
+#include "intel-thc-wot.h"
 
 #define THC_REGMAP_COMMON_OFFSET  0x10
 #define THC_REGMAP_MMIO_OFFSET    0x1000
@@ -56,6 +57,7 @@ enum thc_int_type {
  * @port_type: Port type of THC port instance
  * @pio_int_supported: PIO interrupt supported flag
  * @dma_ctx: DMA specific data
+ * @wot: THC Wake-on-Touch data
  * @write_complete_wait: Signal event for DMA write complete
  * @swdma_complete_wait: Signal event for SWDMA sequence complete
  * @write_done: Bool value that indicates if DMA write is done
@@ -77,6 +79,8 @@ struct thc_device {
 
 	struct thc_dma_context *dma_ctx;
 
+	struct thc_wot wot;
+
 	wait_queue_head_t write_complete_wait;
 	wait_queue_head_t swdma_complete_wait;
 	bool write_done;
drivers/hid/intel-thc-hid/intel-thc/intel-thc-wot.c new file +94 -0

94 lines not on this page · raw message

drivers/hid/intel-thc-hid/intel-thc/intel-thc-wot.h new file +26 -0
new file mode 100644
index 000000000000..6c700621b242
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2025 Intel Corporation */
+
+#ifndef _INTEL_THC_WOT_H_
+#define _INTEL_THC_WOT_H_
+
+#include <linux/types.h>
+
+#include <linux/gpio/consumer.h>
+
+/**
+ * struct thc_wot - THC Wake-on-Touch data structure
+ * @gpio_irq : GPIO interrupt IRQ number for wake-on-touch
+ * @gpio_irq_wakeable : Indicate GPIO IRQ workable or not
+ */
+struct thc_wot {
+	int gpio_irq;
+	bool gpio_irq_wakeable;
+};
+
+struct thc_device;
+
+void thc_wot_config(struct thc_device *thc_dev, const struct acpi_gpio_mapping *gpio_map);
+void thc_wot_unconfig(struct thc_device *thc_dev);
+
+#endif /* _INTEL_THC_WOT_H_ */
Signature · 1 line
2.40.1
author maintainer
#2 lore raw

PATCH 2/3 HID: Intel-thc-hid: Intel-quickspi: Enable Wake-on-Touch feature

In reply to Even Xu

This patch call THC helper functions to enable Wake-on-Touch (WoT) during driver initialization and disable it when driver is removed.

---
 .../intel-thc-hid/intel-quickspi/pci-quickspi.c   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c +15 -0
index d4f89f44c3b4..5e5f179dd113 100644
@@ -11,8 +11,11 @@
 #include <linux/pci.h>
 #include <linux/pm_runtime.h>
 
+#include <linux/gpio/consumer.h>
+
 #include "intel-thc-dev.h"
 #include "intel-thc-hw.h"
+#include "intel-thc-wot.h"
 
 #include "quickspi-dev.h"
 #include "quickspi-hid.h"
@@ -46,6 +49,15 @@ static guid_t thc_platform_guid =
 	GUID_INIT(0x84005682, 0x5b71, 0x41a4, 0x8d, 0x66, 0x81, 0x30,
 		  0xf7, 0x87, 0xa1, 0x38);
 
+
+/* QuickSPI Wake-on-Touch GPIO resource */
+static const struct acpi_gpio_params wake_gpio = { 0, 0, true };
+
+static const struct acpi_gpio_mapping quickspi_gpios[] = {
+	{ "wake-on-touch", &wake_gpio, 1 },
+	{ }
+};
+
 /**
  * thc_acpi_get_property - Query device ACPI parameter
  *
@@ -426,6 +438,8 @@ static struct quickspi_device *quickspi_dev_init(struct pci_dev *pdev, void __io
 
 	thc_interrupt_enable(qsdev->thc_hw, true);
 
+	thc_wot_config(qsdev->thc_hw, &quickspi_gpios[0]);
+
 	qsdev->state = QUICKSPI_INITIATED;
 
 	return qsdev;
@@ -442,6 +456,7 @@ static void quickspi_dev_deinit(struct quickspi_device *qsdev)
 {
 	thc_interrupt_enable(qsdev->thc_hw, false);
 	thc_ltr_unconfig(qsdev->thc_hw);
+	thc_wot_unconfig(qsdev->thc_hw);
 
 	qsdev->state = QUICKSPI_DISABLED;
 }
Signature · 1 line
2.40.1
author maintainer
#3 lore raw

PATCH 3/3 HID: Intel-thc-hid: Intel-quicki2c: Enable Wake-on-Touch feature

In reply to Even Xu

This patch call THC helper functions to enable Wake-on-Touch (WoT) during driver initialization and disable it when driver is removed.

---
 .../intel-thc-hid/intel-quicki2c/pci-quicki2c.c    | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c +14 -0
index 40faba5bd81d..3335775dcf4d 100644
@@ -11,8 +11,11 @@
 #include <linux/sizes.h>
 #include <linux/pm_runtime.h>
 
+#include <linux/gpio/consumer.h>
+
 #include "intel-thc-dev.h"
 #include "intel-thc-hw.h"
+#include "intel-thc-wot.h"
 
 #include "quicki2c-dev.h"
 #include "quicki2c-hid.h"
@@ -31,6 +34,14 @@ static guid_t i2c_hid_guid =
 static guid_t thc_platform_guid =
 	GUID_INIT(0x84005682, 0x5b71, 0x41a4, 0x8d, 0x66, 0x81, 0x30, 0xf7, 0x87, 0xa1, 0x38);
 
+/* QuickI2C Wake-on-Touch GPIO resource */
+static const struct acpi_gpio_params wake_gpio = { 0, 0, true };
+
+static const struct acpi_gpio_mapping quicki2c_gpios[] = {
+	{ "wake-on-touch", &wake_gpio, 1 },
+	{ }
+};
+
 /**
  * quicki2c_acpi_get_dsm_property - Query device ACPI DSM parameter
  * @adev: Point to ACPI device
@@ -398,6 +409,8 @@ static struct quicki2c_device *quicki2c_dev_init(struct pci_dev *pdev, void __io
 
 	thc_interrupt_enable(qcdev->thc_hw, true);
 
+	thc_wot_config(qcdev->thc_hw, &quicki2c_gpios[0]);
+
 	qcdev->state = QUICKI2C_INITED;
 
 	return qcdev;
@@ -413,6 +426,7 @@ static void quicki2c_dev_deinit(struct quicki2c_device *qcdev)
 {
 	thc_interrupt_enable(qcdev->thc_hw, false);
 	thc_ltr_unconfig(qcdev->thc_hw);
+	thc_wot_unconfig(qcdev->thc_hw);
 
 	qcdev->state = QUICKI2C_DISABLED;
 }
Signature · 1 line
2.40.1
maintainer
#4 lore raw
In reply to Even Xu
Quoted 11 lines · Even Xu

Wake-on-Touch (WoT) feature gives system the capability to wake from sleep state by user touch event, it depends on platform providing Wake GPIO through ACPI resource.

This patch set adds wake-on-touch feature support for QuickSPI driver and QuickI2C driver.

Even Xu (3):
HID: Intel-thc-hid: Intel-thc: Add Wake-on-Touch support
HID: Intel-thc-hid: Intel-quickspi: Enable Wake-on-Touch feature
HID: Intel-thc-hid: Intel-quicki2c: Enable Wake-on-Touch feature

Now queued in hid.git#for-6.17/intel-thc.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs