aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/scan.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2011-01-12 04:55:28 -0500
committerLen Brown <len.brown@intel.com>2011-01-12 04:55:28 -0500
commit07bf280521bb06bc8e64f0b998fc391253fcb959 (patch)
tree323f0cb360d890889eacc7344e1dd42a2fb3ef68 /drivers/acpi/scan.c
parent1ae5ec903f71c0ffa583ec54d17415892036ee18 (diff)
parent53eac700b0df1fef8c957b9eedfd7f48120425e3 (diff)
Merge branch 'power-resource' into release
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r--drivers/acpi/scan.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index ce6741ee196..148e7492d73 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -847,6 +847,8 @@ end:
847 return 0; 847 return 0;
848} 848}
849 849
850static void acpi_bus_add_power_resource(acpi_handle handle);
851
850static int acpi_bus_get_power_flags(struct acpi_device *device) 852static int acpi_bus_get_power_flags(struct acpi_device *device)
851{ 853{
852 acpi_status status = 0; 854 acpi_status status = 0;
@@ -875,8 +877,12 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
875 acpi_evaluate_reference(device->handle, object_name, NULL, 877 acpi_evaluate_reference(device->handle, object_name, NULL,
876 &ps->resources); 878 &ps->resources);
877 if (ps->resources.count) { 879 if (ps->resources.count) {
880 int j;
881
878 device->power.flags.power_resources = 1; 882 device->power.flags.power_resources = 1;
879 ps->flags.valid = 1; 883 ps->flags.valid = 1;
884 for (j = 0; j < ps->resources.count; j++)
885 acpi_bus_add_power_resource(ps->resources.handles[j]);
880 } 886 }
881 887
882 /* Evaluate "_PSx" to see if we can do explicit sets */ 888 /* Evaluate "_PSx" to see if we can do explicit sets */
@@ -901,10 +907,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
901 device->power.states[ACPI_STATE_D3].flags.valid = 1; 907 device->power.states[ACPI_STATE_D3].flags.valid = 1;
902 device->power.states[ACPI_STATE_D3].power = 0; 908 device->power.states[ACPI_STATE_D3].power = 0;
903 909
904 /* TBD: System wake support and resource requirements. */ 910 acpi_bus_init_power(device);
905
906 device->power.state = ACPI_STATE_UNKNOWN;
907 acpi_bus_get_power(device->handle, &(device->power.state));
908 911
909 return 0; 912 return 0;
910} 913}
@@ -1326,6 +1329,20 @@ end:
1326#define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \ 1329#define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \
1327 ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING) 1330 ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING)
1328 1331
1332static void acpi_bus_add_power_resource(acpi_handle handle)
1333{
1334 struct acpi_bus_ops ops = {
1335 .acpi_op_add = 1,
1336 .acpi_op_start = 1,
1337 };
1338 struct acpi_device *device = NULL;
1339
1340 acpi_bus_get_device(handle, &device);
1341 if (!device)
1342 acpi_add_single_object(&device, handle, ACPI_BUS_TYPE_POWER,
1343 ACPI_STA_DEFAULT, &ops);
1344}
1345
1329static int acpi_bus_type_and_status(acpi_handle handle, int *type, 1346static int acpi_bus_type_and_status(acpi_handle handle, int *type,
1330 unsigned long long *sta) 1347 unsigned long long *sta)
1331{ 1348{
@@ -1573,6 +1590,8 @@ int __init acpi_scan_init(void)
1573 printk(KERN_ERR PREFIX "Could not register bus type\n"); 1590 printk(KERN_ERR PREFIX "Could not register bus type\n");
1574 } 1591 }
1575 1592
1593 acpi_power_init();
1594
1576 /* 1595 /*
1577 * Enumerate devices in the ACPI namespace. 1596 * Enumerate devices in the ACPI namespace.
1578 */ 1597 */