ACPI / PM: Export acpi_target_system_state() to modules

Export the acpi_target_system_state() function to modules so that
modular drivers can use it to check what the target ACPI sleep state
of the system is (that is needed for i915 mostly at this point).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
PNP / resources: remove positive test on unsigned values

irq and dma are both resource_size_t (derived from phys_addr_t <-> unsigned)

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / proc: Do not say when /proc interfaces will be deleted in Kconfig

Do not tell people in the Kconfig help when exactly we are going to
remove the deprecated ACPI interfaces in /proc, because, honestly,
we don't know.  We will remove them when they are not used any more.

In particular, do not tell them that the interfaces will be removed
in a kernel release that already happened long ago.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPICA: Revert "ACPICA: Add option to favor 32-bit FADT addresses."

Revert commit 0249ed2444d6 (ACPICA: Add option to favor 32-bit FADT
addresses.) that breaks resume from system suspend on the Intel DP45SG
board.

Fixes: 0249ed2444d6 (ACPICA: Add option to favor 32-bit FADT addresses.)
References: https://bugzilla.kernel.org/show_bug.cgi?id=74021
Reported-and-tested-by: Oswald Buddenhagen <ossi@kde.org>
Cc: 3.14+ <stable@vger.kernel.org> # 3.14+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / TPM: Fix resume regression on Chromebooks

Chromebooks (at least Acer C720 and Pixel) implement an ACPI object
for TPM, but don't implement the _DSM method to support PPI.  As
a result, the TPM driver fails to load on those machines after
commit 1569a4c4ceba (ACPI / TPM: detect PPI features by checking
availability of _DSM functions) which causes them to fail to
resume from system suspend, becuase they require the TPM hardware
to be put into the right state during resume and the TPM driver
is necessary for that.

Fix the problem by making tpm_add_ppi() return 0 when tpm_ppi_handle
is still NULL after walking the ACPI namespace in search for the PPI
_DSM, which allows the TPM driver to load and operate the hardware
(during system resume in particular), but avoid creating the PPI
sysfs group in that case.

This change is based on a prototype patch from Jiang Liu.

Fixes: 1569a4c4ceba (ACPI / TPM: detect PPI features by checking availability of _DSM functions)
References: https://bugzilla.kernel.org/show_bug.cgi?id=74021
Reported-by: James Duley <jagduley@gmail.com>
Reported-by: Phillip Dixon <phil@dixon.gen.nz>
Tested-by: Brandon Casey <drafnel@gmail.com>
Cc: 3.14+ <stable@vger.kernel.org> # 3.14+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'acpi-tpm' into linux-next

* acpi-tpm:
  ACPI / TPM: Fix resume regression on Chromebooks
Merge branch 'acpi-proc' into linux-next

* acpi-proc:
  ACPI / proc: Do not say when /proc interfaces will be deleted in Kconfig
Merge branch 'pnp' into linux-next

* pnp:
  PNP / resources: remove positive test on unsigned values
Merge branch 'acpi-pm' into linux-next

* acpi-pm:
  ACPI / PM: Export acpi_target_system_state() to modules
Merge branch 'pm-sleep' into linux-next

* pm-sleep:
  PM / hibernate: convert simple_strtoul to kstrtoul
Merge back earlier ACPICA material.

Conflicts:
	drivers/acpi/acpica/acglobal.h
	drivers/acpi/acpica/tbfadt.c
	include/acpi/acpixf.h
Merge branch 'acpica-tmp' into bleeding-edge

* acpica-tmp: (55 commits)
  ACPICA: Revert "ACPICA: Add option to favor 32-bit FADT addresses."
  ACPICA: Update version to 20140424.
  ACPICA: Comment/format update, no functional change.
  ACPICA: Events: Update GPE handling and initialization code.
  ACPICA: Remove extraneous error message for large number of GPEs.
  ACPICA: Tables: Remove old mechanism to validate if XSDT contains NULL entries.
  ACPICA: Tables: Add new mechanism to skip NULL entries in RSDT and XSDT.
  ACPICA: acpidump: Add support to force using RSDT.
  ACPICA: Back port of improvements on exception code.
  ACPICA: Back port of _PRP update.
  ACPICA: acpidump: Fix truncated RSDP signature validation.
  ACPICA: Linux header: Add support for stubbed externals.
  ACPICA: OSL: Add configurability for generic external functions.
  ACPICA: OSL: Add section to collect the divergence in acpixf.h.
  ACPICA: OSL: Add configurability for debug output functions.
  ACPICA: OSL: Add configurability for error message functions.
  ACPICA: OSL: Add configurability for memory allocation macros.
  ACPICA: OSL: Move external globals from utglobal.c to acpixf.h using ACPI_INIT_GLOBAL/ACPI_GLOBAL.
  ACPICA: Comment updates - no functional change.
  ACPICA: Update handling of PCI ID lists.
  ...
