ACPI / PM: Move device power management functions to device_pm.c

Move ACPI device power management functions from drivers/acpi/bus.c
to drivers/acpi/device_pm.c.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / PM: Consolidate suspend-specific and hibernate-specific code

Move some suspend-specific and hibernate-specific code from
acpi_sleep_init() into separate functions to get rid of explicit
#ifdefs in acpi_sleep_init().  Use pr_info() to start and pr_cont()
to continue printing the supported ACPI sleep states line.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / PM: remove leading whitespace from #ifdef

It is there probably due to an accident, get rid of it so that the format
is consistent across the file.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / PM: Fix build for unusual combination of Kconfig options

CONFIG_PM_SLEEP may be set even if CONFIG_ACPI_SLEEP is unset,
although that is unusual.  For this reason, make the headers of
functions built for both CONFIG_ACPI and CONFIG_PM_SLEEP set
simultaneously depend on that combination of Kconfig options
instead of CONFIG_ACPI_SLEEP.

This fixes a build problem reported by Randy Dunlap.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / PM: Export power states of ACPI devices via sysfs

Make it possible to retrieve the current power state of a device with
ACPI power management from user space via sysfs by adding a new
attribute power_state to the sysfs directory associated with the
struct acpi_device object representing the device's ACPI node.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'acpi-pm' into bleeding-edge

* acpi-pm:
  ACPI / PM: Export power states of ACPI devices via sysfs
  ACPI / PM: Fix build for unusual combination of Kconfig options
  ACPI / PM: remove leading whitespace from #ifdef
  ACPI / PM: Consolidate suspend-specific and hibernate-specific code
  ACPI / PM: Move device power management functions to device_pm.c
  ACPI / PM: Common string representations of device power states
  ACPI / PM: More visible function for retrieving device power states
  ACPI / PM: Change the way power transitions to D3cold are carried out
  ACPI: Use system level attribute of wakeup power resources
  ACPI: Take power resource initialization errors into account
  ACPI / scan: Consolidate extraction of power resources lists
  ACPI / scan: Remove unnecessary initialization of local variables
  ACPI / scan: Move power state initialization to a separate routine
  ACPI / PM: Take order attribute of wakeup power resources into account
  ACPI / PM: Take order attribute of power resources into account
  ACPI: Do not use device power states of power resources
  ACPI: Drop power resources driver
  ACPI / scan: Treat power resources in a special way
  ACPI / scan: More straightforward preparation of ACPI device objects
  ACPI / PM: Rework the handling of devices depending on power resources
ACPI: add support for CSRT table

Core System Resources Table (CSRT) is a proprietary ACPI table that
contains resources for certain devices that are not found in the DSDT
table. Typically a shared DMA controller might be found here.

This patch adds support for this table. We go through all entries in the
table and make platform devices of them. The resources from the table are
passed with the platform device.

There is one special resource in the table and it is the DMA request line
base and number of request lines. This information might be needed by the
DMA controller driver as it needs to map the ACPI DMA request line number
to the actual request line understood by the hardware. This range is passed
as IORESOURCE_DMA resource.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / platform: fix comment about the platform device name

We don't use _UID anymore, instead the name will be taken from the
corresponding ACPI device (adev). Fix the obsolete comment.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
clk: x86: add support for Lynxpoint LPSS clocks

Intel Lynxpoint Low Power Subsystem hosts peripherals like UART, I2C and
SPI controllers. For most of these there is a configuration register that
allows software to enable and disable the functional clock. Disabling the
clock while the peripheral is not used saves power.

In order to take advantage of this we add a new clock gate of type
lpss_gate that just re-uses the ordinary clk_gate but in addition is able
to enumerate the base address register of the device using ACPI.

We then create a clock tree that models the Lynxpoint LPSS clocks using
these gates and fixed clocks so that we can pass clock rate to the drivers
as well.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / platform: create LPSS clocks if Lynxpoint devices are found during scan

Intel Lynxpoint LPSS peripheral drivers depend on LPSS clock tree being
created in order to function properly. The clock tree is exposed as a
platform driver that binds to a device named 'clk-lpt'.

To support this we modify the acpi_create_platform_device() to take one
additional parameter called flags. This is passed from
acpi_platform_device_ids[] array when acpi_create_platform_device() is
called.

We then introduce a new flag ACPI_PLATFORM_CLK which is used to tell
acpi_create_platform_device() to create the platform clocks as well.

Finally we set the ACPI_PLATFORM_CLK flags for all the Lynxpoint LPSS
devices and make sure that when this flag is set we create the
corresponding clock tree platform device.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'acpi-lpss' into bleeding-edge

* acpi-lpss:
  ACPI / platform: create LPSS clocks if Lynxpoint devices are found during scan
  clk: x86: add support for Lynxpoint LPSS clocks
  ACPI / platform: fix comment about the platform device name
  ACPI: add support for CSRT table
Merge branch 'fixes-next' into bleeding-edge

* fixes-next:
  ACPI, APEI: Fixup incorrect 64-bit access width firmware bug
  ACPI / processor: Get power info before updating the C-states
  powernow-k8: Add a kconfig dependency on acpi-cpufreq
  ACPI / cpuidle: Fix NULL pointer issues when cpuidle is disabled
  intel_idle: Don't register CPU notifier if we are not running.
Merge branch 'acpi-assorted-next' into bleeding-edge

* acpi-assorted-next:
  ACPI: fix obsolete comment in custom_method.c
  ACPI / thermal: Use mode to enable/disable kernel thermal processing
  ACPI thermal: remove unnecessary newline from exception message
  ACPI sysfs: remove unnecessary newline from exception
  ACPI video: remove unnecessary newline from error messages
  ACPI: SRAT: report non-volatile memory in debug
  ACPI: Rework acpi_get_child() to be more efficient
Merge branch 'pm-cpufreq-next' into bleeding-edge

* pm-cpufreq-next:
  cpufreq: handle cpufreq being disabled for all exported function.
  cpufreq: Simplify cpufreq_add_dev()
  cpufreq: Simplify __cpufreq_remove_dev()
  cpufreq: SPEAr: Fix sparse warning for cpufreq driver
  cpufreq: Don't use cpu removed during cpufreq_driver_unregister
  cpufreq: Notify governors when cpus are hot-[un]plugged
  cpufreq: Manage only online cpus
  cpufreq: ondemand: use all CPUs in update_sampling_rate
  cpufreq: conservative: call dbs_check_cpu only when necessary
  cpufreq: ondemand: call dbs_check_cpu only when necessary
  cpufreq: star/stop cpufreq timers on cpu hotplug
  cpufreq: handle SW coordinated CPUs
Merge branch 'pm-assorted-next' into bleeding-edge

* pm-assorted-next:
  PM / tracing: remove deprecated power trace API
  PM: don't use [delayed_]work_pending()
  PM / Domains: don't use [delayed_]work_pending()
Merge branch 'pnp-next' into bleeding-edge

* pnp-next:
  drivers/pnp/pnpbios: remove depends on CONFIG_EXPERIMENTAL