Commit graph

4557 commits

Author SHA1 Message Date
Hanjun Guo 3e9eac50cd Revert "ACPI / processor: Make it possible to get APIC ID via GIC"
Revert commit df86f5df79 (ACPI / processor: Make it possible to get
APIC ID via GIC).

APIC ID refers the hardware ID of the CPU, which means MPIDR on
ARM/ARM64, but in ACPI 5.0, GIC ID feild in GIC structure have
no explicit definition and may not refer to the MPIDR.

Commit df86f5df79 assumed that gic->gic_id as MPIDR which may not be
the case, so revert it until the explicit definition of GIC structure
is ready.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-26 16:30:34 +01:00
Lv Zheng 08e1d7c029 ACPICA: Enable auto-serialization as a default kernel behavior.
The previous commit "ACPICA: Add auto-serialization support for ill-behaved
control methods" introduced the auto-serialization facility as a workaround
that can be enabled by "acpi_auto_serialize":

This feature marks control methods that create named objects as "serialized"
to avoid unwanted AE_ALREADY_EXISTS control method evaluation failures.

Enable method auto-serialization as the default kernel behavior.  The new kernel
parameter is also changed from "acpi_auto_serialize" to "acpi_no_auto_serialize"
to reflect the default behavior.

References: https://bugzilla.kernel.org/show_bug.cgi?id=52191
References: http://www.spinics.net/lists/linux-acpi/msg49496.html
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-26 16:26:00 +01:00
Bob Moore d18255795b ACPICA: Ignore sync_level for methods that have been auto-serialized.
Cannot use a sync_level for methods that have been serialized at load-time
or runtime because this may interfere with any existing use of sync_levels
within the ASL code. So, we simply ignore the sync_level for these methods,
thus preserving any existing sync_level priorities. Note, the use of
sync_levels is actually rather rare within BIOS ASL code.

References: http://www.spinics.net/lists/linux-acpi/msg49496.html
Reported-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Reported-by: Sabrina Dubroka <sd@queasysnail.net>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-26 16:25:59 +01:00
Lv Zheng 21bd7e610e ACPICA: Add additional named objects for the auto-serialize method scan.
This change adds some additional opcodes that are detected and will
cause a method to be auto-serialized. These opcodes are the various
CreateXField and the FieldUnit opcodes. Lv Zheng.

References: https://bugzilla.kernel.org/show_bug.cgi?id=52191
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-26 16:25:59 +01:00
Bob Moore 22b5afce6a ACPICA: Add auto-serialization support for ill-behaved control methods.
This change adds support to automatically mark a control method as
"serialized" if the method creates any named objects. This will
positively prevent the method from being entered by more than one
thread and thus preventing a possible abort when an attempt is
made to create an object twice.

Implemented by parsing all non-serialize control methods at table
load time.

This feature is disabled by default and this patch also adds a new
Linux kernel parameter "acpi_auto_serialize" to allow this feature
to be turned on for a specific boot.

References: https://bugzilla.kernel.org/show_bug.cgi?id=52191
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-26 16:25:59 +01:00
Lv Zheng e2b8ddcc6b ACPICA: Remove global option to serialize all control methods.
According to the reports, the "acpi_serialize" mechanism is broken as:

 A. The parallel method calls can still happen when the interpreter lock is
    released under the following conditions:
    1. External callbacks are invoked, for example, by the region handlers,
       the exception handlers, etc.;
    2. Module level execution is performed when Load/LoadTable opcodes are
       executed, and
    3. The _REG control methods are invoked to complete the region
       registrations.
 B. For the following situations, the interpreter lock need to be released
    even for a serialized method while currently, the lock-releasing
    operation is marked as a no-op by
    acpi_ex_relinquish/reacquire_interpreter() when this mechanism is
    enabled:
    1. Wait opcode is executed,
    2. Acquire opcode is executed, and
    3. Sleep opcode is executed.

This patch removes this mechanism and the internal
acpi_ex_relinquish/reacquire_interpreter() APIs.  Lv Zheng.

References: https://bugzilla.kernel.org/show_bug.cgi?id=52191
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-26 16:25:59 +01:00
Rafael J. Wysocki 884411d9a5 Merge branch 'acpi-processor'
* acpi-processor:
  ACPI: Move BAD_MADT_ENTRY() to linux/acpi.h
  ACPI / processor: Make it possible to get APIC ID via GIC
  ACPI / processor: Build idle_boot_override on x86 and ia64
  ACPI / processor: Use ACPI_PROCESSOR_DEVICE_HID instead of "ACPI0007"
  ACPI / processor: Fix acpi_processor_eval_pdc() return value type
2014-03-21 16:53:28 +01:00
Rafael J. Wysocki 36cc86e8ec Merge branches 'pm-runtime' and 'pm-sleep'
* pm-runtime:
  PM / Runtime: Update runtime_idle() documentation for return value meaning

* pm-sleep:
  PM / sleep: Correct whitespace errors in <linux/pm.h>
  PM: Add missing "freeze" state
  PM / Hibernate: Spelling s/anonymouns/anonymous/
  PM / Runtime: Add missing "it" in comment
  PM / suspend: Remove unnecessary !!
  PCI / PM: Resume runtime-suspended devices later during system suspend
  ACPI / PM: Resume runtime-suspended devices later during system suspend
  PM / sleep: Set pm_generic functions to NULL for !CONFIG_PM_SLEEP
  PM: fix typo in comment
  PM / hibernate: use name_to_dev_t to parse resume
  PM / wakeup: Include appropriate header file in kernel/power/wakelock.c
  PM / sleep: Move prototype declaration to header file kernel/power/power.h
  PM / sleep: Asynchronous threads for suspend_late
  PM / sleep: Asynchronous threads for suspend_noirq
  PM / sleep: Asynchronous threads for resume_early
  PM / sleep: Asynchronous threads for resume_noirq
  PM / sleep: Two flags for async suspend_noirq and suspend_late
2014-03-20 13:25:54 +01:00
Rafael J. Wysocki 165f5fd04a Merge branches 'pm-qos', 'pm-domains' and 'pm-drivers'
* pm-qos:
  PM / QoS: Add type to dev_pm_qos_add_ancestor_request() arguments
  ACPI / LPSS: Support for device latency tolerance PM QoS
  ACPI / scan: Add bind/unbind callbacks to struct acpi_scan_handler
  PM / QoS: Introcuce latency tolerance device PM QoS type
  PM / QoS: Add no_constraints_value field to struct pm_qos_constraints
  PM / QoS: Rename device resume latency QoS items

* pm-domains:
  PM / domains: Turn latency warning into debug message

* pm-drivers:
  PM: Add pm_runtime_suspend|resume_force functions
  PM / runtime: Fetch runtime PM callbacks using a macro
