diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2015-07-27 17:03:57 +0200 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2015-07-28 09:50:42 +0200 |
commit | 712e960f0ee9337f3473ba3de2bcfc7e87b7c5a4 (patch) | |
tree | 13e6d1dffce17d0c4cc466e484599cfc38994a05 /drivers/acpi/device_pm.c | |
parent | PM / QoS: Make it possible to expose device latency tolerance to userspace (diff) | |
download | linux-712e960f0ee9337f3473ba3de2bcfc7e87b7c5a4.tar.xz linux-712e960f0ee9337f3473ba3de2bcfc7e87b7c5a4.zip |
ACPI / PM: Attach ACPI power domain only once
Some devices, like MFD subdevices, share a single ACPI companion device so
that they are able to access their resources and children. However,
currently all these subdevices are attached to the ACPI power domain and
this might cause that the power methods for the companion device get called
more than once.
In order to solve this we attach the ACPI power domain only to the first
physical device that is bound to the ACPI companion device. In case of MFD
devices, this is the parent MFD device itself.
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/acpi/device_pm.c')
-rw-r--r-- | drivers/acpi/device_pm.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 717afcdb5f4a..08dc3ec7e892 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -1123,6 +1123,14 @@ int acpi_dev_pm_attach(struct device *dev, bool power_on) if (dev->pm_domain) return -EEXIST; + /* + * Only attach the power domain to the first device if the + * companion is shared by multiple. This is to prevent doing power + * management twice. + */ + if (!acpi_device_is_first_physical_node(adev, dev)) + return -EBUSY; + acpi_add_pm_notifier(adev, dev, acpi_pm_notify_work_func); dev->pm_domain = &acpi_general_pm_domain; if (power_on) { |