Merge branches 'acpica', 'acpi-tpm' and 'acpi-processor'

* acpica:
  ACPICA: Tables: Restore old behavor to favor 32-bit FADT addresses.
  ACPICA: Tables: Fix invalid pointer accesses in acpi_tb_parse_root_table().

* acpi-tpm:
  ACPI / TPM: Fix resume regression on Chromebooks

* acpi-processor:
  ACPI / processor: do not mark present at boot but not onlined CPU as onlined
Merge branches 'acpi-ac' and 'acpi-proc'

* acpi-ac:
  ACPI: Revert "ACPI / AC: convert ACPI ac driver to platform bus"

* acpi-proc:
  ACPI / proc: Do not say when /proc interfaces will be deleted in Kconfig
  ACPI: Revert "ACPI / Battery: Remove battery's proc directory"
  ACPI: Revert "ACPI: Remove CONFIG_ACPI_PROCFS_POWER and cm_sbsc.c"
Merge branches 'acpi-video' and 'acpi-blacklist'

* acpi-video:
  ACPI / video: correct DMI tag for Dell Inspiron 7520
  ACPI / video: Add use_native_backlight quirks for more systems

* acpi-blacklist:
  ACPI / blacklist: Add dmi_enable_osi_linux quirk for Asus EEE PC 1015PX
  ACPI: blacklist win8 OSI for Dell Inspiron 7737
Merge branch 'pm-cpufreq'

* pm-cpufreq:
  intel_pstate: remove setting P state to MAX on init
  intel_pstate: Set turbo VID for BayTrail
ACPI / video: Don't register acpi_video_resume notifier without backlight devices

If we're not going to be registering any backlight devices then
acpi_video_resume is always nop, so don't register it in that case.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / video: Add an acpi_video_unregister_backlight function

Add an acpi_video_unregister_backlight function, which only unregisters
the backlight device, and leaves the acpi_notifier in place. Some acpi_vendor
driver need this as they don't want the acpi_video# backlight device, but do
need the acpi-video driver for hotkey handling.

Chances are that this new acpi_video_unregister_backlight() is actually
what existing acpi_vendor drivers have wanted all along. Currently acpi_vendor
drivers which want to disable the acpi_video# backlight device, make 2 calls:

acpi_video_dmi_promote_vendor();
acpi_video_unregister();

The intention here is to make things independent of when acpi_video_register()
gets called. As acpi_video_register() will get called on acpi-video load time
on non intel gfx machines, while it gets called on i915 load time on intel
gfx machines.

This leads to the following 2 interesting scenarios:

 a) intel gfx:
  1) acpi-video module gets loaded (as it is a dependency of acpi_vendor
     and i915)
  2) acpi-video does NOT call acpi_video_register()
  3) acpi_vendor loads (lets assume it loads before i915), calls
     acpi_video_dmi_promote_vendor(); which sets
     ACPI_VIDEO_BACKLIGHT_DMI_VENDOR
  4) calls acpi_video_unregister -> not registered, nop
  5) i915 loads, calls acpi_video_register
  6) acpi_video_register registers the acpi_notifier for the hotkeys,
     does NOT register a backlight device because of
     ACPI_VIDEO_BACKLIGHT_DMI_VENDOR

 b) non intel gfx
  1) acpi-video module gets loaded (as it is a dependency acpi_vendor)
  2) acpi-video calls acpi_video_register()
  3) acpi_video_register registers the acpi_notifier for the hotkeys,
     and a backlight device
  4) acpi_vendor loads, calls acpi_video_dmi_promote_vendor()
  5) calls acpi_video_unregister, this unregisters BOTH the acpi_notifier
     for the hotkeys AND the backlight device

So here we have possibly the same acpi_vendor module, making the same calls,
but with different results, in one cases acpi-video does handle hotkeys,
in the other it does not.

Note that the a) scenario turns into b) if we assume the i915 module loads
before the vendor_acpi module, so we also have different behavior depending
on module loading order!

So as said I believe that quite a few existing acpi_vendor modules really
always want the behavior of a), hence this patch adds a new
acpi_video_unregister_backlight() which gives the behavior of a) independent
of module loading order.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / acer-wmi: Switch to acpi_video_unregister_backlight()

Switch from acpi_video_unregister(), to acpi_video_unregister_backlight(),
so that the hotkeys handler registered by acpi-video stays in place.

Since there are no mappings for the atkbd raw codes for the brightness
keys used by newer Acer models in /lib/udev/hwdb.d/60-keyboard.hwdb, and
since we map the wmi events with a code of KE_IGNORE, we rely on acpi-video
to do the hotkey handling for us.

For laptops such as the Acer Aspire 5750 which uses intel gfx this works
despite us calling acpi_video_unregister() because the following happens:

 1) acpi-video module gets loaded (as it is a dependency of acer-wmi and i915)
 2) acpi-video does NOT call acpi_video_register()
 3) acer-wmi loads (assume it loads before i915), calls
    acpi_video_dmi_promote_vendor(); which sets
    ACPI_VIDEO_BACKLIGHT_DMI_VENDOR
 4) calls acpi_video_unregister -> not registered, nop
 5) i915 loads, calls acpi_video_register
 6) acpi_video_register registers the acpi_notifier for the hotkeys,
    does NOT register a backlight device because of
    ACPI_VIDEO_BACKLIGHT_DMI_VENDOR

