]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branch 'wakeup-etc-rafael' into release
authorLen Brown <len.brown@intel.com>
Wed, 12 Jan 2011 09:55:46 +0000 (04:55 -0500)
committerLen Brown <len.brown@intel.com>
Wed, 12 Jan 2011 09:55:46 +0000 (04:55 -0500)
1  2 
drivers/acpi/scan.c
drivers/acpi/wakeup.c
include/acpi/acpi_bus.h

diff --combined drivers/acpi/scan.c
index 148e7492d7365282f38acb41f88422243a0691c8,bf7acbff1f5fb90e7457373523639e96f9d071f7..64d4da0d6d5255bbbd7112f44c4d9a88f045fef0
@@@ -778,7 -778,7 +778,7 @@@ acpi_bus_extract_wakeup_device_power_pa
                wakeup->resources.handles[i] = element->reference.handle;
        }
  
 -      acpi_gpe_can_wake(wakeup->gpe_device, wakeup->gpe_number);
 +      acpi_setup_gpe_for_wake(handle, wakeup->gpe_device, wakeup->gpe_number);
  
   out:
        kfree(buffer.pointer);
@@@ -803,7 -803,7 +803,7 @@@ static void acpi_bus_set_run_wake_flags
        /* Power button, Lid switch always enable wakeup */
        if (!acpi_match_device_ids(device, button_device_ids)) {
                device->wakeup.flags.run_wake = 1;
-               device->wakeup.flags.always_enabled = 1;
+               device_set_wakeup_capable(&device->dev, true);
                return;
        }
  
@@@ -847,8 -847,6 +847,8 @@@ end
        return 0;
  }
  
 +static void acpi_bus_add_power_resource(acpi_handle handle);
 +
  static int acpi_bus_get_power_flags(struct acpi_device *device)
  {
        acpi_status status = 0;
                acpi_evaluate_reference(device->handle, object_name, NULL,
                                        &ps->resources);
                if (ps->resources.count) {
 +                      int j;
 +
                        device->power.flags.power_resources = 1;
                        ps->flags.valid = 1;
 +                      for (j = 0; j < ps->resources.count; j++)
 +                              acpi_bus_add_power_resource(ps->resources.handles[j]);
                }
  
                /* Evaluate "_PSx" to see if we can do explicit sets */
        device->power.states[ACPI_STATE_D3].flags.valid = 1;
        device->power.states[ACPI_STATE_D3].power = 0;
  
 -      /* TBD: System wake support and resource requirements. */
 -
 -      device->power.state = ACPI_STATE_UNKNOWN;
 -      acpi_bus_get_power(device->handle, &(device->power.state));
 +      acpi_bus_init_power(device);
  
        return 0;
  }
  #define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \
                          ACPI_STA_DEVICE_UI      | ACPI_STA_DEVICE_FUNCTIONING)
  
 +static void acpi_bus_add_power_resource(acpi_handle handle)
 +{
 +      struct acpi_bus_ops ops = {
 +              .acpi_op_add = 1,
 +              .acpi_op_start = 1,
 +      };
 +      struct acpi_device *device = NULL;
 +
 +      acpi_bus_get_device(handle, &device);
 +      if (!device)
 +              acpi_add_single_object(&device, handle, ACPI_BUS_TYPE_POWER,
 +                                      ACPI_STA_DEFAULT, &ops);
 +}
 +
  static int acpi_bus_type_and_status(acpi_handle handle, int *type,
                                    unsigned long long *sta)
  {
@@@ -1484,7 -1467,7 +1484,7 @@@ int acpi_bus_start(struct acpi_device *
  
        result = acpi_bus_scan(device->handle, &ops, NULL);
  
 -      acpi_update_gpes();
 +      acpi_update_all_gpes();
  
        return result;
  }
@@@ -1590,8 -1573,6 +1590,8 @@@ int __init acpi_scan_init(void
                printk(KERN_ERR PREFIX "Could not register bus type\n");
        }
  
 +      acpi_power_init();
 +
        /*
         * Enumerate devices in the ACPI namespace.
         */
        if (result)
                acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL);
        else
 -              acpi_update_gpes();
 +              acpi_update_all_gpes();
  
        return result;
  }
