From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6129C433B4 for ; Thu, 13 May 2021 13:49:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C66B613D3 for ; Thu, 13 May 2021 13:49:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234171AbhEMNum (ORCPT ); Thu, 13 May 2021 09:50:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:56546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230508AbhEMNum (ORCPT ); Thu, 13 May 2021 09:50:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 405F5613D3; Thu, 13 May 2021 13:49:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620913772; bh=phBFwesI6LoPB/FzWyu6jtVbaIjj25q55QDNPJoXfVU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=dWkKpQiuHXjyiVEUOBmkp2lNVNXuq/t/dO1M40CsbH+LVDzZhjJYejlpy/Pz1NPXs MyrzaF79RRM7PJjs2U/hfZRoNQILumq/lfkuU9WtPLqDC5QJFvDNVX8DyGDzuX0pWW FXLirCs6Er7OjWOALgg14PCYOQUBrvAd+oJAUfB0exG+UqGF8nNRXR6coJ04wMxBZz AA524aHHICj6S6N4f04YDm2C8OoJf/Rug2BAp0kbHMVwnTeRrD+jmNQuH0S/kwWraZ ju/PhrmhvxvIKwhrWd2bV358HVfWx3lKArYU5a0wO5XNi+/mrhuwlZ3dtivZr2NE4p n3U6a14cZ2oUQ== From: Felipe Balbi To: Matthias Kaehlcke Cc: Sandeep Maheswaram , Andy Gross , Bjorn Andersson , Greg Kroah-Hartman , Stephen Boyd , Doug Anderson , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Manu Gautam Subject: Re: [PATCH v7 5/5] usb: dwc3: qcom: Keep power domain on to support wakeup In-Reply-To: References: <1619586716-8687-1-git-send-email-sanm@codeaurora.org> <1619586716-8687-6-git-send-email-sanm@codeaurora.org> <87lf92k9ms.fsf@kernel.org> Date: Thu, 13 May 2021 16:49:19 +0300 Message-ID: <87tun67nhc.fsf@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Matthias Kaehlcke writes: >> Sandeep Maheswaram writes: >> > If wakeup capable devices are connected to the controller (directly >> > or through hubs) at suspend time keep the power domain on in order >> > to support wakeup from these devices. >> > >> > Signed-off-by: Sandeep Maheswaram >> > --- >> > drivers/usb/dwc3/dwc3-qcom.c | 17 +++++++++++++++++ >> > 1 file changed, 17 insertions(+) >> > >> > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom= .c >> > index 82125bc..1e220af 100644 >> > --- a/drivers/usb/dwc3/dwc3-qcom.c >> > +++ b/drivers/usb/dwc3/dwc3-qcom.c >> > @@ -17,9 +17,11 @@ >> > #include >> > #include >> > #include >> > +#include >> > #include >> > #include >> > #include >> > +#include >> >=20=20 >> > #include "core.h" >> >=20=20 >> > @@ -354,10 +356,19 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *q= com) >> > { >> > u32 val; >> > int i, ret; >> > + struct dwc3 *dwc =3D platform_get_drvdata(qcom->dwc3); >> > + struct usb_hcd *hcd; >> > + struct generic_pm_domain *genpd =3D pd_to_genpd(qcom->dev->pm_domain= ); >> >=20=20 >> > if (qcom->is_suspended) >> > return 0; >> >=20=20 >> > + if (dwc->xhci) { >> > + hcd =3D platform_get_drvdata(dwc->xhci); >> > + if (usb_wakeup_enabled_descendants(hcd->self.root_hub)) >> > + genpd->flags |=3D GENPD_FLAG_ACTIVE_WAKEUP; >> > + } >>=20 >> wow, you really need to find a way to do these things generically >> instead of bypassing a bunch of layers and access stuff $this doesn't >> directly own. >> >> I'm gonna say 'no' to this, sorry. It looks like xhci should, directly, >> learn about much of this instead of hiding it 3-layers deep into the >> dwc3 glue layer for your specific SoC. > > Maybe this could be addressed with a pair of wakeup quirks, one for suspe= nd, > another for resume. An optional genpd field could be added to struct > xhci_plat_priv. The wakeup quirks would set/clear GENPD_FLAG_ACTIVE_WAKEUP > of the genpd. > > Does the above sound more palatable? I don't get why you need quirk flags. All you're doing here is: if (usb_wakeup_enabled_descendants(hcd->self.root_hub)) genpd->flags |=3D GENPD_FLAG_ACTIVE_WAKEUP; If you move this test to xhci_suspend(), you shouldn't need all the magic, right? =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFFBAEBCAAvFiEE9DumQ60WEZ09LIErzlfNM9wDzUgFAmCdLl8RHGJhbGJpQGtl cm5lbC5vcmcACgkQzlfNM9wDzUj2tQf+K+dP5MpCwBqSYUdMgtA1zQSdmvkXLPGS Wax1dNP9TJpEuCn5YKhnIvVrfFoEqjtZyiuPFC2T47XZzxNitOELldM8VcU9GSX6 9p+mdAGImL431lmjyn71VoRuTSQZyusSYodnsVMS5C4G0JYufRTnb7MJ3LQ8ICdv pKSAY3M/59Iey6xKPtajgoYa15GmyuqnFpc2eyW1i9K4fcRgZXyPcZgacARElYT6 dCrYk5HHD3qdHtYF0D2pk0vGGedc+FN80mCZ8l9+WZ581ExQ/CaiDCrfNY16OuMS ct/49vVMplt8JFrZODjrYBLffl0IunPFr21jrLB9JmunRDpqS8MSZw== =Wl3O -----END PGP SIGNATURE----- --=-=-=--