But on the Acer Aspire 5750G, which uses nvidia graphics the following
happens:
 1) acpi-video module gets loaded (as it is a dependency of acer-wmi)
 2) acpi-video calls acpi_video_register()
 3) acpi_video_register registers the acpi_notifier for the hotkeys,
    and a backlight device
 4) acer-wmi loads, calls acpi_video_dmi_promote_vendor()
 5) calls acpi_video_unregister, this unregisters BOTH the acpi_notifier for
    the hotkeys AND the backlight device

And we end up without any handler for the brightness hotkeys. This patch fixes
this by switching over to acpi_video_unregister_backlight() which keeps the
hotkey handler in place.

References: https://bugzilla.kernel.org/show_bug.cgi?id=35622
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
acer-wmi: Add Aspire 5741 to video_vendor_dmi_table

The Aspire 5741 has broken acpi-video backlight control, so add it to the
quirk table.

References: https://bugzilla.redhat.com/show_bug.cgi?id=1012674
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / ia64: introduce variable acpi_lapic into ia64

This variable was defined and assigned in x86, is used to indicate
whether LAPIC exists in MADT. Now introduce it into ia64 to help
make correct judgment when get information for ACPI processor later.

Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / processor: Check if LAPIC is present during initialization

In acpi_processor_get_info(), ACPI processor info is initialized including
ID, namely CPU index. Currently, on a UP system running an SMP kerenl with
no LAPIC in the MADT, cpu0_initialized is checked to decide whether or not
the CPU has been initialized.

However, this check may not be sufficient for kdump kernels. Most of time
only 1 CPU is supported because of known problems in kdump kernels. So say
the multiple CPUs are present in the boot kernel and a crash happens on
one specific CPU, say CPU2. Then it jumps into the kdump kernel with
"nr_cpus=1" in the command line. In this situation, the kdump kernel
will reuse the ACPI resources from the crashed kernel directly. That
means all LAPIC instances are enabled in the MADT while only one CPU is
in use.  In the kdump kernel, x86_cpu_to_apicid contains the correct APIC
ID and it's related to the CPU ID. If cpu0_initialized is checked only, 0
will be used as the CPU index instead of that APIC ID, which is not
correct.

In addition to checking cpu0_initialized, check acpi_lapic. If acpi_lapic
is 0, then no LAPIC is available from the MADT and the system should be
treated as a UP one without a LAPIC (that is, assign 0 to the CPU index).
Otherwise, use the original (valid) CPU index.

Signed-off-by: Baoquan He <bhe@redhat.com>
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / platform: add IDs for Broadcom Bluetooth and GPS chips

These IDs are used on Baytrail boards such as Lenovo Miix 2
and Asus Transformer Book T100TA. On lenovo Miix 2 8",
BCM4752 is called LNV4752. All the rest of the IDs are for
Broadcom BCM43241 module with the ID referring to different
revision number.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'acpi-proc' into acpi-battery
ACPI / battery: Accelerate battery resume callback

Most time of battery resume callback is spent on executing AML code
_BTP, _BIF and _BIF to get battery info, status and set alarm. These
AML methods may access EC operation regions several times and consumes
time.

These operations are not necessary during devices resume and can run
during POST_SUSPEND/HIBERNATION event when all processes are thawed.

This also can avoid removing and adding battery sysfs nodes every system
resume even if the battery unit is not actually changed. The original code
updates sysfs nodes without check and this seems not reasonable.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / processor: Fix STARTING/DYING action in acpi_cpu_soft_notify()

During CPU online/offline testing on a large system, one of the
processors got stuck after the message "bad: scheduling from the
idle thread!".  The problem is that acpi_cpu_soft_notify() calls
acpi_bus_get_device() for all action types.  CPU_STARTING and
CPU_DYING do not allow the notify handlers to sleep.  However,
acpi_bus_get_device() can sleep in acpi_ut_acquire_mutex().

Change acpi_cpu_soft_notify() to return immediately for CPU_STARTING
and CPU_DYING as they have no action in this handler.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'acpi-processor-next' into bleeding-edge

* acpi-processor-next:
  ACPI / processor: Fix STARTING/DYING action in acpi_cpu_soft_notify()
  ACPI / processor: Check if LAPIC is present during initialization
  ACPI / ia64: introduce variable acpi_lapic into ia64
Merge branch 'acpi-video-next' into bleeding-edge

* acpi-video-next:
  acer-wmi: Add Aspire 5741 to video_vendor_dmi_table
  ACPI / acer-wmi: Switch to acpi_video_unregister_backlight()
  ACPI / video: Add an acpi_video_unregister_backlight function
  ACPI / video: Don't register acpi_video_resume notifier without backlight devices
Merge branch 'acpi-battery' into bleeding-edge

* acpi-battery:
  ACPI / battery: Accelerate battery resume callback
Merge branch 'acpi-platform' into bleeding-edge

* acpi-platform:
  ACPI / platform: add IDs for Broadcom Bluetooth and GPS chips