diff --combined drivers/acpi/wakeup.c
index c6cb68e0a80c9a16b2e0f7c6da451a8394edea66,f252d0de992276c620620dde0fef46ead4b861ff..ed6501452507ff73ee796fd07f29097987b0dd01
@@@ -37,15 -37,16 +37,16 @@@ void acpi_enable_wakeup_devices(u8 slee
                        container_of(node, struct acpi_device, wakeup_list);
  
                if (!dev->wakeup.flags.valid
-                   || !(dev->wakeup.state.enabled || dev->wakeup.prepare_count)
-                   || sleep_state > (u32) dev->wakeup.sleep_state)
+                   || sleep_state > (u32) dev->wakeup.sleep_state
+                   || !(device_may_wakeup(&dev->dev)
+                       || dev->wakeup.prepare_count))
                        continue;
  
-               if (dev->wakeup.state.enabled)
+               if (device_may_wakeup(&dev->dev))
                        acpi_enable_wakeup_device_power(dev, sleep_state);
  
                /* The wake-up power should have been enabled already. */
 -              acpi_gpe_wakeup(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
 +              acpi_set_gpe_wake_mask(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
                                ACPI_GPE_ENABLE);
        }
  }
@@@ -63,14 -64,15 +64,15 @@@ void acpi_disable_wakeup_devices(u8 sle
                        container_of(node, struct acpi_device, wakeup_list);
  
                if (!dev->wakeup.flags.valid
-                   || !(dev->wakeup.state.enabled || dev->wakeup.prepare_count)
-                   || (sleep_state > (u32) dev->wakeup.sleep_state))
+                   || sleep_state > (u32) dev->wakeup.sleep_state
+                   || !(device_may_wakeup(&dev->dev)
+                       || dev->wakeup.prepare_count))
                        continue;
  
 -              acpi_gpe_wakeup(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
 +              acpi_set_gpe_wake_mask(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
                                ACPI_GPE_DISABLE);
  
-               if (dev->wakeup.state.enabled)
+               if (device_may_wakeup(&dev->dev))
                        acpi_disable_wakeup_device_power(dev);
        }
  }
@@@ -84,8 -86,8 +86,8 @@@ int __init acpi_wakeup_device_init(void
                struct acpi_device *dev = container_of(node,
                                                       struct acpi_device,
                                                       wakeup_list);
-               if (dev->wakeup.flags.always_enabled)
-                       dev->wakeup.state.enabled = 1;
+               if (device_can_wakeup(&dev->dev))
+                       device_set_wakeup_enable(&dev->dev, true);
        }
        mutex_unlock(&acpi_device_lock);
        return 0;
diff --combined include/acpi/acpi_bus.h
index 673a3f4d1f07397a2dc4e31c8942840d126482de,f2499f572109e4abd6ae54073ceaaa8b94c58775..20b05cd6866340a82e8cee11e3de18332f494edc
@@@ -149,7 -149,8 +149,7 @@@ struct acpi_device_flags 
        u32 power_manageable:1;
        u32 performance_manageable:1;
        u32 wake_capable:1;     /* Wakeup(_PRW) supported? */
 -      u32 force_power_state:1;
 -      u32 reserved:22;
 +      u32 reserved:23;
  };
  
  /* File System */
@@@ -241,20 -242,14 +241,14 @@@ struct acpi_device_perf 
  struct acpi_device_wakeup_flags {
        u8 valid:1;             /* Can successfully enable wakeup? */
        u8 run_wake:1;          /* Run-Wake GPE devices */
-       u8 always_enabled:1;    /* Run-wake devices that are always enabled */
        u8 notifier_present:1;  /* Wake-up notify handler has been installed */
  };
  
- struct acpi_device_wakeup_state {
-       u8 enabled:1;
- };
  struct acpi_device_wakeup {
        acpi_handle gpe_device;
        u64 gpe_number;
        u64 sleep_state;
        struct acpi_handle_list resources;
-       struct acpi_device_wakeup_state state;
        struct acpi_device_wakeup_flags flags;
        int prepare_count;
        int run_wake_count;
@@@ -327,8 -322,8 +321,8 @@@ void acpi_bus_data_handler(acpi_handle 
  acpi_status acpi_bus_get_status_handle(acpi_handle handle,
                                       unsigned long long *sta);
  int acpi_bus_get_status(struct acpi_device *device);
 -int acpi_bus_get_power(acpi_handle handle, int *state);
  int acpi_bus_set_power(acpi_handle handle, int state);
 +int acpi_bus_update_power(acpi_handle handle, int *state_p);
  bool acpi_bus_power_manageable(acpi_handle handle);
  bool acpi_bus_can_wakeup(acpi_handle handle);
  #ifdef CONFIG_ACPI_PROC_EVENT