From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755501AbcA2MCs (ORCPT ); Fri, 29 Jan 2016 07:02:48 -0500 Received: from gagarine.paulk.fr ([109.190.93.129]:55498 "EHLO gagarine.paulk.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754323AbcA2MCr (ORCPT ); Fri, 29 Jan 2016 07:02:47 -0500 Message-ID: <1454068955.1482.2.camel@paulk.fr> Subject: Re: [PATCH 2/2] regulator: core: Provide per-regulator runtime PM support From: Paul Kocialkowski To: Mark Brown Cc: Liam Girdwood , linux-kernel@vger.kernel.org Date: Fri, 29 Jan 2016 13:02:35 +0100 In-Reply-To: <1453407851-8039-2-git-send-email-broonie@kernel.org> References: <1453407851-8039-1-git-send-email-broonie@kernel.org> <1453407851-8039-2-git-send-email-broonie@kernel.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-z8tP2oaztGyJFyuDQxDN" X-Mailer: Evolution 3.18.2 (3.18.2-1.fc23) Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-z8tP2oaztGyJFyuDQxDN Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Le jeudi 21 janvier 2016 =C3=A0 20:24 +0000, Mark Brown a =C3=A9crit=C2=A0: > Provide a flag auto_runtime_pm in the regulator_desc which causes the > regulator core to take a runtime PM reference to a regulator while it > is enabled. This helps integration with chip wide power management > for > auxiliary PMICs, they may be able to implement chip wide power > savings > if nothing on the PMIC is in use. Thanks for working on this! I'm having a major drawback on my development unit (fried it accidentally) so I'm unable to test this with the LP8720 regulator on the Optimus Black, but I'll manage to get a working development unit soon. I'll let you know how it goes. Feel free to merge this before I do the work on the lp8720 regulator, though. > Signed-off-by: Mark Brown > --- >=20 > Not tested at all yet, pushing out for testing by others who have > devices that could benefit from this. >=20 > =C2=A0drivers/regulator/core.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0| 20 ++++++++++++++++++-- > =C2=A0include/linux/regulator/driver.h |=C2=A0=C2=A01 + > =C2=A02 files changed, 19 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c > index 3308c6bb83db..968ff3081e6c 100644 > --- a/drivers/regulator/core.c > +++ b/drivers/regulator/core.c > @@ -26,6 +26,7 @@ > =C2=A0#include > =C2=A0#include > =C2=A0#include > +#include > =C2=A0#include > =C2=A0#include > =C2=A0#include > @@ -2059,17 +2060,23 @@ static int _regulator_do_enable(struct > regulator_dev *rdev) > =C2=A0 } > =C2=A0 } > =C2=A0 > + if (rdev->desc->auto_runtime_pm) { > + ret =3D pm_runtime_get_sync(rdev->dev.parent); > + if (ret < 0) > + goto err; > + } > + > =C2=A0 if (rdev->ena_pin) { > =C2=A0 if (!rdev->ena_gpio_state) { > =C2=A0 ret =3D regulator_ena_gpio_ctrl(rdev, true); > =C2=A0 if (ret < 0) > - return ret; > + goto err_pm; > =C2=A0 rdev->ena_gpio_state =3D 1; > =C2=A0 } > =C2=A0 } else if (rdev->desc->ops->enable) { > =C2=A0 ret =3D rdev->desc->ops->enable(rdev); > =C2=A0 if (ret < 0) > - return ret; > + goto err_pm; > =C2=A0 } else { > =C2=A0 return -EINVAL; > =C2=A0 } > @@ -2084,6 +2091,12 @@ static int _regulator_do_enable(struct > regulator_dev *rdev) > =C2=A0 trace_regulator_enable_complete(rdev_get_name(rdev)); > =C2=A0 > =C2=A0 return 0; > + > +err_pm: > + if (rdev->desc->auto_runtime_pm) > + pm_runtime_put_autosuspend(rdev->dev.parent); > +err: > + return ret; > =C2=A0} > =C2=A0 > =C2=A0/* locks held by regulator_enable() */ > @@ -2177,6 +2190,9 @@ static int _regulator_do_disable(struct > regulator_dev *rdev) > =C2=A0 return ret; > =C2=A0 } > =C2=A0 > + if (rdev->desc->auto_runtime_pm) > + pm_runtime_put_autosuspend(rdev->dev.parent); > + > =C2=A0 /* cares about last_off_jiffy only if off_on_delay is > required by > =C2=A0 =C2=A0* device. > =C2=A0 =C2=A0*/ > diff --git a/include/linux/regulator/driver.h > b/include/linux/regulator/driver.h > index 3ac0f306f033..dccea032a143 100644 > --- a/include/linux/regulator/driver.h > +++ b/include/linux/regulator/driver.h > @@ -282,6 +282,7 @@ struct regulator_desc { > =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0struct regulator_config *); > =C2=A0 int id; > =C2=A0 unsigned int continuous_voltage_range:1; > + unsigned int auto_runtime_pm:1; > =C2=A0 unsigned n_voltages; > =C2=A0 const struct regulator_ops *ops; > =C2=A0 int irq; --=-z8tP2oaztGyJFyuDQxDN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWq1TbAAoJEIT9weqP7pUM1jEQAIgTw1nqC346D3OvwvlJCZfd 1FujTXYm8L7D4ajqB2C5AnEjmTtyIQDbScXNoG1u3FWyEOT7K0naTxgaUDcSHCVl UNu/9t5viijolJcq9RTrwUjzHVVvPtcUEvkHhmlSfNhhoQpJ0a64hVsMIaVrddtJ y0WrnTOsY0FffDoYFAbDofmCoqmqsOyUFm/Bd5Pe2BkValkw6IXUqHQicsRqGeSr Tj8LFSQeMllwXsJACJfdTaqdqFB9uTwaHMaqVQH23OY4Oko9UDu+23MP4adkYqDA lP1CzEELwraW0SofDGINTWNYln+ejV+vqY21yxngopsbS2MAFywLBLXYWi36osWp 6dCyWp7tffoprqLYlfWUfAvGikqb+3grrA33arrdQL0llS0ynpLLoaPKJV9bK/H3 GI9kJyY2LRY0CbEBWroU7xswq5I1fo7J1OJyLYhIm//jKw16vY+CovqJlYsUFDwo B1h0umRRI3LX2hjCuQZ0xMdKANvhlZu+KYzhzrvfMvB1IDp7GHF18ch+R035g+gw ejK+yc9FGkk3jtnXk5+aET8I7IQdP0U1YWdyeCrmP5fma9tAo6eebbZme2xHZWHC FzxOJflWS/oreo9GNFSBdqDRNKscckSsjPrstAPIzYsnPNVteD7Bg5l0oaOuvzia /parpADl9ZFEz4ojRINH =arYm -----END PGP SIGNATURE----- --=-z8tP2oaztGyJFyuDQxDN--