Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5933072rdb; Sun, 17 Sep 2023 20:35:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfe59FVR+RVzAuKuz5GecKEbB1Ej3t8bce1GPi6woxc/q7/DpzKVtccEEogS1M/uVQd1U+ X-Received: by 2002:a17:902:e88b:b0:1c5:634f:b36c with SMTP id w11-20020a170902e88b00b001c5634fb36cmr2101994plg.30.1695008156358; Sun, 17 Sep 2023 20:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695008156; cv=none; d=google.com; s=arc-20160816; b=kLv1FN0DJ2eQUJ9PYVQscVChRixAE/fJ9F1dZRMYueWabxISIk7ef28ZaJDH3aXqt0 r/WXchPHhnzN4ImnLZ8SWDNAkMAMTcWGaCu4L3c7xa13lBRM6F7/1F7/K6R8It/G0sKr IqPxfp5Vrnfk7UUhyXP7HpWGxSHzJIODB1+fpXhD8QJo0waPCZnh8UJ6BXkZfYye6N9G 1lGUcM978NmxnDpjX3MRLM5QcdBtilTcEufjH83P68Sa378JmSAAp3ViXr1N27xRf3Lt D8EsxQxclOGJ1ijvEmemk+ZDhtbQ3LHffNDyInlRkQ8FhFRjtJt53q8QwJoVpw7M8QPN J28Q== 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=eaTKx3J1vilBDf/S3SS7BBAAYhcj6+Y8iTvJpOcU5qQ=; fh=FiA0+KqZYNbt0cP/jKV8gtnnwEMAFvc31hPDn98FAzs=; b=xCgtZPSko7bVjt9tn5ldxFcA6ZLCKJh68JBVQjJ0R+EpRrRnFxj4OxApbdBxOk2g4Z si1NcymOfPGlSfiSJkEAM4ta3Q8fBWi7AF+alvDZdjb594iJMKWN4cq6nDQ+zR3u1lje VVwOELhfXMNyfcXurE1YkFBVJ/G2iucDOuIMIbDCz2FIUBttwDuXKB3+gllUj8zEsm5V 71zYhoGoyLj+z9tFOYaw2SUtEgz/UEOnl47gqIkePaciHOjqdzKTKAwwG2Kv2UUrar4B SAxy+IEWXln021YrctT3o9xPeA3yb00se+V1MIAsiLpipxR8Ys2qQyPpw92Sc39Tc7SR IQPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=uZav1LKf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id m3-20020a170902db0300b001c434927d8dsi5147930plx.131.2023.09.17.20.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 20:35:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=uZav1LKf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id AA33E801C1DC; Sun, 17 Sep 2023 18:21:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232760AbjIRBR1 (ORCPT + 99 others); Sun, 17 Sep 2023 21:17:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234809AbjIRBRZ (ORCPT ); Sun, 17 Sep 2023 21:17:25 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10DC1127 for ; Sun, 17 Sep 2023 18:17:17 -0700 (PDT) Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.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-0.canonical.com (Postfix) with ESMTPS id 1F48C3F314 for ; Mon, 18 Sep 2023 01:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1694999836; bh=eaTKx3J1vilBDf/S3SS7BBAAYhcj6+Y8iTvJpOcU5qQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=uZav1LKfzMuIYyW9zmBs5rx1GHnWjTItYxeZt/XgaN4r7qIH6/ZlUV5T1ciTJ+pwS 2tJowHUfZN5o3M8GBV0zh31WtRGGULjU4egg4DA4aeWrrbuSOom3g73mtaPWkYf0Gr 06yDzWaZufAGxpSOoNItFC2kNUHuByhlh7IwPHzRo2V+RLRqXR/xNKf0lxEgduTVRm q9UwB7uXAfS0MhsBVncwaBCQwQq1Ts7h0IwwLnVM0R5jhOITHCVZ4f6RwKeqj4UNaC ww7qsxwjq5/O+1yE7i1FnvQYhnHWrZK5/0L2lUtFgGg6rFPXYLPAGmqI2Jiqs1yJdc Ig4LEfM7iyyEA== Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-5784671b7ebso825366a12.1 for ; Sun, 17 Sep 2023 18:17:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694999834; x=1695604634; 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=eaTKx3J1vilBDf/S3SS7BBAAYhcj6+Y8iTvJpOcU5qQ=; b=hjOeJvomqVyYcrJa5uGF499k4VWe/fHOQDaBTll0rD7AVmJyh7dCOpso4xSFJU3pnA q2NSyEl2DLvFzU/Fj5eGN5nXKaEoQLVwW8qEY3IdU9VMTmfVw02uYaMT15xrx58stvBT VEmNirV7Ppy/aZw23TpNc9jxfy1N/hBnTlGoQUIoL7c8KJW8+BPK+v/7B3R9m2iUxcz2 MkL62oTCPNueIFkE2afGXXmZiULGpMV992Cmu9xbnw42NdyUG3x9+7aoIoXMl58QI0Mo 9QXC2S1ut7/IOkJEUw/LP1TjyaTWXR/DNAt3QOZAXtkSIWjvbECRMxfiN9cUmFhJom1t ZQhA== X-Gm-Message-State: AOJu0Yxy/zbN3bKbD48D++jTrVOuARbzJZK2kylAYM16uynJAWOwnLPJ eItsb7CdkFaVyV6JQp8xaE3adxaBeQiaYqR4/U9BW/aIOCvaKRiE4ZsTLHG1diISs4UA0OVR1L5 HdJuHJA8lm3yz5O1YlQ5ucSbXYK/L8GMm9GvPzewLydMPg3D3Hl4BPMM5bQ== X-Received: by 2002:a05:6a20:7f99:b0:14e:3daf:bef9 with SMTP id d25-20020a056a207f9900b0014e3dafbef9mr8305792pzj.16.1694999834052; Sun, 17 Sep 2023 18:17:14 -0700 (PDT) X-Received: by 2002:a05:6a20:7f99:b0:14e:3daf:bef9 with SMTP id d25-20020a056a207f9900b0014e3dafbef9mr8305771pzj.16.1694999833732; Sun, 17 Sep 2023 18:17:13 -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: Mon, 18 Sep 2023 09:17:00 +0800 Message-ID: Subject: Re: [PATCH] HID: intel-ish-hid: ipc: Rework EHL OOB wakeup 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" 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 morse.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 (morse.vger.email [0.0.0.0]); Sun, 17 Sep 2023 18:21:13 -0700 (PDT) Hi Even, On Mon, Sep 18, 2023 at 8:33=E2=80=AFAM Xu, Even wrote: > > 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 t= he 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. 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@kern= el.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.k= ernel.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@kern= el.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.k= ernel.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 wrot= e: > > > > 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 v= erified 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 te= st 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, > > > }; > > > > >