2014-03-20 13:25:36 +01:00
Rafael J. Wysocki 6ac4a2ab16 Merge branch 'acpica'
* acpica: (29 commits)
  ACPICA: Revert "Headers: Deploy #pragma pack (push) and (pop)."
  ACPICA: Update version to 20140214.
  ACPICA: Prevent infinite loops when traversing corrupted lists.
  ACPICA: Debugger: Add missing objects; Traverse linked lists
  ACPICA: Add text: ACPICA policy for new _OSI strings. No functional change.
  ACPICA: Update for _PRP predefined name.
  ACPICA: Cleanup/improve global variable declarations.
  ACPICA: Comment update - no functional change.
  ACPICA: Do not abort _PRT repair on a single subpackage failure.
  ACPICA: Harden _PRT repair code; check for minimum package length.
  ACPICA: Restore code that repairs NULL package elements in return values.
  ACPICA: Properly handle NULL entries in _PRT return packages.
  ACPICA: Update conditional compilation flags for resource dump functions.
  ACPICA: Predefined names: Add support for the _PRP method.
  ACPICA: Headers: Deploy #pragma pack (push) and (pop).
  ACPICA: Add boot option to disable auto return object repair
  ACPICA: acpidump: Remove integer types translation protection.
  ACPICA: acpidump: Add sparse declarators support.
  ACPICA: Add "Windows 2013" string to _OSI support.
  ACPICA: Update version to 20140114.
  ...
2014-03-20 13:25:02 +01:00
Rafael J. Wysocki 94a81caca3 Merge branches 'acpi-battery' and 'acpi-video'
* acpi-battery:
  ACPI / AC: recheck adapter status upon battery status changes
  ACPI / battery: call ACPI notifier chain in acpi_battery_notify
  ACPI / battery: move some ACPI_BATTERY_* definitions to header

* acpi-video:
  video / output: Drop display output class support
  fujitsu-laptop: Drop unneeded include
  acer-wmi: Stop selecting VIDEO_OUTPUT_CONTROL
  ACPI / gpu / drm: Stop selecting VIDEO_OUTPUT_CONTROL
  ACPI / video: fix ACPI_VIDEO dependencies
2014-03-20 13:21:44 +01:00
Rafael J. Wysocki e25c5abf41 Merge branches 'acpi-cleanup', 'acpi-thermal', 'acpi-pci', 'acpi-lpss' and 'acpi-button'
* acpi-cleanup:
  ACPI: Remove duplicate definitions of PREFIX
  ACPI / tables: Replace printk with pr_*

* acpi-thermal:
  ACPI / thermal: make acpi_thermal_check asynchronous on resume

* acpi-pci:
  ACPI / PCI: Do not call ISA-specific code if ISA is not supported

* acpi-lpss:
  ACPI / LPSS: Add Intel BayTrail ACPI mode PWM

* acpi-button:
  ACPI / button: Add ACPI Button event via netlink routine
2014-03-20 13:20:47 +01:00
Jean Delvare 9f380fc56a ACPI / video: fix ACPI_VIDEO dependencies
ACPI_VIDEO stopped depending on VIDEO_OUTPUT_CONTROL over 3 years ago
(see commit 677bd810, "ACPI video: remove output switching control".)
So it's about time to remove the Kconfig dependency between these two
options.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-20 02:35:36 +01:00
Lan Tianyu 0bf6368ee8 ACPI / button: Add ACPI Button event via netlink routine
Commit 1696d9d (ACPI: Remove the old /proc/acpi/event interface)
removed ACPI Button event which originally was sent to userspace via
/proc/acpi/event. This caused ACPI shutdown regression on gentoo
in VirtualBox. Now ACPI events are sent to userspace via netlink,
so add ACPI Button event back via netlink routine.

References: https://bugzilla.kernel.org/show_bug.cgi?id=71721
Reported-and-tested-by: Richard Musil <richard.musil@gmail.com>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Cc: 3.11+ <stable@vger.kernel.org> # 3.11+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-19 02:06:15 +01:00
Hanjun Guo 07070e12cf ACPI: Remove duplicate definitions of PREFIX
We already have a macro for PREFIX of "ACPI: " in
drivers/acpi/internal.h, so remove the duplicate ones
in ACPI drivers when internal.h is included.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-19 02:01:57 +01:00
Alexander Mezin 4eee4f03ce ACPI / AC: recheck adapter status upon battery status changes
On HP Pavilion dv6-6179er there are no notifications when AC adapter
is plugged/unplugged.
However, when AC status is read (acpi_ac_get_state), and if AC status
has changed, AML code triggers the notification.

This patch solves the problem by re-reading AC adapter status upon
ACPI_BATTERY_NOTIFY_STATUS notification.

Signed-off-by: Alexander Mezin <mezin.alexander@gmail.com>
Acked-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-19 01:57:47 +01:00
Alexander Mezin 411e0f77bd ACPI / battery: call ACPI notifier chain in acpi_battery_notify
Allow other drivers to subscribe to battery status notifications.
Just like AC driver does.

Signed-off-by: Alexander Mezin <mezin.alexander@gmail.com>
Acked-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-19 01:57:46 +01:00
Alexander Mezin f03be3525f ACPI / battery: move some ACPI_BATTERY_* definitions to header
ACPI_BATTERY_CLASS is used in multiple places.
Also, I'll use ACPI_BATTERY_NOTIFY_STATUS inside AC driver in
one of following patches.

So, create a header file and move ACPI_BATTERY_CLASS and
ACPI_BATTERY_NOTIFY_* definitions into it.
Also, remove copy of ACPI_BATTERY_CLASS from sbs.c

Signed-off-by: Alexander Mezin <mezin.alexander@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-19 01:57:46 +01:00
Robert Moore 6e59608483 ACPICA: Revert "Headers: Deploy #pragma pack (push) and (pop)."
This reverts commit aae576e5faefa8ba70647efa320d4747b6375f1e.
Push and Pop are not portable "enough", and caused problems for
some ACPICA customers.

Signed-off-by: Robert Moore <Robert.Moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-18 01:53:45 +01:00
Rafael J. Wysocki bcef50814c Merge branch 'acpi-config' into acpica
Conflicts:
	include/acpi/platform/aclinux.h
2014-03-18 01:53:28 +01:00
Bob Moore f953529f3b ACPICA: Prevent infinite loops when traversing corrupted lists.
This change hardens the ACPICA code to detect circular linked object
lists and prevent an infinite loop if such corruption exists.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-18 01:52:18 +01:00
Bob Moore a487af33a4 ACPICA: Debugger: Add missing objects; Traverse linked lists
This change adds support for two missing objects, the "extra" and
"data" secondary objects, as well as adding support to traverse and
display linked lists related to ACPICA objects.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-18 01:52:17 +01:00
Bob Moore 73581c022d ACPICA: Add text: ACPICA policy for new _OSI strings. No functional change.
Adds further information about why new _OSI strings should be
adopted by all hosts as soon as possible.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-18 01:52:17 +01:00
Bob Moore 3ef27bd002 ACPICA: Update for _PRP predefined name.
Allow objects of type "reference" in the second subpackage element.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-18 01:52:17 +01:00
Lv Zheng 3aa0b085f6 ACPICA: Cleanup/improve global variable declarations.
This change cleans up the entire global variable mechaninism including
the related macros. Also reduces warnings from the "sparse" utility
in the Linux environment. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-18 01:50:57 +01:00
Bob Moore 0a16d12a8e ACPICA: Comment update - no functional change.
Change all instances of "sub-package" to "subpackage" for consistency.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-18 01:47:30 +01:00
Rafael J. Wysocki c730d30c31 Merge branch 'acpi-fan'
* acpi-fan:
  ACPI / fan: do nothing in suspend and poweroff callback
