From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Linux PM <linux-pm@vger.kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alan Stern <stern@rowland.harvard.edu>,
Kevin Hilman <khilman@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
linux-i2c <linux-i2c@vger.kernel.org>,
Linux PCI <linux-pci@vger.kernel.org>,
Lee Jones <lee.jones@linaro.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Wolfram Sang <wsa@the-dreams.de>
Subject: Re: [PATCH 6/7] PM: i2c-designware-platdrv: Optimize power management
Date: Mon, 8 Jan 2018 16:31:58 +0200 [thread overview]
Message-ID: <bb17c593-d8ab-ace6-4127-249da0b8af54@linux.intel.com> (raw)
In-Reply-To: <6243259.Xh4soKtjBb@aspire.rjw.lan>
On 01/03/2018 02:37 AM, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Optimize the power management in i2c-designware-platdrv by making it
> set the DPM_FLAG_SMART_SUSPEND and DPM_FLAG_LEAVE_SUSPENDED which
> allows some code to be dropped from its PM callbacks.
>
> First, setting DPM_FLAG_SMART_SUSPEND causes the intel-lpss driver
> to avoid resuming i2c-designware-platdrv devices in its ->prepare
> callback, so they can stay in runtime suspend after that point even
> if the direct-complete feature is not used for them.
>
> It also causes the ACPI PM domain and the PM core to avoid invoking
> "late" and "noirq" suspend callbacks for these devices if they are
> in runtime suspend at the beginning of the "late" phase of device
> suspend during system suspend. That guarantees dw_i2c_plat_suspend()
> to be called for a device only if it is not in runtime suspend.
>
> Moreover, it causes the device's runtime PM status to be set to
> "active" after calling dw_i2c_plat_resume() for it, so the
> driver doesn't need internal flags to avoid invoking either
> dw_i2c_plat_suspend() or dw_i2c_plat_resume() twice in a row.
>
> Second, setting DPM_FLAG_LEAVE_SUSPENDED enables the optimization
> allowing the device to stay suspended after system resume under
> suitable conditions, so again the driver doesn't need to take
> care of that by itself.
>
> Accordingly, the internal "suspended" and "skip_resume" flags
> used by the driver are not necessary any more, so drop them and
> simplify the driver's PM callbacks.
>
> Additionally, notice that dw_i2c_plat_complete() only needs to
> schedule runtime PM resume for the device if platform firmware
> has been involved in resuming the system, so make it call
> pm_resume_via_firmware() to check that. Also make it check the
> runtime PM status of the device instead of its direct_complete
> flag which also works if the device remained suspended due to
> the DPM_FLAG_LEAVE_SUSPENDED driver flag.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/i2c/busses/i2c-designware-core.h | 2 -
> drivers/i2c/busses/i2c-designware-platdrv.c | 31 ++++++++++------------------
> 2 files changed, 12 insertions(+), 21 deletions(-)
>
This doesn't apply to linux-next due 0326f9f801b2 ("i2c: designware:
rename i2c_dw_plat_prepare_clk to i2c_dw_prepare_clk"). It was trivial
to fix which I did locally for testing.
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
next prev parent reply other threads:[~2018-01-08 14:31 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-09 23:55 [PATCH 0/4] PM / core: Direct handling of DPM_FLAG_SMART_SUSPEND and DPM_FLAG_LEAVE_SUSPENDED Rafael J. Wysocki
2017-12-09 23:56 ` [PATCH 1/4] PM / core: Use dev_pm_skip_next_resume_phases() internally Rafael J. Wysocki
2017-12-11 10:03 ` Geert Uytterhoeven
2017-12-11 10:30 ` Ulf Hansson
2017-12-09 23:58 ` [PATCH 2/4] PM / core: Add helpers for subsystem callback selection Rafael J. Wysocki
2017-12-11 10:08 ` Geert Uytterhoeven
2017-12-10 0:00 ` [PATCH 3/4] PM / core: Direct DPM_FLAG_SMART_SUSPEND optimization Rafael J. Wysocki
2017-12-19 7:38 ` Ulf Hansson
2017-12-19 11:13 ` Rafael J. Wysocki
2017-12-19 11:19 ` Rafael J. Wysocki
2017-12-19 13:15 ` Ulf Hansson
2017-12-19 16:35 ` Rafael J. Wysocki
2017-12-19 13:10 ` Ulf Hansson
2017-12-19 16:29 ` Rafael J. Wysocki
2017-12-19 16:54 ` Rafael J. Wysocki
2017-12-10 0:02 ` [PATCH 4/4] PM / core: Direct DPM_FLAG_LEAVE_SUSPENDED handling Rafael J. Wysocki
2018-01-02 11:32 ` [PATCH 0/4] PM / core: Direct handling of DPM_FLAG_SMART_SUSPEND and DPM_FLAG_LEAVE_SUSPENDED Rafael J. Wysocki
2018-01-02 12:17 ` Ulf Hansson
2018-01-02 12:26 ` Rafael J. Wysocki
2018-01-02 15:57 ` Alan Stern
2018-01-02 13:26 ` Greg Kroah-Hartman
2018-01-03 0:29 ` [PATCH 0/7] " Rafael J. Wysocki
2018-01-03 0:31 ` [PATCH 1/7] PM / core: Add helpers for subsystem callback selection Rafael J. Wysocki
2018-01-03 0:32 ` [PATCH 2/7] PM / core: Direct DPM_FLAG_SMART_SUSPEND optimization Rafael J. Wysocki
2018-01-03 0:33 ` [PATCH 3/7] PM / core: Direct DPM_FLAG_LEAVE_SUSPENDED handling Rafael J. Wysocki
2018-01-03 0:34 ` [PATCH 4/7] PM / mfd: intel-lpss: Use DPM_FLAG_SMART_SUSPEND Rafael J. Wysocki
2018-01-03 0:35 ` [PATCH 5/7] PM: i2c-designware-platdrv: Use DPM_FLAG_SMART_PREPARE Rafael J. Wysocki
2018-01-08 14:31 ` Jarkko Nikula
2018-01-08 14:36 ` Wolfram Sang
2018-01-03 0:37 ` [PATCH 6/7] PM: i2c-designware-platdrv: Optimize power management Rafael J. Wysocki
2018-01-08 14:31 ` Jarkko Nikula [this message]
2018-01-08 14:36 ` Wolfram Sang
2018-01-03 0:38 ` [PATCH 7/7] PCI / PM: Use SMART_SUSPEND and LEAVE_SUSPENDED flags for PCIe ports Rafael J. Wysocki
2018-01-04 22:14 ` Bjorn Helgaas
2018-01-04 23:28 ` Rafael J. Wysocki
2018-01-08 14:33 ` [PATCH 0/7] PM / core: Direct handling of DPM_FLAG_SMART_SUSPEND and DPM_FLAG_LEAVE_SUSPENDED Jarkko Nikula
2018-01-09 0:29 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bb17c593-d8ab-ace6-4127-249da0b8af54@linux.intel.com \
--to=jarkko.nikula@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=khilman@kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rjw@rjwysocki.net \
--cc=stern@rowland.harvard.edu \
--cc=ulf.hansson@linaro.org \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).