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: 147968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2180450vqb; Tue, 3 Oct 2023 08:54:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGnt4K9mcCq4/wF/DZqXyyyBnCPmHEdXzn9sLU3fBAT9cNSKkQI4gUKa62VunG/yrqL5LL X-Received: by 2002:a05:6a00:1589:b0:693:4a43:1c7e with SMTP id u9-20020a056a00158900b006934a431c7emr14920386pfk.29.1696348452423; Tue, 03 Oct 2023 08:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696348452; cv=none; d=google.com; s=arc-20160816; b=0e/FXiERmfrVC9KT6jSAfMGrboI9gsa5zhxsGDB/iOqtmqgST/SSU62MvTaydtn8w4 qCXNG2IPrje6rRL1txO17oQysyDvZhlOCBtM4mX6YWKEc2xvtukWPfLhBr8iLwPm9Rym /RFvbvh/oy7Zi70NdR3QUvENV4UuXtfm1/8JGfUgQOCVLT3wNEujJNDbqJkWH80fuFMK B9mzOWpHxuX0uIopYx2aw6o7qs8URA9KwPshU57CnzenUFUjXuawyHQPNdmgXeiBVUwa Ywm9McEG0hDDO5UVDw2/8nAQLa9vVrMop6iBn+lhFR2nyTDf9Pqh3JLvU71X7/A3+0Uf AFWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=rz/POYks7sGwcFjReMA4jm9360WS+VjrYzRccVPJOyA=; fh=2f8p0LzUhxBTvEi8vrsODvjrTRYp30GjAxO1mIQY8S4=; b=C2Y3b0VHFAS1GaZaTN8M5TJGPbwkgTWOZrvJAQh77GO8Il7yevhB2mf3a8VCznQFRS Ay8ENH0CWTN9DXdtUlzW0ybOSoSYyPPpdzHBejhXBrIY9Qk6dNz/+KyNJC4qtagoOvGa +etCkJ80vBqfNfj5mjRi8EKhnlSqpvxDVUMvT3+Ath7d3uylkbe8ccudYWDMRcBOBPcc xEtgeJRs+TAM0baZZruEjA/bHe2REyDojg1ViDrv0MmF7Z7p102/myKZOrL1pn8UcyLQ suOX1XCmJuDszCBbjMea81dU3rIzrKYcUj2GcoVg0Zh0WMC9I3A9Br50OEY0Oi6yoOw9 BQXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gpsbtYqI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id u11-20020a056a00098b00b00690fe0f6e0dsi1831509pfg.68.2023.10.03.08.54.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 08:54:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gpsbtYqI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 964BC81355EE; Tue, 3 Oct 2023 08:54:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231799AbjJCPxq (ORCPT + 17 others); 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 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 03 Oct 2023 08:54:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778750275174088864 X-GMAIL-MSGID: 1778750275174088864 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");