From patchwork Tue Oct 31 14:09:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Cox X-Patchwork-Id: 1857604 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SKX9y5vYLz1yQZ for ; Wed, 1 Nov 2023 01:11:18 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qxpSX-0001IQ-Q7; Tue, 31 Oct 2023 14:11:09 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qxpSG-000195-Ax for kernel-team@lists.ubuntu.com; Tue, 31 Oct 2023 14:10:53 +0000 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id B037E3F19A for ; Tue, 31 Oct 2023 14:10:51 +0000 (UTC) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-41cdce61dcbso68111661cf.3 for ; Tue, 31 Oct 2023 07:10:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698761449; x=1699366249; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=805Hza22h7eOl09WHs4d59QizObzJX0ziK+1RBbFJSU=; b=i108oe4eZWIiHCXTWcMpaselBSSsLWsNoQB1F7kKx1dHUy1LLs48JHIMpgBiPD7zhC pE79H11AKWTmnIwOuXNtMscl84h8RXoKHopiSQrTHBnYj9eCEgGS8NaunZWkl0KPIpuS ByfEWCd9JdDnm7qZyxtZDft/nrIluCqV+uX+wwzMZKrgbHUVl+BodGctEX/TblG8+P99 svoEK2vd+PcGxkvUFkgtzCJzoV+JYvkJhAhTo1w3nH1+PcSSMukZOvx1bPcz4/2yV4zN dXc9cGxMp9aR0NX1vzJAyQBmnc9i+7nLksQwuTcprwRM2/PzDsr2IwuQkpdPTufjyTa+ 4i3g== X-Gm-Message-State: AOJu0YyGkKAmF5tiGi0O8IwhQt+m4wBLqfDiqc87jZPyslU7R3BKkmCN 2a1mGrzM67A8v8Zj7lUoEc58BbJAnrVlidzUyvQDM5dXj8S1cr1gKtDOHDMS+A3OwAT6WzWUmab n5tlEg1a2xaq1++gDUjBfFvzkefr0fMkmeDDFqLMstvdWDWCFZg== X-Received: by 2002:a05:6214:19e3:b0:65d:660:25a8 with SMTP id q3-20020a05621419e300b0065d066025a8mr13784788qvc.20.1698761449716; Tue, 31 Oct 2023 07:10:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECGq0dbkzNcNFO63gQYYGORjnS+3hx8tB4it+D/T9Fe1rUL1Gp6wo2i6NI+Eyz9SX+P6jGjA== X-Received: by 2002:a05:6214:19e3:b0:65d:660:25a8 with SMTP id q3-20020a05621419e300b0065d066025a8mr13784758qvc.20.1698761449364; Tue, 31 Oct 2023 07:10:49 -0700 (PDT) Received: from cox.conference ([216.154.12.82]) by smtp.gmail.com with ESMTPSA id p20-20020ac84094000000b0041cf5ec8b75sm513989qtl.96.2023.10.31.07.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 07:10:46 -0700 (PDT) From: Philip Cox To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1] HID: intel-ish-hid: ipc: Disable and reenable ACPI GPE bit Date: Tue, 31 Oct 2023 10:09:52 -0400 Message-Id: <20231031140952.461641-2-philip.cox@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231031140952.461641-1-philip.cox@canonical.com> References: <20231031140952.461641-1-philip.cox@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Srinivas Pandruvada BugLink: https://bugs.launchpad.net/bugs/2042101 The EHL (Elkhart Lake) based platforms provide a OOB (Out of band) service, which allows to wakup device when the system is in S5 (Soft-Off state). This OOB service can be enabled/disabled from BIOS settings. When enabled, the ISH device gets PME wake capability. To enable PME wakeup, driver also needs to enable ACPI GPE bit. On resume, BIOS will clear the wakeup bit. So driver need to re-enable it in resume function to keep the next wakeup capability. But this BIOS clearing of wakeup bit doesn't decrement internal OS GPE reference count, so this reenabling on every resume will cause reference count to overflow. So first disable and reenable ACPI GPE bit using acpi_disable_gpe(). Fixes: 2e23a70edabe ("HID: intel-ish-hid: ipc: finish power flow for EHL OOB") Reported-by: Kai-Heng Feng Closes: https://lore.kernel.org/lkml/CAAd53p4=oLYiH2YbVSmrPNj1zpMcfp=Wxbasb5vhMXOWCArLCg@mail.gmail.com/T/ Tested-by: Kai-Heng Feng Signed-off-by: Srinivas Pandruvada Signed-off-by: Jiri Kosina (cherry picked from commit 8f02139ad9a7e6e5c05712f8c1501eebed8eacfd) Signed-off-by: Philip Cox Acked-by: John Cabaj --- drivers/hid/intel-ish-hid/ipc/pci-ish.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c index 2c67ec17bec6..514c193d410a 100644 --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c @@ -131,6 +131,14 @@ static int enable_gpe(struct device *dev) } wakeup = &adev->wakeup; + /* + * Call acpi_disable_gpe(), so that reference count + * gpe_event_info->runtime_count doesn't overflow. + * When gpe_event_info->runtime_count = 0, the call + * to acpi_disable_gpe() simply return. + */ + acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number); + acpi_sts = acpi_enable_gpe(wakeup->gpe_device, wakeup->gpe_number); if (ACPI_FAILURE(acpi_sts)) { dev_err(dev, "enable ose_gpe failed\n");