Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4628803rdb; Fri, 15 Sep 2023 07:52:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHQzjWeE8kRsEHqOeQr1Ht8gpAibwsUIble5qZhb4IGpHPh7xs7Ylz9U2Ljvdj0nM53dlSP X-Received: by 2002:a05:6a00:181d:b0:68e:2d59:b1f3 with SMTP id y29-20020a056a00181d00b0068e2d59b1f3mr2364638pfa.13.1694789524759; Fri, 15 Sep 2023 07:52:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694789524; cv=none; d=google.com; s=arc-20160816; b=FJd6i+jkyWxfRkOS6LTB0/JTr2RyThexqEoJ6Wa7QfPbkQE93MX+iSed/1fAS2yLb/ OjwsShEOGTM68CKBi8b9oYDQzj0cf2wqrktd76quEAhda7F1DUhm+J5bSwMFTnxh6a5Y cVk2nhhYsBG5gwJtjrDEIEKIoFQuKsFBVQhOcU8Iy9WBp6P4UMBzRLlzaDRCHS4Cq+uC KdmlFAe/6pN04OLH9zPWxrDDsfh0fsRhKodC+Vo+8FjYpfmrj4bu/XnleC4P2V/owteA jt3pHzPwRNvczJco9BV+pp2+Kcpiy2ctiqHG0ZHsxQ6BM+sZP60rOq2LUJHXm/8baSt5 tafg== 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=13SYOno9PzBAELprvqBKW3TKbtgqHXvDNkYZ3UiLqu0=; fh=FiA0+KqZYNbt0cP/jKV8gtnnwEMAFvc31hPDn98FAzs=; b=hLWH1DagXEmJsi6G2pGBZySZM542rpAicKFJQ47pmrdw3jXRSPJqMYagfhaxYhl+59 ic2EFoS7P0GIQVodPNa7W9JHhqQddNhdFlDixmw8ffGLOzu3yJQS6qbyELtc9cRcsWpu EQ87J7zYNEmC7qIRI4pgsZdCkl7603Su5ie9zIrYYdafI19AGKLC2BN1ljbg8boo+zPr OvVGd7pVZeCyVrvn04Q/31JKwkNLmRvrlVu/sMV+jt/nifVw3aiMXVXCKWaVJWV+ut/B cDkTPi8wXORDncY25TJCB+RpJuZgf4DuDNa/AnrgGKKX5s3cgVHtgNR9sXi8evYEUbE8 3XYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=NOlYLm+R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id u9-20020a056a00098900b0068fe8cac913si3554645pfg.324.2023.09.15.07.52.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 07:52:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=NOlYLm+R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 1E5AE81016B9; Thu, 14 Sep 2023 23:01:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232225AbjIOGBU (ORCPT + 99 others); Fri, 15 Sep 2023 02:01:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232207AbjIOGBS (ORCPT ); Fri, 15 Sep 2023 02:01:18 -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 6F9E62710 for ; Thu, 14 Sep 2023 23:01:11 -0700 (PDT) Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (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 183153F672 for ; Fri, 15 Sep 2023 06:01:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1694757670; bh=13SYOno9PzBAELprvqBKW3TKbtgqHXvDNkYZ3UiLqu0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=NOlYLm+RMZB3pxLl3mWLFQfpUCNqWRUFIQLftnb9X3+SkcL5jnxfwNH6ylHlDNsLv wU3QwIkQfVTMeEgmK9eAz0HZ+grnnnzn8CjE/yua3IBFQc1R8eExMaPQTe5jvNvrpl AgBVD0PmtcharLqX6DT4IPA5S8QrzihDXjsHIsczc/1bGx7MOrPsYCpmPOcGTBSwte baH79q35N6ZY1NEK8US+WpI/NlIIdE1XGC3RHoRI7HV+tCyqWEoZb1NkPOQ7mww8IO sdwTa2nZPPl8HE5W/o+HLZqj7nyBlaSiyyx7rJCCi1ySuGEWRrGVQzslazJrHgwzoT uakwKxI5OEhcw== Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-2748bffe932so733771a91.3 for ; Thu, 14 Sep 2023 23:01:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694757668; x=1695362468; 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=13SYOno9PzBAELprvqBKW3TKbtgqHXvDNkYZ3UiLqu0=; b=ktF80oGkT1BYPzGj7HhMKHJV8u/yFkp8YTDMwGvd2vNQf7aiwmzQeZHxS8pxUDkAGI lZbSb4Dm4d+xB1ef5xbuq40b8Q8qJuih76oMW9ySj+9bUX9vvBsWmlNYzaI9pNRJZEA3 8P6Q0djIiUB7eAX5JHtaQTuMi1s8Y98rWsmFKiS1tNRANQBtNCSbJWWuWvbmWAB0117q I5pMy21A5GY8tL2C+fKIWNSSjWlsxGI9h3BvLcpVJY4HBJwdvAtfXZOVsex51Lxow8TH h8EwiNIQ9MR21mFfk2utEXDoobBB5wwYsLhY+QrTRxu0kqYGqO7Ty0vF9Ib0EsRbk6Pn XoRg== X-Gm-Message-State: AOJu0YwtlLWk+UdD7T5tw35Tn1ZUL0hqA2W76jH4YwqYd4W6pcOmv5Fr 8JmkdsHqJTHfuOXbsEsu3e9S5LRuEgoE1ZAcBHx+FcdYuJOgQlG15C/SJRzUI96UsKqJ+PN/ply GdIE9ARNR+xKrndKUsmqf8RFEGw3U2nRlxxNbXiYCn3U6iDAV2pbnjImBtA== X-Received: by 2002:a17:90a:e547:b0:268:1355:b03e with SMTP id ei7-20020a17090ae54700b002681355b03emr567212pjb.38.1694757668633; Thu, 14 Sep 2023 23:01:08 -0700 (PDT) X-Received: by 2002:a17:90a:e547:b0:268:1355:b03e with SMTP id ei7-20020a17090ae54700b002681355b03emr567190pjb.38.1694757668286; Thu, 14 Sep 2023 23:01:08 -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: Fri, 15 Sep 2023 14:00:55 +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 fry.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 (fry.vger.email [0.0.0.0]); Thu, 14 Sep 2023 23:01:25 -0700 (PDT) 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 n= ow, I can test this patch on other ISH related platforms. > From the patch, it's focus on EHL platform, I assume Kai-Heng already ver= ified 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; benjam= in.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.kern= el.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, > > }; > > >