diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2013-10-10 06:28:46 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-10-10 20:23:14 -0400 |
commit | 644f17ad7fc12768cd619532383343e514eab2ac (patch) | |
tree | d862d7b92d113ccacc529aeabff9f7ab0af3d6b1 | |
parent | 360818b83f8652655558d0ab0d61c2d98a1cb631 (diff) |
ACPI / PM: allow child devices to ignore parent power state
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>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/device_pm.c | 8 | ||||
-rw-r--r-- | 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 59d3202f6b36..ca723a4c120a 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) | |||
118 | /* | 118 | /* |
119 | * If we were unsure about the device parent's power state up to this | 119 | * If we were unsure about the device parent's power state up to this |
120 | * point, the fact that the device is in D0 implies that the parent has | 120 | * point, the fact that the device is in D0 implies that the parent has |
121 | * to be in D0 too. | 121 | * to be in D0 too, except if ignore_parent is set. |
122 | */ | 122 | */ |
123 | if (device->parent && device->parent->power.state == ACPI_STATE_UNKNOWN | 123 | if (!device->power.flags.ignore_parent && device->parent |
124 | && device->parent->power.state == ACPI_STATE_UNKNOWN | ||
124 | && result == ACPI_STATE_D0) | 125 | && result == ACPI_STATE_D0) |
125 | device->parent->power.state = ACPI_STATE_D0; | 126 | device->parent->power.state = ACPI_STATE_D0; |
126 | 127 | ||
@@ -177,7 +178,8 @@ int acpi_device_set_power(struct acpi_device *device, int state) | |||
177 | acpi_power_state_string(state)); | 178 | acpi_power_state_string(state)); |
178 | return -ENODEV; | 179 | return -ENODEV; |
179 | } | 180 | } |
180 | if (device->parent && (state < device->parent->power.state)) { | 181 | if (!device->power.flags.ignore_parent && |
182 | device->parent && (state < device->parent->power.state)) { | ||
181 | dev_warn(&device->dev, | 183 | dev_warn(&device->dev, |
182 | "Cannot transition to power state %s for parent in %s\n", | 184 | "Cannot transition to power state %s for parent in %s\n", |
183 | acpi_power_state_string(state), | 185 | acpi_power_state_string(state), |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 02e113bb8b7d..e830ab029340 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -222,7 +222,8 @@ struct acpi_device_power_flags { | |||
222 | u32 power_resources:1; /* Power resources */ | 222 | u32 power_resources:1; /* Power resources */ |
223 | u32 inrush_current:1; /* Serialize Dx->D0 */ | 223 | u32 inrush_current:1; /* Serialize Dx->D0 */ |
224 | u32 power_removed:1; /* Optimize Dx->D0 */ | 224 | u32 power_removed:1; /* Optimize Dx->D0 */ |
225 | u32 reserved:28; | 225 | u32 ignore_parent:1; /* Power is independent of parent power state */ |
226 | u32 reserved:27; | ||
226 | }; | 227 | }; |
227 | 228 | ||
228 | struct acpi_device_power_state { | 229 | struct acpi_device_power_state { |