aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-05-23 04:33:44 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-05-23 04:33:44 -0400
commitf1a0b8310c99a0e3d579e61d81870caec058db46 (patch)
tree6bfe155bb1f67c0c798428c93520eca8973738cf
parentc7788792a5e7b0d5d7f96d0766b4cb6112d47d75 (diff)
parentc8f6d8351ba8c89d5cd4c562552ec7ec29274e31 (diff)
Merge branch 'acpi-fixes'
* acpi-fixes: ACPI / video: Add "Asus UL30A" to ACPI video detect blacklist ACPI / PM: Allow device power states to be used for CONFIG_PM unset
-rw-r--r--drivers/acpi/Makefile2
-rw-r--r--drivers/acpi/device_pm.c126
-rw-r--r--drivers/acpi/video_detect.c8
-rw-r--r--include/acpi/acpi_bus.h40
4 files changed, 78 insertions, 98 deletions
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index ecb743bf05a5..7cad994ee44f 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -24,7 +24,7 @@ acpi-y += nvs.o
24# Power management related files 24# Power management related files
25acpi-y += wakeup.o 25acpi-y += wakeup.o
26acpi-y += sleep.o 26acpi-y += sleep.o
27acpi-$(CONFIG_PM) += device_pm.o 27acpi-y += device_pm.o
28acpi-$(CONFIG_ACPI_SLEEP) += proc.o 28acpi-$(CONFIG_ACPI_SLEEP) += proc.o
29 29
30 30
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index 96de787e6104..bc493aa3af19 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -37,68 +37,6 @@
37#define _COMPONENT ACPI_POWER_COMPONENT 37#define _COMPONENT ACPI_POWER_COMPONENT
38ACPI_MODULE_NAME("device_pm"); 38ACPI_MODULE_NAME("device_pm");
39 39
40static DEFINE_MUTEX(acpi_pm_notifier_lock);
41
42/**
43 * acpi_add_pm_notifier - Register PM notifier for given ACPI device.
44 * @adev: ACPI device to add the notifier for.
45 * @context: Context information to pass to the notifier routine.
46 *
47 * NOTE: @adev need not be a run-wake or wakeup device to be a valid source of
48 * PM wakeup events. For example, wakeup events may be generated for bridges
49 * if one of the devices below the bridge is signaling wakeup, even if the
50 * bridge itself doesn't have a wakeup GPE associated with it.
51 */
52acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
53 acpi_notify_handler handler, void *context)
54{
55 acpi_status status = AE_ALREADY_EXISTS;
56
57 mutex_lock(&acpi_pm_notifier_lock);
58
59 if (adev->wakeup.flags.notifier_present)
60 goto out;
61
62 status = acpi_install_notify_handler(adev->handle,
63 ACPI_SYSTEM_NOTIFY,
64 handler, context);
65 if (ACPI_FAILURE(status))
66 goto out;
67
68 adev->wakeup.flags.notifier_present = true;
69
70 out:
71 mutex_unlock(&acpi_pm_notifier_lock);
72 return status;
73}
74
75/**
76 * acpi_remove_pm_notifier - Unregister PM notifier from given ACPI device.
77 * @adev: ACPI device to remove the notifier from.
78 */
79acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
80 acpi_notify_handler handler)
81{
82 acpi_status status = AE_BAD_PARAMETER;
83
84 mutex_lock(&acpi_pm_notifier_lock);
85
86 if (!adev->wakeup.flags.notifier_present)
87 goto out;
88
89 status = acpi_remove_notify_handler(adev->handle,
90 ACPI_SYSTEM_NOTIFY,
91 handler);
92 if (ACPI_FAILURE(status))
93 goto out;
94
95 adev->wakeup.flags.notifier_present = false;
96
97 out:
98 mutex_unlock(&acpi_pm_notifier_lock);
99 return status;
100}
101
102/** 40/**
103 * acpi_power_state_string - String representation of ACPI device power state. 41 * acpi_power_state_string - String representation of ACPI device power state.
104 * @state: ACPI device power state to return the string representation of. 42 * @state: ACPI device power state to return the string representation of.
@@ -385,6 +323,69 @@ bool acpi_bus_power_manageable(acpi_handle handle)
385} 323}
386EXPORT_SYMBOL(acpi_bus_power_manageable); 324EXPORT_SYMBOL(acpi_bus_power_manageable);
387 325
326#ifdef CONFIG_PM
327static DEFINE_MUTEX(acpi_pm_notifier_lock);
328
329/**
330 * acpi_add_pm_notifier - Register PM notifier for given ACPI device.
331 * @adev: ACPI device to add the notifier for.
332 * @context: Context information to pass to the notifier routine.
333 *
334 * NOTE: @adev need not be a run-wake or wakeup device to be a valid source of
335 * PM wakeup events. For example, wakeup events may be generated for bridges
336 * if one of the devices below the bridge is signaling wakeup, even if the
337 * bridge itself doesn't have a wakeup GPE associated with it.
338 */
339acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
340 acpi_notify_handler handler, void *context)
341{
342 acpi_status status = AE_ALREADY_EXISTS;
343
344 mutex_lock(&acpi_pm_notifier_lock);
345
346 if (adev->wakeup.flags.notifier_present)
347 goto out;
348
349 status = acpi_install_notify_handler(adev->handle,
350 ACPI_SYSTEM_NOTIFY,
351 handler, context);
352 if (ACPI_FAILURE(status))
353 goto out;
354
355 adev->wakeup.flags.notifier_present = true;
356
357 out:
358 mutex_unlock(&acpi_pm_notifier_lock);
359 return status;
360}
361
362/**
363 * acpi_remove_pm_notifier - Unregister PM notifier from given ACPI device.
364 * @adev: ACPI device to remove the notifier from.
365 */
366acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
367 acpi_notify_handler handler)
368{
369 acpi_status status = AE_BAD_PARAMETER;
370
371 mutex_lock(&acpi_pm_notifier_lock);
372
373 if (!adev->wakeup.flags.notifier_present)
374 goto out;
375
376 status = acpi_remove_notify_handler(adev->handle,
377 ACPI_SYSTEM_NOTIFY,
378 handler);
379 if (ACPI_FAILURE(status))
380 goto out;
381
382 adev->wakeup.flags.notifier_present = false;
383
384 out:
385 mutex_unlock(&acpi_pm_notifier_lock);
386 return status;
387}
388
388bool acpi_bus_can_wakeup(acpi_handle handle) 389bool acpi_bus_can_wakeup(acpi_handle handle)
389{ 390{
390 struct acpi_device *device; 391 struct acpi_device *device;
@@ -1023,3 +1024,4 @@ void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev)
1023 mutex_unlock(&adev->physical_node_lock); 1024 mutex_unlock(&adev->physical_node_lock);
1024} 1025}
1025EXPORT_SYMBOL_GPL(acpi_dev_pm_remove_dependent); 1026EXPORT_SYMBOL_GPL(acpi_dev_pm_remove_dependent);
1027#endif /* CONFIG_PM */
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index 66f67626f02e..e6bd910bc6ed 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -161,6 +161,14 @@ static struct dmi_system_id video_detect_dmi_table[] = {
161 DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"), 161 DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"),
162 }, 162 },
163 }, 163 },
164 {
165 .callback = video_detect_force_vendor,
166 .ident = "Asus UL30A",
167 .matches = {
168 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
169 DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"),
170 },
171 },
164 { }, 172 { },
165}; 173};
166 174
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 98db31d9f9b4..636c59f2003a 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -377,7 +377,6 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle,
377 unsigned long long *sta); 377 unsigned long long *sta);
378int acpi_bus_get_status(struct acpi_device *device); 378int acpi_bus_get_status(struct acpi_device *device);
379 379
380#ifdef CONFIG_PM
381int acpi_bus_set_power(acpi_handle handle, int state); 380int acpi_bus_set_power(acpi_handle handle, int state);
382const char *acpi_power_state_string(int state); 381const char *acpi_power_state_string(int state);
383int acpi_device_get_power(struct acpi_device *device, int *state); 382int acpi_device_get_power(struct acpi_device *device, int *state);
@@ -385,41 +384,12 @@ int acpi_device_set_power(struct acpi_device *device, int state);
385int acpi_bus_init_power(struct acpi_device *device); 384int acpi_bus_init_power(struct acpi_device *device);
386int acpi_bus_update_power(acpi_handle handle, int *state_p); 385int acpi_bus_update_power(acpi_handle handle, int *state_p);
387bool acpi_bus_power_manageable(acpi_handle handle); 386bool acpi_bus_power_manageable(acpi_handle handle);
387
388#ifdef CONFIG_PM
388bool acpi_bus_can_wakeup(acpi_handle handle); 389bool acpi_bus_can_wakeup(acpi_handle handle);
389#else /* !CONFIG_PM */ 390#else
390static inline int acpi_bus_set_power(acpi_handle handle, int state) 391static inline bool acpi_bus_can_wakeup(acpi_handle handle) { return false; }
391{ 392#endif
392 return 0;
393}
394static inline const char *acpi_power_state_string(int state)
395{
396 return "D0";
397}
398static inline int acpi_device_get_power(struct acpi_device *device, int *state)
399{
400 return 0;
401}
402static inline int acpi_device_set_power(struct acpi_device *device, int state)
403{
404 return 0;
405}
406static inline int acpi_bus_init_power(struct acpi_device *device)
407{
408 return 0;
409}
410static inline int acpi_bus_update_power(acpi_handle handle, int *state_p)
411{
412 return 0;
413}
414static inline bool acpi_bus_power_manageable(acpi_handle handle)
415{
416 return false;
417}
418static inline bool acpi_bus_can_wakeup(acpi_handle handle)
419{
420 return false;
421}
422#endif /* !CONFIG_PM */
423 393
424#ifdef CONFIG_ACPI_PROC_EVENT 394#ifdef CONFIG_ACPI_PROC_EVENT
425int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data); 395int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data);