ACPI / battery: fix wrong value of capacity_now reported when fully charged

It seems that some batteries (noticed on DELL JYPJ136) assume
capacity_now = design_capacity when fully charged. This causes
reported capacity to suddenly jump to >full_charge_capacity (and that
means capacity reported to userspace is >100% and incorrect)
values after 99%. This patch detects capacity_now > full_charge_capacity,
notifies userspace (unless it is the known bug where capacity_now ==
design_capacity) and trims the value to full_charge_capacity.

Signed-off-by: Josef Gajdusek <atx@atx.name>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / i915: ignore firmware requests for backlight change

Some Thinkpad laptops' firmware will initiate a backlight level change
request through operation region on the events of AC plug/unplug, but
since we are not using firmware's interface to do the backlight setting
on these affected laptops, we do not want the firmware to use some
arbitrary value from its ASL variable to set the backlight level on
AC plug/unplug either.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=76491
Link: https://bugzilla.kernel.org/show_bug.cgi?id=77091
Reported-and-tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Reported-and-tested-by: Anton Gubarkov <anton.gubarkov@gmail.com>
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / video: Add Dell Inspiron 5737 to the blacklist

With win8 capabiltiy, the ACPI backlight control is broken.
The system also loses backlight setting when resuming from S3.

Add this model to the the ACPI video detect blacklist to make backlight
functionality work.

Although backlight functionality works via video.use_native_backlight=1,
this approach may be safer.

Signed-off-by: Edward Lin <yidi.lin@canonical.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / video: Add Acer TravelMate B113 to native backlight blacklist

Fix backlight control for Acer TravelMate B113 Laptop by adding
it to the video_dmi_table.

A workaround before that was to use acpi_osi=Linux or
acpi_backlight=vendor on boot but even then, only the function-
keys worked.

With this change there is no need for boot parameters and DE's
controls work as well.

Signed-off-by: Martin Kepplinger <martink@posteo.de>
[rjw: Subject]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / video: mv models with win8 brightness problems to use_native_backlight

When the windows8 related backlight problems became evident, 2 approaches
were follow in parallel, one was to stop claiming to be windows 8 / 2012,
the other was to tell acpi_video to stop registering a backlight driver.

I've read all the threads and it seems that which approach ended up being
applied to which model laptop was never really a concious decision (AFAIK):

https://bugzilla.kernel.org/show_bug.cgi?id=51231
https://bugzilla.kernel.org/show_bug.cgi?id=60682

So lets move all the models which are only on the win8 blacklist because of
brightness issues to the use_native_backlight list, which is the smaller
hammer to use to solve the backlight issues.

Making this change is esp. attractive now that 3.16 has
video.use_native_brightness=1 by default. If that new default does not get
reverted because of regressions, then we can drop all the models
with a use_native_backlight quirk, greatly reducing the number of models we've
a quirk for.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=51231
Link: https://bugzilla.kernel.org/show_bug.cgi?id=60682
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / sleep: Fix up acpi_target_system_state() stub definition

The static inline stub for acpi_target_system_state() is defined in
include/acpi/acpi_bus.h, but that file is only included if CONFIG_ACPI
is set, so drivers that use acpi_target_system_state() will fail to
build for CONFIG_ACPI unset.

To prevent that from happening move the definition of the static
inline stub for acpi_target_system_state() to include/linux/acpi.h.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'acpi-battery' into bleeding-edge

* acpi-battery:
  ACPI / battery: fix wrong value of capacity_now reported when fully charged
  ACPI / battery: Retry to get battery information if failed during probing
Merge branch 'acpi-video' into bleeding-edge

* acpi-video:
  ACPI / video: mv models with win8 brightness problems to use_native_backlight
  ACPI / video: Add Acer TravelMate B113 to native backlight blacklist
  ACPI / video: Add Dell Inspiron 5737 to the blacklist
  ACPI / i915: ignore firmware requests for backlight change
Merge branch 'acpi-sleep' into bleeding-edge

* acpi-sleep:
  ACPI / sleep: Fix up acpi_target_system_state() stub definition