linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: aaron.lu@intel.com (Aaron Lu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/9] i2c: prepare runtime PM support for I2C client devices
Date: Fri, 13 Sep 2013 09:14:20 +0800	[thread overview]
Message-ID: <523266EC.1060501@intel.com> (raw)
In-Reply-To: <52323AC8.30403@gmail.com>

On 09/13/2013 06:06 AM, Sylwester Nawrocki wrote:
> On 09/11/2013 05:32 PM, Mika Westerberg wrote:
>> From: Aaron Lu<aaron.lu@intel.com>
>>
>> This patch adds runtime PM support for the I2C bus in a similar way that
>> has been done for PCI bus already. This means that the I2C bus core
>> prepares runtime PM for a client device just before a driver is about to be
>> bound to it. Devices that are not bound to any driver are not prepared for
>> runtime PM.
>>
>> In order to take advantage of this runtime PM support, the client device
>> driver needs drop the device runtime PM reference count by calling
>> pm_runtime_put() in its ->probe() callback and possibly implement rest of
>> the runtime PM callbacks.
>>
>> If the driver doesn't support runtime PM (like most of the existing I2C
>> client drivers), the device in question is regarded as being runtime PM
>> active and powered on.
>>
>> The patch adds also runtime PM support for the adapter device because it is
>> needed to be able to runtime power manage the I2C controller device. The
>> adapter device is handled along with the I2C controller device (it uses
>> pm_runtime_no_callbacks()).
>>
>> Signed-off-by: Aaron Lu<aaron.lu@intel.com>
>> Signed-off-by: Mika Westerberg<mika.westerberg@linux.intel.com>
>> ---
>>   drivers/i2c/i2c-core.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
>>   1 file changed, 43 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
>> index f32ca29..44374b4 100644
>> --- a/drivers/i2c/i2c-core.c
>> +++ b/drivers/i2c/i2c-core.c
>> @@ -248,11 +248,30 @@ static int i2c_device_probe(struct device *dev)
>>   					client->flags&  I2C_CLIENT_WAKE);
>>   	dev_dbg(dev, "probe\n");
>>
>> +	/* Make sure the adapter is active */
>> +	pm_runtime_get_sync(&client->adapter->dev);
> 
> So there is currently no way to avoid this behaviour, i.e. to have the 
> adapter
> not activated before any of its client devices is probed, but only later on,
> after explicit call to pm_runtime_get*(&client->dev) in the client driver ?

The above pm_runtime_get_sync is used to make sure when the client I2C
device is going to be probed, its host adapter device is turned on(or we
will fail the probe). It doesn't affect the adapter's status before the
probe of I2C client device.

Thanks,
Aaron

  reply	other threads:[~2013-09-13  1:14 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11 15:32 [PATCH v2 0/9] runtime PM support for I2C and SPI client devices Mika Westerberg
2013-09-11 15:32 ` [PATCH v2 1/9] i2c: prepare runtime PM support for I2C " Mika Westerberg
2013-09-12 21:34   ` Kevin Hilman
2013-09-12 21:40     ` Kevin Hilman
     [not found]     ` <20130913065434.GZ7393@intel.com>
2013-09-13  9:59       ` Mark Brown
     [not found]         ` <20130913101611.GA7393@intel.com>
2013-09-13 10:31           ` Mark Brown
     [not found]             ` <20130913115035.GB7393@intel.com>
2013-09-13 12:10               ` Mark Brown
2013-09-13 14:30       ` Kevin Hilman
     [not found]         ` <20130913145022.GC7393@intel.com>
     [not found]           ` <20130913173149.GE7393@intel.com>
2013-09-13 21:10             ` Kevin Hilman
     [not found]               ` <20130915064139.GJ7393@intel.com>
2013-09-15 12:47                 ` Mark Brown
     [not found]                   ` <20130915132823.GL7393@intel.com>
2013-09-16 10:12                     ` Mark Brown
     [not found]                       ` <20130916143811.GP7393@intel.com>
2013-09-16 14:46                         ` Graeme Gregory
2013-09-13 15:14       ` Sylwester Nawrocki
     [not found]         ` <20130913154013.GD7393@intel.com>
2013-09-15 13:48           ` Sylwester Nawrocki
     [not found]             ` <20130916084708.GN7393@intel.com>
2013-09-16 19:07               ` Rafael J. Wysocki
2013-09-16 23:31                 ` Mark Brown
2013-09-17  1:25                   ` Rafael J. Wysocki
2013-09-17 10:48                     ` Mark Brown
     [not found]                 ` <20130917110021.GU7393@intel.com>
2013-09-17 21:38                   ` Rafael J. Wysocki
2013-09-17 11:07               ` Sylwester Nawrocki
2013-09-12 22:06   ` Sylwester Nawrocki
2013-09-13  1:14     ` Aaron Lu [this message]
2013-09-13 10:02       ` Mark Brown
2013-09-11 15:32 ` [PATCH v2 2/9] i2c: attach/detach I2C client device to the ACPI power domain Mika Westerberg
2013-09-11 15:32 ` [PATCH v2 3/9] Input: misc - convert existing I2C client drivers to use I2C core runtime PM Mika Westerberg
2013-09-11 15:32 ` [PATCH v2 4/9] [media] s5p-tv: convert " Mika Westerberg
2013-09-11 15:32 ` [PATCH v2 5/9] drivers/misc: convert existing I2C clients driver " Mika Westerberg
2013-09-12 21:29   ` Greg Kroah-Hartman
2013-09-11 15:32 ` [PATCH v2 6/9] mfd: wm8994: convert " Mika Westerberg
2013-09-11 16:12   ` Samuel Ortiz
     [not found]     ` <20130912092447.GJ7393@intel.com>
2013-09-12  9:28       ` Samuel Ortiz
2013-09-11 15:32 ` [PATCH v2 7/9] ASoC: codecs: convert existing I2C client drivers " Mika Westerberg
2013-09-11 15:44   ` Mark Brown
2013-09-11 15:32 ` [PATCH v2 8/9] spi: prepare runtime PM support for SPI devices Mika Westerberg
2013-09-11 15:51   ` Mark Brown
     [not found]     ` <20130912092743.GK7393@intel.com>
2013-09-12  9:31       ` Mark Brown
     [not found]         ` <20130912094302.GM7393@intel.com>
2013-09-12 11:04           ` Rafael J. Wysocki
2013-09-12 11:04             ` Wolfram Sang
2013-09-11 15:32 ` [PATCH v2 9/9] spi: attach/detach SPI device to the ACPI power domain Mika Westerberg
2013-09-11 15:51   ` Mark Brown
2013-09-11 15:53 ` [PATCH v2 0/9] runtime PM support for I2C and SPI client devices Mark Brown

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=523266EC.1060501@intel.com \
    --to=aaron.lu@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).