aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-17 08:11:05 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-17 08:11:05 -0500
commitbc9b6407bd6df3ab7189e5622816bbc11ae9d2d8 (patch)
tree8f44ae6c9750b271eb423787e19db1288b53c42e /include/acpi
parent6a8dd80821c215bc49bf6b108e85c1738c82bf43 (diff)
ACPI / PM: Rework the handling of devices depending on power resources
Commit 0090def6 (ACPI: Add interface to register/unregister device to/from power resources) made it possible to indicate to the ACPI core that if the given device depends on any power resources, then it should be resumed as soon as all of the power resources required by it to transition to the D0 power state have been turned on. Unfortunately, however, this was a mistake, because all devices depending on power resources should be treated this way (i.e. they should be resumed when all power resources required by their D0 state have been turned on) and for the majority of those devices the ACPI core can figure out by itself which (physical) devices depend on what power resources. For this reason, replace the code added by commit 0090def6 with a new, much more straightforward, mechanism that will be used internally by the ACPI core and remove all references to that code from kernel subsystems using ACPI. For the cases when there are (physical) devices that should be resumed whenever a not directly related ACPI device node goes into D0 as a result of power resources configuration changes, like in the SATA case, add two new routines, acpi_dev_pm_add_dependent() and acpi_dev_pm_remove_dependent(), allowing subsystems to manage such dependencies. Convert the SATA subsystem to use the new functions accordingly. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/acpi')
-rw-r--r--include/acpi/acpi_bus.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 567851b4f043..29a1badfca55 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -279,6 +279,7 @@ struct acpi_device {
279 struct list_head physical_node_list; 279 struct list_head physical_node_list;
280 struct mutex physical_node_lock; 280 struct mutex physical_node_lock;
281 DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE); 281 DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE);
282 struct list_head power_dependent;
282}; 283};
283 284
284static inline void *acpi_driver_data(struct acpi_device *d) 285static inline void *acpi_driver_data(struct acpi_device *d)
@@ -334,8 +335,6 @@ int acpi_device_set_power(struct acpi_device *device, int state);
334int acpi_bus_update_power(acpi_handle handle, int *state_p); 335int acpi_bus_update_power(acpi_handle handle, int *state_p);
335bool acpi_bus_power_manageable(acpi_handle handle); 336bool acpi_bus_power_manageable(acpi_handle handle);
336bool acpi_bus_can_wakeup(acpi_handle handle); 337bool acpi_bus_can_wakeup(acpi_handle handle);
337int acpi_power_resource_register_device(struct device *dev, acpi_handle handle);
338void acpi_power_resource_unregister_device(struct device *dev, acpi_handle handle);
339#ifdef CONFIG_ACPI_PROC_EVENT 338#ifdef CONFIG_ACPI_PROC_EVENT
340int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data); 339int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data);
341int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data); 340int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data);
@@ -414,6 +413,8 @@ acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
414int acpi_device_power_state(struct device *dev, struct acpi_device *adev, 413int acpi_device_power_state(struct device *dev, struct acpi_device *adev,
415 u32 target_state, int d_max_in, int *d_min_p); 414 u32 target_state, int d_max_in, int *d_min_p);
416int acpi_pm_device_sleep_state(struct device *, int *, int); 415int acpi_pm_device_sleep_state(struct device *, int *, int);
416void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev);
417void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev);
417#else 418#else
418static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev, 419static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
419 acpi_notify_handler handler, 420 acpi_notify_handler handler,
@@ -443,6 +444,10 @@ static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
443{ 444{
444 return __acpi_device_power_state(m, p); 445 return __acpi_device_power_state(m, p);
445} 446}
447static inline void acpi_dev_pm_add_dependent(acpi_handle handle,
448 struct device *depdev) {}
449static inline void acpi_dev_pm_remove_dependent(acpi_handle handle,
450 struct device *depdev) {}
446#endif 451#endif
447 452
448#ifdef CONFIG_PM_RUNTIME 453#ifdef CONFIG_PM_RUNTIME