intel_pstate: Set turbo VID for BayTrail

A documentation update exposed that there is a separate set of VID
values that must be used in the turbo/boost P state range.  Add
enumerating and setting the correct VID for P states in the turbo
range.

Cc: v3.13+ <stable@vger.kernel.org> # v3.13+
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
intel_pstate: remove setting P state to MAX on init

Setting the P state of the core to max at init time is a hold over
from early implementation of intel_pstate where intel_pstate disabled
cpufreq and loaded VERY early in the boot sequence.  This was to
ensure that intel_pstate did not affect boot time. This in not needed
now that intel_pstate is a cpufreq driver.

Removing this covers the case where a CPU has gone through a manual
CPU offline/online cycle and the P state is set to MAX on init and the
CPU immediately goes idle.  Due to HW coordination the P state request
on the idle CPU will drag all cores to MAX P state until the load is
reevaluated when to core goes non-idle.

Reported-by: Patrick Marlier <patrick.marlier@gmail.com>
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
intel_pstate: Fix fixed point rounding macro

Change the FP_ROUNDUP macro to add 0.5 in fixed point representation
instead of 1.0

Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
intel_pstate: Remove C0 tracking

Commit fcb6a15c (intel_pstate: Take core C0 time into account for core
busy) introduced a regression referenced below.  The issue with "lockup"
after suspend that this commit was addressing is now dealt with in the
suspend path.

Fixes: fcb6a15c2e7e (intel_pstate: Take core C0 time into account for core busy)
References: https://bugzilla.kernel.org/show_bug.cgi?id=66581
References: https://bugzilla.kernel.org/show_bug.cgi?id=75121
Reported-by: Doug Smythies <dsmythies@telus.net>
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
intel_pstate: Add CPU IDs for Broadwell processors

Add support for Broadwell processors.

Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'pm-cpufreq' into linux-next

* pm-cpufreq:
  intel_pstate: Add CPU IDs for Broadwell processors
  intel_pstate: Remove C0 tracking
  intel_pstate: Fix fixed point rounding macro
  intel_pstate: remove setting P state to MAX on init
  intel_pstate: Set turbo VID for BayTrail
Merge branch 'linux-next' into bleeding-edge

* linux-next: (39 commits)
  intel_pstate: Add CPU IDs for Broadwell processors
  intel_pstate: Remove C0 tracking
  intel_pstate: Fix fixed point rounding macro
  intel_pstate: remove setting P state to MAX on init
  intel_pstate: Set turbo VID for BayTrail
  ACPI / TPM: Fix resume regression on Chromebooks
  ACPI / proc: Do not say when /proc interfaces will be deleted in Kconfig
  PNP / resources: remove positive test on unsigned values
  ACPI / PM: Export acpi_target_system_state() to modules
  PM / hibernate: convert simple_strtoul to kstrtoul
  cpufreq: Fix build error on some platforms that use cpufreq_for_each_*
  PM / hibernate: Documentation: Fix script for unswapping
  PM / suspend: Always use deepest C-state in the "freeze" sleep state
  ACPI / video: change acpi-video brightness_switch_enabled default to 0
  PM / OPP: Move cpufreq specific OPP functions out of generic OPP library
  PM / OPP: Remove cpufreq wrapper dependency on internal data organization
  cpufreq: Catch double invocations of cpufreq_freq_transition_begin/end
  intel_pstate: Remove sample parameter in intel_pstate_calc_busy
  PM / tools: cpupower: add option to display values without round offs
  tools / power: turbostat: Drop temperature checks
  ...