1
0
Fork 0
Commit Graph

273 Commits (4797de450cd2bd439b7c576002d7f4f5fab237e6)

Author SHA1 Message Date
Benjamin Berg fbd3f1d6ef platform/x86: thinkpad_acpi: Send tablet mode switch at wakeup time
[ Upstream commit e40cc1b476 ]

The lid state may change while the machine is suspended. As such, we may
need to re-check the state at wake-up time (at least when waking up from
hibernation).
Add the appropriate call to the resume handler in order to sync the
SW_TABLET_MODE switch state with the hardware state.

Fixes: dda3ec0aa6 ("platform/x86: thinkpad_acpi: Implement tablet mode using GMMS method")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=210269
Signed-off-by: Benjamin Berg <bberg@redhat.com>
Acked-by: Henrique de Moraes Holschuh <hnh@hmh.eng.br>
Link: https://lore.kernel.org/r/20201123132157.866303-1-benjamin@sipsolutions.net
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-12-02 08:49:53 +01:00
Aaron Ma 3fd2647f9d platform/x86: thinkpad_acpi: re-initialize ACPI buffer size when reuse
commit 720ef73d1a upstream.

Evaluating ACPI _BCL could fail, then ACPI buffer size will be set to 0.
When reuse this ACPI buffer, AE_BUFFER_OVERFLOW will be triggered.

Re-initialize buffer size will make ACPI evaluate successfully.

Fixes: 46445b6b89 ("thinkpad-acpi: fix handle locate for video and query of _BCL")
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-14 10:32:58 +02:00
Tom Rix 9bd694ccfd platform/x86: thinkpad_acpi: initialize tp_nvram_state variable
commit 5f38b06db8 upstream.

