From patchwork Wed May 14 06:37:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Even Xu X-Patchwork-Id: 890742 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59C571FF7DC; Wed, 14 May 2025 06:38:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747204695; cv=none; b=frSMCyms1nHuZjKl9fH+llr4IznnwxDQqRibuiEUDklNCTP1gYtZiVpGsUHkiTeH0yVIYKl3txviiDQ3ye9BRJFm9bwS/HpB5KNEaiqbrmk548sMIcp6PgC6LjD9iKWjfDjV7EDZKcePwJ6hJhNfSE34VNmRoUMYzxnTNqG7NKQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747204695; c=relaxed/simple; bh=0oKYL6mFwfcZEDDCrci73jWbiusUT6MphLFr198uVbc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cJtUJzdTHkl9k7WaYpjnToF4rgh/kdgBkCgYupH6MrlYEwlTPNIhE+ZnzP///ePMzx61etgthyr3PlBKa1bA99uxX/FvzwOLFiUZEWzPpTXK5SbUGvZORi4Ht79xouJJpVTyNs1Cz6ySsqJj219yX6NoM7uw5mHEv/PR4wn571U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=UfTtY5yb; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UfTtY5yb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1747204694; x=1778740694; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0oKYL6mFwfcZEDDCrci73jWbiusUT6MphLFr198uVbc=; b=UfTtY5yb/SzDH+UVM/1VF/mWad49G38ElzKbpyKaMLZcpNUaZDPkMF8M 63N+YRBr/MaAzD9PRSvJSAvUcIMFJQOnf+VTayXT1axO0YYQs8JowfDgR WkcEqhNxqXLdEjukqWnUpTU3Xqbya/S7PU3D+zyiLd5IC7OwY8W1B4uce zQCBH3GhBtyh5SWILvhi5toXXiI19I1oMAdHVTMNBueev0TzmHS+Pnwwm EwcPfA6u6Obvfy2AW5Y83nh0jgiL2FCQ2OWn+rnhHg1Piuqxvm2aHaAAA JpQ+uytaQACnruOUwUA8FkKxSAVGnFmig2cJfB2d3D2EqqDLZ+tLTxWnk w==; X-CSE-ConnectionGUID: qO3O+lBbSY2uAH+n6La/7A== X-CSE-MsgGUID: sXiMpzw+TXui4NAw3dXgdg== X-IronPort-AV: E=McAfee;i="6700,10204,11432"; a="49247414" X-IronPort-AV: E=Sophos;i="6.15,287,1739865600"; d="scan'208";a="49247414" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2025 23:38:13 -0700 X-CSE-ConnectionGUID: jz/F6dDYTSyMywaZPjKPUw== X-CSE-MsgGUID: C6bKtHOdR9uObgliNv03jA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,287,1739865600"; d="scan'208";a="138933952" Received: from shsensorbuild.sh.intel.com ([10.239.133.18]) by fmviesa009.fm.intel.com with ESMTP; 13 May 2025 23:38:11 -0700 From: Even Xu To: jikos@kernel.org, bentiss@kernel.org Cc: srinivas.pandruvada@linux.intel.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Even Xu , Chong Han Subject: [PATCH v1 1/3] HID: Intel-thc-hid: Intel-thc: Add Wake-on-Touch support Date: Wed, 14 May 2025 14:37:33 +0800 Message-Id: <20250514063735.141950-2-even.xu@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20250514063735.141950-1-even.xu@intel.com> References: <20250514063735.141950-1-even.xu@intel.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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. Signed-off-by: Even Xu Tested-by: Chong Han --- 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 diff --git a/drivers/hid/intel-thc-hid/Makefile b/drivers/hid/intel-thc-hid/Makefile index 6f762d87af07..f1182253b5b7 100644 --- a/drivers/hid/intel-thc-hid/Makefile +++ b/drivers/hid/intel-thc-hid/Makefile @@ -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 diff --git a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.h b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.h index 8666e2362e32..0db435335e24 100644 --- a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.h +++ b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.h @@ -9,6 +9,7 @@ #include #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; diff --git a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-wot.c b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-wot.c new file mode 100644 index 000000000000..1291b4ea2cd8 --- /dev/null +++ b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-wot.c @@ -0,0 +1,94 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2025 Intel Corporation */ + +#include +#include + +#include "intel-thc-dev.h" +#include "intel-thc-wot.h" + +/** + * thc_wot_config - Query and configure wake-on-touch feature + * @thc_dev: Point to thc_device structure + * @gpio_map: Point to ACPI GPIO resource mapping structure + * + * THC ACPI device only provides _CRS with GpioInt() resources, doesn't contain + * _DSD to map this GPIO resource, so this function first registers wake GPIO + * mapping manually, then queries wake-on-touch GPIO resource from ACPI, + * if it exists and is wake-able, configure driver to enable it, otherwise, + * return immediately. + * This function will not return error as it doesn't impact major function. + */ +void thc_wot_config(struct thc_device *thc_dev, const struct acpi_gpio_mapping *gpio_map) +{ + struct acpi_device *adev; + struct thc_wot *wot; + int ret; + + if (!thc_dev) + return; + + adev = ACPI_COMPANION(thc_dev->dev); + if (!adev) + return; + + wot = &thc_dev->wot; + + ret = acpi_dev_add_driver_gpios(adev, gpio_map); + if (ret) { + dev_warn(thc_dev->dev, "Can't add wake GPIO resource, ret = %d\n", ret); + return; + } + + wot->gpio_irq = acpi_dev_gpio_irq_wake_get_by(adev, "wake-on-touch", 0, + &wot->gpio_irq_wakeable); + if (wot->gpio_irq <= 0) { + dev_warn(thc_dev->dev, "Can't find wake GPIO resource\n"); + return; + } + + if (!wot->gpio_irq_wakeable) { + dev_warn(thc_dev->dev, "GPIO resource isn't wakeable\n"); + return; + } + + ret = device_init_wakeup(thc_dev->dev, true); + if (ret) { + dev_warn(thc_dev->dev, "Failed to init wake up.\n"); + return; + } + + ret = dev_pm_set_dedicated_wake_irq(thc_dev->dev, wot->gpio_irq); + if (ret) { + dev_warn(thc_dev->dev, "Failed to set wake up IRQ.\n"); + device_init_wakeup(thc_dev->dev, false); + } +} +EXPORT_SYMBOL_NS_GPL(thc_wot_config, "INTEL_THC"); + +/** + * thc_wot_unconfig - Unconfig wake-on-touch feature + * @thc_dev: Point to thc_device structure + * + * Configure driver to disable wake-on-touch and release ACPI resource. + */ +void thc_wot_unconfig(struct thc_device *thc_dev) +{ + struct acpi_device *adev; + + if (!thc_dev) + return; + + adev = ACPI_COMPANION(thc_dev->dev); + if (!adev) + return; + + if (thc_dev->wot.gpio_irq_wakeable) + device_init_wakeup(thc_dev->dev, false); + + if (thc_dev->wot.gpio_irq > 0) { + dev_pm_clear_wake_irq(thc_dev->dev); + acpi_dev_remove_driver_gpios(adev); + } +} +EXPORT_SYMBOL_NS_GPL(thc_wot_unconfig, "INTEL_THC"); diff --git a/drivers/hid/intel-thc-hid/intel-thc/intel-thc-wot.h b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-wot.h new file mode 100644 index 000000000000..6c700621b242 --- /dev/null +++ b/drivers/hid/intel-thc-hid/intel-thc/intel-thc-wot.h @@ -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 + +#include + +/** + * 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_ */ From patchwork Wed May 14 06:37:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Even Xu X-Patchwork-Id: 890032 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB00C202963; Wed, 14 May 2025 06:38:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747204696; cv=none; b=RZqHFqUOsVxWsGTdyVPuMIEzNK/KxAuzE0FnbUerVDfaPCWNAQX3qHus4ZqzmA1cOGfaoImuKSHhsrXVWTYXseU4T7QJ3YXhlnUB/yWkTn0PbEkWypjM2fclJZGw9lSXjvSTClSYaxdG5FP2dZdR1cpK1zmIGXKI9IiMFUGYXBc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747204696; c=relaxed/simple; bh=+4Krdkt68RlcOdChDTGXUOMRniV+6NGGjzqsCT5/vio=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DLuL4R7IC5op1HMy9WaOFC8YhbxGWazuf5vK5XE5OA4Z3PNIBp/rq25upzhOY/p3DRxr1i/Wyio28ZmBFdg/Cd2vhW++00on/dTnR64XHQjQgzu910JyWCkrUcoCgMoWHXc8/t5xYCRvygWHxOgpwx/gSp7PiitqNs8OLwGTIfE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=kiQSAanP; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kiQSAanP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1747204695; x=1778740695; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+4Krdkt68RlcOdChDTGXUOMRniV+6NGGjzqsCT5/vio=; b=kiQSAanPggGl6ZLWo8VysGFGijut0E3J6ygdN7p75VoDihbZW/MiEtCT fMGx4n40wszPasofei9PENLqJOyE7eKPiC24gWVpCB6JzgRXs5RfNrpdM XqMStqMjSQKFG3wF7XLWuHVMr6RWqhshH+20IEwd9CBsMSmebHCFv0FWG QJrVzn1NxdCGHxmif/hJj2KVGPNCZp7BcRZxNju/CyCwU3L2EeY1WgKXq +NvJK0zi39SFRIdSYIxJ0yKmbE4gMR/SOJyjAhnQY/pXpLz+6Or2HUi5r m2X2VOjDR4s4kre3YWFIFTTxU6DsO8+knO3ms/hwgWo4tB08+vqgUknZf w==; X-CSE-ConnectionGUID: Us4Y5UmSSHm4294Qc6uahw== X-CSE-MsgGUID: kfO5j2keQ6Gv8cXBLAxD2w== X-IronPort-AV: E=McAfee;i="6700,10204,11432"; a="49247422" X-IronPort-AV: E=Sophos;i="6.15,287,1739865600"; d="scan'208";a="49247422" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2025 23:38:15 -0700 X-CSE-ConnectionGUID: I3ARBeUJQLCydZ3O72z0AA== X-CSE-MsgGUID: r22+eeg2QsS4y/MDAxRLPw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,287,1739865600"; d="scan'208";a="138933960" Received: from shsensorbuild.sh.intel.com ([10.239.133.18]) by fmviesa009.fm.intel.com with ESMTP; 13 May 2025 23:38:13 -0700 From: Even Xu To: jikos@kernel.org, bentiss@kernel.org Cc: srinivas.pandruvada@linux.intel.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Even Xu , Chong Han Subject: [PATCH v1 2/3] HID: Intel-thc-hid: Intel-quickspi: Enable Wake-on-Touch feature Date: Wed, 14 May 2025 14:37:34 +0800 Message-Id: <20250514063735.141950-3-even.xu@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20250514063735.141950-1-even.xu@intel.com> References: <20250514063735.141950-1-even.xu@intel.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This patch call THC helper functions to enable Wake-on-Touch (WoT) during driver initialization and disable it when driver is removed. Signed-off-by: Even Xu Tested-by: Chong Han --- .../intel-thc-hid/intel-quickspi/pci-quickspi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 d4f89f44c3b4..5e5f179dd113 100644 --- a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c +++ b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c @@ -11,8 +11,11 @@ #include #include +#include + #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; } From patchwork Wed May 14 06:37:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Even Xu X-Patchwork-Id: 890741 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BA3E204592; Wed, 14 May 2025 06:38:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747204698; cv=none; b=hS9OxhgIml4+OCz1k1Um40eO9bX/Xe1zwV0+In9oeCDOwpGOfDhVSVxLRzMSEZH6mZjLqChSfMP9jyhK+ZxeMtWR4DPK++fgLx+TMmLwP72tZgsDpyZn9UswOVsYs+C30L3cJlHHFHnbmZ7plC631iKxCruqW8aymX4uuCn8nYA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747204698; c=relaxed/simple; bh=O5XoA45OVZeec67U6NzneQ/tSvQ4WPrXJXEkDN3BaKw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=V1WE186z0nFHW+yDJ1YzJikQpyXWjk0VbVIN5pf5zdCcpa6QXxvNMJYeeM/jebMVjKQJKzkkK00ugvUXp15DwCrIU/+ZoAc06L85tcJi1PDpfqCFTyliRkbO78XZV1sBQL6kHcTzgjXaj8sMpD8w4C8Xpk+t2cryU4IxmR8q17A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mmdMUL8y; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mmdMUL8y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1747204697; x=1778740697; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O5XoA45OVZeec67U6NzneQ/tSvQ4WPrXJXEkDN3BaKw=; b=mmdMUL8ypZvJhchuOhc/g+Bgfb+ZAvbf1Gri61gzz6PHTBbtKQYgR1lY Szn2s6T6bSxeSQblO8HZ2vWC9wdTZr25B9A/Gg7i5CMXLQUiI7+zAjztT 6MquPAr/I7F3MV/g00Uj3HkxeTsvJhiwavjy1rZOxDc01X9n7H27HDZAM rzW3cxcmDvya/VXKUC5KvRBuUh66o+sNsV0VPYQaA30Xb9ez5JNlCX4RZ GMPO/WLC2tNgSypIq4wYzYErEMeyiIuCtLyaQaZXQ2AP+SiNvCoO0heuW u9Ufwav7r1zE9AP9eIUdaChuBBKGxLJyuaOGPd3gGtBrGzEvr0a7c195P g==; X-CSE-ConnectionGUID: drpuVKXATWGCsMIpFMEPbQ== X-CSE-MsgGUID: Gp+Wf9iITPa2Cv3wuks6zg== X-IronPort-AV: E=McAfee;i="6700,10204,11432"; a="49247427" X-IronPort-AV: E=Sophos;i="6.15,287,1739865600"; d="scan'208";a="49247427" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2025 23:38:17 -0700 X-CSE-ConnectionGUID: 7KRsks/CQ3e38/Id89Eakg== X-CSE-MsgGUID: hzxwkZHYRJGw1MUjBHdYbw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,287,1739865600"; d="scan'208";a="138933969" Received: from shsensorbuild.sh.intel.com ([10.239.133.18]) by fmviesa009.fm.intel.com with ESMTP; 13 May 2025 23:38:14 -0700 From: Even Xu To: jikos@kernel.org, bentiss@kernel.org Cc: srinivas.pandruvada@linux.intel.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Even Xu , Chong Han Subject: [PATCH v1 3/3] HID: Intel-thc-hid: Intel-quicki2c: Enable Wake-on-Touch feature Date: Wed, 14 May 2025 14:37:35 +0800 Message-Id: <20250514063735.141950-4-even.xu@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20250514063735.141950-1-even.xu@intel.com> References: <20250514063735.141950-1-even.xu@intel.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This patch call THC helper functions to enable Wake-on-Touch (WoT) during driver initialization and disable it when driver is removed. Signed-off-by: Even Xu Tested-by: Chong Han --- .../intel-thc-hid/intel-quicki2c/pci-quicki2c.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c index 40faba5bd81d..3335775dcf4d 100644 --- a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c +++ b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c @@ -11,8 +11,11 @@ #include #include +#include + #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; }