2014-03-17 13:48:25 +01:00
Rafael J. Wysocki 2eb060975d Merge branch 'acpi-ost'
* acpi-ost:
  ACPI: Drop acpi_evaluate_hotplug_ost() and ACPI_HOTPLUG_OST
  ACPI: use device name LNXSYBUS.xx for ACPI \_SB and \_TZ objects
  ACPI / processor: use acpi_evaluate_ost() to replace open-coded version
  ACPI / PAD / xen: use acpi_evaluate_ost() to replace open-coded version
  ACPI / PAD: use acpi_evaluate_ost() to replace open-coded version
  ACPI: rename acpi_evaluate_hotplug_ost() to acpi_evaluate_ost()
2014-03-17 13:48:18 +01:00
Rafael J. Wysocki 75c44eddcb Merge branch 'acpi-config'
* acpi-config:
  ACPI: Remove Kconfig symbol ACPI_PROCFS
  ACPI / APEI: Remove X86 redundant dependency for APEI GHES.
  ACPI: introduce CONFIG_ACPI_REDUCED_HARDWARE_ONLY
2014-03-17 13:47:24 +01:00
Rafael J. Wysocki 6621c5a69a Merge branch 'acpi-hotplug'
* acpi-hotplug:
  ACPI / hotplug: Rework deferred execution of acpi_device_hotplug()
  ACPI / dock: Update copyright notice
  ACPI / dock: Drop remove_dock_dependent_devices()
  ACPI / dock: Drop struct acpi_dock_ops and all code related to it
  ACPI / ATA: Add hotplug contexts to ACPI companions of SATA devices
  ACPI / dock: Add .uevent() callback to struct acpi_hotplug_context
  ACPI / dock: Use callback pointers from devices' ACPI hotplug contexts
  ACPI / dock: Use ACPI device object pointers instead of ACPI handles
  ACPI / hotplug: Add .fixup() callback to struct acpi_hotplug_context
  ACPI / hotplug / PCI: Do not clear event callback pointer for docks
  ACPI / dock: Associate dock platform devices with ACPI device objects
  ACPI / dock: Pass ACPI device pointer to acpi_device_is_battery()
  ACPI / dock: Dispatch dock notifications from the global notify handler
2014-03-17 13:47:14 +01:00
Rafael J. Wysocki d983f93328 Merge branch 'acpi-pci-hotplug'
* acpi-pci-hotplug: (23 commits)
  ACPI / hotplug / PCI: Use pci_device_is_present()
  ACPI / hotplug / PCI: Add ACPIPHP contexts to devices handled by PCIeHP
  ACPI / hotplug / PCI: Rename register_slot() to acpiphp_add_context()
  ACPI / hotplug / PCI: Execute _EJ0 under the ACPI scan lock
  ACPI / hotplug / PCI: Rework acpiphp_check_host_bridge()
  ACPI / hotplug / PCI: Hotplug notifications from acpi_bus_notify()
  ACPI / hotplug / PCI: Simplify acpi_install_hotplug_notify_handler()
  ACPI / hotplug / PCI: Rework the handling of eject requests
  ACPI / hotplug / PCI: Consolidate ACPIPHP with ACPI core hotplug
  ACPI / hotplug / PCI: Define hotplug context lock in the core
  ACPI / hotplug: Fix potential race in acpi_bus_notify()
  ACPICA: Introduce acpi_get_data_full() and rework acpi_get_data()
  ACPI / hotplug / PCI: Do not pass ACPI handle to hotplug_event()
  ACPI / hotplug / PCI: Use acpi_handle_debug() in hotplug_event()
  ACPI / hotplug / PCI: Simplify hotplug_event()
  ACPI / hotplug / PCI: Drop crit_sect locking
  ACPI / hotplug / PCI: Drop acpiphp_bus_add()
  ACPI / hotplug / PCI: Store acpi_device pointer in acpiphp_context
  ACPI / hotplug / PCI: Rework acpiphp_no_hotplug()
  ACPI / hotplug / PCI: Drop acpiphp_bus_trim()
  ...
2014-03-17 13:47:04 +01:00
Rafael J. Wysocki a4e90bed51 ACPI / sleep: Add extra checks for HW Reduced ACPI mode sleep states
If the HW Reduced ACPI mode bit is set in the FADT, ACPICA uses
the optional sleep control and sleep status registers for making
the system enter sleep states (including S5), so it is not possible
to use system sleep states or power it off using ACPI if the HW
Reduced ACPI mode bit is set and those registers are not available.

For this reason, add a new function, acpi_sleep_state_supported(),
checking if the HW Reduced ACPI mode bit is set and whether or not
system sleep states are usable in that case in addition to checking
the return value of acpi_get_sleep_type_data() and make the ACPI
sleep setup routines use that function to check the availability of
system sleep states.

Among other things, this prevents the kernel from attempting to
use ACPI for powering off HW Reduced ACPI systems without the sleep
control and sleep status registers, because ACPI power off doesn't
have a chance to work on them.  That allows alternative power off
mechanisms that may actually work to be used on those systems.  The
affected machines include Dell Venue 8 Pro, Asus T100TA, Haswell
Desktop SDP and Ivy Bridge EP Demo depot.