clang static analysis flags this represenative problem
thinkpad_acpi.c:2523:7: warning: Branch condition evaluates
  to a garbage value
                if (!oldn->mute ||
                    ^~~~~~~~~~~

In hotkey_kthread() mute is conditionally set by hotkey_read_nvram()
but unconditionally checked by hotkey_compare_and_issue_event().
So the tp_nvram_state variable s[2] needs to be initialized.

Fixes: 01e88f2598 ("ACPI: thinkpad-acpi: add CMOS NVRAM polling for hot keys (v9)")
Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: mark gross <mgross@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-14 10:32:58 +02:00
Alexander Schremmer 110ea1d833 platform/x86: thinkpad_acpi: Add ThinkPad PrivacyGuard
This feature is found optionally in T480s, T490, T490s.

The feature is called lcdshadow and visible via
/proc/acpi/ibm/lcdshadow.

The ACPI methods \_SB.PCI0.LPCB.EC.HKEY.{GSSS,SSSS,TSSS,CSSS} are
available in these machines. They get, set, toggle or change the state
apparently.

The patch was tested on a 5.0 series kernel on a T480s.

Signed-off-by: Alexander Schremmer <alex@alexanderweb.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-09-07 21:16:09 +03:00
Fuqian Huang 35b7c80827 platform/x86: thinkpad_acpi: Use kmemdup rather than duplicating its implementation
kmemdup is introduced to duplicate a region of memory in a neat way.
Rather than kmalloc/kzalloc + memcpy, which the programmer needs to
write the size twice (sometimes lead to mistakes), kmemdup improves
readability, leads to smaller code and also reduce the chances of mistakes.
Suggestion to use kmemdup rather than using kmalloc/kzalloc + memcpy.

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-29 18:31:48 +03:00
Thomas Gleixner 1621633323 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 1
Based on 2 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license as published by
  the free software foundation either version 2 of the license or at
  your option any later version this program is distributed in the
  hope that it will be useful but without any warranty without even
  the implied warranty of merchantability or fitness for a particular
  purpose see the gnu general public license for more details you
  should have received a copy of the gnu general public license along
  with this program if not write to the free software foundation inc
  51 franklin street fifth floor boston ma 02110 1301 usa

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license as published by
  the free software foundation either version 2 of the license or at
  your option [no]_[pad]_[ctrl] any later version this program is
  distributed in the hope that it will be useful but without any
  warranty without even the implied warranty of merchantability or
  fitness for a particular purpose see the gnu general public license
  for more details you should have received a copy of the gnu general
  public license along with this program if not write to the free
  software foundation inc 51 franklin street fifth floor boston ma
  02110 1301 usa

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 176 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Jilayne Lovejoy <opensource@jilayne.com>
Reviewed-by: Steve Winslow <swinslow@gmail.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190519154040.652910950@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 11:28:39 +02:00
Pavel Machek aac3311c48 platform/x86: thinkpad_acpi: cleanup for Thinkpad ACPI led
Make error returns more consistent... no behaviour change intended.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-05-09 00:33:03 +03:00
Gustavo A. R. Silva c77c357722 platform/x86: thinkpad_acpi: Mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

This patch fixes the following warnings:

drivers/platform/x86/thinkpad_acpi.c: In function ‘thermal_get_sensor’:
drivers/platform/x86/thinkpad_acpi.c:6316:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (idx >= 8 && idx <= 15) {
      ^
drivers/platform/x86/thinkpad_acpi.c:6322:2: note: here
  case TPACPI_THERMAL_TPEC_8:
  ^~~~
drivers/platform/x86/thinkpad_acpi.c: In function ‘hotkey_notify’:
drivers/platform/x86/thinkpad_acpi.c:4208:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
    if (tp_features.hotkey_wlsw &&
       ^
drivers/platform/x86/thinkpad_acpi.c:4216:3: note: here
   default:
   ^~~~~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

Notice that, in this particular case, the code comments are modified
in accordance with what GCC is expecting to find.

This patch is part of the ongoing efforts to enable
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-05-09 00:33:02 +03:00
Colin Ian King d33a7e578e platform/x86: thinkpad_acpi: fix spelling mistake "capabilites" -> "capabilities"
There is a spelling mistake in a module parameter description. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-05-06 17:54:15 +03:00
Jiaxun Yang 9a4b33d4d2 platform/x86: thinkpad_acpi: Read EC information on newer models
Newer ThinkPads have a totally different EC program information DMI
table. And thermal subdriver can't work without correct EC version.

Read from this entry if the old method failed to get EC information.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-04-08 20:12:13 +03:00
Jiaxun Yang f7db839fcc platform/x86: thinkpad_acpi: Disable Bluetooth for some machines
Some AMD based ThinkPads have a firmware bug that calling
"GBDC" will cause Bluetooth on Intel wireless cards blocked.

Probe these models by DMI match and disable Bluetooth subdriver
if specified Intel wireless card exist.

Cc: stable <stable@vger.kernel.org> # 4.14+
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-04-08 20:12:13 +03:00
Linus Torvalds 8e61e7b5c4 sound updates for 4.21
There are no intensive changes in both ALSA and ASoC core parts while
 rather most of changes are a bunch of driver fixes and updates.
 A large diff pattern appears in ASoC TI part which now merges both
 OMAP and DaVinci stuff, but the rest spreads allover the places.
 
 Note that this pull request includes also some updates for LED trigger
 and platform drivers for mute LEDs, appearing in the diffstat as well.
 
 Some highlights:
 
 ASoC:
 - Preparatory work for merging the audio-graph and audio-graph-scu
   cards
 - A merge of TI OMAP and DaVinci directories, as both product lines
   get merged together.  Also including a few architecture changes as
   well.
 - Major cleanups of the Maxim MAX9867 driver
 - Small fixes for tablets & co with Intel BYT/CHT chips
 - Lots of rsnd updates as usual
 - Support for Asahi Kaesi AKM4118, AMD ACP3x, Intel platforms with
   RT5660, Meson AXG S/PDIF inputs, several Qualcomm IPs and Xilinx I2S
   controllers
 
 HD-audio:
 - Introduce audio-mute LED trigger for replacing the former hackish
   dynamic binding
 - Huawei WMI hotkey and mute LED support
 - Refactoring of PM code and display power controls
 - Headset button support in the generic jack code
 - A few updates for Tegra
 - Fixups for HP EliteBook and ASUS UX391UA
 - Lots of updates for Intel ASoC HD-audio, including the improved DSP
   detection and the fallback binding from ASoC SST to legacy HD-audio
   controller drivers
 
 Others:
 - Updates for FireWire TASCAM and Fireface devices, some other fixes
 - A few potential Spectre v1 fixes that are all trivial
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAlwbbCIOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE+RoQ//TNKliUP3bOv4BdnSmUHcCSAP3st96Ror5lC+
 RZ103UyjlCsfa7hSPfH7/4WHAjk7wXYdazjA3m2swsxsbcjPMW4uBIBJlegQNM/9
 PmNt4y60UgdgMCT/uu10BlEO8GsqBkRpxFYHtUJ3Lq6h9ECa+VDLazNjK9jABItK
 BVG668/LZp0le94cnJsLICmZ7fwKpAvi58hOsgOJLrPP4gzSGTj1gJXw/yyZ99QC
 MPLVj1PruXq1l8zfxM+MUuOa7hayafx64bCbftlITPonWfEr7OvBCQ7Vf9HqzJIJ
 OzEXAclVSc89R7RQT2omPiRKC7AyL85M9PCkpTtXh2D7DGXw9CFj5IDL6eIC4Ip4
 sycArLOo6LA8ZYu45zCiY3rfh9Hx0Zn2qHz3qJeQtBrv5XYULuf6ZNwq6xJDEUz/
 jxS558wSGHYWAyjv/IaPha1+JD6Us7zkSQgum+/qqnYYnYlDyxXnBatj4HzWZP/M
 Khuhj+k+Y8UXK1MbRiekVCGIwCHGf3cUv4H7tq+qpEzvJZwTFnOBh7/twVL8gN96
 x4ozZogaiaenZwlEZlkzowAMBBYMYb537Y+Y5suxzWGz3HN/Z8raaL8GTkIIB/BO
 bNprJtPR8GJLfdu8NE++dUR2VuHfMnWat+frXk0eAsWutoviRyB4JLCRppfpgrA/
 vDhIreU=
 =SG61
 -----END PGP SIGNATURE-----

Merge tag 'sound-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound updates from Takashi Iwai:
 "There are no intensive changes in both ALSA and ASoC core parts while
  rather most of changes are a bunch of driver fixes and updates. A
  large diff pattern appears in ASoC TI part which now merges both OMAP
  and DaVinci stuff, but the rest spreads allover the places.

  Note that this pull request includes also some updates for LED trigger
  and platform drivers for mute LEDs, appearing in the diffstat as well.

  Some highlights:

  ASoC:
   - Preparatory work for merging the audio-graph and audio-graph-scu
     cards
   - A merge of TI OMAP and DaVinci directories, as both product lines
     get merged together. Also including a few architecture changes as
     well.
   - Major cleanups of the Maxim MAX9867 driver
   - Small fixes for tablets & co with Intel BYT/CHT chips
   - Lots of rsnd updates as usual
   - Support for Asahi Kaesi AKM4118, AMD ACP3x, Intel platforms with
     RT5660, Meson AXG S/PDIF inputs, several Qualcomm IPs and Xilinx
     I2S controllers

  HD-audio:
   - Introduce audio-mute LED trigger for replacing the former hackish
     dynamic binding
   - Huawei WMI hotkey and mute LED support
   - Refactoring of PM code and display power controls
   - Headset button support in the generic jack code
   - A few updates for Tegra
   - Fixups for HP EliteBook and ASUS UX391UA
   - Lots of updates for Intel ASoC HD-audio, including the improved DSP
     detection and the fallback binding from ASoC SST to legacy HD-audio
     controller drivers

  Others:
   - Updates for FireWire TASCAM and Fireface devices, some other fixes
   - A few potential Spectre v1 fixes that are all trivial"

* tag 'sound-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (280 commits)
  ALSA: HD-Audio: SKL+: force HDaudio legacy or SKL+ driver selection
  ALSA: HD-Audio: SKL+: abort probe if DSP is present and Skylake driver selected
  ALSA: HDA: export process_unsol_events()
  ALSA: hda/realtek: Enable audio jacks of ASUS UX391UA with ALC294
  ALSA: bebob: fix model-id of unit for Apogee Ensemble
  ALSA: emu10k1: Fix potential Spectre v1 vulnerabilities
  ALSA: rme9652: Fix potential Spectre v1 vulnerability
  ASoC: ti: Kconfig: Remove the deprecated options
  ARM: davinci_all_defconfig: Update the audio options
  ARM: omap1_defconfig: Do not select ASoC by default
  ARM: omap2plus_defconfig: Update the audio options
  ARM: davinci: dm365-evm: Update for the new ASoC Kcofnig options
  ARM: OMAP2: Update for new MCBSP Kconfig option
  ARM: OMAP1: Makefile: Update for new MCBSP Kconfig option
  MAINTAINERS: Add entry for sound/soc/ti and update the OMAP audio support
  ASoC: ti: Merge davinci and omap directories
  ALSA: hda: add mute LED support for HP EliteBook 840 G4
  ALSA: fireface: code refactoring to handle model-specific registers
  ALSA: fireface: add support for packet streaming on Fireface 800
  ALSA: fireface: allocate isochronous resources in mode-specific implementation
  ...
2018-12-25 13:19:10 -08:00
Jouke Witteveen 599eefffcf platform/x86: thinkpad_acpi: Cleanup quirks macros
- Use generic quirks macros for fan quirks
The fan-specific quirks macros were duplicates of the generic ones.

- Remove useless #undef lines
The referenced macros are not defined anywhere.

Signed-off-by: Jouke Witteveen <j.witteveen@gmail.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-10 11:31:00 +02:00
Takashi Iwai 9e908a180e platform/x86: thinkpad_acpi: Drop superfluous exported function
Since we've switched to the LED trigger for binding with HD-audio,
we can drop the exported function as well as the whole
linux/thinkpad_acpi.h.

The own TPACPI_LED_MUTE and TPACPI_LED_MICMUTE definitions are
replaced with the identical ones for LEDS, i.e. LED_AUDIO_MUTE and
LED_AUDIO_MICMUTE, respectively.  They are no longer needed as
referred only locally.

Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-11-28 23:26:52 +01:00
Takashi Iwai 4e1d092445 platform/x86: thinkpad_acpi: Add audio mute LED classdev support
In the upcoming change, the binding of audio mute / mic-mute LED
controls will be switched with LED trigger.  This patch is the last
piece of preparation: adding the audio mute / mic-mute LED class
devices to thinkpad_acpi driver.

Two devices, platform::mute and platform::micmute, will be added for
controlling the mute LED and mic-mute LED, respectively.  The new
prefix "platform" is the suggestion by upstream for indicating the
generic laptop attribute.

Also this selects CONFIG_LEDS_TRIGGERS and CONFIG_LEDS_TRIGGERS_AUDIO
unconditionally.  Strictly speaking, these aren't 100% mandatory, but
leaving these manual selections would lead to a functional regression
easily once after converting from the dynamic symbol binding to the
LEDs trigger in a later patch.

Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-11-28 23:25:10 +01:00
Zhang Xianwei 8055db3a5b platform/x86: thinkpad_acpi: Change the keymap for Favorites hotkey
The keycode KEY_FAVORITES(0x16c) used in thinkpad_acpi driver is too
big (out of range > 255) for xorg to handle.
xkeyboard-config has already mapped KEY_BOOKMARKS(156) to
XF86Favorites:

keycodes/evdev:
    <I164> = 164;   // #define KEY_BOOKMARKS           156

symbols/inet:
    key <I164>   {      [ XF86Favorites         ]       };

So change the keymap to KEY_BOOKMARKS for Favorites hotkey.

Signed-off-by: Zhang Xianwei <zhang.xianwei8@zte.com.cn>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-11-07 15:56:42 +02:00
Linus Torvalds 899fbc33fd platform-drivers-x86 for v4.19-1
The driver for Silead touchscreen configurations has been renamed
 from silead_dmi to touchscreen_dmi since it starts supporting other
 touchscreens which require some DMI quirks. At the same release cycle
 it gets expanded to cover cases for Chuwi Vi10, ONDA V891W,
 Connect Tablet 9, Onda V820w, and Cube KNote i1101 tablets.
 
 Another bunch of changes is related to Mellanox platform code to allow
 user space to communicate with Mellanox for system control and
 monitoring purposes. The driver notifies user on hotplug device signal
 receiving.
 
 ASUS WMI drivers recognize lid flip action on UX360, and correctly
 toggles airplane mode LED. In addition the keyboard backlight toggle
 gets support.
 
 ThinkPad ACPI driver enables support for calculator key (on at least P52).
 It also has been fixed to support three characters model designators,
 which are used for modern laptops. Earlier the battery, marked as BAT1,
 on ThinkPad laptops has not been configured properly, which is fixed.
 On the opposite the multi-battery configurations now probed correctly.
 
 Dell SMBIOS driver starts working on some Dell servers which do not
 support token interface. The regression with backlight detection has
 also been fixed. In order to support dock mode on some laptops,
 Intel virtual button driver has been fixed. The last but not least
 is the fix to Intel HID driver due to changes in Dell systems that
 prevented to use power button.
 
 The following is an automated git shortlog grouped by driver:
 
 acer-wmi:
  -  Silence "unsupported" message a bit
  -  refactor function has_cap
 
 asus-nb-wmi:
  -  Add keymap entry for lid flip action on UX360
 
 asus-wireless:
  -  Fix uninitialized symbol usage
  -  Toggle airplane mode LED
 
 asus-wmi:
  -  Add keyboard backlight toggle support
  -  Call led hw_changed API on kbd brightness change
 
 dell-laptop:
  -  Fix backlight detection
 
 dell-smbios:
  -  make a function and a pointer static
 
 dell-smbios-base:
  -  Support systems without tokens
 
 dell-smbios-wmi:
  -  make function dell_smbios_wmi_call static
 
 ideapad-laptop:
  -  Add Y520-15IKBM and Y720-15IKBM to no_hw_rfkill
  -  Apply no_hw_rfkill to Y20-15IKBM, too
 
 intel-hid:
  -  Add support for Device Specific Methods
 
 intel_ips:
  -  remove redundant variables slope and offset
 
 intel_pmc_core:
  -  Add CNP SLPS0 debug registers
 
 intel_punit_ipc:
  -  fix build errors
 
 intel-vbtn:
  -  Add support for dock mode detection
 
 mlx-platform:
  -  Fix copy-paste error in mlxplat_init()
  -  Remove unused define
  -  Change mlxreg-io configuration for MSN274x systems
  -  Allow mlxreg-io driver activation for more systems
  -  Add ASIC hotplug device configuration
  -  Add new attribute for mlxreg-io sysfs interfaces
  -  Add mlxreg-fan platform driver activation
  -  Add documentation mlxreg-io sysfs interfaces
  -  Add mlxreg-io platform driver activation
 
 platform/mellanox:
  -  mlxreg-hotplug: Add hotplug hwmon uevent notification
  -  mlxreg-hotplug: Improve mechanism of ASIC health discovery
  -  Use 2-factor allocator calls
  -  Introduce support for Mellanox register access driver
 
 thinkpad_acpi:
  -  Fix multi-battery bug
  -  extend battery quirk coverage
  -  Support battery quirk
  -  Proper model/release matching
  -  Add support for calculator hotkey
 
 toshiba_acpi:
  -  Fix defined but not used build warnings
  -  Update KBD backlight LED on second gen laptops
 
 touchscreen_dmi:
  -  Rename silead_dmi to touchscreen_dmi
  -  Add touchscreen info for the Chuwi Vi10 tablet
  -  Sort entries alphabetically
  -  Rename trekstor entries
  -  Add info for the Cube KNote i1101 tablet
  -  Add info for the Onda V820w tablet
  -  Add info for the "Connect Tablet 9" tablet
  -  Add info for the ONDA V891W Dual OS tablet
 
 wmi:
  -  Do not mix pages and kmalloc
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEhiZOUlnC9oKN3n3AmT3/83c5Sy0FAlt9wVgACgkQmT3/83c5
 Sy3Jdg//WnEJZx7+zEsO+3dJnQGN4Fur6xhP79subRhZPFNTZ+D5vMHC9DL8ZQYx
 U8Kz1ilxCC5HuOo2S1BlzRG+h6ztMSYIFo2H8KRdygOqALEH7hoStPEGYdZcQ0qE
 6SKa4MnRw46UcGPij3f6STPiOjicPaLoUSTXZmi2dbmy6sJZMMJamvnRhezgEgJl
 rA6xvg+tKNBK2jwLpAVfLhy4Btd6LCE4EGgkYdnytOM9ByHLDsTWCZxd/9h7WjPa
 L8Zd8rftrazWF6X2tAhpXtUcMPg/D4lfL5HHaMmL9FioycQ88WqDBZN5sEWdIbaP
 OfaMbcbhCIrrHoMNdq0544IgqRQahX+m3VjSkVf3/Aj5AU0nUJMBWSpGHAs7UCSN
 8i8M2jdpVW7CVxA+4OU2l19udKrQzXutfXXhVYX0B3hKCkH7TBKax+m/ev9n2yvZ
 KoTdSJ/4bB6iGhXF8/MA6H72k0g972d4WXozbTusiBO9grqgU1EIe5bYZ4y+FkJL
 9gtK1xgtDJB7J8U14lpGC+zKhcYn1Mn3Iq4i5HD3sfnKsVGGWJIjRZsDtALD2RKT
 OQe7S8xhQWqsUZFGNflWL+8oHyXOHGD5Q8b/YI92ubriyAzh3I3Ybt/atk20vdmG
 QfKU46suOoOUwcAs00v13oo+9s9GatekXEjGgdRJ14vgzdgx3lc=
 =vRud
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v4.19-1' of git://git.infradead.org/linux-platform-drivers-x86

Pull x86 platform driver updates from Andy Shevchenko:

 - The driver for Silead touchscreen configurations has been renamed
   from silead_dmi to touchscreen_dmi since it starts supporting other
   touchscreens which require some DMI quirks

   It also gets expanded to cover cases for Chuwi Vi10, ONDA V891W,
   Connect Tablet 9, Onda V820w, and Cube KNote i1101 tablets.

 - Another bunch of changes is related to Mellanox platform code to
   allow user space to communicate with Mellanox for system control and
   monitoring purposes. The driver notifies user on hotplug device
   signal receiving.

 - ASUS WMI drivers recognize lid flip action on UX360, and correctly
   toggles airplane mode LED. In addition the keyboard backlight toggle
   gets support.

 - ThinkPad ACPI driver enables support for calculator key (on at least
   P52). It also has been fixed to support three characters model
   designators, which are used for modern laptops. Earlier the battery,
   marked as BAT1, on ThinkPad laptops has not been configured properly,
   which is fixed. On the opposite the multi-battery configurations now
   probed correctly.

 - Dell SMBIOS driver starts working on some Dell servers which do not
   support token interface. The regression with backlight detection has
   also been fixed. In order to support dock mode on some laptops, Intel
   virtual button driver has been fixed. The last but not least is the
   fix to Intel HID driver due to changes in Dell systems that prevented
   to use power button.

* tag 'platform-drivers-x86-v4.19-1' of git://git.infradead.org/linux-platform-drivers-x86: (47 commits)
  platform/x86: acer-wmi: Silence "unsupported" message a bit
  platform/x86: intel_punit_ipc: fix build errors
  platform/x86: ideapad: Add Y520-15IKBM and Y720-15IKBM to no_hw_rfkill
  platform/x86: asus-nb-wmi: Add keymap entry for lid flip action on UX360
  platform/x86: acer-wmi: refactor function has_cap
  platform/x86: thinkpad_acpi: Fix multi-battery bug
  platform/x86: thinkpad_acpi: extend battery quirk coverage
  platform/x86: touchscreen_dmi: Add info for the Cube KNote i1101 tablet
  platform/x86: mlx-platform: Fix copy-paste error in mlxplat_init()
  platform/x86: mlx-platform: Remove unused define
  platform/x86: mlx-platform: Change mlxreg-io configuration for MSN274x systems
  Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces
  platform/x86: mlx-platform: Allow mlxreg-io driver activation for more systems
  platform/x86: mlx-platform: Add ASIC hotplug device configuration
  platform/mellanox: mlxreg-hotplug: Add hotplug hwmon uevent notification
  platform/mellanox: mlxreg-hotplug: Improve mechanism of ASIC health discovery
  platform/x86: mlx-platform: Add mlxreg-fan platform driver activation
  platform/x86: dell-laptop: Fix backlight detection
  platform/x86: toshiba_acpi: Fix defined but not used build warnings
  platform/x86: thinkpad_acpi: Support battery quirk
  ...
2018-08-22 14:14:15 -07:00
Thomas Weißschuh d22296d9c3 platform/x86: thinkpad_acpi: Fix multi-battery bug
The struct containing the supported operations for all batteries is
being zeroed on each battery probe.  This prevents all other batteries
except the lastly probed one from being configured.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-08-15 12:55:32 +03:00
Jouke Witteveen 6640ee6289 platform/x86: thinkpad_acpi: extend battery quirk coverage
Based on bug reports and a web search for
    "Thinkpad_acpi: Error probing battery 2"
four more models were found that require the battery quirk:
Lenovo B5400, Thinkpad 11e, Thinkpad 11e gen 3, Thinkpad 13 gen 3.

Signed-off-by: Jouke Witteveen <j.witteveen@gmail.com>
Tested-by: James Cheshire <jermizzey@gmail.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-08-15 12:55:32 +03:00
Eric W. Biederman 7a36094d61 pids: Compute task_tgid using signal->leader_pid
The cost is the the same and this removes the need
to worry about complications that come from de_thread
and group_leader changing.

__task_pid_nr_ns has been updated to take advantage of this change.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2018-07-21 10:43:12 -05:00
Jouke Witteveen 1a32ebb26b platform/x86: thinkpad_acpi: Support battery quirk
Some Thinkpads have a single battery, but expose it as BAT1. Use the quirks
engine to force these machines into always addressing the primary battery.
Without this, the battery name would resolve to the non-existent secondary
battery and ACPI calls would fail.

Signed-off-by: Jouke Witteveen <j.witteveen@gmail.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-18 13:29:12 +03:00
Jouke Witteveen 846a416b46 platform/x86: thinkpad_acpi: Proper model/release matching
Modern Thinkpads have three character model designators. Previously, they
would be accepted, but recorded incompletely. Revision matching extracted
the wrong bytes from the ID string. This made the use of quirks for modern
machines impossible.

Fixes: 1b0eb5bc24
Signed-off-by: Jouke Witteveen <j.witteveen@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-18 13:29:11 +03:00
Benjamin Berg cb5c1978f7 platform/x86: thinkpad_acpi: Add support for calculator hotkey
The P52 has a keyboard which features a calculator key above the numpad.
Add support for this the calculator key (0x1313).

Signed-off-by: Benjamin Berg <bberg@redhat.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-06-26 15:01:52 -07:00
Linus Torvalds f3b5020e16 platform-drivers-x86 for v4.18-1
Several incremental improvements including new keycodes, new models, new
 quirks, and related documentation. Adds LED platform driver activation
 for Mellanox systems.  Some minor optimizations and cleanups. Includes
 several bug fixes, message silencing, mostly minor.
 
 The following commits were previously merged during the 4.17 RC cycle:
  - 06b8b00b33 platform/x86: asus-wireless: Fix NULL pointer dereference
  - 6ed66c3ce0 platform/x86: Kconfig: Fix dell-laptop dependency chain.
  - 74783c99bf platform/x86: DELL_WMI use depends on instead of select for DELL_SMBIOS
  - cf48bf9eee platform/x86: asus-wmi: Fix NULL pointer dereference
 
 The following is an automated git shortlog grouped by driver:
 
 acer-wmi:
  -  add another KEY_POWER keycode
 
 apple-gmux:
  -  fix gmux_get_client_id()'s return type
 
 asus-laptop:
  -  Simplify getting .drvdata
 
 asus-wireless:
  -  Fix format specifier
 
 dell-laptop:
  -  Fix keyboard backlight timeout on XPS 13 9370
 
 dell-smbios:
  -  Match on www.dell.com in OEM strings too
 
 dell-wmi:
  -  Ignore new rfkill and fn-lock events
  -  Set correct keycode for Fn + left arrow
 
 fujitsu-laptop:
  -  Simplify soft key handling
 
 ideapad-laptop:
  -  Add E42-80 to no_hw_rfkill
  -  Add fn-lock setting
  -  Add MIIX 720-12IKB to no_hw_rfkill
 
 lib/string_helpers:
  -  Add missed declaration of struct task_struct
 
 intel_scu_ipc:
  -  Replace mdelay with usleep_range in intel_scu_ipc_i2c_cntrl
 
 mlx-platform:
  -  Add LED platform driver activation
 
 platform/mellanox:
  -  Add new ODM system types to mlx-platform
  -  mlxreg-hotplug: add extra cycle for hotplug work queue
  -  mlxreg-hotplug: Document fixes for hotplug private data
 
 platform_data/mlxreg:
  -  Document fixes for hotplug device
 
 silead_dmi:
  -  Add entry for Chuwi Hi8 tablet touchscreen
  -  Add touchscreen info for the Onda V891w tablet
  -  Add info for the PoV mobii TAB-P800W (v2.0)
  -  Add touchscreen info for the Jumper EZpad 6 Pro
 
 thinkpad_acpi:
  -  silence false-positive-prone pr_warn
  -  do not report thermal sensor state for tablet mode switch
  -  silence HKEY 0x6032, 0x60f0, 0x6030
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJbIFzqAAoJEKbMaAwKp3644JcIAJ8iBMobacNWjIJvPJ8ytwLE
 NUP7/W/8NUXkwnxXzURorlnoO6Uj4+54c+QfO+HQV/+Y46fJaX9x2tWRtcEkpJU3
 L6c59kYAMlu5rN5ekCcQex4FKL8Pd7q6QpF8KZtP8gw2ujUEeGA1m/qcTmUlkOQF
 AFfbSFJtmMOinbL5ufkaW7Gu91EVFhuvgIoK/XdOhwAbyYAPEbtttKlUjkZGx6GU
 iJbpimcmdtfXBqMzvpOHw/4EUXLwgDVr1F8PdGmvEHyK45SHIZcK936Ihiq+CjVA
 USFKZhMMYU4sifI77pIP9Trftm+FdaLnPumGVj836OMp1+k10YBy1hDIGwI6i68=
 =+O74
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v4.18-1' of git://git.infradead.org/linux-platform-drivers-x86

Pull x86 platform driver updates from Darren Hart:
 "Several incremental improvements including new keycodes, new models,
  new quirks, and related documentation. Adds LED platform driver
  activation for Mellanox systems. Some minor optimizations and
  cleanups. Includes several bug fixes, message silencing, mostly minor

  Automated summary:

  acer-wmi:
   -  add another KEY_POWER keycode

  apple-gmux:
   -  fix gmux_get_client_id()'s return type

  asus-laptop:
   -  Simplify getting .drvdata

  asus-wireless:
   -  Fix format specifier

  dell-laptop:
   -  Fix keyboard backlight timeout on XPS 13 9370

  dell-smbios:
   -  Match on www.dell.com in OEM strings too

  dell-wmi:
   -  Ignore new rfkill and fn-lock events
   -  Set correct keycode for Fn + left arrow

  fujitsu-laptop:
   -  Simplify soft key handling

  ideapad-laptop:
   -  Add E42-80 to no_hw_rfkill
   -  Add fn-lock setting
   -  Add MIIX 720-12IKB to no_hw_rfkill

  lib/string_helpers:
   -  Add missed declaration of struct task_struct

  intel_scu_ipc:
   -  Replace mdelay with usleep_range in intel_scu_ipc_i2c_cntrl

  mlx-platform:
   -  Add LED platform driver activation

  platform/mellanox:
   -  Add new ODM system types to mlx-platform
   -  mlxreg-hotplug: add extra cycle for hotplug work queue
   -  mlxreg-hotplug: Document fixes for hotplug private data

  platform_data/mlxreg:
   -  Document fixes for hotplug device

  silead_dmi:
   -  Add entry for Chuwi Hi8 tablet touchscreen
   -  Add touchscreen info for the Onda V891w tablet
   -  Add info for the PoV mobii TAB-P800W (v2.0)
   -  Add touchscreen info for the Jumper EZpad 6 Pro

  thinkpad_acpi:
   -  silence false-positive-prone pr_warn
   -  do not report thermal sensor state for tablet mode switch
   -  silence HKEY 0x6032, 0x60f0, 0x6030"

* tag 'platform-drivers-x86-v4.18-1' of git://git.infradead.org/linux-platform-drivers-x86: (30 commits)
  platform/x86: silead_dmi: Add entry for Chuwi Hi8 tablet touchscreen
  platform/x86: dell-laptop: Fix keyboard backlight timeout on XPS 13 9370
  platform/x86: dell-wmi: Ignore new rfkill and fn-lock events
  platform/x86: mlx-platform: Add LED platform driver activation
  platform/mellanox: Add new ODM system types to mlx-platform
  platform/mellanox: mlxreg-hotplug: add extra cycle for hotplug work queue
  platform/x86: ideapad-laptop: Add E42-80 to no_hw_rfkill
  platform/x86: silead_dmi: Add touchscreen info for the Onda V891w tablet
  platform/x86: silead_dmi: Add info for the PoV mobii TAB-P800W (v2.0)
  platform/x86: silead_dmi: Add touchscreen info for the Jumper EZpad 6 Pro
  platform/x86: asus-wireless: Fix format specifier
  platform/x86: asus-wmi: Fix NULL pointer dereference
  platform/x86: dell-wmi: Set correct keycode for Fn + left arrow
  platform/x86: acer-wmi: add another KEY_POWER keycode
  platform/x86: ideapad-laptop: Add fn-lock setting
  platform/x86: ideapad-laptop: Add MIIX 720-12IKB to no_hw_rfkill
  lib/string_helpers: Add missed declaration of struct task_struct
  platform/x86: DELL_WMI use depends on instead of select for DELL_SMBIOS
  platform/mellanox: mlxreg-hotplug: Document fixes for hotplug private data
  platform_data/mlxreg: Document fixes for hotplug device
  ...
2018-06-14 16:30:30 +09:00
Kees Cook 6396bb2215 treewide: kzalloc() -> kcalloc()
The kzalloc() function has a 2-factor argument form, kcalloc(). This
patch replaces cases of:

        kzalloc(a * b, gfp)

with:
        kcalloc(a * b, gfp)

as well as handling cases of:

        kzalloc(a * b * c, gfp)

with:

        kzalloc(array3_size(a, b, c), gfp)

as it's slightly less ugly than:

        kzalloc_array(array_size(a, b), c, gfp)

This does, however, attempt to ignore constant size factors like:

        kzalloc(4 * 1024, gfp)

though any constants defined via macros get caught up in the conversion.

Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.

The Coccinelle script used for this was:

// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@

(
  kzalloc(
-	(sizeof(TYPE)) * E
+	sizeof(TYPE) * E
  , ...)
|
  kzalloc(
-	(sizeof(THING)) * E
+	sizeof(THING) * E
  , ...)
)

// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@

(
  kzalloc(
-	sizeof(u8) * (COUNT)
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(__u8) * (COUNT)
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(char) * (COUNT)
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(unsigned char) * (COUNT)
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(u8) * COUNT
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(__u8) * COUNT
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(char) * COUNT
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(unsigned char) * COUNT
+	COUNT
  , ...)
)

// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@

(
- kzalloc
+ kcalloc
  (
-	sizeof(TYPE) * (COUNT_ID)
+	COUNT_ID, sizeof(TYPE)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(TYPE) * COUNT_ID
+	COUNT_ID, sizeof(TYPE)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(TYPE) * (COUNT_CONST)
+	COUNT_CONST, sizeof(TYPE)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(TYPE) * COUNT_CONST
+	COUNT_CONST, sizeof(TYPE)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(THING) * (COUNT_ID)
+	COUNT_ID, sizeof(THING)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(THING) * COUNT_ID
+	COUNT_ID, sizeof(THING)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(THING) * (COUNT_CONST)
+	COUNT_CONST, sizeof(THING)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(THING) * COUNT_CONST
+	COUNT_CONST, sizeof(THING)
  , ...)
)

// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@

- kzalloc
+ kcalloc
  (
-	SIZE * COUNT
+	COUNT, SIZE
  , ...)

// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@

(
  kzalloc(
-	sizeof(TYPE) * (COUNT) * (STRIDE)
+	array3_size(COUNT, STRIDE, sizeof(TYPE))
  , ...)
|
  kzalloc(
-	sizeof(TYPE) * (COUNT) * STRIDE
+	array3_size(COUNT, STRIDE, sizeof(TYPE))
  , ...)
|
  kzalloc(
-	sizeof(TYPE) * COUNT * (STRIDE)
+	array3_size(COUNT, STRIDE, sizeof(TYPE))
  , ...)
|
  kzalloc(
-	sizeof(TYPE) * COUNT * STRIDE
+	array3_size(COUNT, STRIDE, sizeof(TYPE))
  , ...)
|
  kzalloc(
-	sizeof(THING) * (COUNT) * (STRIDE)
+	array3_size(COUNT, STRIDE, sizeof(THING))
  , ...)
|
  kzalloc(
-	sizeof(THING) * (COUNT) * STRIDE
+	array3_size(COUNT, STRIDE, sizeof(THING))
  , ...)
|
  kzalloc(
-	sizeof(THING) * COUNT * (STRIDE)
+	array3_size(COUNT, STRIDE, sizeof(THING))
  , ...)
|
  kzalloc(
-	sizeof(THING) * COUNT * STRIDE
+	array3_size(COUNT, STRIDE, sizeof(THING))
  , ...)
)

// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@

(
  kzalloc(
-	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
  , ...)
|
  kzalloc(
-	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
  , ...)
|
  kzalloc(
-	sizeof(THING1) * sizeof(THING2) * COUNT
+	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
  , ...)
|
  kzalloc(
-	sizeof(THING1) * sizeof(THING2) * (COUNT)
+	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
  , ...)
|
  kzalloc(
-	sizeof(TYPE1) * sizeof(THING2) * COUNT
+	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
  , ...)
|
  kzalloc(
-	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
  , ...)
)

// 3-factor product, only identifiers, with redundant parens removed.
@@
identifier STRIDE, SIZE, COUNT;
@@

(
  kzalloc(
-	(COUNT) * STRIDE * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	COUNT * (STRIDE) * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	COUNT * STRIDE * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	(COUNT) * (STRIDE) * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	COUNT * (STRIDE) * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	(COUNT) * STRIDE * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	(COUNT) * (STRIDE) * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	COUNT * STRIDE * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
)

// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression E1, E2, E3;
constant C1, C2, C3;
@@

(
  kzalloc(C1 * C2 * C3, ...)
|
  kzalloc(
-	(E1) * E2 * E3
+	array3_size(E1, E2, E3)
  , ...)
|
  kzalloc(
-	(E1) * (E2) * E3
+	array3_size(E1, E2, E3)
  , ...)
|
  kzalloc(
-	(E1) * (E2) * (E3)
+	array3_size(E1, E2, E3)
  , ...)
|
  kzalloc(
-	E1 * E2 * E3
+	array3_size(E1, E2, E3)
  , ...)
)

// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@

(
  kzalloc(sizeof(THING) * C2, ...)
|
  kzalloc(sizeof(TYPE) * C2, ...)
|
  kzalloc(C1 * C2 * C3, ...)
|
  kzalloc(C1 * C2, ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(TYPE) * (E2)
+	E2, sizeof(TYPE)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(TYPE) * E2
+	E2, sizeof(TYPE)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(THING) * (E2)
+	E2, sizeof(THING)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(THING) * E2
+	E2, sizeof(THING)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	(E1) * E2
+	E1, E2
  , ...)
|
- kzalloc
+ kcalloc
  (
-	(E1) * (E2)
+	E1, E2
  , ...)
|
- kzalloc
+ kcalloc
  (
-	E1 * E2
+	E1, E2
  , ...)
)

Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-12 16:19:22 -07:00
Henrique de Moraes Holschuh fd75ba2b83 platform/x86: thinkpad_acpi: silence false-positive-prone pr_warn
Do not consider unknown HKEY events in the 0x6000 range to be thermal
warnings.  Instead, handle them as a generic unknown HKEY event, which
are reported to the kernel log at priority "notice", and do not trigger
a thermal registers state dump to the log.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Tested-by: Jordan Glover <Golden_Miller83@protonmail.ch>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-05-07 15:10:31 +03:00
Henrique de Moraes Holschuh edd1ed7302 platform/x86: thinkpad_acpi: do not report thermal sensor state for tablet mode switch
We should not do a thermal sensors state dump to the kernel log just
because the laptop is reporting that it changed into or out of tablet
mode.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Tested-by: Jordan Glover <Golden_Miller83@protonmail.ch>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-05-07 15:10:31 +03:00
Henrique de Moraes Holschuh 6e6bc5f6e6 platform/x86: thinkpad_acpi: silence HKEY 0x6032, 0x60f0, 0x6030
Demote to debug level one existing thermal-control related event, and
also add two new ones that would otherwise trigger unknown event
warnings.  These events are Windows-only for now.

We do report them to userspace in case they become useful in the future.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Reported-by: Jordan Glover <Golden_Miller83@protonmail.ch>
Tested-by: Jordan Glover <Golden_Miller83@protonmail.ch>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-05-07 15:10:31 +03:00
Linus Torvalds a7726f6b61 platform-drivers-x86 for v4.17-1
Dell SMBIOS driver fixed against memory leaks.
 
 The fujitsu-laptop driver is cleaned up and now supports hotkeys for
 Lifebook U7x7 models. Besides that the typo introduced by one of
 previous clean up series has been fixed.
 
 Specific to x86-based laptops HID device now supports
 KEY_ROTATE_LOCK_TOGGLE event which is emitted, for example,
 by Wacom MobileStudio Pro 13.
 
 Turbo MAX 3 technology is enabled for the rest of platforms that support
 Hardware-P-States feature which have core priority described by
 ACPI CPPC table.
 
 Mellanox on x86 gets better support of I2C bus in use including support
 of hotpluggable ones.
 
 Silead touchscreen is enabled on two tablet models, i.e Yours Y8W81 and
 I.T.Works TW701.
 
 From now on the second fan on Thinkpad P50 is supported.
 
 The topstar-laptop driver is reworked to support new models, in
 particular Topstar U931.
 
 Some of the changes had been already applied during v4.16 cycle and thus
 have a duplication here:
 
 - 027d50ccd6 platform/x86: intel-vbtn: Only activate tablet mode switch on 2-in-1's
 - 250b044e1a platform/x86: intel-vbtn: Reset wakeup capable flag on removal
 - 356b57752c platform/x86: intel-hid: Reset wakeup capable flag on removal
 - 501f7e52de platform/x86: wmi: Fix misuse of vsprintf extension %pULL
 - 98c76a3904 platform/x86: dell-smbios: Correct some style warnings
 - ec34fe3859 platform/x86: dell-smbios: Rename dell-smbios source to dell-smbios-bae
 - 41e36f2f85 platform/x86: dell-smbios: Link all dell-smbios-* modules together
 - c715e43455 platform/x86: Allow for SMBIOS backend defaults
 - cc69c88fbe platform/x86: dell-smbios: Resolve dependency error on DCDBAS
 - 4716007c23 platform/x86: dell-smbios: Resolve dependency error on ACPI_WMI
 - 7129707ec2 platform/x86: Fix dell driver init order
 
 The following is an automated git shortlog grouped by driver:
 
 dell-smbios:
  -  Fix memory leaks in build_tokens_sysfs()
  -  Fix dell driver init order
  -  Resolve dependency error on ACPI_WMI
  -  Resolve dependency error on DCDBAS
  -  Allow for SMBIOS backend defaults
  -  Link all dell-smbios-* modules together
  -  Rename dell-smbios source to dell-smbios-base
  -  Correct some style warnings
 
 fujitsu-laptop:
  -  Support Lifebook U7x7 hotkeys
  -  Revert UNSUPPORTED_CMD back to an int
  -  Clean up constants
  -  Define constants for backlight power control
  -  Do not include linux/slab.h
  -  Clearly distinguish module parameters
  -  Simplify error paths
  -  Defer input device registration
  -  Unify local variable naming
 
 GPD pocket fan:
  -  fix spelling mistake: "Mill-celcius" -> "millicelsius"
 
 intel-hid:
  -  support KEY_ROTATE_LOCK_TOGGLE
  -  clean up and sort header files
  -  Reset wakeup capable flag on removal
 
 intel_turbo_max_3:
  -  Remove restriction for HWP platforms
 
 intel-vbtn:
  -  Reset wakeup capable flag on removal
  -  Only activate tablet mode switch on 2-in-1's
 
 mlx-platform:
  -  Add physical bus number auto detection
  -  Add deffered bus functionality
  -  Use define for the channel numbers
 
 platform/mellanox:
  -  mlxreg-hotplug: Change input for device create routine
 
 silead_dmi:
  -  Add entry for the Yours Y8W81 tablet
  -  Add DMI match for the I.T.Works TW701 tablet
 
 thinkpad_acpi:
  -  Add 2nd Fan Support for Thinkpad P50
 
 topstar-laptop:
  -  replace licence text with SPDX tag
  -  update copyright and fix some comments
  -  add Topstar U931/RVP7 WLAN LED workaround
  -  add platform device
  -  split ACPI events and input handling
  -  use consistent naming scheme
  -  revert "convert to module_acpi_driver()"
 
 wmi:
  -  Fix misuse of vsprintf extension %pULL
  -  Replace list_for_each() by list_for_each_entry()
  -  Replace kmalloc + sprintf() with kasprintf()
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEhiZOUlnC9oKN3n3AmT3/83c5Sy0FAlrM6icACgkQmT3/83c5
 Sy0qUA//Zg1uCmqTzvTxEsj7Z6RfwPV5IKE0pl86JufNXibuvxInVQI3qMU9D7lw
 Fl6n0k0HDoOEce5wo8fy7pic1WmmwDrapaV977elMfv4yGNQl/eIEoT6g9VBGMhE
 9ORrdjBJtVYJR2rWLNH0DzeU2WoLUL0OwTQs0e3mj/mLazIARN6lC0qPDr9P4baE
 yXKkLGBmeuw2m0s3BfLVP5CDSanv0oB2IFsH5Qt1/y1qVT/VQnzcqFSSwz/IENm7
 ZslNKR4Msi9/lDDt5HOsTADpgUI3m1t4fUReXx3MtcvuxZb6DdrHJWIAVU86NhKk
 /Yxm6/HU5/zpYgLXF+980GVjT6/KfPtRjJFoBItFtNeatj/oI9YStcaPFWwt2TFV
 hBHgS0OjPjuQNIizsjByitKerVEdsV7dJHY7wcmfq/3CpvB4Y8xrIJAa/Hj3HR34
 SNbnl8vO1EfUu1vo1W4R8GfHxkIETKXT/hLpj54GSmSCzVY9lUQydyQwLTIC2Nsr
 L8XPsZyZfS6mq4ZeGfy9QDFbLZ9NephjnGFBiRceWM8xZKO0l8iDYMfd2sVfOP+v
 4SzoWmLMVXS+ittObRo8i26B7ISlzVwdf3XCQA2ZgYeP/E/1ilo44Ifwf7ycOgeu
 Q8uk0mLAs0etfV8IqKwW3U5d/KzJEkBxYI4+HdL1IcQ2tAqe0J4=
 =SuHR
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v4.17-1' of git://git.infradead.org/linux-platform-drivers-x86

Pull x86 platform driver updates from Andy Shevchenko:

 - Dell SMBIOS driver fixed against memory leaks.

 - The fujitsu-laptop driver is cleaned up and now supports hotkeys for
   Lifebook U7x7 models. Besides that the typo introduced by one of
   previous clean up series has been fixed.

 - Specific to x86-based laptops HID device now supports
   KEY_ROTATE_LOCK_TOGGLE event which is emitted, for example, by Wacom
   MobileStudio Pro 13.

 - Turbo MAX 3 technology is enabled for the rest of platforms that
   support Hardware-P-States feature which have core priority described
   by ACPI CPPC table.

 - Mellanox on x86 gets better support of I2C bus in use including
   support of hotpluggable ones.

 - Silead touchscreen is enabled on two tablet models, i.e Yours Y8W81
   and I.T.Works TW701.

 - From now on the second fan on Thinkpad P50 is supported.

 - The topstar-laptop driver is reworked to support new models, in
   particular Topstar U931.

* tag 'platform-drivers-x86-v4.17-1' of git://git.infradead.org/linux-platform-drivers-x86: (41 commits)
  platform/x86: thinkpad_acpi: Add 2nd Fan Support for Thinkpad P50
  platform/x86: dell-smbios: Fix memory leaks in build_tokens_sysfs()
  intel-hid: support KEY_ROTATE_LOCK_TOGGLE
  intel-hid: clean up and sort header files
  platform/x86: silead_dmi: Add entry for the Yours Y8W81 tablet
  platform/x86: fujitsu-laptop: Support Lifebook U7x7 hotkeys
  platform/x86: mlx-platform: Add physical bus number auto detection
  platform/mellanox: mlxreg-hotplug: Change input for device create routine
  platform/x86: mlx-platform: Add deffered bus functionality
  platform/x86: mlx-platform: Use define for the channel numbers
  platform/x86: fujitsu-laptop: Revert UNSUPPORTED_CMD back to an int
  platform/x86: Fix dell driver init order
  platform/x86: dell-smbios: Resolve dependency error on ACPI_WMI
  platform/x86: dell-smbios: Resolve dependency error on DCDBAS
  platform/x86: Allow for SMBIOS backend defaults
  platform/x86: dell-smbios: Link all dell-smbios-* modules together
  platform/x86: dell-smbios: Rename dell-smbios source to dell-smbios-base
  platform/x86: dell-smbios: Correct some style warnings
  platform/x86: wmi: Fix misuse of vsprintf extension %pULL
  platform/x86: intel-hid: Reset wakeup capable flag on removal
  ...
2018-04-10 12:18:50 -07:00
Alexander Kappner a986c75a7d platform/x86: thinkpad_acpi: Add 2nd Fan Support for Thinkpad P50
The Thinkpad P50 has 2 fans. Add the 2FAN quirk so the tpacpi driver
properly reports both fan speeds.
Because the P50 doesn't report the version of its EC controller,
we need to identify it by BIOS version (N1).

Signed-off-by: Alexander Kappner <agk@godking.net>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
[andy: renamed macro, massaged changelog]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-04-03 11:06:04 +03:00
Ognjen Galic 2801b9683f thinkpad_acpi: Add support for battery thresholds
1) Charge start threshold
/sys/class/power_supply/BATN/charge_start_threshold

Valid values are [0, 99]. A value of 0 turns off the
start threshold wear control.

2) Charge stop threshold
/sys/class/power_supply/BATN/charge_stop_threshold

Valid values are [1, 100]. A value of 100 turns off
the stop threshold wear control. This must be
configured first.

Signed-off-by: Ognjen Galic <smclt30p@gmail.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2018-02-21 23:27:13 +01:00
David Herrmann 587d8628fb platform/x86: thinkpad_acpi: suppress warning about palm detection
This patch prevents the thinkpad_acpi driver from warning about 2 event
codes returned for keyboard palm-detection. No behavioral changes,
other than suppressing the warning in the kernel log. The events are
still forwarded via acpi-netlink channels.

We could, optionally, decide to forward the event through a
input-switch on the tpacpi input device. However, so far no suitable
input-code exists, and no similar drivers report such events. Hence,
leave it an acpi event for now.

Note that the event-codes are named based on empirical studies. On the
ThinkPad X1 5th Gen the sensor can be found underneath the arrow key.

Cc: Matthew Thode <mthode@mthode.org>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-01-24 08:39:06 +02:00
Benjamin Berg 26befef00e platform/x86: thinkpad_acpi: Accept flat mode for type 4 multi mode status
On the X1 Yoga 2nd Generation and most likely other notebooks the FLAT
mode is reported. Decode it correctly rather than warning about an
unexpected multi mode status to be reported.

Signed-off-by: Benjamin Berg <bberg@redhat.com>
Cc: Peter FP1 Zhang <zhangfp1@lenovo.com
Cc: Lyude <lyude@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-12-21 14:56:27 +02:00
Linus Torvalds 07c455ee22 platform-drivers-x86 for v4.15-1
For this cycle we have quite an update for the Dell SMBIOS driver
 including WMI work to provide an interface for SMBIOS tokens via sysfs
 and WMI support for 2017+ Dell laptop models. SMM dispatcher code is
 split into a separate driver followed by a new WMI dispatcher.
 The latter provides a character device interface to user space.
 
 The pull request contains a merge of immutable branch from Wolfram Sang
 in order to apply a dependent fix to the Intel CherryTrail Battery
 Management driver.
 
 Other Intel drivers got a lot of cleanups. The Turbo Boost Max 3.0
 support is added for Intel Skylake.
 
 Peaq WMI hotkeys driver gets its own maintainer and white list of
 supported models.
 
 Silead DMI is expanded to support few additional platforms.
 
 Tablet mode via GMMS ACPI method is added to support some ThinkPad
 tablets.
 
 Two commits appear here which were previously merged during the
 v4.14-rcX cycle:
 
 - d7ca5ebf24 platform/x86: intel_pmc_ipc: Use devm_* calls in driver probe function
 - e3075fd6f8 platform/x86: intel_pmc_ipc: Use spin_lock to protect GCR updates
 
 Add driver to force WMI Thunderbolt controller power status:
  - Add driver to force WMI Thunderbolt controller power status
 
 asus-wmi:
  -  Add lightbar led support
 
 dell-laptop:
  -  Allocate buffer before rfkill use
 
 dell-smbios:
  -  fix string overflow
  -  Add filtering support
  -  Introduce dispatcher for SMM calls
  -  Add a sysfs interface for SMBIOS tokens
  -  only run if proper oem string is detected
  -  Prefix class/select with cmd_
  -  Add pr_fmt definition to driver
 
 dell-smbios-smm:
  -  test for WSMT
 
 dell-smbios-wmi:
  -  release mutex lock on WMI call failure
  -  introduce userspace interface
  -  Add new WMI dispatcher driver
 
 dell-smo8800:
  -  remove redundant assignments to byte_data
 
 dell-wmi:
  -  don't check length returned
  -  clean up wmi descriptor check
  -  increase severity of some failures
  -  Do not match on descriptor GUID modalias
  -  Label driver as handling notifications
 
 dell-*wmi*:
  -  Relay failed initial probe to dependent drivers
 
 dell-wmi-descriptor:
  -  check if memory was allocated
  -  split WMI descriptor into it's own driver
 
 fujitsu-laptop:
  -  Fix radio LED detection
  -  Don't oops when FUJ02E3 is not presnt
 
 hp_accel:
  -  Add quirk for HP ProBook 440 G4
 
 hp-wmi:
  -  Fix tablet mode detection for convertibles
 
 ideapad-laptop:
  -  Add Lenovo Yoga 920-13IKB to no_hw_rfkill dmi list
 
 intel_cht_int33fe:
  -  Update fusb302 type string, add properties
  -  make a couple of local functions static
  -  Work around BIOS bug on some devices
 
 intel-hid:
  -  Power button suspend on Dell Latitude 7275
 
 intel_ips:
  -  Convert timers to use timer_setup()
  -  Remove FSF address from GPL notice
  -  Remove unneeded fields and label
  -  Keep pointer to struct device
  -  Use PCI_VDEVICE() macro
  -  Switch to new PCI IRQ allocation API
  -  Simplify error handling via devres API
 
 intel_pmc_ipc:
  -  Revert Use MFD framework to create dependent devices
  -  Use MFD framework to create dependent devices
  -  Use spin_lock to protect GCR updates
  -  Use devm_* calls in driver probe function
 
 intel_punit_ipc:
  -  Fix resource ioremap warning
 
 intel_telemetry:
  -  Remove useless default in Kconfig
  -  Add needed inclusion
  -  cleanup redundant headers
  -  Fix typos
  -  Fix load failure info
 
 intel_telemetry_debugfs:
  -  Use standard ARRAY_SIZE() macro
 
 intel_turbo_max_3:
  -  Add Skylake platform
 
 intel-wmi-thunderbolt:
  -  Silence error cases
 
 MAINTAINERS:
  -  Add entry for the PEAQ WMI hotkeys driver
 
 mlx-platform:
  -  make a couple of structures static
 
 peaq_wmi:
  -  Fix missing terminating entry for peaq_dmi_table
 
 peaq-wmi:
  -  Remove unnecessary checks from peaq_wmi_exit
  -  Add DMI check before binding to the WMI interface
  -  Revert Blacklist Lenovo ideapad 700-15ISK
  -  Blacklist Lenovo ideapad 700-15ISK
 
 silead_dmi:
  -  Add silead, home-button property to some tablets
  -  Add entry for the Digma e200 tablet
  -  Fix GP-electronic T701 entry
  -  Add entry for the Chuwi Hi8 Pro tablet
 
 sony-laptop:
  -  Drop variable assignment in sony_nc_setup_rfkill()
  -  Fix error handling in sony_nc_setup_rfkill()
 
 thinkpad_acpi:
  -  Implement tablet mode using GMMS method
 
 tools/wmi:
  -  add a sample for dell smbios communication over WMI
 
 wmi:
  -  release mutex on module acquistion failure
  -  create userspace interface for drivers
  -  Don't allow drivers to get each other's GUIDs
  -  Add new method wmidev_evaluate_method
  -  Destroy on cleanup rather than unregister
  -  Cleanup exit routine in reverse order of init
  -  Sort include list
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEhiZOUlnC9oKN3n3AmT3/83c5Sy0FAloQcs0ACgkQmT3/83c5
 Sy2agQ//WJirmlqR4WMSDynq0w/rKomx7qMZvabbIxFc7n5beCUrlc61lt4x/cPN
 0HrdkNcYvkW21j8q/Lk5RDlK45JLZLgtDb1rIGjx8Pkf+EXyKwNb4UtqaZuwZRN6
 nVnSGAdShF6f4OqVQU+ZuRr2nQvBlK4OyopKuRaq0kuejJjMLq1sc7VNidvb9zdj
 w4zfhh8RQ2KV3NK8g0k/uQu573Y+tCDUQvxQj5YIgC4RWbv4ZTuZD1Hbjc3Vdy9+
 z0RvrUBCikM0CTqVyXn/ncgiMnAj6oeLdB76F1dlaIaAH/WtisEWr3hLWHskdJwW
 N+qGBB0K72gUHwr4Ck4x2s/S76XeiFYD0BeHL3ODn6ZlKoh7gV2NVwYFDNQHd+uc
 MXN9Xzs3lRkiDFyoXbtBG0wZRn2rS1rhGSYDYQUKg8Qf7MirwEVdYA0CZKeXAA78
 2V29FNdvUmWiL/ZiA/2peeuUTWgPdzENDLHXzE/jOCGBS2/pL4znYv2ZSJ+HIeyW
 oCVMxasSI3pMLxCU8KxgA1QwrbDoiFTYYXCa1Ighq9o2ZEoy7Ub1XmpBB9HKHby7
 K6zQcCYcf+SyscIqvu50ZImZ8nt5FnIdPSrTOX/FMM0Niv42mfKwD+UniG+P5K1z
 OLCIEm74NE9jRjzxuW5E1DSo56gJHUbxxy1rOFzgJnGQ+CAVXKo=
 =upqs
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v4.15-1' of git://git.infradead.org/linux-platform-drivers-x86

Pull x86 platform driver updates from Andy Shevchenko:
 "Here is the collected material against Platform Drivers x86 subsystem.
  It's rather bit busy cycle for PDx86, mostly due to Dell SMBIOS driver
  activity

  For this cycle we have quite an update for the Dell SMBIOS driver
  including WMI work to provide an interface for SMBIOS tokens via sysfs
  and WMI support for 2017+ Dell laptop models. SMM dispatcher code is
  split into a separate driver followed by a new WMI dispatcher. The
  latter provides a character device interface to user space.

  The git history also contains a merge of immutable branch from Wolfram
  Sang in order to apply a dependent fix to the Intel CherryTrail
  Battery Management driver.

  Other Intel drivers got a lot of cleanups. The Turbo Boost Max 3.0
  support is added for Intel Skylake.

  Peaq WMI hotkeys driver gets its own maintainer and white list of
  supported models.

  Silead DMI is expanded to support few additional platforms.

  Tablet mode via GMMS ACPI method is added to support some ThinkPad
  tablets.

  new driver:
   - Add driver to force WMI Thunderbolt controller power status

  asus-wmi:
   -  Add lightbar led support

  dell-laptop:
   -  Allocate buffer before rfkill use

  dell-smbios:
   -  fix string overflow
   -  Add filtering support
   -  Introduce dispatcher for SMM calls
   -  Add a sysfs interface for SMBIOS tokens
   -  only run if proper oem string is detected
   -  Prefix class/select with cmd_
   -  Add pr_fmt definition to driver

  dell-smbios-smm:
   -  test for WSMT

  dell-smbios-wmi:
   -  release mutex lock on WMI call failure
   -  introduce userspace interface
   -  Add new WMI dispatcher driver

  dell-smo8800:
   -  remove redundant assignments to byte_data

  dell-wmi:
   -  don't check length returned
   -  clean up wmi descriptor check
   -  increase severity of some failures
   -  Do not match on descriptor GUID modalias
   -  Label driver as handling notifications

  dell-*wmi*:
   -  Relay failed initial probe to dependent drivers

  dell-wmi-descriptor:
   -  check if memory was allocated
   -  split WMI descriptor into it's own driver

  fujitsu-laptop:
   -  Fix radio LED detection
   -  Don't oops when FUJ02E3 is not presnt

  hp_accel:
   -  Add quirk for HP ProBook 440 G4

  hp-wmi:
   -  Fix tablet mode detection for convertibles

  ideapad-laptop:
   -  Add Lenovo Yoga 920-13IKB to no_hw_rfkill dmi list

  intel_cht_int33fe:
   -  Update fusb302 type string, add properties
   -  make a couple of local functions static
   -  Work around BIOS bug on some devices

  intel-hid:
   -  Power button suspend on Dell Latitude 7275

  intel_ips:
   -  Convert timers to use timer_setup()
   -  Remove FSF address from GPL notice
   -  Remove unneeded fields and label
   -  Keep pointer to struct device
   -  Use PCI_VDEVICE() macro
   -  Switch to new PCI IRQ allocation API
   -  Simplify error handling via devres API

  intel_pmc_ipc:
   -  Revert Use MFD framework to create dependent devices
   -  Use MFD framework to create dependent devices
   -  Use spin_lock to protect GCR updates
   -  Use devm_* calls in driver probe function

  intel_punit_ipc:
   -  Fix resource ioremap warning

  intel_telemetry:
   -  Remove useless default in Kconfig
   -  Add needed inclusion
   -  cleanup redundant headers
   -  Fix typos
   -  Fix load failure info

  intel_telemetry_debugfs:
   -  Use standard ARRAY_SIZE() macro

  intel_turbo_max_3:
   -  Add Skylake platform

  intel-wmi-thunderbolt:
   -  Silence error cases

  mlx-platform:
   -  make a couple of structures static

  peaq_wmi:
   -  Fix missing terminating entry for peaq_dmi_table

  peaq-wmi:
   -  Remove unnecessary checks from peaq_wmi_exit
   -  Add DMI check before binding to the WMI interface
   -  Revert Blacklist Lenovo ideapad 700-15ISK
   -  Blacklist Lenovo ideapad 700-15ISK

  silead_dmi:
   -  Add silead, home-button property to some tablets
   -  Add entry for the Digma e200 tablet
   -  Fix GP-electronic T701 entry
   -  Add entry for the Chuwi Hi8 Pro tablet

  sony-laptop:
   -  Drop variable assignment in sony_nc_setup_rfkill()
   -  Fix error handling in sony_nc_setup_rfkill()

  thinkpad_acpi:
   -  Implement tablet mode using GMMS method

  tools/wmi:
   -  add a sample for dell smbios communication over WMI

  wmi:
   -  release mutex on module acquistion failure
   -  create userspace interface for drivers
   -  Don't allow drivers to get each other's GUIDs
   -  Add new method wmidev_evaluate_method
   -  Destroy on cleanup rather than unregister
   -  Cleanup exit routine in reverse order of init
   -  Sort include list"

* tag 'platform-drivers-x86-v4.15-1' of git://git.infradead.org/linux-platform-drivers-x86: (74 commits)
  platform/x86: silead_dmi: Add silead, home-button property to some tablets
  platform/x86: dell-laptop: Allocate buffer before rfkill use
  platform/x86: dell-*wmi*: Relay failed initial probe to dependent drivers
  platform/x86: dell-wmi-descriptor: check if memory was allocated
  platform/x86: Revert intel_pmc_ipc: Use MFD framework to create dependent devices
  platform/x86: dell-smbios-wmi: release mutex lock on WMI call failure
  platform/x86: wmi: release mutex on module acquistion failure
  platform/x86: dell-smbios: fix string overflow
  platform/x86: intel_pmc_ipc: Use MFD framework to create dependent devices
  platform/x86: intel_punit_ipc: Fix resource ioremap warning
  platform/x86: dell-smo8800: remove redundant assignments to byte_data
  platform/x86: hp-wmi: Fix tablet mode detection for convertibles
  platform/x86: intel_ips: Convert timers to use timer_setup()
  platform/x86: sony-laptop: Drop variable assignment in sony_nc_setup_rfkill()
  platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill()
  tools/wmi: add a sample for dell smbios communication over WMI
  platform/x86: dell-smbios-wmi: introduce userspace interface
  platform/x86: wmi: create userspace interface for drivers
  platform/x86: dell-smbios: Add filtering support
  platform/x86: dell-smbios-smm: test for WSMT
  ...
2017-11-18 10:26:57 -08:00
Kees Cook e4dca7b7aa treewide: Fix function prototypes for module_param_call()
Several function prototypes for the set/get functions defined by
module_param_call() have a slightly wrong argument types. This fixes
those in an effort to clean up the calls when running under type-enforced
compiler instrumentation for CFI. This is the result of running the
following semantic patch:

@match_module_param_call_function@
declarer name module_param_call;
identifier _name, _set_func, _get_func;
expression _arg, _mode;
@@

 module_param_call(_name, _set_func, _get_func, _arg, _mode);

@fix_set_prototype
 depends on match_module_param_call_function@
identifier match_module_param_call_function._set_func;
identifier _val, _param;
type _val_type, _param_type;
@@

 int _set_func(
-_val_type _val
+const char * _val
 ,
-_param_type _param
+const struct kernel_param * _param
 ) { ... }

@fix_get_prototype
 depends on match_module_param_call_function@
identifier match_module_param_call_function._get_func;
identifier _val, _param;
type _val_type, _param_type;
@@

 int _get_func(
-_val_type _val
+char * _val
 ,
-_param_type _param
+const struct kernel_param * _param
 ) { ... }

Two additional by-hand changes are included for places where the above
Coccinelle script didn't notice them:

	drivers/platform/x86/thinkpad_acpi.c
	fs/lockd/svc.c

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
2017-10-31 15:30:37 +01:00
Benjamin Berg dda3ec0aa6 platform/x86: thinkpad_acpi: Implement tablet mode using GMMS method
Many thinkpad laptops and convertibles provide the GMMS method to
resolve how far the laptop has been opened and whether it has been
converted into tablet mode. This allows reporting a more precise tablet
mode state to userspace.

The current implementation only reports a summarized tablet mode state
which is triggered as soon as the input devices become unusable as they
are folded away from the display.

This will work on all models where the CMMD method was used previously and
it may also work in other cases.

Thanks to Peter Zhang of Lenovo for providing information on how to use the
GMMS method to query the tablet mode.

Signed-off-by: Benjamin Berg <bberg@redhat.com>
Cc: Peter FP1 Zhang <zhangfp1@lenovo.com>
Cc: Lyude Paul <lyude@redhat.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-10-01 17:33:13 +03:00
Stanislav Fomichev 6b99e3569b platform/x86: thinkpad_acpi: Fix warning about deprecated hwmon_device_register
Use hwmon_device_register_with_groups instead of deprecated
hwmon_device_register and fix a dmesg warning.

This patch however changes the userspace API.
hwmon_device_register_with_groups takes `hwmon' name as an argument and
creates a name file in the `hwmon' device, not in the `platform_device'.
This allows us to remove custom `name' device attribute, but in order to
make lm-sensors happy we also have to move fans and thermal attributes
to the `hwmon' device.

Even though this patch changes userspace API, it's still compatible with
the lm-sensors. Starting with lm-sensors 3.0 (circa 2007), it looks at
both hwmon and the backing device for the name and other attributes.

before:
$ cat /sys/devices/platform/thinkpad_hwmon/{name,fan1_input}
thinkpad
2007
$ cat /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/{name,fan1_input}
cat: /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/name: No such file or directory
cat: /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/fan1_input: No such file or directory
$ cat /sys/class/hwmon/hwmon1/{name,fan1_input}
cat: /sys/class/hwmon/hwmon1/name: No such file or directory
cat: /sys/class/hwmon/hwmon1/fan1_input: No such file or directory
$ sensors
thinkpad-isa-0000
Adapter: ISA adapter
fan1:        3533 RPM

after:
$ cat /sys/devices/platform/thinkpad_hwmon/{name,fan1_input}
cat: /sys/devices/platform/thinkpad_hwmon/name: No such file or directory
cat: /sys/devices/platform/thinkpad_hwmon/fan1_input: No such file or directory
$ cat /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon1/{name,fan1_input}
thinkpad
3478
$ cat /sys/class/hwmon/hwmon1/{name,fan1_input}
thinkpad
3478
$ sensors
thinkpad-isa-0000
Adapter: ISA adapter
fan1:        3489 RPM

$ sensors -v
sensors version 3.4.0 with libsensors version 3.4.0

Signed-off-by: Stanislav Fomichev <kernel@fomichev.me>
[dvhart: cleaned up commit log, bumped version to 4.14 in the doc change]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-08-18 15:57:24 -07:00
Linus Torvalds 0dfaeb618f platform-drivers-x86 for v4.13-1
Introduce new bus architecture for WMI and expose BMOF data through
 sysfs. Correct several assumptions about WMI instance number from 1 to
 0. Further fujitsu-laptop cleanups, continuing to prepare for separation
 into two modules. Add support for several new ideapad laptops and
 silead-based tablets. Various minor fixes and const cleanups.
 
 sony-laptop:
  - constify attribute_group and input index array
 
 fujitsu-laptop:
  - rework debugging
  - do not evaluate ACPI _INI methods
  - do not update ACPI device power status
  - sanitize hotkey input device identification
  - use strcpy to set ACPI device names and classes
  - remove redundant safety checks
  - use device-specific data in remaining module code
  - use device-specific data in LED-related code
  - explicitly pass ACPI device to call_fext_func()
  - track the last instantiated FUJ02E3 ACPI device
  - allocate fujitsu_laptop in acpi_fujitsu_laptop_add()
  - use device-specific data in backlight code
  - allocate fujitsu_bl in acpi_fujitsu_bl_add()
  - distinguish current uses of device-specific data
 
 msi-laptop:
  - constify msipf*_attribute_group
 
 eeepc-laptop:
  - constify platform_attribute_group
 
 toshiba_haps:
  - constify haps_attr_group
 
 dell-wmi-led:
  - Adjust instance of wmi_evaluate_method calls to 0
 
 alienware-wmi:
  - Adjust instance of wmi_evaluate_method calls to 0
 
 intel_menlow:
  - Add const to thermal_cooling_device_ops structure
 
 acerhdf:
  - Add const to thermal_cooling_device_ops structure
 
 dell-laptop:
  - Fix bogus keyboard backlight sysfs interface
 
 acer-wmi:
  - Using zero as first WMI instance number
  - Detect RF Button capability
 
 ideapad-laptop:
  - Add Y720-15IKBN to no_hw_rfkill
  - Add Y520-15IKBN to no_hw_rfkill
  - constify rfkill_ops structure
  - Squelch ACPI event 1
  - hide unused 'touchpad_store'
  - Switch touchpad attribute to be RO
  - Add sysfs interface for touchpad state
 
 silead_dmi:
  - Add touchscreen info for PoV mobii wintab p800w
  - Add touchscreen info for Pipo W2S tablet
  - Add touchscreen info for GP-electronic T701
 
 dell-rbtn:
  - constify rfkill_ops structures
  - Improve explanation about DELLABC6
 
 samsung-laptop:
  - constify rfkill_ops structures
 
 panasonic-laptop:
  - remove unused code
 
 samsung-laptop:
  - Initialize loca variable
 
 dell-wmi:
  - Convert to the WMI bus infrastructure
  - Add a better description for "stealth mode"
  - Add a comment explaining the 0xb2 magic number
 
 wmi-bmof:
  - New driver to expose embedded Binary WMI MOF metadata
 
 wmi*:
  - Fix printing info about WDG structure
  - Add recent copyright statements
  - Require query for data blocks, rename writable to setable
  - Add an interface for subdrivers to access sibling devices
  - Bind the platform device, not the ACPI node
  - Add a new interface to read block data
  - Incorporate acpi_install_notify_handler
  - Instantiate all devices before adding them
  - Probe data objects for read and write capabilities
  - Split devices into types and add basic sysfs attributes
  - Fix error handling when creating devices
  - Turn WMI into a bus driver
  - Track wmi devices per ACPI device
  - Clean up acpi_wmi_add
  - Pass the acpi_device through to parse_wdg
  - Drop "Mapper (un)loaded" messages
 
 intel_cht_int33fe:
  - Set supplied-from property on max17047 dev
 
 intel_pmc_ipc:
  - Mark ipc_data_readb() as __maybe_unused
 
 topstar-laptop:
  - Add new device id
 
 peaq-wmi:
  - Add new peaq-wmi driver
 
 thinkpad_acpi:
  - Add a comment about 0 in module_param_call()
  - Join string literals back
 
 toshiba_acpi:
  - use memdup_user_nul
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJZXSzcAAoJEKbMaAwKp364hSEIAKC0xJRZWv1aI1f69JCSZR0+
 5/6tMsps9nK4LtaKQCvPHeOCxmwpE4tZYzyuYHyHW+pfUMquIdRVQRMe3u2FTrKS
 HuvCgmYAkZqCzy/zQIPaVU2K9m7/9HubXYy0Q1qkjlGZp/IYMFoeo7DU65Ajm+HS
 wrRXIYIKSbjAU0pmzW//MFauEi26MWpAHMraw+HCJbXcGwhokSrtTYitqFpQXnhJ
 kdguSkEluW1NoG3Tv7CbfXWXge7zwxlrmI06b4FtkpFK6b2LCZcYeUhIn33yNYT1
 IwhNOsaWlxNw3K3c1IRZSwYoJ6dmBJ+cxmZ0sd3cr8jahgpHB/nJiRElHmTdf2M=
 =PbWU
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v4.13-1' of git://git.infradead.org/linux-platform-drivers-x86

Pull x86 platform driver updates from Darren Hart:
 "Introduce new bus architecture for WMI and expose BMOF data through
  sysfs. Correct several assumptions about WMI instance number from 1 to
  0. Further fujitsu-laptop cleanups, continuing to prepare for
  separation into two modules. Add support for several new ideapad
  laptops and silead-based tablets. Various minor fixes and const
  cleanups.

  Detail summary:

  sony-laptop:
   - constify attribute_group and input index array

  fujitsu-laptop:
   - rework debugging
   - do not evaluate ACPI _INI methods
   - do not update ACPI device power status
   - sanitize hotkey input device identification
   - use strcpy to set ACPI device names and classes
   - remove redundant safety checks
   - use device-specific data in remaining module code
   - use device-specific data in LED-related code
   - explicitly pass ACPI device to call_fext_func()
   - track the last instantiated FUJ02E3 ACPI device
   - allocate fujitsu_laptop in acpi_fujitsu_laptop_add()
   - use device-specific data in backlight code
   - allocate fujitsu_bl in acpi_fujitsu_bl_add()
   - distinguish current uses of device-specific data

  msi-laptop:
   - constify msipf*_attribute_group

  eeepc-laptop:
   - constify platform_attribute_group

  toshiba_haps:
   - constify haps_attr_group

  dell-wmi-led:
   - Adjust instance of wmi_evaluate_method calls to 0

  alienware-wmi:
   - Adjust instance of wmi_evaluate_method calls to 0

  intel_menlow:
   - Add const to thermal_cooling_device_ops structure

  acerhdf:
   - Add const to thermal_cooling_device_ops structure

  dell-laptop:
   - Fix bogus keyboard backlight sysfs interface

  acer-wmi:
   - Using zero as first WMI instance number
   - Detect RF Button capability

  ideapad-laptop:
   - Add Y720-15IKBN to no_hw_rfkill
   - Add Y520-15IKBN to no_hw_rfkill
   - constify rfkill_ops structure
   - Squelch ACPI event 1
   - hide unused 'touchpad_store'
   - Switch touchpad attribute to be RO
   - Add sysfs interface for touchpad state

  silead_dmi:
   - Add touchscreen info for PoV mobii wintab p800w
   - Add touchscreen info for Pipo W2S tablet
   - Add touchscreen info for GP-electronic T701

  dell-rbtn:
   - constify rfkill_ops structures
   - Improve explanation about DELLABC6

  samsung-laptop:
   - constify rfkill_ops structures

  panasonic-laptop:
   - remove unused code

  samsung-laptop:
   - Initialize loca variable

  dell-wmi:
   - Convert to the WMI bus infrastructure
   - Add a better description for "stealth mode"
   - Add a comment explaining the 0xb2 magic number

  wmi-bmof:
   - New driver to expose embedded Binary WMI MOF metadata

  wmi*:
   - Fix printing info about WDG structure
   - Add recent copyright statements
   - Require query for data blocks, rename writable to setable
   - Add an interface for subdrivers to access sibling devices
   - Bind the platform device, not the ACPI node
   - Add a new interface to read block data
   - Incorporate acpi_install_notify_handler
   - Instantiate all devices before adding them
   - Probe data objects for read and write capabilities
   - Split devices into types and add basic sysfs attributes
   - Fix error handling when creating devices
   - Turn WMI into a bus driver
   - Track wmi devices per ACPI device
   - Clean up acpi_wmi_add
   - Pass the acpi_device through to parse_wdg
   - Drop "Mapper (un)loaded" messages

  intel_cht_int33fe:
   - Set supplied-from property on max17047 dev

  intel_pmc_ipc:
   - Mark ipc_data_readb() as __maybe_unused

  topstar-laptop:
   - Add new device id

  peaq-wmi:
   - Add new peaq-wmi driver

  thinkpad_acpi:
   - Add a comment about 0 in module_param_call()
   - Join string literals back

  toshiba_acpi:
   - use memdup_user_nul"

* tag 'platform-drivers-x86-v4.13-1' of git://git.infradead.org/linux-platform-drivers-x86: (67 commits)
  platform/x86: sony-laptop: constify attribute_group and input index array
  platform/x86: fujitsu-laptop: rework debugging
  platform/x86: fujitsu-laptop: do not evaluate ACPI _INI methods
  platform/x86: fujitsu-laptop: do not update ACPI device power status
  platform/x86: fujitsu-laptop: sanitize hotkey input device identification
  platform/x86: fujitsu-laptop: use strcpy to set ACPI device names and classes
  platform/x86: fujitsu-laptop: remove redundant safety checks
  platform/x86: msi-laptop: constify msipf*_attribute_group
  platform/x86: eeepc-laptop: constify platform_attribute_group
  platform/x86: toshiba_haps: constify haps_attr_group
  platform/x86: dell-wmi-led: Adjust instance of wmi_evaluate_method calls to 0
  platform/x86: alienware-wmi: Adjust instance of wmi_evaluate_method calls to 0
  platform/x86: intel_menlow: Add const to thermal_cooling_device_ops structure
  platform/x86: acerhdf: Add const to thermal_cooling_device_ops structure
  platform/x86: dell-laptop: Fix bogus keyboard backlight sysfs interface
  platform/x86: acer-wmi: Using zero as first WMI instance number
  platform/x86: ideapad-laptop: Add Y720-15IKBN to no_hw_rfkill
  platform/x86: ideapad-laptop: Add Y520-15IKBN to no_hw_rfkill
  platform/x86: silead_dmi: Add touchscreen info for PoV mobii wintab p800w
  platform/x86: silead_dmi: Add touchscreen info for Pipo W2S tablet
  ...
2017-07-06 15:33:27 -07:00
Greg Kroah-Hartman ac3054c4f6 platform: thinkpad_acpi: convert to use DRIVER_ATTR_RO/RW
We are trying to get rid of DRIVER_ATTR(), and the thinkpad_acpi
driver's attributes can be trivially changed to use DRIVER_ATTR_RO() and
DRIVER_ATTR_RW().

Cc: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
Cc: Andy Shevchenko <andy@infradead.org>
Cc: <ibm-acpi-devel@lists.sourceforge.net>
Cc: <platform-driver-x86@vger.kernel.org>
Reviewed-by: Darren Hart (VMware) <dvhart@infradead.org>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-12 16:14:31 +02:00
Andy Shevchenko 9b4bbbd2ae platform/x86: thinkpad_acpi: Add a comment about 0 in module_param_call()
As per discussion [1] there are only few users of module_param_call() in
kernel which prevent to read module parameters back.

It thinkpad_acpi driver there is even no method do so. Thus, for now,
add just a comment to explain why 0 is used as permissions in
module_param_call().

[1]: https://patchwork.ozlabs.org/patch/713245/

Cc: Richard Weinberger <richard.weinberger@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
2017-05-15 12:07:40 +03:00
Andy Shevchenko 5cac62ac92 platform/x86: thinkpad_acpi: Join string literals back
There is no point to keep string literal split. It even makes slightly
harder to maintain and debug.

Join string literals back to be oneliners.

While here, print negative error without changing a sign as it is a
common pattern in the kernel.

Other than above there were no functional changes intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
2017-05-15 12:07:34 +03:00
Christian Kellner 696c6523ec platform/x86: thinkpad_acpi: add mapping for new hotkeys
The T470, X270 emits new hkey events in the 0x1311 - 0x1315 range.
According to the user manual they should launch a user selected
favorite application (star icon, 0x1311), snipping tool (0x1312,
currently ignored), enable/disable bluetooth (0x1314) and open they
keyboard settings (0x1315).

The third nibble (0xf00) is used to differentiate between the original
hotkeys, the adaptive keyboard codes and the new, additional ones.

Signed-off-by: Christian Kellner <ckellner@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:57:13 -07:00
Christian Kellner 149c8c75b3 platform/x86: thinkpad_acpi: guard generic hotkey case
Currently when dispatching hotkeys we check if the scancode is in
the range of 0 and TPACPI_HOTKEY_MAP_LEN, although the bottom 20
entries in the hotkey keymap are already adaptive keycodes.
Therefore we introduce a TP_ACPI_HOTKEYSCAN_ADAPTIVE_START and
ensure that we are in the range 0 and ADAPTIVE_START for the generic
keycode case.

Signed-off-by: Christian Kellner <ckellner@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:57:12 -07:00
Hans de Goede c685e20df5 platform/x86: thinkpad_acpi: Call led_classdev_notify_brightness_hw_changed on kbd brightness change
Make thinkpad_acpi call led_classdev_notify_brightness_hw_changed on the
kbd_led led_classdev registered by thinkpad_acpi when the kbd backlight
brightness is changed through the hotkey.

This will allow userspace to monitor (poll) for brightness changes on
these LEDs caused by the hotkey.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
2017-02-24 23:48:52 -08:00
Hans de Goede 86ec0c2c0b platform/x86: thinkpad_acpi: Use brightness_set_blocking callback for LEDs
Now a days the LED core can take care of executing brightness_set from
a workqueue if it needs to sleep, make use of this and remove a bunch
of DIY code for this.

Since this commit removes the workqueue usage for LEDs, the
led_sysfs_blink_set callback may now also sleep, this is fine.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
2017-02-24 23:48:51 -08:00
Hans de Goede 06da5325d0 platform/x86: thinkpad_acpi: Stop setting led_classdev brightness directly
There is no need to set the led_classdev's brightness value from
its set_brightness callback, this is taken care of by the led-core and
thinkpad_acpi really should not be mucking with it.

Note that kbdlight_set_level_and_update() is still used by the old
thinpad_acpi specific sysfs interface for the led, so we cannot
remove it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
2017-02-24 23:48:51 -08:00
Linus Torvalds 7c0f6ba682 Replace <asm/uaccess.h> with <linux/uaccess.h> globally
This was entirely automated, using the script by Al:

  PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>'
  sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \
        $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h)

to do the replacement at the end of the merge window.

Requested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-24 11:46:01 -08:00
Darren Hart cb2bf25145 platform/x86: thinkpad_acpi: Initialize local in_tablet_mode and type
linux-next reported in_tablet_mode and type may be used uninitialized
after:

b318002838 ("platform/x86: thinkpad_acpi: Move tablet detection into separate function")

This turns out to be a false positive as the pr_info call cannot be
reached if tp_features.hotkey_tablet (global scope) is 0, and
in_tablet_mode and type are assigned in both places
tp_features.hotkey_tablet is assigned.

Regardless, to make it explicit and avoid further reports, initialize
in_tablet_mode to 0 and type to NULL.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Lyude <lyude@redhat.com>
2016-12-15 12:31:48 -08:00
Tobias Klauser bb55a2ee76 platform/x86: thinkpad_acpi: Fix old style declaration GCC warning
Fix an [-Wold-style-declaration] GCC warning by moving the inline
keyword before the return type.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-12-13 09:29:07 -08:00
Hui Wang a3c42a467a platform/x86: thinkpad_acpi: Adding new hotkey ID for Lenovo thinkpad
Recently we met an issue on lots of Lenovo thinkpad laptops (those
laptops are not released to market yet), the issue is that the
thinkpad_acpi.ko can't be automatically loaded as before.

Through debugging, we found the HKEY_HID is LEN0268 instead of
LEN0068 on those machines, and the MHKV is 0x200 instead of
0x100. So adding the new ID into the driver.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-12-13 09:29:07 -08:00