mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: linux-i2c@vger.kernel.org, Wolfram Sang <wsa@the-dreams.de>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Lv Zheng <lv.zheng@intel.com>, Aaron Lu <aaron.lu@intel.com>
Subject: Re: [RFC PATCH 2/2] i2c: attach/detach I2C client device to the ACPI power domain
Date: Tue, 20 Aug 2013 16:16:46 +0200	[thread overview]
Message-ID: <1832329.klZ26Zknis@vostro.rjw.lan> (raw)
In-Reply-To: <1377007416-13851-3-git-send-email-mika.westerberg@linux.intel.com>

On Tuesday, August 20, 2013 05:03:36 PM Mika Westerberg wrote:
> From: Lv Zheng <lv.zheng@intel.com>
> 
> If the I2C client device is enumerated from ACPI namespace it might have
> ACPI methods that needs to be called in order to transition the device to
> a different power states (such as _PSx).
> 
> Implement this for I2C client devices by checking if the device has an ACPI
> handle and if that's the case, attach it to the ACPI power domain. In
> addition we make sure that the device is fully powered when its ->probe()
> function gets called.
> 
> For non-ACPI devices this patch is a no-op.
> 
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  drivers/i2c/i2c-core.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 8fad5ac..fdf086b 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -257,6 +257,9 @@ static int i2c_device_probe(struct device *dev)
>  	/* Make sure the adapter is active */
>  	pm_runtime_get_sync(&client->adapter->dev);
>  
> +	if (ACPI_HANDLE(&client->dev))
> +		acpi_dev_pm_attach(&client->dev, true);
> +
>  	/*
>  	 * Enable runtime PM for the client device. If the client wants to
>  	 * participate on runtime PM it should call pm_runtime_put() in its
> @@ -278,6 +281,9 @@ static int i2c_device_probe(struct device *dev)
>  		pm_runtime_disable(&client->dev);
>  		pm_runtime_set_suspended(&client->dev);
>  		pm_runtime_put_noidle(&client->dev);
> +
> +		if (ACPI_HANDLE(&client->dev))
> +			acpi_dev_pm_detach(&client->dev, true);
>  	}
>  
>  	pm_runtime_put(&client->adapter->dev);
> @@ -314,6 +320,9 @@ static int i2c_device_remove(struct device *dev)
>  	pm_runtime_set_suspended(&client->dev);
>  	pm_runtime_put_noidle(&client->dev);
>  
> +	if (ACPI_HANDLE(&client->dev))
> +		acpi_dev_pm_detach(&client->dev, true);
> +
>  	pm_runtime_put(&client->adapter->dev);
>  	return status;
>  }
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

      reply	other threads:[~2013-08-20 14:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20 14:03 [RFC PATCH 0/2] runtime PM support for I2C clients Mika Westerberg
2013-08-20 14:03 ` [RFC PATCH 1/2] i2c: prepare runtime PM support for I2C client devices Mika Westerberg
2013-08-20 14:16   ` Rafael J. Wysocki
2013-08-28  9:38   ` Wolfram Sang
2013-09-02 10:56     ` Mika Westerberg
2013-08-20 14:03 ` [RFC PATCH 2/2] i2c: attach/detach I2C client device to the ACPI power domain Mika Westerberg
2013-08-20 14:16   ` Rafael J. Wysocki [this message]

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=1832329.klZ26Zknis@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=aaron.lu@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --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

all inboxes | Powered by JetHome®