From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfram Sang Subject: Re: [PATCH v4 3/3] PM: i2c-designware-platdrv: Suspend/resume at the late/early stages Date: Thu, 5 Oct 2017 13:00:54 +0200 Message-ID: <20171005110053.2oxmz25ucnpoxjrk@ninjato> References: <3023226.l5IfJK6GIc@aspire.rjw.lan> <3958866.l2qnKDbinI@aspire.rjw.lan> <65494652.vEfz4tCBDb@aspire.rjw.lan> <7572899.CfQ69SdO4W@aspire.rjw.lan> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="73evo3vnpt6mv5jd" Return-path: Content-Disposition: inline In-Reply-To: <7572899.CfQ69SdO4W@aspire.rjw.lan> Sender: linux-acpi-owner@vger.kernel.org To: "Rafael J. Wysocki" Cc: linux-pm@vger.kernel.org, linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org, Kevin Hilman , Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Jisheng Zhang , John Stultz , Guodong Xu , Sumit Semwal , Haojian Zhuang , Johannes Stezenbach , Ulf Hansson , Lee Jones , Rajat Jain List-Id: linux-i2c@vger.kernel.org --73evo3vnpt6mv5jd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 25, 2017 at 01:30:51AM +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki >=20 > As reported by Rajat Jain, there are problems when ACPI operation > region handlers or similar, called at the ->resume_early() time, for > I2C client devices try to access an I2C controller that has already > been suspended at that point. To avoid that, move the suspend/resume > of i2c-designware-platdrv to the late/early stages, respectively. >=20 > While at it, avoid resuming the device from runtime suspend in the > driver's ->suspend callback which isn't particularly nice. [A better > approach would be to make the driver track the PM state of the device > so that it doesn't need to resume it in ->suspend, so implement it.] >=20 > First, drop dw_i2c_plat_suspend() added by commit a23318feeff6 (i2c: > designware: Fix system suspend) and rename dw_i2c_plat_runtime_suspend() > back to dw_i2c_plat_suspend(). >=20 > Second, point the driver's ->late_suspend and ->early_resume > callbacks, rather than its ->suspend and ->resume callbacks, > to dw_i2c_plat_suspend() and dw_i2c_plat_resume(), respectively, > so that they are not executed in parallel with each other, for > example if runtime resume of the device takes place during system > suspend. >=20 > Finally, add "suspended" and "skip_resume" flags to struct dw_i2c_dev > and make dw_i2c_plat_suspend() and dw_i2c_plat_resume() use them to > avoid suspending or resuming the device twice in a row and to avoid > resuming a previously runtime-suspended device during system resume. >=20 > Signed-off-by: Rafael J. Wysocki > Tested-by: Jarkko Nikula > Tested-by: Mika Westerberg > Tested-by: Johannes Stezenbach > Tested-by: Rajat Jain Applied to for-next, thanks! --73evo3vnpt6mv5jd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAlnWEOUACgkQFA3kzBSg KbYxQQ/8C+AcBagRN7uTok0wINHEcCdOk/W8/Z+cbmtBvMtbpiBbS19op9Pi43+8 av+WC+XtJ6BjiI3/xlDOlteZTHlN/c+7XUqL52RBgwyeeL9u70QjQuUv8Bt3tPsq HQ4V8k1ptsZFqt0G7TQ4KTkhtelxKgoSxggFw696lIeHTyg98oxjdEmMN/BbJgnL zUfAIRgZmJMguY8GOvI74u41gP5vEBY3ViQy1np9qF8Es20nml2ix1whVwjgxbbA /Rdo7Qspc1o82lL/ymEjkRMMmAybPC1s9OuDa2Xs8TSqflpaaFCeZmNSIgIkTPgO B3v7h/2ScQd3ami+djUHIgRxnlproW0f/GL8pB8EzkqI33fUN8UZPcxxf9SF1qby htb5bRufKr1kEbkwpGJ1PbUp0Uy3gf7n5JP/09WW4sUn1oVEf7m70390iyNzeBQl nDOfMhsRBi3BCGds6LhjbahVOkSkrDQLCnMBEcdTrzDrdXIYxpNdsRbscA55xT8S 2pLzMRM9quhSxtyNKJVjYOns7AYi0pJbMPbEtvL6uxAmM2IgoXdB0wUjw4DU4ESu 5Wn/EgaRLIlVzypj/ITnXfkqbIpMza6Xmij6vFEMn44gCjvbZcXbRJfetgK0Nn2M qSfuPTyX7bvZvmphaqA4NDdN0HxSPGaILyc7N33piEkzZ0xo1J8= =y9Ii -----END PGP SIGNATURE----- --73evo3vnpt6mv5jd--