Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp623597pxj; Thu, 13 May 2021 12:51:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxN8msAa1nHKIhgagH+IknNOREs9Bs9A8bU8CLQLyDlSQqVvoVtJ9HRS/pTpoeHzeMnc8p7 X-Received: by 2002:aa7:c610:: with SMTP id h16mr51445077edq.202.1620935477170; Thu, 13 May 2021 12:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620935477; cv=none; d=google.com; s=arc-20160816; b=UV4PayMLMwjwQQmfUmG4m0I+RkFE6TwAnR99lyUkUOOPoxzc4WxClCjSkXQHpiNwV4 8AS21NkBG0SIV6sZDbpg2vq2IJcp1HcoHyo9YSJGxWcsYcNEqUXbU6FK0imceLpyN7X/ xRFpsBQ2Gcu5k8axWWrEJgHU2ab5+Z4ulMccr3SXRovx5Vqdb2TRooWT3DbiFo6ZGQ7P QipNWRJ2x78XxjmgiTvvetSIzGMydQDBoEfIFovMCO5ineRERsJHu/AbtkIuEVRSLaHJ PJIYXhhXCRtgDaFqOQjIg/I86SDjvoq+L+dR3+dXiWcN3MFBWY7XJjzQ2rXuc+UghUUm 3kmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=mkGxUef8G9orV6YMDGO9Odn1MTt/vN2b+gVm7BMd4Ik=; b=SDhP/iZAB6WPdvTEFu4gx550dTT5lb9M2C3u9vv/ygkcuQq6MjbmjOPfctI/cHCVxf 4gjflj4Ze6hIL4yUeuppnNDYDdZsdPYUIMO+4tc7yT4QIvSlKT+jh+p8L+a58/MmN72W E1xFmmG+NGiTHkoiL2afP5ROWunGJxLA3NCHaTWL50hZmzpdfSAhM45T/mNxT3GXr7tI xaMwtMxO57wAPdFGNbk6NP2QpcJMHu6OWpge3f1PV1L7C+yag6air2Qzpsre/12QgkAI /p+ykU0cuZtJ+ZLkyzVgTnDduMv1mt/rgOGpQF7xayFw9DDnVb/PUIHS3HAp5twdGLxX fxKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dWkKpQiu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v1si4188817eju.143.2021.05.13.12.50.52; Thu, 13 May 2021 12:51:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dWkKpQiu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234191AbhEMNun (ORCPT + 99 others); Thu, 13 May 2021 09:50:43 -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-kernel@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----- --=-=-=--