[{"id":1780464,"web_url":"http://patchwork.ozlabs.org/comment/1780464/","msgid":"<20171005110053.2oxmz25ucnpoxjrk@ninjato>","list_archive_url":null,"date":"2017-10-05T11:00:54","subject":"Re: [PATCH v4 3/3] PM: i2c-designware-platdrv: Suspend/resume at the\n\tlate/early stages","submitter":{"id":22495,"url":"http://patchwork.ozlabs.org/api/people/22495/","name":"Wolfram Sang","email":"wsa@the-dreams.de"},"content":"On Mon, Sep 25, 2017 at 01:30:51AM +0200, Rafael J. Wysocki wrote:\n> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>\n> \n> As reported by Rajat Jain, there are problems when ACPI operation\n> region handlers or similar, called at the ->resume_early() time, for\n> I2C client devices try to access an I2C controller that has already\n> been suspended at that point.  To avoid that, move the suspend/resume\n> of i2c-designware-platdrv to the late/early stages, respectively.\n> \n> While at it, avoid resuming the device from runtime suspend in the\n> driver's ->suspend callback which isn't particularly nice.  [A better\n> approach would be to make the driver track the PM state of the device\n> so that it doesn't need to resume it in ->suspend, so implement it.]\n> \n> First, drop dw_i2c_plat_suspend() added by commit a23318feeff6 (i2c:\n> designware: Fix system suspend) and rename dw_i2c_plat_runtime_suspend()\n> back to dw_i2c_plat_suspend().\n> \n> Second, point the driver's ->late_suspend and ->early_resume\n> callbacks, rather than its ->suspend and ->resume callbacks,\n> to dw_i2c_plat_suspend() and dw_i2c_plat_resume(), respectively,\n> so that they are not executed in parallel with each other, for\n> example if runtime resume of the device takes place during system\n> suspend.\n> \n> Finally, add \"suspended\" and \"skip_resume\" flags to struct dw_i2c_dev\n> and make dw_i2c_plat_suspend() and dw_i2c_plat_resume() use them to\n> avoid suspending or resuming the device twice in a row and to avoid\n> resuming a previously runtime-suspended device during system resume.\n> \n> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>\n> Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>\n> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>\n> Tested-by: Johannes Stezenbach <js@sig21.net>\n> Tested-by: Rajat Jain <rajatja@google.com>\n\nApplied to for-next, thanks!","headers":{"Return-Path":"<linux-i2c-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-i2c-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y78vZ3Wsqz9sRq\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  5 Oct 2017 22:00:58 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751756AbdJELA4 (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 5 Oct 2017 07:00:56 -0400","from sauhun.de ([88.99.104.3]:38888 \"EHLO pokefinder.org\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751958AbdJELAz (ORCPT <rfc822;linux-i2c@vger.kernel.org>);\n\tThu, 5 Oct 2017 07:00:55 -0400","from localhost (p54B33366.dip0.t-ipconnect.de [84.179.51.102])\n\tby pokefinder.org (Postfix) with ESMTPSA id 710A72C379C;\n\tThu,  5 Oct 2017 13:00:54 +0200 (CEST)"],"Date":"Thu, 5 Oct 2017 13:00:54 +0200","From":"Wolfram Sang <wsa@the-dreams.de>","To":"\"Rafael J. Wysocki\" <rjw@rjwysocki.net>","Cc":"linux-pm@vger.kernel.org, linux-i2c@vger.kernel.org,\n\tlinux-acpi@vger.kernel.org, Kevin Hilman <khilman@kernel.org>,\n\tJarkko Nikula <jarkko.nikula@linux.intel.com>,\n\tAndy Shevchenko <andriy.shevchenko@linux.intel.com>,\n\tMika Westerberg <mika.westerberg@linux.intel.com>,\n\tJisheng Zhang <jszhang@marvell.com>,\n\tJohn Stultz <john.stultz@linaro.org>, Guodong Xu <guodong.xu@linaro.org>,\n\tSumit Semwal <sumit.semwal@linaro.org>,\n\tHaojian Zhuang <haojian.zhuang@linaro.org>,\n\tJohannes Stezenbach <js@sig21.net>, Ulf Hansson <ulf.hansson@linaro.org>,\n\tLee Jones <lee.jones@linaro.org>, Rajat Jain <rajatja@google.com>","Subject":"Re: [PATCH v4 3/3] PM: i2c-designware-platdrv: Suspend/resume at the\n\tlate/early stages","Message-ID":"<20171005110053.2oxmz25ucnpoxjrk@ninjato>","References":"<3023226.l5IfJK6GIc@aspire.rjw.lan>\n\t<3958866.l2qnKDbinI@aspire.rjw.lan>\n\t<65494652.vEfz4tCBDb@aspire.rjw.lan>\n\t<7572899.CfQ69SdO4W@aspire.rjw.lan>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"73evo3vnpt6mv5jd\"","Content-Disposition":"inline","In-Reply-To":"<7572899.CfQ69SdO4W@aspire.rjw.lan>","User-Agent":"NeoMutt/20170113 (1.7.2)","Sender":"linux-i2c-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-i2c.vger.kernel.org>","X-Mailing-List":"linux-i2c@vger.kernel.org"}}]