From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAF4FE7C4E9 for ; Wed, 4 Oct 2023 19:15:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245536AbjJDTPY (ORCPT ); Wed, 4 Oct 2023 15:15:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245327AbjJDTPF (ORCPT ); Wed, 4 Oct 2023 15:15:05 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AF0911B; Wed, 4 Oct 2023 12:14:54 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD8A5C433C7; Wed, 4 Oct 2023 19:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696446894; bh=ApDtmv1qaYUzh+pCuxsBvwGBh8O049GYBAMvDvx1obk=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=TMYJ03zG548A10EOdx0m9PqE48jMm461T/Vv7Y0d6un4xq17JNktqH5MSHtkkXXEr NG9rwPnK/PGy8hojDP1JTJqjHV9/yq+Re46N6OfV48b8/aVaWQcabd9Z/Rs33wDYbQ FUirFo19d3/UKpljDIECkCOOy7Yhg63BlhMBCYJ9qiaxPUiXzsVtPva7FnJb4eYum5 2vS5u0tQ1D0tm916wP5D0eN0xWM+aEoYD45kQJ+UIE2FI2aNT8A4ihfgrh01zC2Vbs eTa+Ho2Heun97pSJmixDTbUrl5GQy9Z4i4Z1j0WEsmlEkp0kXbp83IdJDwYnA+w5a7 wsftpvSXDPrIA== Date: Wed, 4 Oct 2023 21:14:50 +0200 (CEST) From: Jiri Kosina To: Srinivas Pandruvada cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Kai-Heng Feng Subject: Re: [PATCH] HID: intel-ish-hid: ipc: Disable and reenable ACPI GPE bit In-Reply-To: <20231003155332.1855569-1-srinivas.pandruvada@linux.intel.com> Message-ID: References: <20231003155332.1855569-1-srinivas.pandruvada@linux.intel.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 3 Oct 2023, Srinivas Pandruvada wrote: > 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 > --- > 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 55cb25038e63..710fda5f19e1 100644 > --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c > +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c > @@ -133,6 +133,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"); Applied, thanks Srinivas. -- Jiri Kosina SUSE Labs