From patchwork Tue Oct 3 15:53:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Pandruvada X-Patchwork-Id: 729103 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 A64FDE7AD72 for ; Tue, 3 Oct 2023 15:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231758AbjJCPxq (ORCPT ); Tue, 3 Oct 2023 11:53:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231206AbjJCPxp (ORCPT ); Tue, 3 Oct 2023 11:53:45 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B22BA6; Tue, 3 Oct 2023 08:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696348422; x=1727884422; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=cSNZnvTcszynHkc7EOnPJtMLPyMJLtAPb33rc17IhQU=; b=gpsbtYqIlth1T2AggptEJW4GTA+aYSxWT8OfmV5C+wqG6FLFE7Pqu+SQ F+DbZWVYho8bKafr7BPK6hDwFjUlSlgIr+Z+TpNUuDmfy6d+G9x/o/H2M 8A6cQa463rig9iOB0He4avuG0ozmymVsmZGshfTwJia0HpHdutKbBfE/v /P7lisGKk5EHumb1mMn9vYgMY+7LtvDExSXJ5Imkl+4cxI6tzP6UhwlsD qXZTTpfowL4yuBfCBwCB/jjG8bZgd3ibvDe/3+mwdawS95OLxyPWr9cWs nXW9AzIWaVdMmdlH08jWjn+AjTy6zMBUFcw0S6bYYeUiYg/l/TmOJ/W5p Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="380186347" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="380186347" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 08:53:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="744564490" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="744564490" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by orsmga007.jf.intel.com with ESMTP; 03 Oct 2023 08:53:41 -0700 From: Srinivas Pandruvada To: jikos@kernel.org, benjamin.tissoires@redhat.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada , Kai-Heng Feng Subject: [PATCH] HID: intel-ish-hid: ipc: Disable and reenable ACPI GPE bit Date: Tue, 3 Oct 2023 08:53:32 -0700 Message-Id: <20231003155332.1855569-1-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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");