References: https://bugzilla.kernel.org/show_bug.cgi?id=70931
Reported-by: Adam Williamson <awilliam@redhat.com>
Tested-by: Aubrey Li <aubrey.li@linux.intel.com>
Cc: 3.4+ <stable@vger.kernel.org> # 3.4+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-13 22:11:39 +01:00
Rafael J. Wysocki 4c7b70406e Revert "ACPI / sleep: pm_power_off needs more sanity checks to be installed"
Revert commit 3130497f5b ("ACPI / sleep: pm_power_off needs more
sanity checks to be installed") that breaks power ACPI power off on a
lot of systems, because it checks wrong registers.

Fixes: 3130497f5b ("ACPI / sleep: pm_power_off needs more sanity checks to be installed")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-03-09 13:48:36 -07:00
Rafael J. Wysocki beb0082efd Merge branches 'acpi-resources', 'acpi-ec' and 'acpi-sleep'
* acpi-resources:
  ACPI / resources: ignore invalid ACPI device resources

* acpi-ec:
  ACPI / EC: Clear stale EC events on Samsung systems

* acpi-sleep:
  ACPI / sleep: pm_power_off needs more sanity checks to be installed
2014-03-08 01:07:06 +01:00
Kieran Clancy ad332c8a45 ACPI / EC: Clear stale EC events on Samsung systems
A number of Samsung notebooks (530Uxx/535Uxx/540Uxx/550Pxx/900Xxx/etc)
continue to log events during sleep (lid open/close, AC plug/unplug,
battery level change), which accumulate in the EC until a buffer fills.
After the buffer is full (tests suggest it holds 8 events), GPEs stop
being triggered for new events. This state persists on wake or even on
power cycle, and prevents new events from being registered until the EC
is manually polled.

This is the root cause of a number of bugs, including AC not being
detected properly, lid close not triggering suspend, and low ambient
light not triggering the keyboard backlight. The bug also seemed to be
responsible for performance issues on at least one user's machine.

Juan Manuel Cabo found the cause of bug and the workaround of polling
the EC manually on wake.

The loop which clears the stale events is based on an earlier patch by
Lan Tianyu (see referenced attachment).

This patch:
 - Adds a function acpi_ec_clear() which polls the EC for stale _Q
   events at most ACPI_EC_CLEAR_MAX (currently 100) times. A warning is
   logged if this limit is reached.
 - Adds a flag EC_FLAGS_CLEAR_ON_RESUME which is set to 1 if the DMI
   system vendor is Samsung. This check could be replaced by several
   more specific DMI vendor/product pairs, but it's likely that the bug
   affects more Samsung products than just the five series mentioned
   above. Further, it should not be harmful to run acpi_ec_clear() on
   systems without the bug; it will return immediately after finding no
   data waiting.
 - Runs acpi_ec_clear() on initialisation (boot), from acpi_ec_add()
 - Runs acpi_ec_clear() on wake, from acpi_ec_unblock_transactions()

References: https://bugzilla.kernel.org/show_bug.cgi?id=44161
References: https://bugzilla.kernel.org/show_bug.cgi?id=45461
References: https://bugzilla.kernel.org/show_bug.cgi?id=57271
References: https://bugzilla.kernel.org/attachment.cgi?id=126801
Suggested-by: Juan Manuel Cabo <juanmanuel.cabo@gmail.com>
Signed-off-by: Kieran Clancy <clancy.kieran@gmail.com>
Reviewed-by: Lan Tianyu <tianyu.lan@intel.com>
Reviewed-by: Dennis Jansen <dennis.jansen@web.de>
Tested-by: Kieran Clancy <clancy.kieran@gmail.com>
Tested-by: Juan Manuel Cabo <juanmanuel.cabo@gmail.com>
Tested-by: Dennis Jansen <dennis.jansen@web.de>
Tested-by: Maurizio D'Addona <mauritiusdadd@gmail.com>
Tested-by: San Zamoyski <san@plusnet.pl>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-06 13:27:23 +01:00
Aaron Lu a59ffb2062 ACPI / thermal: make acpi_thermal_check asynchronous on resume
On resume we do not need to wait for acpi_thermal_check to finish.
Instead, we can run it asynchronously and not block the whole system
resume. Also, we make sure when we are suspending again, previously
queued work for acpi_thermal_check is done.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-05 01:43:44 +01:00
Rafael J. Wysocki 1e3bcb596c ACPI / hotplug: Rework deferred execution of acpi_device_hotplug()
Since the only function executed by acpi_hotplug_execute() is
acpi_device_hotplug() and it only is called by the ACPI core,
simplify its definition so that it only takes two arguments, the
ACPI device object pointer and event code, rename it to
acpi_hotplug_schedule() and move its header from acpi_bus.h to
the ACPI core's internal header file internal.h.  Modify the
definition of acpi_device_hotplug() so that its first argument is
an ACPI device object pointer and modify the definition of
struct acpi_hp_work accordingly.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Toshi Kani <toshi.kani@hp.com>
2014-03-05 01:26:35 +01:00
Rafael J. Wysocki 92858c476e ACPI / PM: Resume runtime-suspended devices later during system suspend
Runtime-suspended devices are resumed during system suspend by
acpi_subsys_prepare() for two reasons: First, because they may need
to be reprogrammed in order to change their wakeup settings and,
second, because they may need to be operatonal for their children
to be successfully suspended.  That is a problem, though, if there
are many runtime-suspended devices that need to be resumed this
way during system suspend, because the .prepare() PM callbacks of
devices are executed sequentially and the times taken by them
accumulate, which may increase the total system suspend time quite
a bit.

For this reason, move the resume of runtime-suspended devices up
to the next phase of device suspend (during system suspend), except
for the ones that have power.ignore_children set.  The exception is
made, because the devices with power.ignore_children set may still
be necessary for their children to be successfully suspended (during
system suspend) and they won't be resumed automatically as a result
of the runtime resume of their children.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-04 00:17:48 +01:00
Li, Aubrey 3130497f5b ACPI / sleep: pm_power_off needs more sanity checks to be installed
Sleep control and status registers need santity checks as well before
ACPI installs acpi_power_off to pm_power_off hook. The checking code in
acpi_enter_sleep_state() is too late, we should not allow a not-working
pm_power_off function to be hooked up.

Signed-off-by: Aubrey Li <aubrey.li@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-03 00:21:14 +01:00
Hanjun Guo 730bf5ebb4 ACPI / tables: Replace printk with pr_*
This patch just does some cleanup to replace printk with pr_*,
and introduces pr_fmt() to remove all PREFIXs in tables.c,
no functional change.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-02 01:34:16 +01:00
Zhang Rui b355cee88e ACPI / resources: ignore invalid ACPI device resources
ACPI table may export resource entry with 0 length.
But the current code interprets this kind of resource in a wrong way.
It will create a resource structure with
res->end = acpi_resource->start + acpi_resource->len - 1;

This patch fixes a problem on my machine that a platform device fails
to be created because one of its ACPI IO resource entry (start = 0,
end = 0, length = 0) is translated into a generic resource with
start = 0, end = 0xffffffff.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-01 22:46:05 +01:00
Bob Moore 69e6bb6898 ACPICA: Do not abort _PRT repair on a single subpackage failure.
Always examine all subpackages for reversed entries.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-27 00:46:00 +01:00
Bob Moore 1c3c2a545d ACPICA: Harden _PRT repair code; check for minimum package length.
This change prevents a fault during the repair by checking up
front if the _PRT subpackage contains the minimum number of
elements (4).

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-27 00:46:00 +01:00
Lv Zheng 61db45ca21 ACPICA: Restore code that repairs NULL package elements in return values.
The original code was lost accidently, it was not generated along with the
following commit of mechanism improvements and thus not get merged:

  Commit: d5a36100f6
  Subject: ACPICA: Add mechanism for early object repairs on a per-name basis

  Adds the framework to allow object repairs very early in the
  return object analysis. Enables repairs like string->unicode,
  etc.

This patch restores the implementation of the NULL element repair code for
ACPI_RTYPE_NONE.  In the original design, ACPI_RTYPE_NONE is defined to
collect simple NULL object repairs.
Lv Zheng.

Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=67901
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Cc: 3.10+ <stable@vger.kernel.org> # 3.10+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-27 00:46:00 +01:00
Lv Zheng 8313064930 ACPICA: Properly handle NULL entries in _PRT return packages.
This change enables proper handling of NULL package entries in a _PRT
return value, during construction of the PCI routing table.
Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-27 00:45:59 +01:00
Lv Zheng 9ad4caf3f8 ACPICA: Update conditional compilation flags for resource dump functions.
Corrects ACPI_DISASSEMBLER to the compile conditions.  The wrong
condition was introduced by this commit:
  Commit: 3334861b1e
  Subject: ACPICA: Update the conditions to enable the utility resource dump strings.

This was detected in the ACPICA upstream.  Linux is not affected by the
wrong commit as the disassembler is not shipped in the Linux.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-27 00:45:59 +01:00
Bob Moore 5e7f18334f ACPICA: Predefined names: Add support for the _PRP method.
This is not an official predefined name yet, but we add it to assist
with development.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-27 00:45:59 +01:00
Bob Moore 4ac4c5fad8 ACPICA: Headers: Deploy #pragma pack (push) and (pop).
Use push and pop to both guarantee that the correct alignment is used,
and to restore the alignment to whatever it was before the header
was included.

It is reported that the #pragma pack(push/pop) directives are not supported
by the specific GCCs, but this patch still doesn't affect kernel build
as there are already #pragma pack([1]) directives used in the old ACPICA
headers, which means there shouldn't be GCCs that are currently used to
compile the ACPI kernels do not support #pragma pack() directives.

References: https://bugs.acpica.org/show_bug.cgi?id=1058
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-27 00:45:59 +01:00
Rafael J. Wysocki 38953d3945 Merge back earlier 'acpi-processor' material. 2014-02-27 00:22:42 +01:00
Lan Tianyu f3ca416452 ACPI / processor: Rework processor throttling with work_on_cpu()
acpi_processor_set_throttling() uses set_cpus_allowed_ptr() to make
sure that the (struct acpi_processor)->acpi_processor_set_throttling()
callback will run on the right CPU.  However, the function may be
called from a worker thread already bound to a different CPU in which
case that won't work.

Make acpi_processor_set_throttling() use work_on_cpu() as appropriate
instead of abusing set_cpus_allowed_ptr().

Reported-and-tested-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Cc: All applicable <stable@vger.kernel.org>
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-27 00:21:05 +01:00
Rafael J. Wysocki 700b8422fb ACPI: Drop acpi_evaluate_hotplug_ost() and ACPI_HOTPLUG_OST
Replace acpi_evaluate_hotplug_ost() with acpi_evaluate_ost()
everywhere and drop the ACPI_HOTPLUG_OST symbol so that hotplug
_OST is supported unconditionally.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Toshi Kani <toshi.kani@hp.com>
2014-02-22 00:50:49 +01:00
Rafael J. Wysocki 8cc2568124 ACPI / dock: Update copyright notice
Update the copyright notice of the ACPI dock driver to reflect the
fact that substantial changes have been made to it recently.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-22 00:48:57 +01:00
Rafael J. Wysocki f311e1c4a6 ACPI / dock: Drop remove_dock_dependent_devices()
Since remove_dock_dependent_devices() is only called from acpi_dock_add()
and it only is called if the add_dock_dependent_device() adding the
dock station to its own list of dependent devices has failed, it is not
really necessary, because the dock station's list of dependent devices
is guaranteed to be empty at that point.  Drop it, then.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-22 00:48:56 +01:00
Rafael J. Wysocki 2f16817d87 ACPI / dock: Drop struct acpi_dock_ops and all code related to it
Since struct acpi_dock_ops and the code handling it don't have any
users any more after the previous changes, drop that structure and
the code related to it altogether.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-22 00:48:56 +01:00
Rafael J. Wysocki 5d5132059a ACPI / ATA: Add hotplug contexts to ACPI companions of SATA devices
Modify the SATA subsystem to add hotplug contexts to ACPI companions
of SATA devices and ports instead of registering special ACPI dock
operations using register_hotplug_dock_device().

That change will allow the entire code handling those special ACPI
dock operations to be dropped in the next commit.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Tejun Heo <tj@kernel.org>
2014-02-22 00:48:31 +01:00
Rafael J. Wysocki d8ad344cb4 Merge branches 'acpi-pm' and 'acpi-video'
* acpi-pm:
  ACPI / thermal: fix thermal driver compile error when CONFIG_PM_SLEEP is undefined
  ACPI / SBS: fix SBS driver compile error when CONFIG_PM_SLEEP is undefined
  ACPI / fan: fix fan driver compile error when CONFIG_PM_SLEEP is undefined
  ACPI / button: fix button driver compile error when CONFIG_PM_SLEEP is undefined
  ACPI / battery: fix battery driver compile error when CONFIG_PM_SLEEP is undefined
  ACPI / AC: fix AC driver compile error when CONFIG_PM_SLEEP is undefined

* acpi-video:
  Revert "ACPI: Blacklist Win8 OSI for some HP laptop 2013 models"
  ACPI / video: Add systems that should favour native backlight interface
  ACPI / video: Filter the _BCL table for duplicate brightness values
2014-02-21 01:28:12 +01:00
Rafael J. Wysocki 200df1cc88 Merge branches 'acpi-cleanup', 'acpi-dock', 'acpi-pci' and 'acpi-dsm'
* acpi-cleanup:
  ACPI / SBS: Fix incorrect sscanf() string

* acpi-dock:
  ACPI / dock: Make 'docked' sysfs attribute work as documented

* acpi-pci:
  ACPI / PCI: Fix memory leak in acpi_pci_irq_enable()

* acpi-dsm:
  ACPI / nouveau: fix probing regression related to _DSM
2014-02-21 01:27:48 +01:00
Rafael J. Wysocki be27b3dcb0 ACPI / dock: Add .uevent() callback to struct acpi_hotplug_context
In order to avoid the need to register special ACPI dock
operations for SATA devices add a .uevent() callback pointer to
struct acpi_hotplug_context and make dock_hotplug_event() use that
callback if available.  Also rename the existing .event() callback
in struct acpi_hotplug_context to .notify() to avoid possible
confusion in the future.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-21 01:10:27 +01:00
Rafael J. Wysocki edf5bf34d4 ACPI / dock: Use callback pointers from devices' ACPI hotplug contexts
Instead of requiring a set of special dock operations to be registered
via register_hotplug_dock_device() for each ACPI dock device, it is
much more straightforward to use callback pointers from the devices'
hotplug contexts if available.

For this reason, modify dock_hotplug_event() to use callback pointers
from the hotplug contexts of ACPI devices and fall back to using the
special dock operarions only if those callbacks are missing.  Also
make the ACPI-based PCI hotplug (ACPIPHP) subsystem set the .fixup
callback pointer in the hotplug contexts of devices handled by it to
a new function, acpiphp_post_dock_fixup(), so that the dock station
driver can use the callbacks from those contexts instead of special
dock operations registered via register_hotplug_dock_device().

Along with the above changes drop the ACPIPHP's dock operations that
are not necessary any more.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-21 01:10:18 +01:00
Rafael J. Wysocki 3b52b21fa1 ACPI / dock: Use ACPI device object pointers instead of ACPI handles
Rework the ACPI dock station driver to store ACPI device object
pointers instead of ACPI handles in its internal data structures.

The purpose is moslty to make subsequent simplifications possible,
but also this allows the overall code size to be reduced slightly.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-21 01:10:09 +01:00
Rafael J. Wysocki 2bd74d91b1 Merge branch 'acpi-pci-hotplug' into acpi-ost 2014-02-21 01:06:58 +01:00
Jiang Liu ae3caa80a5 ACPI: use device name LNXSYBUS.xx for ACPI \_SB and \_TZ objects
Use device name "LNXSYBUS:xx" instead  of "device.xx" for ACPI objects
\_SB and \_TZ.

BTW, the original check of "handle == ACPI_ROOT_OBJECT" in statment
"else if (list_empty(&pnp->ids) && handle == ACPI_ROOT_OBJECT)"
is always false because of the code at the begin of that block.
                if (handle == ACPI_ROOT_OBJECT) {
                        acpi_add_id(pnp, ACPI_SYSTEM_HID);
                        break;
                }

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-21 00:27:48 +01:00
Jiang Liu 4a6172a4e9 ACPI / processor: use acpi_evaluate_ost() to replace open-coded version
Use public function acpi_evaluate_ost() to replace open-coded
version of evaluating ACPI _OST method.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-21 00:27:47 +01:00
Jiang Liu 8b296d9412 ACPI / PAD: use acpi_evaluate_ost() to replace open-coded version
Use public function acpi_evaluate_ost() to replace open-coded
version of evaluating ACPI _OST method.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-21 00:27:47 +01:00
Jiang Liu 05730c1952 ACPI: rename acpi_evaluate_hotplug_ost() to acpi_evaluate_ost()
Rename acpi_evaluate_hotplug_ost() to acpi_evaluate_ost() for later
resue.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-21 00:27:46 +01:00
Aaron Lu b9b8515f34 ACPI / fan: do nothing in suspend and poweroff callback
We put fans to full speed in acpi_fan_suspend(), but that is only
needed in the hibernation case when we are generating hibernation
image, so this patch removes that when we are about to suspend or
poweroff.

References: http://www.spinics.net/lists/linux-acpi/msg48636.html
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-20 21:42:09 +01:00
Rafael J. Wysocki 5e2e46e84b Merge branch 'acpi-pm' into acpi-fan 2014-02-20 21:42:03 +01:00
Tomasz Nowicki c1aaae673f ACPI / PCI: Do not call ISA-specific code if ISA is not supported
This commit moves ISA-specific code to separate function and makes that
function depend on CONFIG_{E}ISA so that we do not have to maintain
acpi_isa_irq_to_gsi() function for architectures which do not support ISA.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-20 21:37:42 +01:00
Rafael J. Wysocki a6940190ac Revert "ACPI: Blacklist Win8 OSI for some HP laptop 2013 models"
This reverts commit 2d4054d842 (ACPI: Blacklist Win8 OSI for some HP
laptop 2013 models) that is not necessary any more after previous
commit 1811fcb029fa (ACPI / video: Add systems that should favour native
backlight interface).

Requested-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-20 01:33:40 +01:00
Aaron Lu 0e9f81d3b7 ACPI / video: Add systems that should favour native backlight interface
Some system's ACPI video backlight control interface is broken and the
native backlight control interface should be used by default. This patch
sets the use_native_backlight parameter to true for those systems so
that video backlight control interface will not be created. For detailed
models that are added here, reference the following list.

Note that the user specified kernel cmdline option will always have the
highest priority, i.e. if use_native_backlight=0 is specified and the
system is in the DMI table, the video module will not skip registering
backlight interface for it.

Thinkpad T430s:
Reported-by: Theodore Tso <tytso@mit.edu>
Reported-and-tested-by: Peter Weber <bugs@ttyhoney.com>
References: https://bugzilla.kernel.org/show_bug.cgi?id=51231
Thinkpad X230:
Reported-and-tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
References: https://bugzilla.kernel.org/show_bug.cgi?id=51231
ThinkPad X1 Carbon:
Reported-and-tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Lenovo Yoga 13:
Reported-by: Lennart Poettering <lennart@poettering.net>
Reported-and-tested-by: Kevin Smith <thirdwiggin@gmail.com>
References: https://bugzilla.kernel.org/show_bug.cgi?id=63811
Dell Inspiron 7520:
Reported-by: Rinat Ibragimov <ibragimovrinat@mail.ru>
Acer Aspire 5733Z:
Reported-by: <sov.info@mail.ru>
References: https://bugzilla.kernel.org/show_bug.cgi?id=62941
Acer Aspire V5-431:
Reported-by: Thomas Christensen <christensenthomas@gmail.com>
References: https://bugzilla.kernel.org/show_bug.cgi?id=68751
HP ProBook 4340s:
Reported-and-tested-by: Vladimir Sherenkov <a_12300@mail.ru>
References: http://redmine.russianfedora.pro/issues/1258
HP EliteBook/ProBook 2013 models, ZBook and some others:
Provided-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-20 01:33:40 +01:00
Hans de Goede bd8ba20597 ACPI / video: Filter the _BCL table for duplicate brightness values
Some devices have duplicate entries in there brightness levels table, ie
on my Dell Latitude E6430 the table looks like this:

[    3.686060] acpi backlight index   0, val 80
[    3.686095] acpi backlight index   1, val 50
[    3.686122] acpi backlight index   2, val 5
[    3.686147] acpi backlight index   3, val 5
[    3.686172] acpi backlight index   4, val 5
[    3.686197] acpi backlight index   5, val 5
[    3.686223] acpi backlight index   6, val 5
[    3.686248] acpi backlight index   7, val 5
[    3.686273] acpi backlight index   8, val 6
[    3.686332] acpi backlight index   9, val 7
[    3.686356] acpi backlight index  10, val 8
[    3.686380] acpi backlight index  11, val 9
etc.

Notice that brightness values 0-5 are all mapped to 5. This means that
if userspace writes any value between 0 and 5 to the brightness sysfs attribute
and then reads it, it will always return 0, which is somewhat unexpected.

This is a problem for ie gnome-settings-daemon, which uses read-modify-write
logic when the users presses the brightness up or down keys. This is done
this way to take brightness changes from other sources into account.

On this specific laptop what happens once the brightness has been set to 0,
is that gsd reads 0, adds 5, writes 5, and on the next brightness up key press
again reads 0, so things get stuck at the lowest brightness setting.

Filtering out the duplicate table entries, makes any write to brightness
read back as the written value as one would expect, fixing this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Aaron Lu <aaron.lu@intel.com>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-20 01:33:40 +01:00
Chew, Chiau Ee e1c7481797 ACPI / LPSS: Add Intel BayTrail ACPI mode PWM
Intel BayTrail LPSS consists of two PWM controllers which can
be enumerated from ACPI namespace. This change will cause
platform device objects to be created for Intel BayTrail PWM
controllers which will allow the pwm-lpss driver to bind to them
and handle those devices.

Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-19 01:00:33 +01:00
Hanjun Guo df86f5df79 ACPI / processor: Make it possible to get APIC ID via GIC
Introduce a new function map_gic_id() to allow APIC IDs to be obtained
from the GIC Structure introduced by ACPI 5.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-19 00:53:15 +01:00
Hanjun Guo 2c4fa0033a ACPI / processor: Build idle_boot_override on x86 and ia64
idle_boot_override depends on x86 and ia64 now and it is not clear
whether or not it will be used on ARM or ARM64, so put the DMI
blacklist setting it in processor_core.c into a #if block so that
it is built for CONFIG_X86 or CONFIG_IA64 only to allow
processor_core.c to be compiled for ARM64.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-19 00:41:06 +01:00
Hanjun Guo 52056925f4 ACPI / processor: Use ACPI_PROCESSOR_DEVICE_HID instead of "ACPI0007"
Replace "ACPI0007" with ACPI_PROCESSOR_DEVICE_HID to improve code
readability.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-19 00:33:09 +01:00
Hanjun Guo 1606484ec1 ACPI / processor: Fix acpi_processor_eval_pdc() return value type
The return value type of acpi_processor_eval_pdc() should be
'acpi_status' but is defined as 'int', so fix it.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-19 00:31:36 +01:00
Paul Bolle 7919010c42 ACPI: Remove Kconfig symbol ACPI_PROCFS
Nothing cares about ACPI_PROCFS. This has been the case since v2.6.38.
This Kconfig symbol serves no purpose and its help text is now
misleading. It can safely be removed. If this symbol would be needed
again in the future it can be readded in a commit that adds code that
actually uses it.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-19 00:27:37 +01:00
Tomasz Nowicki b685f3b174 ACPI / PCI: Fix memory leak in acpi_pci_irq_enable()
acpi_pci_link_allocate_irq() can return negative gsi even if
entry != NULL.  For that case we have a memory leak, so free
entry before returning from acpi_pci_irq_enable() for gsi < 0.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Cc: All applicable <stable@vger.kernel.org>
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-18 15:47:23 +01:00
Tomasz Nowicki 5157275392 ACPI / APEI: Remove X86 redundant dependency for APEI GHES.
ACPI_APEI already depends on X86, so there is no need to define
such dependency for ACPI_APEI_GHES (Generic Hardware Error Source)
again.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-18 01:29:45 +01:00
Rafael J. Wysocki af8874491d ACPI / dock: Associate dock platform devices with ACPI device objects
To allow user space to check which ACPI device object the dock
station is represented by, make acpi_dock_add() indicate to
platform_device_register_full() which ACPI device object should
be the companion of the new platform device.

This also ensures that the ACPI device object in question will
not go away while the dock platform device is present (which is
always).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-16 01:51:16 +01:00
Rafael J. Wysocki b43109fa46 ACPI / dock: Pass ACPI device pointer to acpi_device_is_battery()
Since we already know what the device's PNP IDs are when
acpi_device_is_battery() is called, it is not necessary to run
acpi_get_object_info() for the device in that function.  Instead, if
acpi_device_is_battery() is passed a pointer to a struct acpi_device
object, it can use the list of PNP IDs from that object, so make that
happen and modify the function's header accordingly

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-16 01:51:15 +01:00
Rafael J. Wysocki 1e2380cd14 ACPI / dock: Dispatch dock notifications from the global notify handler
The ACPI dock station code carries out an extra namespace scan
before the main one in order to find and register all of the dock
device objects.  Then, it registers a notify handler for each of
them for handling dock events.

However, dock device objects need not be scanned for upfront.  They
very well can be enumerated and registered during the first phase
of the main namespace scan, before attaching scan handlers and ACPI
drivers to ACPI device objects.  Then, the dependent devices can be
added to the in the second phase.  That makes it possible to drop
the extra namespace scan, so do it.

Moreover, it is not necessary to register notify handlers for all
of the dock stations' namespace nodes, becuase notifications may
be dispatched from the global notify handler for them.  Do that and
drop two functions used for dock notify handling, acpi_dock_deferred_cb()
and dock_notify_handler(), that aren't necessary any more.

Finally, some dock station objects have _HID objects matching the
ACPI container scan handler which causes it to claim those objects
and try to handle their hotplug, but that is not a good idea,
because those objects have their own special hotplug handling anyway.
For this reason, the hotplug_notify flag should not be set for ACPI
device objects representing dock stations and the container scan
handler should be made ignore those objects, so make that happen.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-16 01:51:01 +01:00
Rafael J. Wysocki d6a40224a3 Merge back earlier 'acpi-dock' material. 2014-02-16 00:21:24 +01:00
Rafael J. Wysocki ab62f9cd7b ACPI / dock: Make 'docked' sysfs attribute work as documented
After recent ACPI core changes acpi_bus_get_device() will always
succeed for dock station ACPI device objects, so show_docked()
should not use that function's return value as an indicator of
whether or not the dock device is present.

Make it use acpi_device_enumerated() for this purpose.

Fixes: 202317a573 (ACPI / scan: Add acpi_device objects for all device nodes in the namespace)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-15 01:29:06 +01:00
Lv Zheng 4dde507fc1 ACPICA: Add boot option to disable auto return object repair
Sometimes, there might be bugs caused by unexpected AML which is compliant
to the Windows but not compliant to the Linux implementation.

There is a predefined validation mechanism implemented in ACPICA to repair
the unexpected AML evaluation results that are caused by the unexpected
AMLs.  For example, BIOS may return misorder _CST result and the repair
mechanism can make an ascending order on the returned _CST package object
based on the C-state type.
This mechanism is quite useful to implement an AML interpreter with better
compliance with the real world where Windows is the de-facto standard and
BIOS codes are only tested on one platform thus not compliant to the
ACPI specification.

But if a compliance issue hasn't been figured out yet, it will be
difficult for developers to identify if the unexpected evaluation result
is caused by this mechanism or by the AML interpreter.
For example, _PR0 is expected to be a control method, but BIOS may use
Package: "Name(_PR0, Package(1) {P1PR})".
This boot option can disable the predefined validation mechanism so that
developers can make sure the root cause comes from the parser/executer.

This patch adds a new kernel parameter to disable this feature.

A build test has been made on a Dell Inspiron mini 1100 (i386 z530)
machine when this patch is applied and the corresponding boot test is
performed w/ or w/o the new kernel parameter specified.

References: https://bugzilla.kernel.org/show_bug.cgi?id=67901
Tested-by: Fabian Wehning <fabian.wehning@googlemail.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-13 16:25:16 +01:00
Bob Moore faae404ebd ACPICA: Add "Windows 2013" string to _OSI support.
This urgent patch is cherry picked from ACPICA upstream.
It is reported that some platforms fail to boot without this new _OSI
string.

This change adds this string for Windows 8.1 and Server 2012 R2.

Reported-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Bob Moore <Robert.Moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-13 15:28:08 +01:00
Luis G.F 32a9051205 ACPI / SBS: Fix incorrect sscanf() string
Fix incorrect sscanf() string in function acpi_battery_alarm_store().

Signed-off-by: Luis G.F <luisgf@luisgf.es>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-13 15:18:37 +01:00
Shuah Khan fae9e2a4b1 ACPI / thermal: fix thermal driver compile error when CONFIG_PM_SLEEP is undefined
The ACPI thermal driver defines acpi_thermal_resume() when
CONFIG_PM_SLEEP is defined. This results in the following compile
error when CONFIG_PM_SLEEP is undefined.

  CC      drivers/acpi/thermal.o
drivers/acpi/thermal.c:107:8: error: ‘acpi_thermal_resume’ undeclared here (not in a function)
make[2]: *** [drivers/acpi/thermal.o] Error 1

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-13 15:13:45 +01:00
Shuah Khan 15029dd794 ACPI / SBS: fix SBS driver compile error when CONFIG_PM_SLEEP is undefined
The ACPI SBS driver defines acpi_sbs_resume() when CONFIG_PM_SLEEP is
defined. This results in the following compile error when CONFIG_PM_SLEEP
is undefined:

  CC [M]  drivers/acpi/sbs.o
drivers/acpi/sbs.c:674:8: error: ‘acpi_sbs_resume’ undeclared here (not in a function)

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-13 15:13:45 +01:00
Shuah Khan b108e0ea94 ACPI / fan: fix fan driver compile error when CONFIG_PM_SLEEP is undefined
The ACPI fan driver defines acpi_fan_suspend() and acpi_fan_resume()
when CONFIG_PM_SLEEP is defined. This results in the following compile
errors when CONFIG_PM_SLEEP is undefined:

drivers/acpi/fan.c:60:8: error: ‘acpi_fan_suspend’ undeclared here (not in a function)
drivers/acpi/fan.c:60:8: error: ‘acpi_fan_resume’ undeclared here (not in a function)

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-13 15:13:44 +01:00
Shuah Khan 2de9fd17c0 ACPI / button: fix button driver compile error when CONFIG_PM_SLEEP is undefined
The ACPI button driver defines acpi_button_resume() when
CONFIG_PM_SLEEP is defined. This results in the following
compile error when CONFIG_PM_SLEEP is undefined:

drivers/acpi/button.c:85:8: error: ‘acpi_button_resume’ undeclared here (not in a function)

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-13 15:13:44 +01:00
Shuah Khan 7f6895c60f ACPI / battery: fix battery driver compile error when CONFIG_PM_SLEEP is undefined
The ACPI battery driver defines acpi_battery_resume() when
CONFIG_PM_SLEEP is defined. This results in the following compile
error when CONFIG_PM_SLEEP is undefined:

drivers/acpi/battery.c:847:8: error: ‘acpi_battery_resume’ undeclared here (not in a function)

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-13 15:13:44 +01:00
Shuah Khan 06521c2e4a ACPI / AC: fix AC driver compile error when CONFIG_PM_SLEEP is undefined
The ACPI AC driver defines acpi_ac_resume() when CONFIG_PM_SLEEP is
defined.  This results in the following compile error when
CONFIG_PM_SLEEP is undefined:

drivers/acpi/ac.c:248:8: error: ‘acpi_ac_resume’ undeclared here (not in a function)

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-13 15:13:44 +01:00
Rafael J. Wysocki d990ce0d5b Merge branches 'acpi-dock', 'acpi-scan' and 'acpi-pci-hotplug'
* acpi-dock:
  ACPI / dock: Use acpi_device_enumerated() to check if dock is present

* acpi-scan:
  ACPI / container: Fix error code path in container_device_attach()

* acpi-pci-hotplug:
  ACPI / hotplug / PCI: Relax the checking of _STA return values
2014-02-12 14:56:58 +01:00
Rafael J. Wysocki 0f6aa09e40 ACPI / container: Fix error code path in container_device_attach()
To avoid leaking memory on errors from device_register(), do a
put_device() on the device object in question in the error code
path of container_device_attach().

Fixes: caa73ea158 (ACPI / hotplug / driver core: Handle containers in a special way)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
2014-02-12 14:55:16 +01:00
Rafael J. Wysocki 4b49b9fe2b Merge back earlier 'acpi-pci-hotplug' material.
Conflicts:
	drivers/pci/hotplug/acpiphp_glue.c
2014-02-12 12:56:56 +01:00
Rafael J. Wysocki 1a8f83515c ACPI / LPSS: Support for device latency tolerance PM QoS
Add a new routine, acpi_lpss_set_ltr(), for setting latency tolerance
values for LPSS devices having LTR (Latency Tolerance Reporting)
registers.  Add .bind()/.unbind() callbacks to lpss_handler to set
the LPSS devices' power.set_latency_tolerance callback pointers to
acpi_lpss_set_ltr() during device addition and to clear them on
device removal, respectively.

That will cause the device latency tolerance PM QoS to work for
the devices in question as documented.

This changeset includes a fix from Mika Westerberg.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-11 00:35:53 +01:00
Rafael J. Wysocki 9cb32acf09 ACPI / scan: Add bind/unbind callbacks to struct acpi_scan_handler
In some cases it may be necessary to perform certain setup/cleanup
operations on a device object representing a physical device after
it has been associated with an ACPI companion by acpi_bind_one() or
before disassociating it from that companion by acpi_unbind_one(),
respectively.  If there is a struct acpi_bus_type object for the
given device's bus type, the .setup()/.cleanup() callbacks from there
are executed for these purposes.  However, an analogous mechanism will
be necessary for devices whose bus types don't have corresponding
struct acpi_bus_type objects and that have specific ACPI scan handlers.

For those devices, add new .bind() and .unbind() callbacks to struct
acpi_scan_handler that will be executed by acpi_platform_notify()
right after the given device has been associated with an ACPI
comapnion and by acpi_platform_notify_remove() right before calling
acpi_unbind_one() for that device, respectively.

To make that work for scan handlers registering new devices in their
.attach() callbacks, modify acpi_scan_attach_handler() to set the
ACPI device object's handler field before calling .attach() from the
scan handler at hand.

This changeset includes a fix from Mika Westerberg.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-11 00:35:46 +01:00
Lv Zheng 3334861b1e ACPICA: Update the conditions to enable the utility resource dump strings.
This patch enables resource dump functions for debugging purpose where
ACPI_DEBUG_OUTPUT is enabled.  Such functions are useful for developers
to track kernel issues when composing debugging patches.  They will be
optimized out during link stage for normal builds.

This patch updates the compilation condition used for the resource dump
related string tables to match the compilation environment used for
rsdump.c and rsdumpinfo.c.

This patch can help to improve the ACPICA release automation.  Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-11 00:30:25 +01:00
Bob Moore eb60c4d3a4 ACPICA: Debugger: Add new command to read/write/compare all namespace objects.
This command "test objects" will exercise the entire namespace by
writing new values to each data object, and ensuring that the write
was successful. The original value is then restored and verified.

This patch doesn't affect kernel behavior as the debugger is
currently not shipped in the Linux source tree.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-02-11 00:30:25 +01:00