From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-acpi@vger.kernel.org
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Wolfram Sang <wsa@the-dreams.de>, Mark Brown <broonie@kernel.org>,
Aaron Lu <aaron.lu@intel.com>, Lv Zheng <lv.zheng@intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/3] ACPI / PM: allow child devices to ignore parent power state
Date: Thu, 10 Oct 2013 13:28:46 +0300 [thread overview]
Message-ID: <1381400928-2689-2-git-send-email-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <1381400928-2689-1-git-send-email-mika.westerberg@linux.intel.com>
Some serial buses like I2C and SPI don't require that the parent device is
in D0 before any of its children transitions to D0, but instead the parent
device can control its own power independently from the children.
This does not follow the ACPI specification as it requires the parent to be
powered on before its children. However, Windows seems to ignore this
requirement so I think we can do the same in Linux.
Implement this by adding a new power flag 'ignore_parent' to struct
acpi_device. If this flag is set the ACPI core ignores checking of the
parent device power state when the device is powered on/off.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/acpi/device_pm.c | 8 +++++---
include/acpi/acpi_bus.h | 3 ++-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index 59d3202..ca723a4 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -118,9 +118,10 @@ int acpi_device_get_power(struct acpi_device *device, int *state)
/*
* If we were unsure about the device parent's power state up to this
* point, the fact that the device is in D0 implies that the parent has
- * to be in D0 too.
+ * to be in D0 too, except if ignore_parent is set.
*/
- if (device->parent && device->parent->power.state == ACPI_STATE_UNKNOWN
+ if (!device->power.flags.ignore_parent && device->parent
+ && device->parent->power.state == ACPI_STATE_UNKNOWN
&& result == ACPI_STATE_D0)
device->parent->power.state = ACPI_STATE_D0;
@@ -177,7 +178,8 @@ int acpi_device_set_power(struct acpi_device *device, int state)
acpi_power_state_string(state));
return -ENODEV;
}
- if (device->parent && (state < device->parent->power.state)) {
+ if (!device->power.flags.ignore_parent &&
+ device->parent && (state < device->parent->power.state)) {
dev_warn(&device->dev,
"Cannot transition to power state %s for parent in %s\n",
acpi_power_state_string(state),
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 02e113b..e830ab0 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -222,7 +222,8 @@ struct acpi_device_power_flags {
u32 power_resources:1; /* Power resources */
u32 inrush_current:1; /* Serialize Dx->D0 */
u32 power_removed:1; /* Optimize Dx->D0 */
- u32 reserved:28;
+ u32 ignore_parent:1; /* Power is independent of parent power state */
+ u32 reserved:27;
};
struct acpi_device_power_state {
--
1.8.4.rc3
next prev parent reply other threads:[~2013-10-10 10:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-09 14:04 [PATCH 0/3] ACPI power management support for I2C and SPI devices Mika Westerberg
2013-10-09 14:04 ` [PATCH 1/3] ACPI / PM: allow child devices to ignore parent power state Mika Westerberg
[not found] ` <1381327461-10562-1-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2013-10-09 14:04 ` [PATCH 2/3] i2c: attach/detach I2C client device to the ACPI power domain Mika Westerberg
2013-10-10 8:09 ` Wolfram Sang
2013-10-10 8:26 ` Mika Westerberg
2013-10-09 14:04 ` [PATCH 3/3] spi: attach/detach SPI " Mika Westerberg
[not found] ` <1381327461-10562-4-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2013-10-09 17:55 ` Mark Brown
2013-10-10 6:12 ` Mika Westerberg
[not found] ` <20131010061256.GB3521-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-10-10 9:38 ` Mark Brown
2013-10-10 10:28 ` [PATCH v2 0/3] ACPI power management support for I2C and SPI devices Mika Westerberg
2013-10-10 10:28 ` Mika Westerberg [this message]
2013-10-10 10:28 ` [PATCH v2 2/3] i2c: attach/detach I2C client device to the ACPI power domain Mika Westerberg
[not found] ` <1381400928-2689-1-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2013-10-10 10:28 ` [PATCH v2 3/3] spi: attach/detach SPI " Mika Westerberg
2013-10-10 13:02 ` [PATCH v2 0/3] ACPI power management support for I2C and SPI devices 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=1381400928-2689-2-git-send-email-mika.westerberg@linux.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=aaron.lu@intel.com \
--cc=broonie@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lv.zheng@intel.com \
--cc=rjw@rjwysocki.net \
--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).