1. 22 1月, 2013 1 次提交
    • R
      ACPI / PM: Make acpi_bus_init_power() more robust · a2367807
      Rafael J. Wysocki 提交于
      The ACPI specification requires the _PSC method to be present under
      a device object if its power state cannot be inferred from the states
      of power resources used by it (ACPI 5, Section 7.6.2).  However, it
      also requires that (for power states D0-D2 and D3hot) if the _PSn
      (n = 0, 1, 2, 3) method is present under the device object, it also
      must be executed after the power resources have been set
      appropriately for the device to go into power state Dn (D3 means
      D3hot in this case).  Thus it is not clear from the specification
      whether or not the _PSn method should be executed if the initial
      configuraion of power resources used by the device indicates power
      state Dn and the _PSC method is not present.
      
      The current implementation of acpi_bus_init_power() is based on the
      assumption that it should not be necessary to execute _PSn in the
      above situation, but experience shows that in fact that assumption
      need not be satisfied.  For this reason, make acpi_bus_init_power()
      always execute _PSn if the initial configuration of device power
      resources indicates power state Dn.
      Reported-and-tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a2367807
  2. 20 1月, 2013 2 次提交
  3. 17 1月, 2013 1 次提交
    • R
      ACPI / PM: Rework the handling of devices depending on power resources · bc9b6407
      Rafael J. Wysocki 提交于
      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: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      bc9b6407
  4. 03 1月, 2013 2 次提交
  5. 26 11月, 2012 1 次提交
  6. 15 11月, 2012 6 次提交
    • R
      ACPI / PM: Provide ACPI PM callback routines for subsystems · e5cc8ef3
      Rafael J. Wysocki 提交于
      Some bus types don't support power management natively, but generally
      there may be device nodes in ACPI tables corresponding to the devices
      whose bus types they are (under ACPI 5 those bus types may be SPI,
      I2C and platform).  If that is the case, standard ACPI power
      management may be applied to those devices, although currently the
      kernel has no means for that.
      
      For this reason, provide a set of routines that may be used as power
      management callbacks for such devices.  This may be done in three
      different ways.
      
       (1) Device drivers handling the devices in question may run
           acpi_dev_pm_attach() in their .probe() routines, which (on
           success) will cause the devices to be added to the general ACPI
           PM domain and ACPI power management will be used for them going
           forward.  Then, acpi_dev_pm_detach() may be used to remove the
           devices from the general ACPI PM domain if ACPI power management
           is not necessary for them any more.
      
       (2) The devices' subsystems may use acpi_subsys_runtime_suspend(),
           acpi_subsys_runtime_resume(), acpi_subsys_prepare(),
           acpi_subsys_suspend_late(), acpi_subsys_resume_early() as their
           power management callbacks in the same way as the general ACPI
           PM domain does that.
      
       (3) The devices' drivers may execute acpi_dev_suspend_late(),
           acpi_dev_resume_early(), acpi_dev_runtime_suspend(),
           acpi_dev_runtime_resume() from their power management callbacks
           as appropriate, if that's absolutely necessary, but it is not
           recommended to do that, because such drivers may not work
           without ACPI support as a result.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e5cc8ef3
    • R
      ACPI / PM: Move device PM functions related to sleep states · a6ae7594
      Rafael J. Wysocki 提交于
      Introduce helper function returning the target sleep state of the
      system and use it to move the remaining device power management
      functions from sleep.c to device_pm.c.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a6ae7594
    • R
      ACPI / PM: Split device wakeup management routines · dee8370c
      Rafael J. Wysocki 提交于
      Two device wakeup management routines in device_pm.c and sleep.c,
      acpi_pm_device_run_wake() and acpi_pm_device_sleep_wake(), take a
      device pointer argument and use it to obtain the ACPI handle of the
      corresponding ACPI namespace node.  That handle is then used to get
      the address of the struct acpi_device object corresponding to the
      struct device passed as the argument.
      
      Unfortunately, that last operation may be costly, because it involves
      taking the global ACPI namespace mutex, so it shouldn't be carried
      out too often.  However, the callers of those routines usually call
      them in a row with acpi_pm_device_sleep_state() which also takes that
      mutex for the same reason, so it would be more efficient if they ran
      acpi_bus_get_device() themselves to obtain a pointer to the struct
      acpi_device object in question and then passed that pointer to the
      appropriate PM routines.
      
      To make that possible, split each of the PM routines mentioned above
      in two parts, one taking a struct acpi_device pointer argument and
      the other implementing the current interface for compatibility.
      
      Additionally, change acpi_pm_device_run_wake() to actually return
      an error code if there is an error while setting up runtime remote
      wakeup for the device.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      dee8370c
    • R
      ACPI / PM: Move runtime remote wakeup setup routine to device_pm.c · cd7bd02d
      Rafael J. Wysocki 提交于
      The ACPI function for setting up devices to do runtime remote
      wakeup is now located in drivers/acpi/sleep.c, but
      drivers/acpi/device_pm.c is a more logical place for it, so move it
      there.
      
      No functional changes should result from this modification.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cd7bd02d
    • R
      ACPI / PM: Move device power state selection routine to device_pm.c · 86b3832c
      Rafael J. Wysocki 提交于
      The ACPI function for choosing device power state is now located
      in drivers/acpi/sleep.c, but drivers/acpi/device_pm.c is a more
      logical place for it, so move it there.
      
      However, instead of moving the function entirely, move its core only
      under a different name and with a different list of arguments, so
      that it is more flexible, and leave a wrapper around it in the
      original location.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      86b3832c
    • R
      ACPI / PM: Move routines for adding/removing device wakeup notifiers · ec2cd81c
      Rafael J. Wysocki 提交于
      ACPI routines for adding and removing device wakeup notifiers are
      currently defined in a PCI-specific file, but they will be necessary
      for non-PCI devices too, so move them to a separate file under
      drivers/acpi and rename them to indicate their ACPI origins.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ec2cd81c