Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp476455rdb; Tue, 19 Sep 2023 00:39:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHx4FIGNUIoXYOeqGBBv/M/EzupaUaQdkgiQ9m0dueNLFe8FJqcuRzuZh47oRQzUIwrENWf X-Received: by 2002:a17:903:230f:b0:1c1:ec40:9321 with SMTP id d15-20020a170903230f00b001c1ec409321mr11869962plh.60.1695109143684; Tue, 19 Sep 2023 00:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695109143; cv=none; d=google.com; s=arc-20160816; b=eajU7P9NZjJLu+Uy+Z+jpzuLXlzeMteUq8aje+u4jI8DMjc12PKhMqssMynIOf6H0P oensD54t/aN6152XcDvX04fsTTkvB/lM7iXTg8AOEPzwYtisEKVBNYRXMQzex/rePGBt l9kn0DUtmP/IwwITdustKFtqae0oK4++UcMkuOsLmcc7PuhXsWDWKv8B5NPZLFCUsW6w VOSsQR3YpO3Fll9uuB/1IqMdS50+JFOrby0P8gtV+VAx1e2VvtZTaip2CQrvcqqwtK7G Srki90XxD9dQLitnaogewT/ze4WHxAUZGlvKwMq0A9dsoEiNFTAfXVzT9xlXUrmDUTwR 1j+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=MLRLAry2NlpMQaxof2G7yyxkoAcAjcPTZ7UlFboZNJM=; fh=bvzPOzglhK96TxOdhJPqRe5AG+3QmwAY5IiOIP1MIfg=; b=XVdrNQufH0r6HF8CuE0TzajXwCxjngfS31SuAUT1mBeFfoDb5OLonRngZ+lWIUH+kf ++fXeRPb61oOzGPW+x8akcL/79AUhfn/kf8obSMU/yeakg8jMP8eooCRtYs7Ffsuw0P1 zsSC6y8sXkxfTwwC3W/9oqkQdCmIfm3O1WrD2kYAK/8cMnOTFvTLHJ8AZG+l4HYTFqHy hSD1ykAFnuWL7V9/OHOi/LbgJuaDDFpjWMK4XW4XoL+RVwRkoGqNQMTgKOQPXo+6B09M e6MGkof6a2p6IboUJ3equHxW+6dACZQ7b2Nr6HQQ3AfBIfBABTHqo4wxbzWk5R5Uxl5Q /ulA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=C9ZkFaGt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id m11-20020a1709026bcb00b001b829a32f2dsi5848773plt.457.2023.09.19.00.39.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 00:39:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=C9ZkFaGt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id DB79D8142D95; Tue, 19 Sep 2023 00:36:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231693AbjISHgw (ORCPT + 99 others); Tue, 19 Sep 2023 03:36:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229803AbjISHgt (ORCPT ); Tue, 19 Sep 2023 03:36:49 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3411FFC for ; Tue, 19 Sep 2023 00:36:43 -0700 (PDT) Received: from mail-il1-f197.google.com (mail-il1-f197.google.com [209.85.166.197]) (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-1.canonical.com (Postfix) with ESMTPS id 88A2F3F662 for ; Tue, 19 Sep 2023 07:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1695109001; bh=MLRLAry2NlpMQaxof2G7yyxkoAcAjcPTZ7UlFboZNJM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=C9ZkFaGtSwvZIUkupLFlOBmkbPzHkLhOck8VkqBNgNbK5K3dr4IQng+CECFDCRPcd FoYXkaBmzusvGjrxtIROvNRs2eSc/v7FrnoLLj+ZieD2HTn0CQmVCJe8zotc6DxIvl LluL8TpNVmLl/TjN02zLotF0dp9ndYRrFhRm14cP9NsjzomYMX6VBqfTAKCayi8yLi J/7xtX9xWyIu6CHLP13CySUml2yxMN1THbZmZ8y1x9wV6YBYLSAZLiMibD5FwqsFza PHJy2/zN1k8E4yMuIjRyM/X9YtX6unVnUhZNQ7cIBImRsKq8I72LGLvnQ7SoVoTNDf s8gOg2kBk+5Hw== Received: by mail-il1-f197.google.com with SMTP id e9e14a558f8ab-34fc5edba1cso31338025ab.3 for ; Tue, 19 Sep 2023 00:36:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695109000; x=1695713800; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MLRLAry2NlpMQaxof2G7yyxkoAcAjcPTZ7UlFboZNJM=; b=QxrBUE4vXAbTaH0RArKdJfsyGHFc314qupQzxaJlxNKU85abAbFB649y/arhHs5TqU mXaBmXSEJ1KqUWcU+ESoE8k/jvF0ENFZwM6pU7smcPnnXIguPxBfaCnL/dJnXcD73tC2 0N6imlYbZI42xcvAVn9ywhprfzfiAr+Z2lgJA4RyMMaSI3HKN4DAl5doBa1TGBw8brkW yvvn0phF0lhiudoXu/5uviFs75UN5sNbyVnd0ieIhgllQnvORmb05VRu8SF/aFD9scLs KlEXaY+tIasdGUzktYdlzvohONfRlKqzJ99ekgw8YSoDxog96FUxjp2LiBPaaFDvKD3h adKA== X-Gm-Message-State: AOJu0YzSxF5MQt4AoTQXGAJb+EgZICEt+kWkLXdaWsgMA0PQsXx1ooEI 4mjuR6Q0kbdyd3qkrS61CDsNhTvWC/G2fS9IVJjKhPmpycFFYfbffSaYx6HBGLv6NMpDJN9Xq9u GLKZlgJxoC0waYzT5SGgCcgNopZGDEnj9aonyqISMAkLQNWnjrpN790S6ag== X-Received: by 2002:a92:a309:0:b0:34d:f0b9:97fd with SMTP id a9-20020a92a309000000b0034df0b997fdmr12317190ili.8.1695109000341; Tue, 19 Sep 2023 00:36:40 -0700 (PDT) X-Received: by 2002:a92:a309:0:b0:34d:f0b9:97fd with SMTP id a9-20020a92a309000000b0034df0b997fdmr12317179ili.8.1695109000063; Tue, 19 Sep 2023 00:36:40 -0700 (PDT) MIME-Version: 1.0 References: <20230914041806.816741-1-kai.heng.feng@canonical.com> <7b45ac2ed091497b4e21a6a5c19956161175ba16.camel@linux.intel.com> In-Reply-To: From: Kai-Heng Feng Date: Tue, 19 Sep 2023 15:36:26 +0800 Message-ID: Subject: Re: [PATCH] HID: intel-ish-hid: ipc: Rework EHL OOB wakeup To: srinivas pandruvada Cc: "Xu, Even" , "jikos@kernel.org" , "benjamin.tissoires@redhat.com" , "linux-pm@vger.kernel.org" , "linux-pci@vger.kernel.org" , "Lee, Jian Hui" , "Zhang, Lixu" , "Ba, Najumon" , "linux-input@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 19 Sep 2023 00:36:57 -0700 (PDT) On Mon, Sep 18, 2023 at 11:57=E2=80=AFPM srinivas pandruvada wrote: > > Hi Kai-Heng, > On Mon, 2023-09-18 at 09:17 +0800, Kai-Heng Feng wrote: > > Hi Even, > > > > On Mon, Sep 18, 2023 at 8:33=E2=80=AFAM Xu, Even wr= ote: > > > > > > Hi, Kai-Heng, > > > > > > I just got feedback, for testing EHL S5 wakeup feature, you need > > > several steps to setup and access > > > "https://portal.devicewise.com/things/browse" to trigger wake. > > > But currently, our test account of this website are all out of > > > data. > > > So maybe you need double check with the team who required you > > > preparing the patch for the verification. > > > > The patch is to solve the GPE refcount overflow, while maintaining S5 > > wakeup. I don't have any mean to test S5 wake. > > > The issue is not calling acpi_disable_gpe(). To reduce the scope of > change can we just add that instead of a adding new callbacks. This way > scope is reduced. This patch does exactly the same thing by letting PCI and ACPI handle the PME and GPE. Though the change seems to be bigger, it actually reduces the duped code, while keep the S5 wakeup ability intact. Kai-Heng > > Something like the attached > > Thanks, > Srinivas > > > > > > > > So if you also don't have ways to verify S5 wake functionality, maybe > > we can simply revert 2e23a70edabe ("HID: intel-ish-hid: ipc: finish > > power flow for EHL OOB") as alternative? > > > > Kai-Heng > > > > > Thanks! > > > > > > Best Regards, > > > Even Xu > > > > > > -----Original Message----- > > > From: Xu, Even > > > Sent: Friday, September 15, 2023 3:27 PM > > > To: Kai-Heng Feng > > > Cc: srinivas pandruvada ; > > > jikos@kernel.org; benjamin.tissoires@redhat.com; > > > linux-pm@vger.kernel.org; linux-pci@vger.kernel.org; Lee, Jian Hui > > > ; Zhang, Lixu ; > > > Ba, Najumon ; linux-input@vger.kernel.org; > > > linux-kernel@vger.kernel.org > > > Subject: RE: [PATCH] HID: intel-ish-hid: ipc: Rework EHL OOB wakeup > > > > > > Hi, Kai-Heng, > > > > > > I am also not familiar with this S5 wakeup test case. > > > I already sent out mails to ask for help on it. > > > Will come back to you once I get feedback. > > > Thanks! > > > > > > Best Regards, > > > Even Xu > > > > > > -----Original Message----- > > > From: Kai-Heng Feng > > > Sent: Friday, September 15, 2023 2:01 PM > > > To: Xu, Even > > > Cc: srinivas pandruvada ; > > > jikos@kernel.org; benjamin.tissoires@redhat.com; > > > linux-pm@vger.kernel.org; linux-pci@vger.kernel.org; Lee, Jian Hui > > > ; Zhang, Lixu ; > > > Ba, Najumon ; linux-input@vger.kernel.org; > > > linux-kernel@vger.kernel.org > > > Subject: Re: [PATCH] HID: intel-ish-hid: ipc: Rework EHL OOB wakeup > > > > > > Hi Even, > > > > > > On Fri, Sep 15, 2023 at 1:31=E2=80=AFPM Xu, Even = wrote: > > > > > > > > Hi, Srinivas, > > > > > > > > Sure, I will test it. > > > > As long term not working on EHL, I doesn't have EHL board on hand > > > > right now, I can test this patch on other ISH related platforms. > > > > From the patch, it's focus on EHL platform, I assume Kai-Heng > > > > already verified the function on EHL board. > > > > > > I only made sure the GPE overflow issue is fixed by the patch, but > > > I didn't test the S5 wakeup. > > > That's because I don't know how to test it on the EHL system I > > > have. > > > I'll test it if you can let me know how to test the S5 wakeup. > > > > > > Kai-Heng > > > > > > > I don't think it will take effect on other platforms, anyway, I > > > > will test it on the platforms I have to provide cross platform > > > > verification. > > > > > > > > Thanks! > > > > > > > > Best Regards, > > > > Even Xu > > > > > > > > -----Original Message----- > > > > From: srinivas pandruvada > > > > Sent: Friday, September 15, 2023 12:11 AM > > > > To: Kai-Heng Feng ; > > > > jikos@kernel.org; > > > > benjamin.tissoires@redhat.com > > > > Cc: linux-pm@vger.kernel.org; linux-pci@vger.kernel.org; Lee, > > > > Jian Hui > > > > ; Xu, Even ; Zhang, > > > > Lixu > > > > ; Ba, Najumon ; > > > > linux-input@vger.kernel.org; linux-kernel@vger.kernel.org > > > > Subject: Re: [PATCH] HID: intel-ish-hid: ipc: Rework EHL OOB > > > > wakeup > > > > > > > > Hi Even, > > > > > > > > On Thu, 2023-09-14 at 12:18 +0800, Kai-Heng Feng wrote: > > > > > System cannot suspend more than 255 times because the driver > > > > > doesn't > > > > > have corresponding acpi_disable_gpe() for acpi_enable_gpe(), so > > > > > the > > > > > GPE refcount overflows. > > > > > > > > > > Since PCI core and ACPI core already handles PCI PME wake and > > > > > GPE > > > > > wake when the device has wakeup capability, use > > > > > device_init_wakeup() > > > > > to let them do the wakeup setting work. > > > > > > > > > > Also add a shutdown callback which uses pci_prepare_to_sleep() > > > > > to > > > > > let PCI and ACPI set OOB wakeup for S5. > > > > > > > > > Please test this change. > > > > > > > > Thanks, > > > > Srinivas > > > > > > > > > Fixes: 2e23a70edabe ("HID: intel-ish-hid: ipc: finish power > > > > > flow for > > > > > EHL OOB") > > > > > Cc: Jian Hui Lee > > > > > Signed-off-by: Kai-Heng Feng > > > > > --- > > > > > drivers/hid/intel-ish-hid/ipc/pci-ish.c | 59 > > > > > +++++++---------------- > > > > > -- > > > > > 1 file changed, 15 insertions(+), 44 deletions(-) > > > > > > > > > > diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c > > > > > b/drivers/hid/intel-ish-hid/ipc/pci-ish.c > > > > > index 55cb25038e63..65e7eeb2fa64 100644 > > > > > --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c > > > > > +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c > > > > > @@ -119,42 +119,6 @@ static inline bool > > > > > ish_should_leave_d0i3(struct > > > > > pci_dev *pdev) > > > > > return !pm_resume_via_firmware() || pdev->device =3D=3D > > > > > CHV_DEVICE_ID; } > > > > > > > > > > -static int enable_gpe(struct device *dev) -{ -#ifdef > > > > > CONFIG_ACPI > > > > > - acpi_status acpi_sts; > > > > > - struct acpi_device *adev; > > > > > - struct acpi_device_wakeup *wakeup; > > > > > - > > > > > - adev =3D ACPI_COMPANION(dev); > > > > > - if (!adev) { > > > > > - dev_err(dev, "get acpi handle failed\n"); > > > > > - return -ENODEV; > > > > > - } > > > > > - wakeup =3D &adev->wakeup; > > > > > - > > > > > - acpi_sts =3D acpi_enable_gpe(wakeup->gpe_device, wakeup- > > > > > > gpe_number); > > > > > - if (ACPI_FAILURE(acpi_sts)) { > > > > > - dev_err(dev, "enable ose_gpe failed\n"); > > > > > - return -EIO; > > > > > - } > > > > > - > > > > > - return 0; > > > > > -#else > > > > > - return -ENODEV; > > > > > -#endif > > > > > -} > > > > > - > > > > > -static void enable_pme_wake(struct pci_dev *pdev) -{ > > > > > - if ((pci_pme_capable(pdev, PCI_D0) || > > > > > - pci_pme_capable(pdev, PCI_D3hot) || > > > > > - pci_pme_capable(pdev, PCI_D3cold)) && > > > > > !enable_gpe(&pdev- > > > > > > dev)) { > > > > > - pci_pme_active(pdev, true); > > > > > - dev_dbg(&pdev->dev, "ish ipc driver pme wake > > > > > enabled\n"); > > > > > - } > > > > > -} > > > > > - > > > > > /** > > > > > * ish_probe() - PCI driver probe callback > > > > > * @pdev: pci device > > > > > @@ -225,7 +189,7 @@ static int ish_probe(struct pci_dev *pdev, > > > > > const > > > > > struct pci_device_id *ent) > > > > > > > > > > /* Enable PME for EHL */ > > > > > if (pdev->device =3D=3D EHL_Ax_DEVICE_ID) > > > > > - enable_pme_wake(pdev); > > > > > + device_init_wakeup(dev, true); > > > > > > > > > > ret =3D ish_init(ishtp); > > > > > if (ret) > > > > > @@ -248,6 +212,19 @@ static void ish_remove(struct pci_dev > > > > > *pdev) > > > > > ish_device_disable(ishtp_dev); } > > > > > > > > > > + > > > > > +/** > > > > > + * ish_shutdown() - PCI driver shutdown callback > > > > > + * @pdev: pci device > > > > > + * > > > > > + * This function sets up wakeup for S5 */ static void > > > > > +ish_shutdown(struct pci_dev *pdev) { > > > > > + if (pdev->device =3D=3D EHL_Ax_DEVICE_ID) > > > > > + pci_prepare_to_sleep(pdev); } > > > > > + > > > > > static struct device __maybe_unused *ish_resume_device; > > > > > > > > > > /* 50ms to get resume response */ > > > > > @@ -370,13 +347,6 @@ static int __maybe_unused > > > > > ish_resume(struct > > > > > device *device) > > > > > struct pci_dev *pdev =3D to_pci_dev(device); > > > > > struct ishtp_device *dev =3D pci_get_drvdata(pdev); > > > > > > > > > > - /* add this to finish power flow for EHL */ > > > > > - if (dev->pdev->device =3D=3D EHL_Ax_DEVICE_ID) { > > > > > - pci_set_power_state(pdev, PCI_D0); > > > > > - enable_pme_wake(pdev); > > > > > - dev_dbg(dev->devc, "set power state to D0 for > > > > > ehl\n"); > > > > > - } > > > > > - > > > > > ish_resume_device =3D device; > > > > > dev->resume_flag =3D 1; > > > > > > > > > > @@ -392,6 +362,7 @@ static struct pci_driver ish_driver =3D { > > > > > .id_table =3D ish_pci_tbl, > > > > > .probe =3D ish_probe, > > > > > .remove =3D ish_remove, > > > > > + .shutdown =3D ish_shutdown, > > > > > .driver.pm =3D &ish_pm_ops, > > > > > }; > > > > > > > > > >