From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756892AbdCUIIi (ORCPT ); Tue, 21 Mar 2017 04:08:38 -0400 Received: from mga02.intel.com ([134.134.136.20]:6857 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755241AbdCUIIg (ORCPT ); Tue, 21 Mar 2017 04:08:36 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,198,1486454400"; d="asc'?scan'208";a="946524554" From: Felipe Balbi To: Baolin Wang , Mathias Nyman Cc: Mathias Nyman , Greg KH , Mark Brown , USB , LKML , Alan Stern Subject: Re: [PATCH v5 1/2] usb: host: plat: Enable xhci plat runtime PM In-Reply-To: References: <58908DBC.5010208@linux.intel.com> <58AB06EA.7040401@linux.intel.com> Date: Tue, 21 Mar 2017 10:07:28 +0200 Message-ID: <87d1dbuk73.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Baolin Wang writes: >>> I don't yet understand why we can't just keep runtime pm disabled as a >>> default for xhci platform devices. >>> It could be enabled by whatever creates the platform device by setting = some >>> device property >>> (or equivalent), which would be checked in xhci_plat_probe() before ena= bling >>> runtime pm. It >>> could then optionally be set in sysfs via power/control entry. >> >> I think runtime pm is not one hardware property, is it suitable if we >> introduce one device property to enable/disable runtime pm? > > As I said, runtime pm is not one hardware property, I think it is not > suitable if we introduce one device property to enable/disable runtime > pm. we already this functionality exposed on sysfs. > Secondly, we only can resume the xhci platform device by getting the > xhci usage counter from gadget driver, since the cable plug in/out > events only can be notified to glue layer of gadget driver(like dwc3 > glue layer). That means if we want to suspend xhci platform device, we this is a problem with the glue layer, IMO. It should be something like so: static irqreturn_t dwc3_foobar_wakeup(int irq, void *_glue) { struct dwc3_foobar_glue *glue =3D _glue; u32 reg; reg =3D real(glue->base, OFFSET); if (reg & CONNECT) pm_runtime_resume(&glue->dwc3); return IRQ_HANDLED; } then dwc3's ->runtime_resume() should check if the event is supposed to be handled by host or peripheral by checking which mode it was before suspend and making the assumption that we don't change modes while suspended. Something like: static int dwc3_runtime_resume(struct device *dev) { struct dwc3 *dwc =3D dev_get_drvdata(dev); [...] if (dwc->is_host) pm_runtime_resume(dwc->xhci.dev); [...] return 0; } > must put xhci usage counter (so we can not keep their parent-child > relationship intact). That is why we need > pm_suspend_ignore_children(dev, true). you really shouldn't need that and it's still unclear why you think you do. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAljQ30AACgkQzL64meEa mQar7g/+PBS04v3l8sUE6CA/peMJCmUZJh/OvfND6s1vY+c6tojI05MtEY+gQ+Oi y5mAVbBouj4jodgyWLViwn5hfq3Ri3K5UCec8I/cp9QrkJ33NgBz8dTK0opSOyVC +bTvYcRoipwmEREX/RL5KNUaPXInq29LjFTEurmB4VfX1FycHyqwa0NRwnw/sn59 EvbUkOE97Twn7znUTsniCJZ6BnMIy6FqzGMLqZHPIYzdPN7FLN8qOJvZ/Xzw173K RXSpOWKr2NeZklvcitCwmvLYbAqE4lVNPgPQaM9T9jJ02l6zufCWQqbNxyKLIaGM lghRzMY8VZ6yH3ZRufwTBSnUM67JLSFF3K8fBnlYoJDJKD/jXS6scYXW9CIem/11 Kj8vSxR0J1V0Sp0CwNPJC/2dPxLdBsR/u7mVNGa3bhiWzGcKY/1zlvZgR0ez7Qjr 1KJHfhOkFDgJXi2+EYs+fN3fo8qQvy2dLDIAE9y+owY49o6ipBAsBqF3YoLEJd7M mMRF6HC1CvmssFKbxd48UhbaaVvWZEubC5RcusMhwoDXn96VknV1HGvOph+vbygD q9huHBcU9RfcPDhE6DDuCV2O+ESLtDk8s8SKfRFQUmkOblcjNY+X8ch14435QWZa htnf/gNHsbkrcFnvVjVI09JRil0/V+mgNPWa0vWThtVDW5iaqe4= =+Vya -----END PGP SIGNATURE----- --=-=-=--