platform-drivers-x86: intel_pmic_gpio: Fix off-by-one valid offset range check

Only pin 0-7 support input, so the valid offset range should be 0 ~ 7.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
toshiba_acpi: Add alternative keymap support for Satellite M840

Toshiba Satellite M840 laptop has a complete different keymap although
it's bound with the same ACPI ID "TOS1900".  This patch provides an
alternative keymap specific to this machine by identifying via DMI
matching.  The keymap table doesn't fill all entries that were used
before since some keys aren't found on this machine at all.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=69761
Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=812209
Reported-and-tested-by: Federico Vecchiarelli <fedev@gmx.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
platform/x86: samsung-laptop: Add support for Samsung's NP7[34]0U3E models.

These models have only 4 levels of keyboard backlight brightness and forget
how to work the backlight after resuming from S3 sleep. I've added a quirk
to set the appropriate number of backlight levels, and one to re-enable the
keyboard backlight on resume.

(Whitespace cleaned up by Matthew Garrett)

Signed-off-by: Scott Thrasher <scott.thrasher@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
pvpanic: Set high notifier priority

We've observed the missing pvpanic call at panic, and it turned out
that this was blocked by the broken notifier of drm_fb_helper, where
scheduling may be called during switching to the fb console.
It's fairly difficult to fix the drm_fb problem and a quick fix isn't
foreseen, a simpler solution for the missing pvpanic call would be
just to call this earlier.

In order to assure that, this patch sets a higher priority to pvpanic
notifier_block.  Once when the issue of drm_fb is resolved, we can
remove this priority again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
alienware-wmi: Update WMAX brightness method limit to 15

This more closely reflects what the hardware can actually support.

Signed-off-by: Mario Limonciello <mario_limonciello@dell.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
alienware-wmi: For WMAX HDMI method, introduce a way to query HDMI cable status

Since there are now multiple HDMI attributes associated with the WMAX method,
create a sysfs group for them instead.

Signed-off-by: Mario Limonciello <mario_limonciello@dell.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
asus-wmi: Set WAPF to 4 for Asus X550CA

The 'asus-nb-wmi' WAPF parameter must be set to 4, so the internal Wireless LAN device is operational.

Signed-off-by: Andreas Utterberg <andreas.utterberg@thundera.se>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
ideapad-laptop: Blacklist rfkill control on the Lenovo Yoga 2 11

The Lenovo Yoga 2 11 always reports everything as blocked, causing userspace
to not even try to use the wlan / bluetooth even though they work fine.

Note this patch also removes the "else priv->rfk[i] = NULL;" bit of the
rfkill initialization, it is not necessary as the priv struct is allocated
with kzalloc.

Reported-and-tested-by: Vincent Gerris <vgerris@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Documentation: Add list of laptop models supported by the Compal driver

Signed-off-by: Ismael Luceno <ismael.luceno@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
platform x86 Kconfig: Refer to the laptop list in the Compal driver help

Signed-off-by: Ismael Luceno <ismael.luceno@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
ix86/mid/thermal: Introduce the use of the managed version of kzalloc

This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions.

The following Coccinelle semantic patch was used for making the change:

@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
  .probe = probefn,
  .remove = removefn,
};

@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
  <+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
  ...
?-kfree(e);
  ...+>
}

@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
  <...
- kfree(e);
  ...>
}

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
platform: x86: asus-wmi.c: Cleaning up uninitialized variables

There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
platform/x86: Fix run-time dependencies of OLPC drivers

Let the xo15-ebook driver depend on OLPC as all other OLPC drivers
already do. Add COMPILE_TEST as an alternative for both xo1-rfkill
and xo15-ebook, to increase the build testing coverage.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
ideapad_laptop: Introduce the use of the managed version of kzalloc

This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions. The label sysfs_failed is removed as it is no longer
required.  Also, linux/device.h is added to make sure the devm_*()
routine declarations are unambiguously available.

The following Coccinelle semantic patch was used for making the change:

@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
  .probe = probefn,
  .remove = removefn,
};

@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
  <+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
  ...
?-kfree(e);
  ...+>
}

@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
  <...
- kfree(e);
  ...>
}

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)

This acpi driver provide supports for freefall sensors SMO8800/SMO8810 which
can be found on Dell Latitude laptops. Driver register /dev/freefall misc
device which has same interface as driver hp_accel freefall driver. So any
existing applications for HP freefall sensor /dev/freefall will work for with
this new driver for Dell Latitude laptops too.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Cc: Sonal Santan <sonal.santan@gmail.com>
Tested-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Acked-By: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
thinkpad_acpi: Add mappings for F9 - F12 hotkeys on X240 / T440 / T540

The T440s user guide says that when Fn-lock is not active, the *40s' F9 - F12
keys should be mapped to: control-panel, search, show-all-windows and Computer.

These keys generate the sofar unused 28 - 31 hotkey scancodes.

For the first 2 this nicely matches the icons on the keys, for the latter 2
the icons are somewhat creative, which is why I ended up looking them up in
the user manual.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
hp-wmi: Enable hotkeys on some systems

This is a third attempt to enable these buttons. The new variable being
commit 997daa1bd9aca412ab97955a35b26c460c0ec7a4 (i.e. hp-wmi: detect
"2009 BIOS or later"). Older systems that do not have the 2009 BIOS query
method respond with a dummy value, in this case 4. Using that, we can
target a fairly narrow group of systems. i.e. old enough to not have
HPWMI_FEATURE_QUERY 0xd, but new enough to have HPWMI_BIOS_QUERY 0x9.
This group may be further limited if some systems respond with something
other than 4 to non-existant feature queries.

Signed-off-by: Kyle Evans <kvans32@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Merge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86

Pull x86 platform driver updates from Matthew Garrett:
 "Very little of excitement here - the most significant is a new driver
  for detecting device freefall on Dells, other than that it's pretty
  much entirely minor fixes for specific machines"

* 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86:
  hp-wmi: Enable hotkeys on some systems
  thinkpad_acpi: Add mappings for F9 - F12 hotkeys on X240 / T440 / T540
  platform: x86: dell-smo8800: Dell Latitude freefall driver (ACPI SMO8800/SMO8810)
  ideapad_laptop: Introduce the use of the managed version of kzalloc
  platform/x86: Fix run-time dependencies of OLPC drivers
  platform: x86: asus-wmi.c: Cleaning up uninitialized variables
  ix86/mid/thermal: Introduce the use of the managed version of kzalloc
  platform x86 Kconfig: Refer to the laptop list in the Compal driver help
  Documentation: Add list of laptop models supported by the Compal driver
  ideapad-laptop: Blacklist rfkill control on the Lenovo Yoga 2 11
  asus-wmi: Set WAPF to 4 for Asus X550CA
  alienware-wmi: For WMAX HDMI method, introduce a way to query HDMI cable status
  alienware-wmi: Update WMAX brightness method limit to 15
  pvpanic: Set high notifier priority
  platform/x86: samsung-laptop: Add support for Samsung's NP7[34]0U3E models.
  toshiba_acpi: Add alternative keymap support for Satellite M840
  platform-drivers-x86: intel_pmic_gpio: Fix off-by-one valid offset range check