Commit graph

3083 commits

Author SHA1 Message Date
Colin Ian King 309dca51c9 platform/x86: intel_ips: remove redundant variables slope and offset
Variables slope and offset are being assigned but are never used hence
they are redundant and can be removed.

Cleans up clang warnings:
warning: variable 'slope' set but not used [-Wunused-but-set-variable]
warning: variable 'offset' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-18 13:29:11 +03:00
Kees Cook e78fd3c3ee platform/mellanox: Use 2-factor allocator calls
As already done treewide, switch from open-coded multiplication to using
2-factor allocation helpers.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-18 13:29:11 +03:00
Neil Armstrong 57e94c8b97 mfd: cros-ec: Increase maximum mkbp event size
Having a 16 byte mkbp event size makes it possible to send CEC
messages from the EC to the AP directly inside the mkbp event
instead of first doing a notification and then a read.

Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2018-07-13 08:44:31 +01:00
Arnd Bergmann 37070d6c94 headers: fix linux/mod_devicetable.h inclusions
A couple of drivers produced build errors after the mod_devicetable.h
header was split out from the platform_device one, e.g.

drivers/media/platform/davinci/vpbe_osd.c:42:40: error: array type has incomplete element type 'struct platform_device_id'
drivers/media/platform/davinci/vpbe_venc.c:42:40: error: array type has incomplete element type 'struct platform_device_id'

This adds the inclusion where needed.

Fixes: ac3167257b ("headers: separate linux/mod_devicetable.h from linux/platform_device.h")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-10 08:47:02 +02:00
Benson Leung 40291fb751 Immutable branch (mfd, chrome) due for the v4.19 window
Immutable Branch which moves the cros_ec_i2c and cros_ec_spi
 transport drivers from mfd to platform/chrome. Changes in arm are a simple
 rename in defconfigs. Change in input is a rename in help text.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE6gYDF28Li+nEiKLaHwn1ewov5lgFAltCtRsACgkQHwn1ewov
 5lhIQg//fEoZkDIjFsWIDn2WB1brLS2q7Wnv01NJR3/ZxzA29JYQ1lNA3nCM5mVS
 Bf1RqPfVwIO6/d+QA5AnxLBRpRYJ7F7NKwvTvrqQ9QpFPNOLk0m7uUNYSsWTOqlA
 uoReeFfJ2/UuUavd04KJRPv1ilCjoki2Wyc4lqVFSJSGZZjDWUOASAiOd666h26F
 avW4qBUpJm7mmAfOFh76g6c/Jq713fJkqfdRcstRajB13oLjotfRxa/Rhxb+y8aX
 RrlNz8PChIjpYTQ7yDwfLU8u5TDg2sEtz8529YaddDNBWkRyC2BIrKrkev+GIiUx
 SZiPT7nmvpEOGJoPQodUa5bgE/9db7pPKb7XqUNmYQIS71jtLaOXMNje9uLn2NHo
 CJtoVHJXZ9YWyODn1NPvFM28aysis14PWQGWK1HRq5PCfb8TpZ8W0QTaJV18pUBe
 vdrmgxPcdnkAn0Tbt92oBiUrsVT3zoSQuLw9FPuy3ne9Oz+TKHa6kKzjcMMkynwb
 mFmDhf822mfbUVkjUpNTtLJ0UMsNtd/tphDUmv1OQDRNStZS/MI4+xr23bPZbf/X
 blrIjz5fM6uhUbHSKztWnntGAtzbEy75zzyhh2w99JVzJtK4UK+3ET40Kko4KUIx
 1ppYa2wOJVVSvd733O8mYGmzQotKuFc5lyNozlB4EUT8ro/zW1Q=
 =EhHj
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE6gYDF28Li+nEiKLaHwn1ewov5lgFAltD8WcACgkQHwn1ewov
 5ljpGBAAtU0XoIn0p+ujvGdX/EdMrt3vzanjg995Z7yncUk3N4Ahx5q4l9NV7tTL
 FulOH4mhA/1djVZk5q+Rr7vENHaZW+T4v6GMhG9wqhk2VBd6e3s2It3y+LKzQ0oI
 Bpc6CyGAfNrCNXAK8pkeBf82771+X9QL5KIIh5ZRtGEV/lKzJPPNJ/2Q78m/eh85
 Z/izB5v0dY9YfwsIQTKBoIMw7ddz3RPWiGsc1HVNarM9Jz0G+Mj83hwnMoraUvBd
 P2JF0xL072sL59T+PCJlUVuh5abx0kh1nei2eROr3dqcunROG3sbhTFvQ7x/OOCN
 KbxDWascFi+8D8M6QYM3orvc4LZF8GMf8aaRlill6S/KFwcD28uNtXMAARJgdvR4
 v/j4HvYo5dmMtxMiRR7kkm7er3tWsUevXEQg2TLqbbJln8Wp/3jPcKM46uV5diLd
 Kei2iiM7cTuLMU36StHW6VbLk9tDkVcJzjKf8968j/ZrvsRw/79j4wVVuNcZSHx5
 2QTacquSPk1h0ax8bOXjZf/Gb8VlD34AquJOpYzZbmQggXO3KX9kXcoW5gdM6UjF
 dQmdobGueUD+C9qT647XAggS7OI8As/dv1iIHBzWYwnq871wWDFiUjbs3VDFmeoU
 n+EybA4UQCxiFHL75PmW98jB2erZ3b/QDQNTECG8AyBQ7N90L8c=
 =u5Ht
 -----END PGP SIGNATURE-----

Merge tag 'ib-platform-chrome-mfd-move-cros-ec-transport-for-4.19' into working-branch-for-4.19

Immutable branch (mfd, chrome) due for the v4.19 window

Immutable Branch which moves the cros_ec_i2c and cros_ec_spi
transport drivers from mfd to platform/chrome. Changes in arm are a simple
rename in defconfigs. Change in input is a rename in help text.
2018-07-09 16:36:00 -07:00
Randy Dunlap ac3167257b headers: separate linux/mod_devicetable.h from linux/platform_device.h
At over 4000 #includes, <linux/platform_device.h> is the 9th most
#included header file in the Linux kernel.  It does not need
<linux/mod_devicetable.h>, so drop that header and explicitly add
<linux/mod_devicetable.h> to source files that need it.

   4146 #include <linux/platform_device.h>

After this patch, there are 225 files that use <linux/mod_devicetable.h>,
for a reduction of around 3900 times that <linux/mod_devicetable.h>
does not have to be read & parsed.

    225 #include <linux/mod_devicetable.h>

This patch was build-tested on 20 different arch-es.

It also makes these drivers SubmitChecklist#1 compliant.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kbuild test robot <lkp@intel.com> # drivers/media/platform/vimc/
Reported-by: kbuild test robot <lkp@intel.com> # drivers/pinctrl/pinctrl-u300.c
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-07 17:52:26 +02:00
Enric Balletbo i Serra d00a8741fd
platform/chrome: Move cros-ec transport drivers to drivers/platform.
There are some cros-ec transport drivers (I2C, SPI) living in MFD, while
others (LPC) living in drivers/platform. The transport drivers are more
platform specific. So, move the I2C and SPI transport drivers to the
platform/chrome directory. The patch also removes the MFD_ prefix of
their Kconfig symbols.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-07-03 12:40:06 -07:00
Colin Ian King ea4ba866d1 goldfish_pipe: make tasklet goldfish_interrupt_tasklet static
Tasklet goldfish_interrupt_tasklet is local to the source and
does not need to be in global scope, so make it static.

Cleans up sparse warning:
symbol 'goldfish_interrupt_tasklet' was not declared. Should it be static?

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-03 13:01:57 +02:00
João Paulo Rechi Vita eca4c4e47e platform/x86: asus-wireless: Fix uninitialized symbol usage
'ret' will not be initialized if acpi_evaluate_integer() returns through
an error path, so it should not be used in this case. This fixes the
following Smatch static analyser error:

 drivers/platform/x86/asus-wireless.c:76 asus_wireless_method() error:
                                                     uninitialized symbol 'ret'.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 16:48:22 +03:00
João Paulo Rechi Vita 6bb6ec285d platform/x86: asus-wireless: Toggle airplane mode LED
This commit makes use of a newly implemented RFKill LED trigger to
trigger the LED when all radios are blocked.

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 16:48:22 +03:00
Colin Ian King 10a2032d7a platform/x86: dell-smbios-wmi: make function dell_smbios_wmi_call static
The function dell_smbios_wmi_call is local to the source and does not
need to be in global scope, so make it static.

Cleans up sparse warning:
symbol 'dell_smbios_wmi_call' was not declared. Should it be static?

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 16:48:22 +03:00
Matt Delco 4f5e81a7a6 platform/x86: intel-vbtn: Add support for dock mode detection
The Dell laptop I have has an ACPI that sends 0xCB and 0xCC on entering
tablet mode.  On exiting tablet mode it sends 0xCA and 0xCD. Based on:

http://www.traby.de/medion/DSDT/dsdt.dsl
https://gist.github.com/jprvita/5737de3cbb670e80973b7d4e51c38ab6
https://osdn.net/projects/android-x86/scm/git/kernel/commits/
7cbe5a330687b851f32dd9f1048a6ce182d0ff44

It appears that 0xCA and 0xCB are about dock mode, which for my
convertible laptop seems questionably tied to whether I've put
the laptop in tablet or laptop mode.  I previously proposed no-oping
0xCA and 0xCB but this revised change attempts to add support for
detecting dock mode--this detection will essentially be broken for
my laptop (the main workaround would be for 0xCA and 0xCB to be used
to provoke a query of the VGBS method that reports the current dock &
tablet mode [which is accurately reported on my laptop but based on
the prior workarounds in the driver it apparently can't be trusted
for all systems]).

Signed-off-by: Matt Delco <delco@chromium.org>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andy@infradead.org>
Cc: platform-driver-x86@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 16:48:22 +03:00
Srinivas Pandruvada 5bf24e20d1 platform/x86: intel-hid: Add support for Device Specific Methods
In some of the recent platforms, it is possible that stand alone methods
for HEBC() or other methods used in this driver may not exist. In this
case intel-hid driver will fail to load and power button will not be
functional.

It is also possible that some quirks in this driver added for some
platforms may have same issue in loading intel-hid driver.

There is an update to the ACPI details for the HID event filter driver.
In the updated specification a _DSM is added, which has separate function
indexes for each of the previous stand alone methods.

This change brings in support for the _DSM and allows usage of function
index for corresponding stand alone methods.

Details of Device Specific Method:

Intel HID Event Filter Driver _DSM UUID:
eeec56b3-4442-408f-a792-4edd4d758054

• Function index 0: Returns a buffer with a bit-field representing the
supported function IDs.

Function Index	ASL Object
--------------------------------
1		BTNL
2		HDMM
3		HDSM
4		HDEM
5		BTNS
6		BTNE
7		HEBC
8		VGBS
9		HEBC

One significant change is to query the supported methods implemented on
the platform. So the previous HEBC() has two variants. HEBC v1 and
HEBC v2. The v2 version allowed further define which of the 5-button
are actually defined by the platform. HEBC v2 support is only available
via new DSM.

v1 Button details:
Bits [0] - Rotation Lock, Num Lock, Home, End, Page Up,
Page Down
Bits [1] - Wireless Radio Control
Bits [2] - System Power Down
Bits [3] - System Hibernate
Bits [4] - System Sleep/ System Wake
Bits [5] - Scan Next Track
Bits [6] - Scan Previous Track
Bits [7] - Stop
Bits [8] - Play/Pause
Bits [9] - Mute
Bits [10] - Volume Increment
Bits [11] - Volume Decrement
Bits [12] - Display Brightness Increment
Bits [13] - Display Brightness Decrement
Bits [14] - Lock Tablet
Bits [15] - Release Tablet
Bits [16] - Toggle Bezel
Bits [17] - 5 button array
Bits [18-31] - reserved

v2 Buttom details:
Bits [0-16] - Same as v1 version
Bits [17] - 5 button array
Bits [18] – Power Button
Bits [19] - W Home Button
Bits [20] - Volume Up Button
Bits [21] - Volume Down Button
Bits [22] – Rotation Lock Button
Bits [23-31] – reserved

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Tested-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 16:48:22 +03:00
Jun Bo Bi ee08f5782a platform/x86: touchscreen_dmi: Add info for the Onda V820w tablet
Add touchscreen platform data for the Onda V820w tablet.

Signed-off-by: Jun Bo Bi <jambonmcyeah@gmail.com>
[andy: fixed compilation error, massaged commit message]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 16:48:22 +03:00
Hans de Goede c72d95e518 platform/x86: touchscreen_dmi: Add info for the "Connect Tablet 9" tablet
Add touchscreen info for the "Connect Tablet 9" tablet. This appears to be
a variant of the same hardware as the ITworks TW891 tablet, but it needs
different firmware for the touchscreen to fonction properly.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 15:23:44 +03:00
youling257 c0d730885e platform/x86: touchscreen_dmi: Add info for the ONDA V891W Dual OS tablet
Add touchscreen info for hardware revision "v3" of the ONDA V891W Dual
OS tablet.

Reported-and-tested-by: youling257 <youling257@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 15:20:44 +03:00
Chris Chiu ed99d29b2b platform/x86: asus-wmi: Add keyboard backlight toggle support
Some ASUS laptops like UX550GE has hotkey (Fn+F7) for keyboard
backlight toggle which would emit the scan code 0xc7 each keypress.
On the UX550GE, the max keyboard brightness level is 3 so the
toggle would not be simply on/off the led but need to be cyclic.
Per ASUS spec, it should increment the brightness for each keypress,
then toggle(off) the LED when it already reached the max level.

Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 15:13:40 +03:00
Chris Chiu dbb3d78f61 platform/x86: asus-wmi: Call led hw_changed API on kbd brightness change
Make asus-wmi notify on hotkey kbd brightness changes, listen for
brightness events and update the brightness directly in the driver.
Create new do_kbd_led_set function for in-driver update, and leave
kbd_led_set for original led_classdev call path.

Update the brightness by led_classdev_notify_brightness_hw_changed.
This will allow userspace to monitor (poll) for brightness changes
on the LED without reporting via input keymapping.

Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 15:13:40 +03:00
Box, David E 4cf2afd6ef platform/x86: intel_pmc_core: Add CNP SLPS0 debug registers
Adds debugfs access to registers in the Cannon Point PCH PMC that are
useful for debugging #SLP_S0 signal assertion and other low power relate
activities. Device pm states are latched in these registers whenever the
package enters C10 and can be read from slp_s0_debug_status. The pm
states may also be latched by writing 1 to slp_s0_dbg_latch which will
immediately capture the current state on the next read of
slp_s0_debug_status.

Signed-off-by: Box, David E <david.e.box@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 15:00:30 +03:00
Hans de Goede 74421786f0 platform/x86: Rename silead_dmi to touchscreen_dmi
Not only silead touchscreens need some extra info not available in the
ACPI tables to work properly. X86 devices with a Chipone ICN8505 chip also
need some DMI based extra configuration.

There is no reason to have separate dmi config code per touchscreen
controller vendor. This commit renames silead_dmi to a more generic
touchscreen_dmi name (and Kconfig option) in preparation of adding
info for tablets with an ICN8505 based touchscreen.

Note there are no functional changes all code changes are limited to
removing references to silead where these are no longer applicable.

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 15:00:30 +03:00
Hans de Goede b4c86811ce platform/x86: silead_dmi: Add touchscreen info for the Chuwi Vi10 tablet
Add touchscreen info for the 10" Chuwi Vi10 (CWI505) tablet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 15:00:29 +03:00
Hans de Goede 6a655a0dfe platform/x86: silead_dmi: Sort entries alphabetically
We have so much entries now that it is good to bring some form of order
to them. This should also reduce conflicts when multiple patches make
changes at the same time (compared to tagging all new entries at the end).

Note this commit purely moves stuff around and adds 2 comments about
keeping the data and table alphabetically sorted. There are no functional
changes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 15:00:29 +03:00
Hans de Goede d6b0d7d8d5 platform/x86: silead_dmi: Rename trekstor entries
Prefix the entries for trekstor tablets with trekstor_ and drop the
detailed model version (still available as comment in the dmi table)
to keep things within 80 chars.

This is a preparation patch for sorting all the entries alphabetically.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-07-02 15:00:29 +03:00
Colin Ian King 1e169ca3c4 platform/x86: dell-smbios: make a function and a pointer static
The function dell_smbios_smm_call and pointer platform_device are
local to the source and do not need to be in global scope, so make
them static.

Cleans up sparse warnings:
warning: symbol 'platform_device' was not declared. Should it be static?
warning: symbol 'dell_smbios_smm_call' was not declared. Should it be
static?

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-06-26 15:12:20 -07:00
Takashi Iwai 58e73aa177 platform/x86: ideapad-laptop: Apply no_hw_rfkill to Y20-15IKBM, too
The commit 5d9f40b566 ("platform/x86: ideapad-laptop: Add
Y520-15IKBN to no_hw_rfkill") added the entry for Y20-15IKBN, and it
turned out that another variant, Y20-15IKBM, also requires the
no_hw_rfkill.

Trim the last letter from the string so that it matches to both
Y20-15IKBN and Y20-15IKBM models.

Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=1098626
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-06-26 15:01:52 -07:00
Mario Limonciello 937b62b44c platform/x86: dell-smbios-base: Support systems without tokens
Some Dell servers can use dell-smbios but they don't support the
token interface.  Make it optional.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-06-26 15:01:52 -07: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
Azael Avalos 147288e63d platform/x86: toshiba_acpi: Update KBD backlight LED on second gen laptops
Second generation keyboard backlight (type 2) laptops can switch
on the keyboard LED on their own via hardware/firmware, but the
LED subsystem is unaware of such change since the LED interface
was only being created on first generation keyboard backlight
(type 1) laptops.

This patch creates the LED interface for second gen keyboards
and calls the *_hw_changed API whenever userspace changes the
state of the keyboard backlight LED.

While we are at it, remove an unneeded asignment to the acpi_dev
struct under *_kbd_bl_work, and also update the kbd_event_generated
variable in the main toshiba struct instead of the global struct.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
[dvhart: correct int* and int compare with dev->kbd_mode]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-06-26 14:51:38 -07:00
Kees Cook 6fb741076a platform/x86: wmi: Do not mix pages and kmalloc
The probe handler_data was being allocated with __get_free_pages()
for no reason I could find. The error path was using kfree(). Since
other things are happily using kmalloc() in the probe path, switch to
kmalloc() entirely. This fixes the error path mismatch and will avoid
issues with CONFIG_HARDENED_USERCOPY_PAGESPAN=y.

Reported-by: Mihai Donțu <mihai.dontu@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Mario Limonciello <Mario.limonciello@dell.com>
Cc: stable@vger.kernel.org
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-06-22 16:24:40 -07:00
Vadim Pasternak 8871f5e423 platform/x86: mlx-platform: Add mlxreg-io platform driver activation
Add mlxreg-io platform driver activation. Access driver uses the same
regmap infrastructure as others Mellanox platform drivers.
Specific registers description for default platform data configuration are
added to mlx-platform. There are the registers for resets control, reset
causes monitoring, programmable devices version reading and mux select
control. This platform data is passed to mlxreg-io driver. Also some
default values for the register are set at initialization time through
the regmap infrastructure, which are necessary for moving write protection
from the general purpose registers, which are used by mlxreg-io for
write access.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
v4-v5:
 Changes added by Vadim:
 - Add two new attributes for ASIC health and main power domain shutdown.
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-06-19 16:57:21 -07:00
Vadim Pasternak 5ec4a8ace0 platform/mellanox: Introduce support for Mellanox register access driver
Introduce new Mellanox platform driver to allow access to Mellanox
programmable device register space trough sysfs interface.
The driver purpose is to provide sysfs interface for user space for the
registers essential for system control and monitoring.
The sets of registers for sysfs access are supposed to be defined per
system type bases and include the registers related to system resets
operation, system reset causes monitoring and some kinds of mux selection.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
[dvhart: Kconfig typo fixes spotted by Randy Dunlap]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-06-19 16:56:53 -07:00
Benson Leung c474e9f2be
platform/chrome: chromeos_tbmc - fix SPDX identifier
Original submission was GPLv2 only, so mark as GPL-2.0.
Also restored some descriptive lines that were there before.

Signed-off-by: Benson Leung <bleung@chromium.org>
2018-06-16 16:52:59 -07:00
Mauro Carvalho Chehab 44348e8ac1 fix a series of Documentation/ broken file name references
As files move around, their previous links break. Fix the
references for them.

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2018-06-15 18:10:01 -03: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 a86854d0c5 treewide: devm_kzalloc() -> devm_kcalloc()
The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
This patch replaces cases of:

        devm_kzalloc(handle, a * b, gfp)

with:
        devm_kcalloc(handle, a * b, gfp)

as well as handling cases of:

        devm_kzalloc(handle, a * b * c, gfp)

with:

        devm_kzalloc(handle, array3_size(a, b, c), gfp)

as it's slightly less ugly than:

        devm_kcalloc(handle, array_size(a, b), c, gfp)

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

        devm_kzalloc(handle, 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.

Some manual whitespace fixes were needed in this patch, as Coccinelle
really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".

The Coccinelle script used for this was:

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

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

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

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

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

(
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	sizeof(TYPE) * (COUNT_ID)
+	COUNT_ID, sizeof(TYPE)
  , ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	sizeof(TYPE) * COUNT_ID
+	COUNT_ID, sizeof(TYPE)
  , ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	sizeof(TYPE) * (COUNT_CONST)
+	COUNT_CONST, sizeof(TYPE)
  , ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	sizeof(TYPE) * COUNT_CONST
+	COUNT_CONST, sizeof(TYPE)
  , ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	sizeof(THING) * (COUNT_ID)
+	COUNT_ID, sizeof(THING)
  , ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	sizeof(THING) * COUNT_ID
+	COUNT_ID, sizeof(THING)
  , ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	sizeof(THING) * (COUNT_CONST)
+	COUNT_CONST, sizeof(THING)
  , ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	sizeof(THING) * COUNT_CONST
+	COUNT_CONST, sizeof(THING)
  , ...)
)

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

- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	SIZE * COUNT
+	COUNT, SIZE
  , ...)

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

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

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

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

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

(
  devm_kzalloc(HANDLE,
-	(COUNT) * STRIDE * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  devm_kzalloc(HANDLE,
-	COUNT * (STRIDE) * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  devm_kzalloc(HANDLE,
-	COUNT * STRIDE * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  devm_kzalloc(HANDLE,
-	(COUNT) * (STRIDE) * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  devm_kzalloc(HANDLE,
-	COUNT * (STRIDE) * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  devm_kzalloc(HANDLE,
-	(COUNT) * STRIDE * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  devm_kzalloc(HANDLE,
-	(COUNT) * (STRIDE) * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  devm_kzalloc(HANDLE,
-	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 HANDLE;
expression E1, E2, E3;
constant C1, C2, C3;
@@

(
  devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
  devm_kzalloc(HANDLE,
-	(E1) * E2 * E3
+	array3_size(E1, E2, E3)
  , ...)
|
  devm_kzalloc(HANDLE,
-	(E1) * (E2) * E3
+	array3_size(E1, E2, E3)
  , ...)
|
  devm_kzalloc(HANDLE,
-	(E1) * (E2) * (E3)
+	array3_size(E1, E2, E3)
  , ...)
|
  devm_kzalloc(HANDLE,
-	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 HANDLE;
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@

(
  devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
|
  devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
|
  devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
  devm_kzalloc(HANDLE, C1 * C2, ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	sizeof(TYPE) * (E2)
+	E2, sizeof(TYPE)
  , ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	sizeof(TYPE) * E2
+	E2, sizeof(TYPE)
  , ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	sizeof(THING) * (E2)
+	E2, sizeof(THING)
  , ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	sizeof(THING) * E2
+	E2, sizeof(THING)
  , ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	(E1) * E2
+	E1, E2
  , ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	(E1) * (E2)
+	E1, E2
  , ...)
|
- devm_kzalloc
+ devm_kcalloc
  (HANDLE,
-	E1 * E2
+	E1, E2
  , ...)
)

Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-12 16:19:22 -07: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
Linus Torvalds 883cad5ba8 - New Device Support
- Add support for AXP813 ADC to AXP20x
    - Add support for PM8005, PM8998 and PMI8998
 
  - New Functionality
    - Add support for Battery Power Supply to AXP813
    - Add support for SYSCON to SPARD SC27XX SPI
    - Add support for RTC to ChromeOS Embedded-Controller
 
  - Fix-ups
    - Remove unused code; exynos{4,5}-pmu, cros_ec, cros_ec_acpi_gpe
    - Remove duplicate error messages (-ENOMEM, etc); htc-i2cpld, janz-cmodio,
 		max8997, rc5t583, sm501, smsc-ece1099, abx500-core, si476x-i2c,
 		ti_am335x_tscadc, tps65090, tps6586x, tps65910, tps80031,
 		twl6030-irq, viperboard
    - Succinctly use ptr to struct in sizeof(); rc5t583, abx500-core, sm501,
 		smsc-ece1099
    - Simplify syntax for NULL ptr checking; abx500-core, sm501
    - No not unnecessarily initialise variables; tps65910, tps65910
    - Reorganise and simplify driver data; omap-usb-tll
    - Move to SPDX license statement; tps68470
    - Probe ADCs via DT; axp20x
    - Use new GPIOD API; arizona-core
    - Constify things; axp20x
    - Reduce code-size (use MACROS, etc); axp20x, omap-usb-host
    - Add DT support/docs; motorola-cpcap
    - Remove VLAs; rave-sp
    - Use devm_* managed resources; cros_ec
    - Interrogate HW for firmware version; rave-sp
    - Provide ACPI support for ChromeOS Embedded-Controller
 
  - Bug Fixes
    - Reorder ordered (enum) device list; tps65218
    - Only accept valid data from the offset; rave-sp
    - Refrain from copying junk from failed SPI read; cros_ec_dev
    - Fix potential memory leaks; pcf50633-core
    - Fix clock initialisation; twl-core
    - Fix build-issue; tps65911
    - Fix off-by-one error; tps65911
    - Fix code ordering issues; intel-lpss
    - Fix COMPILE_TEST related issues; pwm-stm32
    - Fix broken MMC card detection; asic3
    - Fix clocking related issues; intel-lpss-pci
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAlsea+sACgkQUa+KL4f8
 d2Fc+A//aaFlfHfJh337tvmJ6wC8w13jjXn0f2M2NrCvRS1CoMF/WqSmJbFGguET
 gwv4v8Yf5mWe9crJfSLR4b6hlNWfvzK9Rxwy1WJ8sfnN7a71SIS6LlapxQwZ0S5o
 3tQ8n2YKdIyy6feATKnxzRi6IvTjTsIe6BRYev2+m23cEqxoI7b6xo0H1CApVXez
 vEnPaT08421qZ2vuPx3UW3JgwWMTYe4iazq1BRkveZZBdyQC+GLpdpoJIO5/OziF
 Wgn01Hluu11YuAPidxtmLCAI23RcqLNcPB0zu6//CG5+ut71qnQRs6ua4R352nME
 G6aMRVCTR1b0XY48MK+IOLb7mPCCUByHdvdaonzBd48dIrX6k//kVzYxNKY1vlmk
 //l/cYhnHBZxGvJAvCmtyi+4AjGz0aLcabY6S7qHMvpNMQ7oNU9FDomJXxynjXg9
 ulDkA4EJy6jlWDS6h0u99xycyLuQ4wKo997/Sl5SU+9FBFrdOor2q7R4KfIXQsG9
 VGZXi2kWBO9V9oFbbo1oyZ52hDiCy2TKz6fk0rdRltOpVMd4PYluETc4nmnWDo5W
 hvjP3rIJSSSIcpggOoQMp5L03cONPGP4MdiuCXOREc6q476CFtpEgJMWApgaEUjw
 e1SE8HMKounqw0JYLVz3Lf0RbcHPuR1PN5HDbrchDb8LaAAyCcA=
 =NF/E
 -----END PGP SIGNATURE-----

Merge tag 'mfd-next-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "New Device Support:
   - Add support for AXP813 ADC to AXP20x
   - Add support for PM8005, PM8998 and PMI8998

  New Functionality:
   - Add support for Battery Power Supply to AXP813
   - Add support for SYSCON to SPARD SC27XX SPI
   - Add support for RTC to ChromeOS Embedded-Controller

  Fix-ups:
   - Remove unused code; exynos{4,5}-pmu, cros_ec, cros_ec_acpi_gpe
   - Remove duplicate error messages (-ENOMEM, etc); htc-i2cpld,
        janz-cmodio, max8997, rc5t583, sm501, smsc-ece1099, abx500-core,
        si476x-i2c, ti_am335x_tscadc, tps65090, tps6586x, tps65910,
        tps80031, twl6030-irq, viperboard
   - Succinctly use ptr to struct in sizeof(); rc5t583, abx500-core,
        sm501, smsc-ece1099
   - Simplify syntax for NULL ptr checking; abx500-core, sm501
   - No not unnecessarily initialise variables; tps65910, tps65910
   - Reorganise and simplify driver data; omap-usb-tll
   - Move to SPDX license statement; tps68470
   - Probe ADCs via DT; axp20x
   - Use new GPIOD API; arizona-core
   - Constify things; axp20x
   - Reduce code-size (use MACROS, etc); axp20x, omap-usb-host
   - Add DT support/docs; motorola-cpcap
   - Remove VLAs; rave-sp
   - Use devm_* managed resources; cros_ec
   - Interrogate HW for firmware version; rave-sp
   - Provide ACPI support for ChromeOS Embedded-Controller

  Bug Fixes:
   - Reorder ordered (enum) device list; tps65218
   - Only accept valid data from the offset; rave-sp
   - Refrain from copying junk from failed SPI read; cros_ec_dev
   - Fix potential memory leaks; pcf50633-core
   - Fix clock initialisation; twl-core
   - Fix build-issue; tps65911
   - Fix off-by-one error; tps65911
   - Fix code ordering issues; intel-lpss
   - Fix COMPILE_TEST related issues; pwm-stm32
   - Fix broken MMC card detection; asic3
   - Fix clocking related issues; intel-lpss-pci"

* tag 'mfd-next-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (84 commits)
  mfd: cros_ec: Remove unused __remove function
  mfd: wm97xx-core: Platform data can be NULL
  mfd: cros_ec_dev: Don't advertise junk features on failure
  mfd: cros_ec: Use devm_kzalloc for private data
  mfd: intel-lpss: Fix Intel Cannon Lake LPSS I2C input clock
  mfd: asic3: Fix broken MMC card detection
  mfd: timberdale: Fix spelling mistake "Uknown" -> "Unknown"
  mfd: omap-usb-host: Use match_string() helper
  mfd: stm32-timers: Fix pwm-stm32 linker issue with COMPILE_TEST
  pwm: stm32: Initialize raw local variables
  mfd: arizona: Update DT doc to support more standard Reset binding
  dt-bindings: mfd: Add bindings for DA9063L
  mfd: intel-lpss: Correct names of RESETS register bits
  mfd: qcom-spmi-pmic: Add support for pm8005, pm8998 and pmi8998
  mfd: intel-lpss: Program REMAP register in PIO mode
  mfd: cros_ec_i2c: Moving the system sleep pm ops to late
  mfd: cros_ec_i2c: Add ACPI module device table
  mfd: cros_ec_dev: Register shutdown function for debugfs
  mfd: cros_ec_dev: Register cros-ec-rtc driver as a subdevice
  mfd: cros_ec: Don't try to grab log when suspended
  ...
2018-06-11 07:20:17 -07:00
yuk7 26ed9d1c07 platform/x86: silead_dmi: Add entry for Chuwi Hi8 tablet touchscreen
Add entry for Chuwi Hi8 S806_206 tablet touchscreen.

Signed-off-by: Haruka Kawajiri <yukx00@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-06-08 14:22:15 +03:00
Linus Torvalds 07c4dd3435 USB/PHY patches for 4.18-rc1
Here is the big USB pull request for 4.18-rc1.
 
 Lots of stuff here, the highlights are:
 	- phy driver updates and new additions
 	- usual set of xhci driver updates
 	- normal set of musb updates
 	- gadget driver updates and new controllers
 	- typec work, it's getting closer to getting fully out of the
 	  staging portion of the tree.
 	- lots of minor cleanups and bugfixes.
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWxba6w8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ykumQCg2abWE5LijR0SNJIwX8xk64HLUAMAnAxBZDG3
 aB0GyOQd54L+09q4LAdn
 =ZCEx
 -----END PGP SIGNATURE-----

Merge tag 'usb-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB and PHY updates from Greg KH:
 "Here is the big USB pull request for 4.18-rc1.

  Lots of stuff here, the highlights are:

   - phy driver updates and new additions

   - usual set of xhci driver updates

   - normal set of musb updates

   - gadget driver updates and new controllers

   - typec work, it's getting closer to getting fully out of the staging
     portion of the tree.

   - lots of minor cleanups and bugfixes.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'usb-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (263 commits)
  Revert "xhci: Reset Renesas uPD72020x USB controller for 32-bit DMA issue"
  xhci: Add quirk to zero 64bit registers on Renesas PCIe controllers
  xhci: Allow more than 32 quirks
  usb: xhci: force all memory allocations to node
  selftests: add test for USB over IP driver
  USB: typec: fsusb302: no need to check return value of debugfs_create_dir()
  USB: gadget: udc: s3c2410_udc: no need to check return value of debugfs_create functions
  USB: gadget: udc: renesas_usb3: no need to check return value of debugfs_create functions
  USB: gadget: udc: pxa27x_udc: no need to check return value of debugfs_create functions
  USB: gadget: udc: gr_udc: no need to check return value of debugfs_create functions
  USB: gadget: udc: bcm63xx_udc: no need to check return value of debugfs_create functions
  USB: udc: atmel_usba_udc: no need to check return value of debugfs_create functions
  USB: dwc3: no need to check return value of debugfs_create functions
  USB: dwc2: no need to check return value of debugfs_create functions
  USB: core: no need to check return value of debugfs_create functions
  USB: chipidea: no need to check return value of debugfs_create functions
  USB: ehci-hcd: no need to check return value of debugfs_create functions
  USB: fhci-hcd: no need to check return value of debugfs_create functions
  USB: fotg210-hcd: no need to check return value of debugfs_create functions
  USB: imx21-hcd: no need to check return value of debugfs_create functions
  ...
2018-06-05 16:14:12 -07:00
Linus Torvalds 910470e03f Changes to chrome-platform for v4.18
Further changes from Dmitry related to the removal of platform data from
 atmel_mxt_ts and chromeos_laptop. This time, we have some changes that
 teach chromeos_laptop how to supply acpi properties for some input devices
 so that the peripheral driver doesn't have to do dmi matching on some
 Chromebook platforms.
 
 Also adds the Chromebook Tablet switch driver, which is useful for x86
 convertible Chromebooks.
 
 Other misc. cleanup.
 
 Thanks,
 Benson
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE6gYDF28Li+nEiKLaHwn1ewov5lgFAlsUrmMACgkQHwn1ewov
 5ljpzRAAqgscZzPqHZNOtLC/QXsohdCKnbfjVL1Nd+xor773kJwA0jJVU6fSfvzx
 sxqQkRUno3aFD3TeKzRVY+jBXzb8hkYUpIfvT2Fl3fGK26NIFaB+F0wqqwZZcyOt
 36lR7Ngtun3HvrxxiJ8utQeF4z5fofpWRwSGzE+ADalBr47NSIBM2JofcWmo35tk
 pw0wkZvvJhzSlouF4JW8ca6LjPpk6Ngw2988HEDzyXlYGwdS/IXGjriMQ5AIiRuE
 qAFtydRYYcBfZ9IH7O3Utmq74mDg+UXcFjnnt8lrvbca8QiPRWvblxwkQ5alpbPQ
 x/HS9dJqkPfy5xskKiivDSKCtYXSNi5E15crcbhreiZwSlX2ictVIYu9zEo2KYCh
 aD0Ba1iCQVCs8uXdoIqIh92LDLzgkr8L7kjqqFwDWpQeEH5LGYtOaHD17e5vIBc8
 dllkAiJfRPVtcJtdZgUkW7NwKl8CdKFAMi2X5owYCyEsPgwUtpi2xfO6xSpA2gWl
 +srbY22RTcwmMgds0kktS46GgbW73rdFxEIlbeR6moaO6GUEILicsxu6BzvXYxuj
 pfsjAt1CP50Hy1kInyiFjtgEwIEv0vbr39DsZNTWWjMFXlZHzmOc8JbjFK1lb+Kw
 Hh2x31BtXHA4pFyk2DUem9ctqybDZePt1vlN5QYz7WjHzMeJRqg=
 =mA72
 -----END PGP SIGNATURE-----

Merge tag 'chrome-platform-for-linus-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform

Pull chrome platform updates from Benson Leung:

 - further changes from Dmitry related to the removal of platform data
   from atmel_mxt_ts and chromeos_laptop.

   This time, we have some changes that teach chromeos_laptop how to
   supply acpi properties for some input devices so that the peripheral
   driver doesn't have to do dmi matching on some Chromebook platforms.

 - new Chromebook Tablet switch driver, which is useful for x86
   convertible Chromebooks.

 - other misc cleanup

* tag 'chrome-platform-for-linus-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform:
  platform/chrome: Use to_cros_ec_dev more broadly
  platform/chrome: chromeos_laptop: fix touchpad button mapping on Celes
  platform: chrome: Add input dependency for tablet switch driver
  platform/chrome: chromeos_laptop - supply properties for ACPI devices
  platform/chrome: chromeos_tbmc - add SPDX identifier
  platform: chrome: Add Tablet Switch ACPI driver
  platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device found
2018-06-04 11:28:58 -07:00
Linus Torvalds cf626b0da7 Merge branch 'hch.procfs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull procfs updates from Al Viro:
 "Christoph's proc_create_... cleanups series"

* 'hch.procfs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (44 commits)
  xfs, proc: hide unused xfs procfs helpers
  isdn/gigaset: add back gigaset_procinfo assignment
  proc: update SIZEOF_PDE_INLINE_NAME for the new pde fields
  tty: replace ->proc_fops with ->proc_show
  ide: replace ->proc_fops with ->proc_show
  ide: remove ide_driver_proc_write
  isdn: replace ->proc_fops with ->proc_show
  atm: switch to proc_create_seq_private
  atm: simplify procfs code
  bluetooth: switch to proc_create_seq_data
  netfilter/x_tables: switch to proc_create_seq_private
  netfilter/xt_hashlimit: switch to proc_create_{seq,single}_data
  neigh: switch to proc_create_seq_data
  hostap: switch to proc_create_{seq,single}_data
  bonding: switch to proc_create_seq_data
  rtc/proc: switch to proc_create_single_data
  drbd: switch to proc_create_single
  resource: switch to proc_create_seq_data
  staging/rtl8192u: simplify procfs code
  jfs: simplify procfs code
  ...
2018-06-04 10:00:01 -07:00
Timur Kristóf e6a7379fcb platform/x86: dell-laptop: Fix keyboard backlight timeout on XPS 13 9370
The XPS 13 9370 doesn't expose the necessary KBD_LED_AC_TOKEN in
the BIOS, so the driver thinks it cannot adjust the AC keyboard
backlight timeout. This patch adds a quirk to fix this until
Dell adds the missing token to the BIOS.

For further discussion, see:
https://github.com/dell/libsmbios/issues/48

Signed-off-by: Timur Kristóf <venemo@fedoraproject.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-06-04 12:30:09 +03:00
Kai Heng Feng 64b824649b platform/x86: dell-wmi: Ignore new rfkill and fn-lock events
There are two new events generated by dell-wmi, rfkill and fn-lock, from
Dell Systems.

When Fn-lock hotkey gets pressed to switch to function mode:
[85951.591542] dell_wmi: Unknown key with type 0x0010 and code 0xe035
pressed
[85951.591546] dell_wmi: Unknown key with type 0x0010 and code 0x0000
pressed

When Fn-lock hotkey gets pressed to switch to multimedia mode:
[85956.667686] dell_wmi: Unknown key with type 0x0010 and code 0xe035
pressed
[85956.667690] dell_wmi: Unknown key with type 0x0010 and code 0x0001
pressed

When radio hotkey gets pressed:
[85974.430220] dell_wmi: Unknown key with type 0x0010 and code 0xe008
pressed

These events are for notification purpose, so we can ignore them.

This patch is tested on XPS 9370.

Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-06-04 12:20:22 +03:00
Vadim Pasternak 1189456b1c platform/x86: mlx-platform: Add LED platform driver activation
Add LED platform driver activation from mlx-platform. This LED driver uses
the same regmap infrastructure as others Mellanox platform drivers, so LED
specific registers description is added.

System LED configuration depends on system type. To support all the
relevant types per system type LED descriptions are defined for passing
to LED platform driver.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-06-01 09:54:34 -07:00
Vadim Pasternak cbf7ff8cdb platform/mellanox: Add new ODM system types to mlx-platform
Add new ODM system types, matched according to DMI_BOARD_NAME. The
supported ODM Ids are: VMOD0001, VMOD0002, VMOD0003, VMOD0004, VMOD0005.
Patch does not introduce new systems, but allows to ODM companies to set
DMI_BOARD_VENDOR and DMI_PRODUCT_NAME on their own. It assumes that ODM
company can't change DMI_BOARD_NAME.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-06-01 09:54:34 -07:00
Vadim Pasternak 4b5e32df66 platform/mellanox: mlxreg-hotplug: add extra cycle for hotplug work queue
Add extra cycle for hotplug work queue to handle the case when a signal is
It adds missed logic for signal acknowledge, by adding an extra run for
received, but no specific signal assertion is detected. Such case
theoretically can happen for example in case several units are removed or
inserted at the same time. In this situation acknowledge for some signal
can be missed at signal top aggreagation status level. The extra run will
allow to handler to acknowledge the missed signal.

The interrupt handling flow performs the next steps:
(1)
Enter mlxreg_hotplug_work_handler due to signal assertion.
Aggregation status register is changed for example from 0xff to 0xfd
(event signal group related to bit 1).
(2)
Mask aggregation interrupts, read aggregation status register and save it
(0xfd) in aggr_cache, then traverse down to handle signal from groups
related to the changed bit.
(3)
Read and mask group related signal.
Acknowledge and unmask group related signal (acknowledge should clear
aggregation status register from 0xfd back to 0xff).
(4)
Re-schedule work queue for the immediate execution.
(5)
Enter mlxreg_hotplug_work_handler due to re-scheduling.
Aggregation status is changed from previous 0xfd to 0xff.
Go over steps (2) - (5) and in case no new signal assertion
is detected - unmask aggregation interrupts.

The possible race could happen in case new signal from the same group is
asserted after step (3) and prior step (5). In such case aggregation
status will change back from 0xff to 0xfd and the value read from the
aggregation status register will be the same as a value saved in
aggr_cache. As a result the handler will not traverse down and signal
will stay unhandled.

Example of faulty flow:
The signal routing flow is as following (f.e. for of FANi removing):
 - FAN status and event registers related bit is changed;
 -- intermediate aggregation status register is changed;
 --- top aggregation status register is changed;
 ---- interrupt routed to CPU and interrupt handler is invoked.

When interrupt handler is invoked it follows the next simple logic (f.e
FAN3 is removed):
 (a1) mask top aggregation interrupt mask register;
 (a2) read top aggregation interrupt status register and test to which
      underling group belongs a signal (FANs in this case and is changed
	  from 0xff to 0xfb and 0xfb is saved as a last status value);
   (b1) mask FANs interrupt mask register;
   (b2) read FANs status register and test which FAN has been changed
        FAN3 in this example);
     (c1) perform relevant action;
              <--------------- (FAN2 is removed at this point)
   (b3) clear FANs interrupt event register to acknowledge FAN3 signal;
   (b4) unmask FANs interrupt mask register
 (a3) unmask top aggregation interrupt mask register;

 An interrupt handler is invoked, since FAN2 interrupt is not acknowledge.
 It should set top aggregation interrupt status register bit 6 (0xfb).
 In step (a2)
 (a2) read top aggregation interrupt and comparing it with saved value
      does not show change (same 0xfb) and after (a2) execution jumps to
	  (a3) and signal leaved unhandled

The fix will enforce handler to traverse down in case the signal is
received, but signal assertion is not detected.

Fixes: 304887041d ("platform/x86: Introduce support for Mellanox hotplug driver")
Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-06-01 09:54:34 -07:00
dylanchu 1262516e6a platform/x86: ideapad-laptop: Add E42-80 to no_hw_rfkill
Lenovo Zhaoyang E42-80 is another Lenovo model without a hw rfkill switch,
resulting in wifi always reported as hard blocked.

Add the model to the list of models without rfkill switch.

Signed-off-by: dylanchu <chdy.uuid@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-06-01 17:49:09 +03:00
Hans de Goede adf762dc82 platform/x86: silead_dmi: Add touchscreen info for the Onda V891w tablet
Add touchscreen info for the Onda V891w 8.9" windows tablet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-06-01 17:49:09 +03:00
Hans de Goede 3cd33db88e platform/x86: silead_dmi: Add info for the PoV mobii TAB-P800W (v2.0)
This commit adds the necessary device-properties to make the touchscreen
on Point of View mobii TAB-P800W (v2.0) tablets work.

Note that we already have an entry for the Point of View mobii
TAB-P800W (v2.1), that version uses a different digitizer and different
firmware, so the v2.0 version needs its own entry.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-06-01 17:49:09 +03:00
Hans de Goede 828615f8f7 platform/x86: silead_dmi: Add touchscreen info for the Jumper EZpad 6 Pro
Add touchscreen info for the Jumper EZpad 6 Pro.

Cc: zy <574249312@qq.com>
Reported-and-tested-by: zy <574249312@qq.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-06-01 17:49:09 +03:00
Linus Torvalds dd52cb8790 platform-drivers-x86 for v4.17-4
Fix NULL pointer dereference in asus-wmi on rfkill cleanup.
 
 The following is an automated git shortlog grouped by driver:
 
 asus-wmi:
  -  Fix NULL pointer dereference
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEhiZOUlnC9oKN3n3AmT3/83c5Sy0FAlsP6SQACgkQmT3/83c5
 Sy2rGA//b4nN3aa2LAKYiMzwQUlrYY8QGxBC4VVyJB+ewTK9R0wEQbIGiwX08Ism
 cz23kP5Ewn3SjKikytRBaqwZA92hkke1YSOPCXwgbLFz7e4Q7dxH+oPOxZB2dQoF
 lSYe4FEh6XolsEq6aOvzGIUkQl4Ne97rpNGMozIYXnIwzlTTG/NPnwo3ghZL6YTb
 XyTekpfLKUycUqKaADIkEGEAXTxDgeeoQnQLLQzBM6cuEkHAk8zyPsE1mVr9G9ns
 3CCQlh4U2PFY9k2X32v5YMUrTZh1EtcVDG1gF4kV7OVFqeMjN3cQJti+W6dOjc6u
 WoElplxWZ1yy5XKvyN1V4/Fm157t5Hf3BxytgHnwhfi5RvWP526alR42dfHYb6ss
 desWCFPmG9nzDbzkVWZapnfVJpb9gqkyev4O9KYLk4ZJrUqEdiaumQicRAnwjwlV
 NE1BYGmnj5N9EIw+k5/zYiBuAtYbtDlv5cf1EPbSMg/opXD4JZu+460Ea1y//D7N
 mcq6KW6ZjFdsz9Ppw8cWcaEhTnXxYXRyT9IduIwlJ+6wttafGhFKumWMTxgu3WTj
 +fhM+D+PXgFIgEoJNOVDSSK1zw2ajYzOyTXzXGo9FWxuFPIw0WfvgubArnOMTspi
 kNe6WFJSpE+7UX0xCK0J00ORG6cquHVthYj+rB0seNixyM0+z78=
 =GJY6
 -----END PGP SIGNATURE-----

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

Pull x86 platform driver fix from Andy Shevchenko:
 "Fix NULL pointer dereference in asus-wmi on rfkill cleanup.

  The effective change is just one new condition - two lines of code.
  But it required moving one static helper function, which is why the
  diff looks a bit bigger"

* tag 'platform-drivers-x86-v4.17-4' of git://git.infradead.org/linux-platform-drivers-x86:
  platform/x86: asus-wmi: Fix NULL pointer dereference
2018-05-31 09:39:57 -05:00
João Paulo Rechi Vita cc5cceff28 platform/x86: asus-wireless: Fix format specifier
u64 should be printed with %llx instead of %x and cast to uint.

Signed-off-by: João Paulo Rechi Vita <jprvita@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-05-31 17:16:59 +03:00
João Paulo Rechi Vita cf48bf9eee platform/x86: asus-wmi: Fix NULL pointer dereference
Do not perform the rfkill cleanup routine when
(asus->driver->wlan_ctrl_by_user && ashs_present()) is true, since
nothing is registered with the rfkill subsystem in that case. Doing so
leads to the following kernel NULL pointer dereference:

  BUG: unable to handle kernel NULL pointer dereference at           (null)
  IP: [<ffffffff816c7348>] __mutex_lock_slowpath+0x98/0x120
  PGD 1a3aa8067
  PUD 1a3b3d067
  PMD 0

  Oops: 0002 [#1] PREEMPT SMP
  Modules linked in: bnep ccm binfmt_misc uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core hid_a4tech videodev x86_pkg_temp_thermal intel_powerclamp coretemp ath3k btusb btrtl btintel bluetooth kvm_intel snd_hda_codec_hdmi kvm snd_hda_codec_realtek snd_hda_codec_generic irqbypass crc32c_intel arc4 i915 snd_hda_intel snd_hda_codec ath9k ath9k_common ath9k_hw ath i2c_algo_bit snd_hwdep mac80211 ghash_clmulni_intel snd_hda_core snd_pcm snd_timer cfg80211 ehci_pci xhci_pci drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm xhci_hcd ehci_hcd asus_nb_wmi(-) asus_wmi sparse_keymap r8169 rfkill mxm_wmi serio_raw snd mii mei_me lpc_ich i2c_i801 video soundcore mei i2c_smbus wmi i2c_core mfd_core
  CPU: 3 PID: 3275 Comm: modprobe Not tainted 4.9.34-gentoo #34
  Hardware name: ASUSTeK COMPUTER INC. K56CM/K56CM, BIOS K56CM.206 08/21/2012
  task: ffff8801a639ba00 task.stack: ffffc900014cc000
  RIP: 0010:[<ffffffff816c7348>]  [<ffffffff816c7348>] __mutex_lock_slowpath+0x98/0x120
  RSP: 0018:ffffc900014cfce0  EFLAGS: 00010282
  RAX: 0000000000000000 RBX: ffff8801a54315b0 RCX: 00000000c0000100
  RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff8801a54315b4
  RBP: ffffc900014cfd30 R08: 0000000000000000 R09: 0000000000000002
  R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801a54315b4
  R13: ffff8801a639ba00 R14: 00000000ffffffff R15: ffff8801a54315b8
  FS:  00007faa254fb700(0000) GS:ffff8801aef80000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000000000000 CR3: 00000001a3b1b000 CR4: 00000000001406e0
  Stack:
   ffff8801a54315b8 0000000000000000 ffffffff814733ae ffffc900014cfd28
   ffffffff8146a28c ffff8801a54315b0 0000000000000000 ffff8801a54315b0
   ffff8801a66f3820 0000000000000000 ffffc900014cfd48 ffffffff816c73e7
  Call Trace:
   [<ffffffff814733ae>] ? acpi_ut_release_mutex+0x5d/0x61
   [<ffffffff8146a28c>] ? acpi_ns_get_node+0x49/0x52
   [<ffffffff816c73e7>] mutex_lock+0x17/0x30
   [<ffffffffa00a3bb4>] asus_rfkill_hotplug+0x24/0x1a0 [asus_wmi]
   [<ffffffffa00a4421>] asus_wmi_rfkill_exit+0x61/0x150 [asus_wmi]
   [<ffffffffa00a49f1>] asus_wmi_remove+0x61/0xb0 [asus_wmi]
   [<ffffffff814a5128>] platform_drv_remove+0x28/0x40
   [<ffffffff814a2901>] __device_release_driver+0xa1/0x160
   [<ffffffff814a29e3>] device_release_driver+0x23/0x30
   [<ffffffff814a1ffd>] bus_remove_device+0xfd/0x170
   [<ffffffff8149e5a9>] device_del+0x139/0x270
   [<ffffffff814a5028>] platform_device_del+0x28/0x90
   [<ffffffff814a50a2>] platform_device_unregister+0x12/0x30
   [<ffffffffa00a4209>] asus_wmi_unregister_driver+0x19/0x30 [asus_wmi]
   [<ffffffffa00da0ea>] asus_nb_wmi_exit+0x10/0xf26 [asus_nb_wmi]
   [<ffffffff8110c692>] SyS_delete_module+0x192/0x270
   [<ffffffff810022b2>] ? exit_to_usermode_loop+0x92/0xa0
   [<ffffffff816ca560>] entry_SYSCALL_64_fastpath+0x13/0x94
  Code: e8 5e 30 00 00 8b 03 83 f8 01 0f 84 93 00 00 00 48 8b 43 10 4c 8d 7b 08 48 89 63 10 41 be ff ff ff ff 4c 89 3c 24 48 89 44 24 08 <48> 89 20 4c 89 6c 24 10 eb 1d 4c 89 e7 49 c7 45 08 02 00 00 00
  RIP  [<ffffffff816c7348>] __mutex_lock_slowpath+0x98/0x120
   RSP <ffffc900014cfce0>
  CR2: 0000000000000000
  ---[ end trace 8d484233fa7cb512 ]---
  note: modprobe[3275] exited with preempt_count 2

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

Reported-by: red.f0xyz@gmail.com
Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-05-31 15:19:16 +03:00
João Paulo Rechi Vita 32ffd6e8d1 platform/x86: asus-wmi: Fix NULL pointer dereference
Do not perform the rfkill cleanup routine when
(asus->driver->wlan_ctrl_by_user && ashs_present()) is true, since
nothing is registered with the rfkill subsystem in that case. Doing so
leads to the following kernel NULL pointer dereference:

  BUG: unable to handle kernel NULL pointer dereference at           (null)
  IP: [<ffffffff816c7348>] __mutex_lock_slowpath+0x98/0x120
  PGD 1a3aa8067
  PUD 1a3b3d067
  PMD 0

  Oops: 0002 [#1] PREEMPT SMP
  Modules linked in: bnep ccm binfmt_misc uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core hid_a4tech videodev x86_pkg_temp_thermal intel_powerclamp coretemp ath3k btusb btrtl btintel bluetooth kvm_intel snd_hda_codec_hdmi kvm snd_hda_codec_realtek snd_hda_codec_generic irqbypass crc32c_intel arc4 i915 snd_hda_intel snd_hda_codec ath9k ath9k_common ath9k_hw ath i2c_algo_bit snd_hwdep mac80211 ghash_clmulni_intel snd_hda_core snd_pcm snd_timer cfg80211 ehci_pci xhci_pci drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm xhci_hcd ehci_hcd asus_nb_wmi(-) asus_wmi sparse_keymap r8169 rfkill mxm_wmi serio_raw snd mii mei_me lpc_ich i2c_i801 video soundcore mei i2c_smbus wmi i2c_core mfd_core
  CPU: 3 PID: 3275 Comm: modprobe Not tainted 4.9.34-gentoo #34
  Hardware name: ASUSTeK COMPUTER INC. K56CM/K56CM, BIOS K56CM.206 08/21/2012
  task: ffff8801a639ba00 task.stack: ffffc900014cc000
  RIP: 0010:[<ffffffff816c7348>]  [<ffffffff816c7348>] __mutex_lock_slowpath+0x98/0x120
  RSP: 0018:ffffc900014cfce0  EFLAGS: 00010282
  RAX: 0000000000000000 RBX: ffff8801a54315b0 RCX: 00000000c0000100
  RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff8801a54315b4
  RBP: ffffc900014cfd30 R08: 0000000000000000 R09: 0000000000000002
  R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801a54315b4
  R13: ffff8801a639ba00 R14: 00000000ffffffff R15: ffff8801a54315b8
  FS:  00007faa254fb700(0000) GS:ffff8801aef80000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000000000000 CR3: 00000001a3b1b000 CR4: 00000000001406e0
  Stack:
   ffff8801a54315b8 0000000000000000 ffffffff814733ae ffffc900014cfd28
   ffffffff8146a28c ffff8801a54315b0 0000000000000000 ffff8801a54315b0
   ffff8801a66f3820 0000000000000000 ffffc900014cfd48 ffffffff816c73e7
  Call Trace:
   [<ffffffff814733ae>] ? acpi_ut_release_mutex+0x5d/0x61
   [<ffffffff8146a28c>] ? acpi_ns_get_node+0x49/0x52
   [<ffffffff816c73e7>] mutex_lock+0x17/0x30
   [<ffffffffa00a3bb4>] asus_rfkill_hotplug+0x24/0x1a0 [asus_wmi]
   [<ffffffffa00a4421>] asus_wmi_rfkill_exit+0x61/0x150 [asus_wmi]
   [<ffffffffa00a49f1>] asus_wmi_remove+0x61/0xb0 [asus_wmi]
   [<ffffffff814a5128>] platform_drv_remove+0x28/0x40
   [<ffffffff814a2901>] __device_release_driver+0xa1/0x160
   [<ffffffff814a29e3>] device_release_driver+0x23/0x30
   [<ffffffff814a1ffd>] bus_remove_device+0xfd/0x170
   [<ffffffff8149e5a9>] device_del+0x139/0x270
   [<ffffffff814a5028>] platform_device_del+0x28/0x90
   [<ffffffff814a50a2>] platform_device_unregister+0x12/0x30
   [<ffffffffa00a4209>] asus_wmi_unregister_driver+0x19/0x30 [asus_wmi]
   [<ffffffffa00da0ea>] asus_nb_wmi_exit+0x10/0xf26 [asus_nb_wmi]
   [<ffffffff8110c692>] SyS_delete_module+0x192/0x270
   [<ffffffff810022b2>] ? exit_to_usermode_loop+0x92/0xa0
   [<ffffffff816ca560>] entry_SYSCALL_64_fastpath+0x13/0x94
  Code: e8 5e 30 00 00 8b 03 83 f8 01 0f 84 93 00 00 00 48 8b 43 10 4c 8d 7b 08 48 89 63 10 41 be ff ff ff ff 4c 89 3c 24 48 89 44 24 08 <48> 89 20 4c 89 6c 24 10 eb 1d 4c 89 e7 49 c7 45 08 02 00 00 00
  RIP  [<ffffffff816c7348>] __mutex_lock_slowpath+0x98/0x120
   RSP <ffffc900014cfce0>
  CR2: 0000000000000000
  ---[ end trace 8d484233fa7cb512 ]---
  note: modprobe[3275] exited with preempt_count 2

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

Reported-by: red.f0xyz@gmail.com
Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-05-31 15:18:02 +03:00
Gwendal Grignou 79a3d60300
platform/chrome: Use to_cros_ec_dev more broadly
Move to_cros_ec_dev macro to cros_ec.h and use it when the private ec
object is needed from device object.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-05-30 11:53:40 -07:00
Dmitry Torokhov 683b647309
platform/chrome: chromeos_laptop: fix touchpad button mapping on Celes
Celes has newer touch controller (compared to the controllers used in
older BayTrail-based devices) and so uses the same button mapping as
Samus.

This fixes the issue with mouse button being stuck in pressed state
after the first click.

Reported-by: Sultan Alsawaf <sultanxda@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-05-29 15:11:04 -07:00
Douglas Anderson 44d99d7372 mfd: cros_ec: Don't try to grab log when suspended
We should stop our worker thread while we're suspended.  If we don't
then we'll get messages like:

  cros-ec-spi spi5.0: spi transfer failed: -108
  cros-ec-spi spi5.0: cs-deassert spi transfer failed: -108
  cros-ec-ctl cros-ec-ctl.0.auto: EC communication failed

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2018-05-29 09:10:39 +01:00
Benson Leung 1eb89893ec
Merge branch 'ib-chrome-platform-atmel-mxt-ts-device-properties' into working-branch-for-4.18
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-05-28 23:04:10 -07:00
Arnd Bergmann 485aa74a8e
platform: chrome: Add input dependency for tablet switch driver
Without CONFIG_INPUT, or with a modular input layer and built-in
tablet driver, we get a link error:

ERROR: "input_event" [drivers/platform/chrome/chromeos_tbmc.ko] undefined!
ERROR: "input_register_device" [drivers/platform/chrome/chromeos_tbmc.ko] undefined!
ERROR: "input_set_capability" [drivers/platform/chrome/chromeos_tbmc.ko] undefined!
ERROR: "devm_input_allocate_device" [drivers/platform/chrome/chromeos_tbmc.ko] undefined!

This adds the corresponding Kconfig dependency

Fixes: b418f74170 ("platform: chrome: Add Tablet Switch ACPI driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-05-28 22:51:27 -07:00
Heikki Krogerus 7c8d44566d platform: x86: intel_cht_int33fe: Fix dependencies
The driver will not probe unless bq24190 is loaded, so
making it a dependency.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-24 18:17:00 +02:00
Dmitry Torokhov 5020cd29d8
platform/chrome: chromeos_laptop - supply properties for ACPI devices
BayTrail-based and newer Chromebooks describe their peripherals in ACPI;
unfortunately their description is not complete, and peripherals
drivers, such as driver for Atmel Touch controllers, has to resort to
DMI-matching to configure the peripherals properly. To avoid polluting
peripheral driver code, let's teach chromeos_laptop driver to supply
missing data via generic device properties.

Note we supply "compatible" string for Atmel peripherals not because it is
needed for matching devices and driver (matching is still done on ACPI HID
entries), but because peripherals driver will be using presence of
"compatible" property to determine if device properties have been attached
to the device, and fail to bind if they are absent.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-05-23 12:48:31 -07:00
Benson Leung 4574d1d61d
platform/chrome: chromeos_tbmc - add SPDX identifier
Replace the original license statement with the SPDX identifier.
Add also one line of description as recommended by the COPYING file.

Signed-off-by: Benson Leung <bleung@chromium.org>
2018-05-23 12:00:47 -07:00
Gwendal Grignou b418f74170
platform: chrome: Add Tablet Switch ACPI driver
Add a kernel driver for GOOG0006, an ACPI driver reporting an event when
the tablet switch status changes.

On an ACPI based convertible chromebook check evtest display tablet mode
switch changes:
Available devices:
..
/dev/input/event3:      Tablet Mode Switch
..
Testing ... (interrupt to exit)
Event: time 1484879712.604360, type 5 (EV_SW), code 1 (SW_TABLET_MODE),
value 1
Event: time 1484879712.604360, -------------- SYN_REPORT ------------
Event: time 1484879715.132228, type 5 (EV_SW), code 1 (SW_TABLET_MODE),
value 0
Event: time 1484879715.132228, -------------- SYN_REPORT ------------
...
Check state is updated at resume time when different from suspend time.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-05-23 11:56:45 -07:00
Brian Norris 11799564fc mfd: cros_ec: Retry commands when EC is known to be busy
Commit 001dde9400 ("mfd: cros ec: spi: Fix "in progress" error
signaling") pointed out some bad code, but its analysis and conclusion
was not 100% correct.

It *is* correct that we should not propagate result==EC_RES_IN_PROGRESS
for transport errors, because this has a special meaning -- that we
should follow up with EC_CMD_GET_COMMS_STATUS until the EC is no longer
busy. This is definitely the wrong thing for many commands, because
among other problems, EC_CMD_GET_COMMS_STATUS doesn't actually retrieve
any RX data from the EC, so commands that expected some data back will
instead start processing junk.

For such commands, the right answer is to either propagate the error
(and return that error to the caller) or resend the original command
(*not* EC_CMD_GET_COMMS_STATUS).

Unfortunately, commit 001dde9400 forgets a crucial point: that for
some long-running operations, the EC physically cannot respond to
commands any more. For example, with EC_CMD_FLASH_ERASE, the EC may be
re-flashing its own code regions, so it can't respond to SPI interrupts.
Instead, the EC prepares us ahead of time for being busy for a "long"
time, and fills its hardware buffer with EC_SPI_PAST_END. Thus, we
expect to see several "transport" errors (or, messages filled with
EC_SPI_PAST_END). So we should really translate that to a retryable
error (-EAGAIN) and continue sending EC_CMD_GET_COMMS_STATUS until we
get a ready status.

IOW, it is actually important to treat some of these "junk" values as
retryable errors.

Together with commit 001dde9400, this resolves bugs like the
following:

1. EC_CMD_FLASH_ERASE now works again (with commit 001dde9400, we
   would abort the first time we saw EC_SPI_PAST_END)
2. Before commit 001dde9400, transport errors (e.g.,
   EC_SPI_RX_BAD_DATA) seen in other commands (e.g.,
   EC_CMD_RTC_GET_VALUE) used to yield junk data in the RX buffer; they
   will now yield -EAGAIN return values, and tools like 'hwclock' will
   simply fail instead of retrieving and re-programming undefined time
   values

Fixes: 001dde9400 ("mfd: cros ec: spi: Fix "in progress" error signaling")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2018-05-23 06:59:00 +01:00
Dmitry Torokhov b410b12266
platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device found
Older models of Chromebooks did not describe the LPC EC in their ACPI
tables; starting with Strago-based devices Google is using GOOG0004 device
to describe EC LPC.

DMI-based match is fragile and does not work reliably, especially when
using custom firmware. It is also not needed when we can locate the right
ACPI device, so let's stop bailing out when DMI does not match but the
right ACPI device is present.

Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-05-22 16:46:13 -07:00
Henk 8b0695841d platform/x86: dell-wmi: Set correct keycode for Fn + left arrow
Fn + left arrow hotkey combination is used for enabling/disabling automatic
display brightness based on integrated ALS sensor. For this purpose there
is standard Linux key KEY_BRIGHTNESS_AUTO so use it instead of KEY_UNKNOWN.

Tested on Dell Lattitude E6500.

Signed-off-by: Henk Vergonet <henk.vergonet@gmail.com>
Reviewed-By: Pali Rohár <pali.rohar@gmail.com>
Reviewed-By: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-05-22 12:24:12 +03:00
Antonio Rosario Intilisano c7a437fdd6 platform/x86: acer-wmi: add another KEY_POWER keycode
Now that we have informed the firmware that the Power Button driver is active,
laptops such as the Acer Swift 3 will generate a WMI key event with code 0x87
when the power button key is pressed.

Add this keycode to the table so that it is converted to
an appropriate input event.

Signed-off-by: Antonio Rosario Intilisano <antonio.intilisano@gmail.com>
Acked-by: Gianfranco Costamagna <locutusofborg@debian.org>
Tested-by: Antonio Rosario Intilisano <antonio.intilisano@gmail.com>
Cc: Chris Chiu <chiu@endlessm.com>
Cc: Daniel Drake <drake@endlessm.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-05-22 12:24:12 +03:00
Oleg Keri 40760717f9 platform/x86: ideapad-laptop: Add fn-lock setting
Some of latest Lenovo ideapad laptops do not have UEFI/BIOS setting for
switching fn-lock mode. This commit adds related acpi calls to ideapad
platform driver. However setting is available via sysfs.

Signed-off-by: Oleg Keri <ezhi99@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-05-22 12:24:12 +03:00
Takashi Iwai 7caf0c1efd platform/x86: ideapad-laptop: Add MIIX 720-12IKB to no_hw_rfkill
Yet another Lenovo model to be added to the no_hw_rfkill blacklist:
ideapad MIIX 720-12IKB.  Otherwise it's always hard-blocked.

Reported-by: Robin Roevens <robin.roevens1@pandora.be>
Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=1093035
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-05-22 12:19:23 +03:00
Darren Hart 54940fa60a platform/x86: DELL_WMI use depends on instead of select for DELL_SMBIOS
If DELL_WMI "select"s DELL_SMBIOS, the DELL_SMBIOS dependencies are
ignored and it is still possible to end up with unmet direct
dependencies.

Change the select to a depends on.

Tested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-05-18 15:49:26 -07:00
Christoph Hellwig 3f3942aca6 proc: introduce proc_create_single{,_data}
Variants of proc_create{,_data} that directly take a seq_file show
callback and drastically reduces the boilerplate code in the callers.

All trivial callers converted over.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2018-05-16 07:23:35 +02:00
Darren Hart 74783c99bf platform/x86: DELL_WMI use depends on instead of select for DELL_SMBIOS
If DELL_WMI "select"s DELL_SMBIOS, the DELL_SMBIOS dependencies are
ignored and it is still possible to end up with unmet direct
dependencies.

Change the select to a depends on.

Tested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-05-12 15:38:40 -07:00
Vadim Pasternak 321089a4da platform/mellanox: mlxreg-hotplug: Document fixes for hotplug private data
Add missing description of dev, regmap, dwork_irq, after_probe in struct
mlxreg_hotplug_priv_data.

Remove dwork field from the structure mlxreg_hotplug_priv_data itself and
for the descriptions, since it is not used.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-05-12 15:38:40 -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
Mario Limonciello 7fe3fa3b5e platform/x86: Kconfig: Fix dell-laptop dependency chain.
As reported by Randy Dunlap:
>> WARNING: unmet direct dependencies detected for DELL_SMBIOS
>>   Depends on [m]: X86 [=y] && X86_PLATFORM_DEVICES [=y]
>>	&& (DCDBAS [=m] ||
>> DCDBAS [=m]=n) && (ACPI_WMI [=n] || ACPI_WMI [=n]=n)
>>   Selected by [y]:
>>   - DELL_LAPTOP [=y] && X86 [=y] && X86_PLATFORM_DEVICES [=y]
>> && DMI [=y]
>> && BACKLIGHT_CLASS_DEVICE [=y] && (ACPI_VIDEO [=n] ||
>>	ACPI_VIDEO [=n]=n)
>> && (RFKILL [=n] || RFKILL [=n]=n) && SERIO_I8042 [=y]
>>

Right now it's possible to set dell laptop to compile in but this
causes dell-smbios to compile in which breaks if dcdbas is a module.

Dell laptop shouldn't select dell-smbios anymore, but depend on it.

Fixes: 32d7b19bad (platform/x86: dell-smbios: Resolve dependency error on DCDBAS)
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Cc: stable@vger.kernel.org
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-05-04 22:20:14 +02:00
João Paulo Rechi Vita 9f0a93de91 platform/x86: asus-wireless: Fix NULL pointer dereference
When the module is removed the led workqueue is destroyed in the remove
callback, before the led device is unregistered from the led subsystem.

This leads to a NULL pointer derefence when the led device is
unregistered automatically later as part of the module removal cleanup.
Bellow is the backtrace showing the problem.

  BUG: unable to handle kernel NULL pointer dereference at           (null)
  IP: __queue_work+0x8c/0x410
  PGD 0 P4D 0
  Oops: 0000 [#1] SMP NOPTI
  Modules linked in: ccm edac_mce_amd kvm_amd kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc aesni_intel aes_x86_64 joydev crypto_simd asus_nb_wmi glue_helper uvcvideo snd_hda_codec_conexant snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel asus_wmi snd_hda_codec cryptd snd_hda_core sparse_keymap videobuf2_vmalloc arc4 videobuf2_memops snd_hwdep input_leds videobuf2_v4l2 ath9k psmouse videobuf2_core videodev ath9k_common snd_pcm ath9k_hw media fam15h_power ath k10temp snd_timer mac80211 i2c_piix4 r8169 mii mac_hid cfg80211 asus_wireless(-) snd soundcore wmi shpchp 8250_dw ip_tables x_tables amdkfd amd_iommu_v2 amdgpu radeon chash i2c_algo_bit drm_kms_helper syscopyarea serio_raw sysfillrect sysimgblt fb_sys_fops ahci ttm libahci drm video
  CPU: 3 PID: 2177 Comm: rmmod Not tainted 4.15.0-5-generic #6+dev94.b4287e5bem1-Endless
  Hardware name: ASUSTeK COMPUTER INC. X555DG/X555DG, BIOS 5.011 05/05/2015
  RIP: 0010:__queue_work+0x8c/0x410
  RSP: 0018:ffffbe8cc249fcd8 EFLAGS: 00010086
  RAX: ffff992ac6810800 RBX: 0000000000000000 RCX: 0000000000000008
  RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff992ac6400e18
  RBP: ffffbe8cc249fd18 R08: ffff992ac6400db0 R09: 0000000000000000
  R10: 0000000000000040 R11: ffff992ac6400dd8 R12: 0000000000002000
  R13: ffff992abd762e00 R14: ffff992abd763e38 R15: 000000000001ebe0
  FS:  00007f318203e700(0000) GS:ffff992aced80000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000000000000 CR3: 00000001c720e000 CR4: 00000000001406e0
  Call Trace:
   queue_work_on+0x38/0x40
   led_state_set+0x2c/0x40 [asus_wireless]
   led_set_brightness_nopm+0x14/0x40
   led_set_brightness+0x37/0x60
   led_trigger_set+0xfc/0x1d0
   led_classdev_unregister+0x32/0xd0
   devm_led_classdev_release+0x11/0x20
   release_nodes+0x109/0x1f0
   devres_release_all+0x3c/0x50
   device_release_driver_internal+0x16d/0x220
   driver_detach+0x3f/0x80
   bus_remove_driver+0x55/0xd0
   driver_unregister+0x2c/0x40
   acpi_bus_unregister_driver+0x15/0x20
   asus_wireless_driver_exit+0x10/0xb7c [asus_wireless]
   SyS_delete_module+0x1da/0x2b0
   entry_SYSCALL_64_fastpath+0x24/0x87
  RIP: 0033:0x7f3181b65fd7
  RSP: 002b:00007ffe74bcbe18 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
  RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f3181b65fd7
  RDX: 000000000000000a RSI: 0000000000000800 RDI: 0000555ea2559258
  RBP: 0000555ea25591f0 R08: 00007ffe74bcad91 R09: 000000000000000a
  R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000003
  R13: 00007ffe74bcae00 R14: 0000000000000000 R15: 0000555ea25591f0
  Code: 01 00 00 02 0f 85 7d 01 00 00 48 63 45 d4 48 c7 c6 00 f4 fa 87 49 8b 9d 08 01 00 00 48 03 1c c6 4c 89 f7 e8 87 fb ff ff 48 85 c0 <48> 8b 3b 0f 84 c5 01 00 00 48 39 f8 0f 84 bc 01 00 00 48 89 c7
  RIP: __queue_work+0x8c/0x410 RSP: ffffbe8cc249fcd8
  CR2: 0000000000000000
  ---[ end trace 7aa4f4a232e9c39c ]---

Unregistering the led device on the remove callback before destroying the
workqueue avoids this problem.

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

Reported-by: Dun Hum <bitter.taste@gmx.com>
Cc: stable@vger.kernel.org
Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-05-04 22:20:02 +02:00
Luc Van Oostenryck 19e752052b platform/x86: apple-gmux: fix gmux_get_client_id()'s return type
The method struct vga_switcheroo_handler::get_client_id() is defined
as returning an 'enum vga_switcheroo_client_id' but the implementation
in this driver, gmux_get_client_id(), returns an 'int'.

Fix this by returning 'enum vga_switcheroo_client_id' in this driver too.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-04-24 19:55:33 +03:00
Mario Limonciello 6ed66c3ce0 platform/x86: Kconfig: Fix dell-laptop dependency chain.
As reported by Randy Dunlap:
>> WARNING: unmet direct dependencies detected for DELL_SMBIOS
>>   Depends on [m]: X86 [=y] && X86_PLATFORM_DEVICES [=y]
>>	&& (DCDBAS [=m] ||
>> DCDBAS [=m]=n) && (ACPI_WMI [=n] || ACPI_WMI [=n]=n)
>>   Selected by [y]:
>>   - DELL_LAPTOP [=y] && X86 [=y] && X86_PLATFORM_DEVICES [=y]
>> && DMI [=y]
>> && BACKLIGHT_CLASS_DEVICE [=y] && (ACPI_VIDEO [=n] ||
>>	ACPI_VIDEO [=n]=n)
>> && (RFKILL [=n] || RFKILL [=n]=n) && SERIO_I8042 [=y]
>>

Right now it's possible to set dell laptop to compile in but this
causes dell-smbios to compile in which breaks if dcdbas is a module.

Dell laptop shouldn't select dell-smbios anymore, but depend on it.

Fixes: 32d7b19bad (platform/x86: dell-smbios: Resolve dependency error on DCDBAS)
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Cc: stable@vger.kernel.org
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-04-23 08:52:59 -07:00
Wolfram Sang d605ca29c3 platform/x86: Simplify getting .drvdata
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-04-23 08:52:59 -07:00
João Paulo Rechi Vita 06b8b00b33 platform/x86: asus-wireless: Fix NULL pointer dereference
When the module is removed the led workqueue is destroyed in the remove
callback, before the led device is unregistered from the led subsystem.

This leads to a NULL pointer derefence when the led device is
unregistered automatically later as part of the module removal cleanup.
Bellow is the backtrace showing the problem.

  BUG: unable to handle kernel NULL pointer dereference at           (null)
  IP: __queue_work+0x8c/0x410
  PGD 0 P4D 0
  Oops: 0000 [#1] SMP NOPTI
  Modules linked in: ccm edac_mce_amd kvm_amd kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc aesni_intel aes_x86_64 joydev crypto_simd asus_nb_wmi glue_helper uvcvideo snd_hda_codec_conexant snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel asus_wmi snd_hda_codec cryptd snd_hda_core sparse_keymap videobuf2_vmalloc arc4 videobuf2_memops snd_hwdep input_leds videobuf2_v4l2 ath9k psmouse videobuf2_core videodev ath9k_common snd_pcm ath9k_hw media fam15h_power ath k10temp snd_timer mac80211 i2c_piix4 r8169 mii mac_hid cfg80211 asus_wireless(-) snd soundcore wmi shpchp 8250_dw ip_tables x_tables amdkfd amd_iommu_v2 amdgpu radeon chash i2c_algo_bit drm_kms_helper syscopyarea serio_raw sysfillrect sysimgblt fb_sys_fops ahci ttm libahci drm video
  CPU: 3 PID: 2177 Comm: rmmod Not tainted 4.15.0-5-generic #6+dev94.b4287e5bem1-Endless
  Hardware name: ASUSTeK COMPUTER INC. X555DG/X555DG, BIOS 5.011 05/05/2015
  RIP: 0010:__queue_work+0x8c/0x410
  RSP: 0018:ffffbe8cc249fcd8 EFLAGS: 00010086
  RAX: ffff992ac6810800 RBX: 0000000000000000 RCX: 0000000000000008
  RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff992ac6400e18
  RBP: ffffbe8cc249fd18 R08: ffff992ac6400db0 R09: 0000000000000000
  R10: 0000000000000040 R11: ffff992ac6400dd8 R12: 0000000000002000
  R13: ffff992abd762e00 R14: ffff992abd763e38 R15: 000000000001ebe0
  FS:  00007f318203e700(0000) GS:ffff992aced80000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000000000000 CR3: 00000001c720e000 CR4: 00000000001406e0
  Call Trace:
   queue_work_on+0x38/0x40
   led_state_set+0x2c/0x40 [asus_wireless]
   led_set_brightness_nopm+0x14/0x40
   led_set_brightness+0x37/0x60
   led_trigger_set+0xfc/0x1d0
   led_classdev_unregister+0x32/0xd0
   devm_led_classdev_release+0x11/0x20
   release_nodes+0x109/0x1f0
   devres_release_all+0x3c/0x50
   device_release_driver_internal+0x16d/0x220
   driver_detach+0x3f/0x80
   bus_remove_driver+0x55/0xd0
   driver_unregister+0x2c/0x40
   acpi_bus_unregister_driver+0x15/0x20
   asus_wireless_driver_exit+0x10/0xb7c [asus_wireless]
   SyS_delete_module+0x1da/0x2b0
   entry_SYSCALL_64_fastpath+0x24/0x87
  RIP: 0033:0x7f3181b65fd7
  RSP: 002b:00007ffe74bcbe18 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
  RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f3181b65fd7
  RDX: 000000000000000a RSI: 0000000000000800 RDI: 0000555ea2559258
  RBP: 0000555ea25591f0 R08: 00007ffe74bcad91 R09: 000000000000000a
  R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000003
  R13: 00007ffe74bcae00 R14: 0000000000000000 R15: 0000555ea25591f0
  Code: 01 00 00 02 0f 85 7d 01 00 00 48 63 45 d4 48 c7 c6 00 f4 fa 87 49 8b 9d 08 01 00 00 48 03 1c c6 4c 89 f7 e8 87 fb ff ff 48 85 c0 <48> 8b 3b 0f 84 c5 01 00 00 48 39 f8 0f 84 bc 01 00 00 48 89 c7
  RIP: __queue_work+0x8c/0x410 RSP: ffffbe8cc249fcd8
  CR2: 0000000000000000
  ---[ end trace 7aa4f4a232e9c39c ]---

Unregistering the led device on the remove callback before destroying the
workqueue avoids this problem.

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

Reported-by: Dun Hum <bitter.taste@gmx.com>
Cc: stable@vger.kernel.org
Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-04-23 08:52:59 -07:00
Mario Limonciello b004b21cc6 platform/x86: dell-smbios: Match on www.dell.com in OEM strings too
Sergey reported that some much older Dell systems don't support
the OEM string "Dell System" but instead supported www.dell.com
in OEM strings.

Match both of these to indicate that this driver is running on
a Dell system.

Reported-by: Sergey Kubushyn <ksi@koi8.net>
Tested-by: Sergey Kubushyn <ksi@koi8.net>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
[dvhart: Simplify DMI logic and eliminate unnecessary variables]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-04-23 08:52:59 -07:00
Jia-Ju Bai 8fddfb39a4 platform: x86: intel_scu_ipc: Replace mdelay with usleep_range in intel_scu_ipc_i2c_cntrl
intel_scu_ipc_i2c_cntrl() calls mutex_lock(), which indicates
this function is not called in atomic context.

Despite never getting called from atomic context,
intel_scu_ipc_i2c_cntrl() calls mdelay to busily wait.
This is not necessary and can be replaced with usleep_range to
avoid busy waiting.

This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-04-23 17:24:23 +03:00
Darren Hart (VMware) de15b94f87 platform/x86: fujitsu-laptop: Simplify soft key handling
The hardcoded BIT(X) used in the soft key handling can be confusing and
prone to errors.

Instead, use the status FLAG_* defines for the sparse keymap index.
Rather than check for each known bit, use a bitmask to filter for all
known soft keys, and use the for_each_set_bit iterator.

Cc: Jan-Marek Glogowski <glogow@fbihome.de>
Cc: Michał Kępień <kernel@kempniu.pl>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-04-19 16:25:54 -07:00
Linus Torvalds f6811370b9 Changes to chrome-platform for v4.17
Incorporates a series from Dmitry to remove platform data from
 chromeos_laptop.c, which was the only user of platform data
 for the atmel_mxt_ts driver.
 
 Includes a series to clean up sysfs and debugfs for cros_ec.
 
 Other misc. cleanups.
 
 Thanks,
 Benson
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE6gYDF28Li+nEiKLaHwn1ewov5lgFAlrP2NkACgkQHwn1ewov
 5lhd7RAAgueLytizaj9QlWgiq5mqN6OJ9z+QoipmCQlB2oqSAJZhWJ17BT91t+dW
 0V/xaV0qJ6k8ttcC2UiDAiyFrLk9T/7tYjcvqsNQPz4zMqRcKO73m92+hBcIWIFV
 X0DUyNvck1sE0lKgmvuKo+m8Rhtrf13gkYVeYp3RV21PiEaUmhn8hr88L83arnPu
 SHsk/PUS4cQo/Pwfgxc7Zh6jXDMByCw3oIBdmxbbNtZOnWBatmO2N20rn2yQC77d
 I/+n6zHgkTpZ2TpjtzYRxb9iW2NdgDwEDaJt/r57Nk+z0XEgYfvS8U+R/vYC4Lb8
 C6sIgAGP5gCv9wh9UJOC1+XlZRGeKHSLZkQRHqESV7K38aOLX7lQopwGR5USYimY
 KtUIknRJSZD/jiGyH8NW94u6RlxeoqLWP7GKERm8gGhOkTAqjvFfD5uBLZbEl9Ub
 Bk9HPIZ/Nq1mg0srGQjSuhgRFoub1MWriD6xthy9PfV0i72pxtRfIZuvhieCBvQ/
 Bi3HW05uMfXasuGOjsDJbCbTiKmISMtBC7B1XXE0ioUcZE2bnFyYBmL92E+Vck6q
 mxFmmdwHmbDrShaEmzWTnXRCA/06QABxWZK0S2IZWu/qy8+UP4OwxFFNvC+6vKNN
 utUBvmCYjt46CZ0q6JD9eeQ8E7lf0HMJh4DMManrB2fa7BAhLQQ=
 =mDkk
 -----END PGP SIGNATURE-----

Merge tag 'chrome-platform-for-linus-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform

Pull chrome platform updates from Benson Leung:

 - a series from Dmitry to remove platform data from chromeos_laptop.c,
   which was the only user of platform data for the atmel_mxt_ts driver.

 - a series to clean up sysfs and debugfs for cros_ec

 - other misc cleanups

* tag 'chrome-platform-for-linus-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform: (22 commits)
  platform/chrome: mfd/cros_ec_dev: Add sysfs entry to set keyboard wake lid angle
  platform/chrome: cros_ec_debugfs: Add PD port info to debugfs
  platform/chrome: cros_ec_debugfs: Use octal permissions '0444'
  platform/chrome: cros_ec_sysfs: use permission-specific DEVICE_ATTR variants
  platform/chrome: cros_ec_sysfs: introduce to_cros_ec_dev define.
  platform/chrome: cros_ec_sysfs: Modify error handling
  platform/chrome: cros_ec_lpc: Add support for Google devices using custom coreboot firmware
  platform/chrome: cros_ec_lpc: wake up from s2idle on Chrome EC
  Input: atmel_mxt_ts - remove platform data support
  platform/chrome: chromeos_laptop - discard data for unneeded boards
  platform/chrome: chromeos_laptop - use device properties for Pixel
  platform/chrome: chromeos_laptop - rely on I2C to set up interrupt trigger
  platform/chrome: chromeos_laptop - use I2C notifier to create devices
  platform/chrome: chromeos_laptop - parse DMI IRQ data once
  platform/chrome: chromeos_laptop - rework i2c peripherals initialization
  platform/chrome: chromeos_laptop - factor out getting IRQ from DMI
  platform/chrome: chromeos_laptop - introduce pr_fmt()
  platform/chrome: chromeos_laptop - stop setting suspend mode for Atmel devices
  platform/chrome: chromeos_laptop - add SPDX identifier
  Input: atmel_mxt_ts - switch ChromeOS ACPI devices to generic props
  ...
2018-04-13 16:20:36 -07:00
Benson Leung c171d3b8a6
Merge remote-tracking branch 'origin/ib-chrome-platform-cros-ec-sysfs-debugfs-for-v4.17' into working-branch-for-4.17
Merging Enric's cros-ec sysfs and debugfs fixes from immutable branch.

Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-10 22:30:34 -07:00
Gwendal Grignou c1d1e91aff
platform/chrome: mfd/cros_ec_dev: Add sysfs entry to set keyboard wake lid angle
This adds a sysfs attribute (/sys/class/chromeos/cros_ec/kb_wake_angle)
used to set and get the keyboard wake lid angle. This attribute is
present only if 2 accelerometers are controlled by the EC.

This patch also moves the cros_ec features check before the device is
added so the features map obtained from the EC is ready on time.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-10 22:25:07 -07:00
Shawn Nematbakhsh b082b2e145
platform/chrome: cros_ec_debugfs: Add PD port info to debugfs
Add info useful for debugging USB-PD port state.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-10 22:24:51 -07:00
Enric Balletbo i Serra f63192800e
platform/chrome: cros_ec_debugfs: Use octal permissions '0444'
Fixed the following checkpatch warning:

    WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider
    using octal permissions '0444'.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-10 22:24:16 -07:00
Enric Balletbo i Serra 7d800c99ec
platform/chrome: cros_ec_sysfs: use permission-specific DEVICE_ATTR variants
Use DEVICE_ATTR variants for read/write attributes. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-10 22:23:48 -07:00
Enric Balletbo i Serra 93afebbe69
platform/chrome: cros_ec_sysfs: introduce to_cros_ec_dev define.
Add a define to get the cros_ec_dev from device and use it.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-10 22:22:49 -07:00
Gwendal Grignou 311394248c
platform/chrome: cros_ec_sysfs: Modify error handling
When accessing a sysfs attribute, if the EC command fails, -EPROTO is
now returned instead of an error message as it is unlikely an app is
parsing the error message to do something meaningful.
Also, this patch makes use of cros_ec_cmd_xfer_status() instead of
cros_ec_cmd_xfer() so an error message is printed in the syslog.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-10 22:22:34 -07: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
Benson Leung 72655f6cf7 Merge remote-tracking branch 'chrome-platform-stop-being-a-platform-driver-plus-atmel_mxt_ts-for-v4.17' into working-branch-for-4.17 2018-04-09 23:00:04 -07:00
Salvatore Bellizzi f56db262e4 platform/chrome: cros_ec_lpc: Add support for Google devices using custom coreboot firmware
This patch adds generic device information to the DMI table of
the cros_ec_lpc driver, needed for Chromebooks/boxes using a
custom coreboot firmware.

The DMI info would not contain "Google_*" as BIOS version string,
instead the system vendor string would still be "GOOGLE", so this
seems to be a reasonable match for every Chromebook/box running
a custom firmware.

Signed-off-by: Salvatore Bellizzi <lkml@seppia.net>
Signed-off-by: Vittorio Gambaletta <linuxbugs@vittgam.net>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09 22:57:46 -07:00
Wenkai Du d6542b3916 platform/chrome: cros_ec_lpc: wake up from s2idle on Chrome EC
Chrome platform installed a Chrome EC notify handler which prevents
default EC GPE handler getting called. Add pm_system_wakeup to the
Chrome EC notify handler so wake up from s2idle can happen.

Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Wenkai Du <wenkai.du@intel.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09 22:57:46 -07:00
Dmitry Torokhov c0bb0608ec platform/chrome: chromeos_laptop - discard data for unneeded boards
Mark board data as __intconst/__initdata and make a copy of appropriate
entry once we identified the board we are running on. The rest of the data
will be discarded once the kernel finished booting (or module finished
loading).

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09 22:52:17 -07:00
Dmitry Torokhov f00c1d199e platform/chrome: chromeos_laptop - use device properties for Pixel
Now that Atmel driver uses generic device properties we can use them
instead of platform data when setting up touchpad on the original
Google Pixel.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09 22:51:22 -07:00
Dmitry Torokhov e6215eeaa2 platform/chrome: chromeos_laptop - rely on I2C to set up interrupt trigger
Instead of passing interrupt flags via platform data to drivers, or
hoping that drivers will do the right thing and set it up the way we
need, let's set up IRQ resource and attach it to the I2C board info, and
let I2C core set it up for us.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09 22:49:59 -07:00
Dmitry Torokhov 8d88cb03c2 platform/chrome: chromeos_laptop - use I2C notifier to create devices
Instead of using platform device and deferrals to handle the case when i2C
adapters appear late in the game, and not handling device unbinding all
that well, let's switch to using I2C bus notifier to get told when a new
I2C adapter appears in the system, and attempt to add appropriate devices
at that time.

In case when we have 2 Designware adapters in the system (Acer C720),
instead of counting and hoping they get enumerate din the right order,
let's switch to using their PCI devids (slot/function) that should be
stable.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09 22:46:09 -07:00
Dmitry Torokhov 65582920d7 platform/chrome: chromeos_laptop - parse DMI IRQ data once
Instead of trying to parse DMI IRQ data every time we try to instantiate a
device, let's do it once, when we identify the device we are working with.
This allows us to mark chromeos_laptop_get_irq_from_dmi() as __init and
discard it once module is initialized.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09 22:44:53 -07:00
Dmitry Torokhov 28cd38f105 platform/chrome: chromeos_laptop - rework i2c peripherals initialization
Instead of having separate setup() functions responsible for instantiating
i2c client for each peripheral, let's generalize the behavior and use
common code for instantiating all i2c peripherals.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09 22:39:49 -07:00
Dmitry Torokhov ab6c5600d8 platform/chrome: chromeos_laptop - factor out getting IRQ from DMI
This will make code instantiating I2C device a bit clearer.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09 22:38:04 -07:00
Dmitry Torokhov 4f27f677c9 platform/chrome: chromeos_laptop - introduce pr_fmt()
Define pr_fmt() to standardize driver messages.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09 22:38:04 -07:00
Dmitry Torokhov ed58f90c11 platform/chrome: chromeos_laptop - stop setting suspend mode for Atmel devices
Atmel touch controller driver no longer respects suspend mode specified in
platform data, so let's stop setting it.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09 22:38:04 -07:00
Dmitry Torokhov 203e0baedb platform/chrome: chromeos_laptop - add SPDX identifier
Replace the original license statement with the SPDX identifier.
Add also one line of description as recommended by the COPYING file.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09 22:38:04 -07:00
Linus Torvalds 672a9c1069 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree updates from Jiri Kosina.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
  kfifo: fix inaccurate comment
  tools/thermal: tmon: fix for segfault
  net: Spelling s/stucture/structure/
  edd: don't spam log if no EDD information is present
  Documentation: Fix early-microcode.txt references after file rename
  tracing: Block comments should align the * on each line
  treewide: Fix typos in printk
  GenWQE: Fix a typo in two comments
  treewide: Align function definition open/close braces
2018-04-05 11:56:35 -07:00
Linus Torvalds ac9053d2dc USB/PHY patches for 4.17-rc1
Here is the big set of USB and PHY driver patches for 4.17-rc1.
 
 Lots of USB typeC work happened this round, with code moving from the
 staging directory into the "real" part of the kernel, as well as new
 infrastructure being added to be able to handle the different types of
 "roles" that typeC requires.
 
 There is also the normal huge set of USB gadget controller and driver
 updates, along with XHCI changes, and a raft of other tiny fixes all
 over the USB tree.  And the PHY driver updates are merged in here as
 well as they interacted with the USB drivers in some places.
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWsSpJw8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ylGawCdED2xS3HUxOIqfh81d8B1py8ji04AoJXdLAsH
 JgwXbdbibZBabYTVi5s5
 =LrRH
 -----END PGP SIGNATURE-----

Merge tag 'usb-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB/PHY updates from Greg KH:
 "Here is the big set of USB and PHY driver patches for 4.17-rc1.

  Lots of USB typeC work happened this round, with code moving from the
  staging directory into the "real" part of the kernel, as well as new
  infrastructure being added to be able to handle the different types of
  "roles" that typeC requires.

  There is also the normal huge set of USB gadget controller and driver
  updates, along with XHCI changes, and a raft of other tiny fixes all
  over the USB tree. And the PHY driver updates are merged in here as
  well as they interacted with the USB drivers in some places.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'usb-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (250 commits)
  Revert "USB: serial: ftdi_sio: add Id for Physik Instrumente E-870"
  usb: musb: gadget: misplaced out of bounds check
  usb: chipidea: imx: Fix ULPI on imx53
  usb: chipidea: imx: Cleanup ci_hdrc_imx_platform_flag
  usb: chipidea: usbmisc: small clean up
  usb: chipidea: usbmisc: evdo can be set e/o reset
  usb: chipidea: usbmisc: evdo is only specific to OTG port
  USB: serial: ftdi_sio: add Id for Physik Instrumente E-870
  usb: dwc3: gadget: never call ->complete() from ->ep_queue()
  usb: gadget: udc: core: update usb_ep_queue() documentation
  usb: host: Remove the deprecated ATH79 USB host config options
  usb: roles: Fix return value check in intel_xhci_usb_probe()
  USB: gadget: f_midi: fixing a possible double-free in f_midi
  usb: core: Add USB_QUIRK_DELAY_CTRL_MSG to usbcore quirks
  usb: core: Copy parameter string correctly and remove superfluous null check
  USB: announce bcdDevice as well as idVendor, idProduct.
  USB:fix USB3 devices behind USB3 hubs not resuming at hibernate thaw
  usb: hub: Reduce warning to notice on power loss
  USB: serial: ftdi_sio: add support for Harman FirmwareHubEmulator
  USB: serial: cp210x: add ELDAT Easywave RX09 id
  ...
2018-04-04 17:55:35 -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
Dan Carpenter 0e5b09b165 platform/x86: dell-smbios: Fix memory leaks in build_tokens_sysfs()
We're freeing "value_name" which is NULL, so that's a no-op, but we
intended to free "location_name" instead.  And then we don't free the
names in token_location_attrs[0] and token_value_attrs[0].

Fixes: 33b9ca1e53 ("platform/x86: dell-smbios: Add a sysfs interface for SMBIOS tokens")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-04-02 18:28:45 +03:00
Alex Hung 2b5de0cc1f intel-hid: support KEY_ROTATE_LOCK_TOGGLE
KEY_ROTATE_LOCK_TOGGLE is introduced in 4.16 rc1 and this key event is
emitted on Wacom MobileStudio Pro 13.

Signed-off-by: Alex Hung <alex.hung@canonical.com>
Co-developed-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-04-02 18:26:59 +03:00
Alex Hung 28e8ed2a01 intel-hid: clean up and sort header files
Removed unused header files and sorted them alphabetically. No
functional changes are made.

Signed-off-by: Alex Hung <alex.hung@canonical.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-04-02 17:54:42 +03:00
Hans de Goede 24e2bb311f platform/x86: silead_dmi: Add entry for the Yours Y8W81 tablet
Add an entry with touchscreen info for the Yours Y8W81 8" tablet.

This tablet has the same case and mostly the same internals as the Chuwi
Vi8. Both seem to be from an ODM called inet-tek. Both are labelled:
"INET-I86M-REVxx" on the PCB, with the Chuwi Vi8 being REV03 (and having
an ALC5640 audio codec) and the Yours Y8W81 being REV21 (and having an
ALC5651 audio codec). The wifi, accelerometer and touchscreen are
identical on both.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-04-02 17:31:50 +03:00
Rafael J. Wysocki 0c9ed61bdd Merge branches 'acpi-battery', 'acpi-doc' and 'acpi-pmic'
* acpi-battery:
  Revert "ACPI: battery: Add the ThinkPad "Not Charging" quirk"
  ACPI: battery: do not export degraded capacity values over 100
  ACPI: battery: make function __battery_hook_unregister() static
  ACPI: battery: Add the ThinkPad "Not Charging" quirk
  thinkpad_acpi: Add support for battery thresholds
  power: add to_power_supply macro to the API
  battery: Add the battery hooking API

* acpi-doc:
  ACPI: sysfs: Update device object sysfs documentation

* acpi-pmic:
  ACPI / PMIC: Replace license boilerplate with SPDX license identifier
2018-04-02 10:58:13 +02:00
Joe Perches 447a5647c9 treewide: Align function definition open/close braces
Some functions definitions have either the initial open brace and/or
the closing brace outside of column 1.

Move those braces to column 1.

This allows various function analyzers like gnu complexity to work
properly for these modified functions.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-03-26 11:13:09 +02:00
Jan-Marek Glogowski 797195a376 platform/x86: fujitsu-laptop: Support Lifebook U7x7 hotkeys
Generate input events for hotkeys present in Fujitsu Lifebook
U727 and U757 laptops:
  - Fn+F1 (KEY_MICMUTE)
  - Fn+F5 (KEY_RFKILL)

Signed-off-by: Jan-Marek Glogowski <glogow@fbihome.de>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-23 16:14:29 -07:00
Vadim Pasternak ef0f62264b platform/x86: mlx-platform: Add physical bus number auto detection
mlx-platform does not provide a bus number to i2c-mlxcpld, assuming it
is always one. On some x86 systems, other i2c drivers may probe before
i2c-mlxcpld, causing bus one to be busy.

Make mlx-platform determine which adapter number is free prior to
activating i2c-mlxpld, adjusting the mux base numbers accordingly.
Update the mlxreg-hotplug pdata similarly.

This adds an explicit mlx-platform build dependency on I2C, update the
Kconfig accordingly. Add the missing REGMAP dependency while we're at
it.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
[dvhart: Rewrite commit message more concisely]
[dvhart: Add build dependencies]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-23 16:14:29 -07:00
Vadim Pasternak f709e1bfb0 platform/mellanox: mlxreg-hotplug: Change input for device create routine
Change the first input parameter in mlxreg_hotplug_device_create to the
pointer to mlxreg_hotplug private data in order to use the fields from
the private data structure.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
[dvhart: Cleaned up commit message]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-23 16:14:28 -07:00
Vadim Pasternak d726f6b199 platform/x86: mlx-platform: Add deffered bus functionality
mlx-platform activates i2c-mux-reg, which creates buses needed by
mlxreg-hotplug. If the mlxreg-hotplug probe runs before the i2c-mux-reg
probe completes, it may attempt to connect a device to an adapter number
that has not been created yet, and fail.

Make mlx-platform driver record the highest bus number in mlxreg-hotplug
platform data and defer mlxreg-hotplug probe until all the buses are
created.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
[dvhart: rewrite commit message more concisely]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-23 16:14:28 -07:00
Vadim Pasternak d066f144d6 platform/x86: mlx-platform: Use define for the channel numbers
Add define for the channels number for mux device, instead of using
hardcoded value inside the code in order to improve code readability.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-23 16:14:27 -07:00
Hans de Goede 29b4aec2f4 platform/x86: intel_cht_int33fe: Add device connections for the Type-C port
We need to add device-connections for the Type-C mux/switch and usb-role
code to be able to find the PI3USB30532 Type-C cross-switch and the
device/host role-switch integrated in the CHT SoC.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-22 13:49:28 +01:00
Michał Kępień 502ab004e6 platform/x86: fujitsu-laptop: Revert UNSUPPORTED_CMD back to an int
UNSUPPORTED_CMD was previously 0x80000000 (int), but commit 819cddae7c
("platform/x86: fujitsu-laptop: Clean up constants") changed it into an
unsigned long due to BIT() being used to define it.  As call_fext_func()
returns an int, 0x80000000 would get type promoted when compared to an
unsigned long, which on a 64-bit system would cause it to become
0xffffffff80000000 due to sign extension.  This causes one logical
condition in fujitsu-laptop to always be true and another one to always
be false on 64-bit systems.  Fix this by reverting UNSUPPORTED_CMD back
to an int.

This patch fixes the following smatch warnings:

drivers/platform/x86/fujitsu-laptop.c:763 acpi_fujitsu_laptop_leds_register() warn: always true condition '(call_fext_func(device, ((1 << (12)) | (1 << (0))), 2, (1 << (16)), 0) != (1 << (31))) => (s32min-s32max != 2147483648)'
drivers/platform/x86/fujitsu-laptop.c:816 acpi_fujitsu_laptop_add() warn: impossible condition '(priv->flags_supported == (1 << (31))) => (0-2147483647,18446744071562067968-u64max == 2147483648)'

Fixes: 819cddae7c ("platform/x86: fujitsu-laptop: Clean up constants")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-21 16:28:14 -07:00
Linus Torvalds 274a1ff070 platform-drivers-x86 for v4.16-7
DELL_SMBIOS conditionally depends on ACPI_WMI in the same way it depends
 on DCDBAS, update the Kconfig accordingly. Correct the driver init order
 to ensure that the driver dependencies are met, avoiding race conditions
 resulting in boot failure on certain systems when the drivers are
 built-in.
 
 The following is an automated git shortlog grouped by driver:
 
 dell-smbios and related drivers:
  - Fix dell driver init order
  - Resolve dependency error on ACPI_WMI
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJaqWWlAAoJEKbMaAwKp364y2gH/RUWyV2snZKLQNSzi9w5xdxb
 G99n0Hsy5ugUcnqDx6jK7Hgy0Lm7D7Gs4+ePlY0AuPZN99ywTNfUQkr6Tbdns/wv
 CKJtToA6DRh/fbvHDbNMsFEiv9a/Xdf21925K73KWqTN6RK/dWZVffafvRh0UmQe
 ffGYccVNdxsOI4e8qNzk2++3QfxSsH97nDHDFDVA0lRWdKljK3DJTSzeUOhoRErf
 YsyjUydVcnmlLmaoDt6xNAJIYcSqUqKwvIgX20hbeBYRBDLLZyjSpDjSW0F3NT2H
 LZKq3hBoVzyp9ta3uZEwIZIdBk+5prR44ugFZZjOVsr7xvaMcKczerDPQEw9lgo=
 =WjAI
 -----END PGP SIGNATURE-----

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

Pull x86 platform drives fixes from Darren Hart:

 - DELL_SMBIOS conditionally depends on ACPI_WMI in the same way it
   depends on DCDBAS, update the Kconfig accordingly.

 - fix the dell driver init order to ensure that the driver dependencies
   are met, avoiding race conditions resulting in boot failure on
   certain systems when the drivers are built-in.

* tag 'platform-drivers-x86-v4.16-7' of git://git.infradead.org/linux-platform-drivers-x86:
  platform/x86: Fix dell driver init order
  platform/x86: dell-smbios: Resolve dependency error on ACPI_WMI
2018-03-14 13:01:14 -07:00
Darren Hart (VMware) 49368c1321 platform/x86: Fix dell driver init order
Update the initcall ordering to satisfy the following dependency
ordering:

1. DCDBAS, ACPI_WMI
2. DELL_SMBIOS, DELL_RBTN
3. DELL_LAPTOP, DELL_WMI

By assigning them to the following initcall levels:

subsys_initcall: DCDBAS, ACPI_WMI
module_init: DELL_SMBIOS, DELL_RBTN
late_initcall: DELL_LAPTOP, DELL_WMI

Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Mario.Limonciello@dell.com
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-14 11:05:53 -07:00
Darren Hart 75073a64a9 platform/x86: dell-smbios: Resolve dependency error on ACPI_WMI
Similarly to DCDBAS for DELL_SMBIOS_SMM, if DELL_SMBIOS_WMI is enabled,
DELL_SMBIOS becomes dependent on ACPI_WMI. Update the depends lines to
prevent a configuration where DELL_SMBIOS=y and either backend
dependency =m. Update the comment accordingly.

Cc: Mario Limonciello <mario.limonciello@dell.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-14 11:05:43 -07:00
Darren Hart (VMware) 7129707ec2 platform/x86: Fix dell driver init order
Update the initcall ordering to satisfy the following dependency
ordering:

1. DCDBAS, ACPI_WMI
2. DELL_SMBIOS, DELL_RBTN
3. DELL_LAPTOP, DELL_WMI

By assigning them to the following initcall levels:

subsys_initcall: DCDBAS, ACPI_WMI
module_init: DELL_SMBIOS, DELL_RBTN
late_initcall: DELL_LAPTOP, DELL_WMI

Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Mario.Limonciello@dell.com
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-14 10:48:06 -07:00
Darren Hart 4716007c23 platform/x86: dell-smbios: Resolve dependency error on ACPI_WMI
Similarly to DCDBAS for DELL_SMBIOS_SMM, if DELL_SMBIOS_WMI is enabled,
DELL_SMBIOS becomes dependent on ACPI_WMI. Update the depends lines to
prevent a configuration where DELL_SMBIOS=y and either backend
dependency =m. Update the comment accordingly.

Cc: Mario Limonciello <mario.limonciello@dell.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-12 13:31:38 -07:00
Linus Torvalds b3337a6c35 platform-drivers-x86 for v4.16-6
Correct a module loading race condition between the DELL_SMBIOS backend
 modules and the first user by converting them to bool features of the
 DELL_SMBIOS driver. Fixup the resulting Kconfig dependency issue with
 DCDBAS.
 
 The following is an automated git shortlog grouped by driver:
 
  -  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
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJaot3AAAoJEKbMaAwKp364dmgIAIfHTsJK43WBdhiA8t+ZR2eI
 vW6gWOmTR0srhybgBFh+yNd0ljH4Ogb/JUrFuF6cemtpWxTJC+KS0gZWbHFw/5w5
 OsovY0/8AVtC7IFVe0HH3w3fZwsGGq4H/LU1K580cRF/YYzMVXnr2ASkIqn/EUzS
 voeAuL23JYvq+ByAqqKmA3tN7/+YpMrt5MPkJHk/MGnGxspTapcMvEK/fkYSlDWa
 MpWuKWqfFMM02sV37zyNQYaU64+5/FtGL/2OwsuMD6OgCism+FS/gPhR1JYLtPbd
 GKJoSfWqn2cMnLTA+1V9ya0zvGAwK4AdIoe4Cjg49pITXZneNfw+NzoQUe12Yg4=
 =FAX7
 -----END PGP SIGNATURE-----

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

Pull x86 platform driver fixes from Darren Hart:
 "Correct a module loading race condition between the DELL_SMBIOS
  backend modules and the first user by converting them to bool features
  of the DELL_SMBIOS driver. Fixup the resulting Kconfig dependency
  issue with DCDBAS"

* tag 'platform-drivers-x86-v4.16-6' of git://git.infradead.org/linux-platform-drivers-x86:
  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
2018-03-10 08:35:29 -08:00
Darren Hart (VMware) 32d7b19bad platform/x86: dell-smbios: Resolve dependency error on DCDBAS
When the DELL_SMBIOS_SMM backend is enabled, the DELL_SMBIOS symbol
depends on DELL_DCDBAS, and we must avoid the situation where
DELL_SMBIOS=y and DCDBAS=m.

Adding the conditional dependency to DELL_SMBIOS such as:

depends !DELL_SMBIOS_SMM || (DCDBAS || DCDBAS=n)

results in the Kconfig tooling complaining about a circular dependency,
although it appears to work in practice.

Avoid the errors by simplifying the dependency and forcing DELL_SMBIOS
to be <= DCDBAS if DCDBAS is enabled (thanks to Greg KH for the
suggestion).

Cc: Mario.Limonciello@dell.com
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-09 09:35:46 -08:00
Darren Hart (VMware) 329d58b890 platform/x86: Allow for SMBIOS backend defaults
Avoid accidental configurations by setting default y for DELL_SMBIOS
backends. Avoid this impacting the default build size, by making them
dependent on DELL_SMBIOS, so they only appear when DELL_SMBIOS is
manually selected, or by DELL_LAPTOP or DELL_WMI.

While DELL_SMBIOS does have a prompt, it does not have any dependencies.
Keeping DELL_SMBIOS visible, despite being "select"ed by DELL_LAPTOP and
DELL_WMI, is a deliberate choice to provide context for the WMI and SMM
backends, which would otherwise appear to float without context within
the menu.

Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-09 09:35:44 -08:00
Mario Limonciello 25d47027e1 platform/x86: dell-smbios: Link all dell-smbios-* modules together
Some race conditions were raised due to dell-smbios and its backends
not being ready by the time that a consumer would call one of the
exported methods.

To avoid this problem, guarantee that all initialization has been
done by linking them all together and running init for them all.

As part of this change the Kconfig needs to be adjusted so that
CONFIG_DELL_SMBIOS_SMM and CONFIG_DELL_SMBIOS_WMI are boolean
rather than modules.

CONFIG_DELL_SMBIOS is a visually selectable option again and both
CONFIG_DELL_SMBIOS_WMI and CONFIG_DELL_SMBIOS_SMM are optional.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
[dvhart: Update prompt and help text for DELL_SMBIOS_* backends]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-09 09:35:42 -08:00
Mario Limonciello 94f77cb168 platform/x86: dell-smbios: Rename dell-smbios source to dell-smbios-base
This is being done to faciliate a later change to link all the dell-smbios
drivers together.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-09 09:35:30 -08:00
Mario Limonciello b53539625e platform/x86: dell-smbios: Correct some style warnings
WARNING: function definition argument 'struct calling_interface_buffer *'
should also have an identifier name
+       int (*call_fn)(struct calling_interface_buffer *);

WARNING: Block comments use * on subsequent lines
+       /* 4 bytes of table header, plus 7 bytes of Dell header,
	plus at least
+          6 bytes of entry */

WARNING: Block comments use a trailing */ on a separate line
+          6 bytes of entry */

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-09 09:35:16 -08:00
Darren Hart (VMware) cc69c88fbe platform/x86: dell-smbios: Resolve dependency error on DCDBAS
When the DELL_SMBIOS_SMM backend is enabled, the DELL_SMBIOS symbol
depends on DELL_DCDBAS, and we must avoid the situation where
DELL_SMBIOS=y and DCDBAS=m.

Adding the conditional dependency to DELL_SMBIOS such as:

depends !DELL_SMBIOS_SMM || (DCDBAS || DCDBAS=n)

results in the Kconfig tooling complaining about a circular dependency,
although it appears to work in practice.

Avoid the errors by simplifying the dependency and forcing DELL_SMBIOS
to be <= DCDBAS if DCDBAS is enabled (thanks to Greg KH for the
suggestion).

Cc: Mario.Limonciello@dell.com
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-08 13:37:26 -08:00
Dmitry Torokhov fc88bbdae0 Revert "platform/chrome: chromeos_laptop: make chromeos_laptop const"
This reverts commit a376cd9160 because
chromeos_laptop instances should not be marked as "const" (at this
time), since i2c_peripheral is being modified (we change "state" and
"tries") when we instantiate devices.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-03-07 21:18:04 -08:00
Darren Hart (VMware) c715e43455 platform/x86: Allow for SMBIOS backend defaults
Avoid accidental configurations by setting default y for DELL_SMBIOS
backends. Avoid this impacting the default build size, by making them
dependent on DELL_SMBIOS, so they only appear when DELL_SMBIOS is
manually selected, or by DELL_LAPTOP or DELL_WMI.

While DELL_SMBIOS does have a prompt, it does not have any dependencies.
Keeping DELL_SMBIOS visible, despite being "select"ed by DELL_LAPTOP and
DELL_WMI, is a deliberate choice to provide context for the WMI and SMM
backends, which would otherwise appear to float without context within
the menu.

Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-05 15:35:33 -08:00
Mario Limonciello 41e36f2f85 platform/x86: dell-smbios: Link all dell-smbios-* modules together
Some race conditions were raised due to dell-smbios and its backends
not being ready by the time that a consumer would call one of the
exported methods.

To avoid this problem, guarantee that all initialization has been
done by linking them all together and running init for them all.

As part of this change the Kconfig needs to be adjusted so that
CONFIG_DELL_SMBIOS_SMM and CONFIG_DELL_SMBIOS_WMI are boolean
rather than modules.

CONFIG_DELL_SMBIOS is a visually selectable option again and both
CONFIG_DELL_SMBIOS_WMI and CONFIG_DELL_SMBIOS_SMM are optional.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
[dvhart: Update prompt and help text for DELL_SMBIOS_* backends]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-02 16:56:45 -08:00
Mario Limonciello ec34fe3859 platform/x86: dell-smbios: Rename dell-smbios source to dell-smbios-base
This is being done to faciliate a later change to link all the dell-smbios
drivers together.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-02 16:11:02 -08:00
Mario Limonciello 98c76a3904 platform/x86: dell-smbios: Correct some style warnings
WARNING: function definition argument 'struct calling_interface_buffer *'
should also have an identifier name
+       int (*call_fn)(struct calling_interface_buffer *);

WARNING: Block comments use * on subsequent lines
+       /* 4 bytes of table header, plus 7 bytes of Dell header,
	plus at least
+          6 bytes of entry */

WARNING: Block comments use a trailing */ on a separate line
+          6 bytes of entry */

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-02 16:11:02 -08:00
Joe Perches 1cedc6385d platform/x86: wmi: Fix misuse of vsprintf extension %pULL
%pULL doesn't officially exist but %pUL does.

Miscellanea:

o Add missing newlines to a couple logging messages

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-01 10:01:39 -08:00
Joe Perches 501f7e52de platform/x86: wmi: Fix misuse of vsprintf extension %pULL
%pULL doesn't officially exist but %pUL does.

Miscellanea:

o Add missing newlines to a couple logging messages

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-03-01 09:57:04 -08:00
Rafael J. Wysocki 38c08aa54b platform/x86: intel-hid: Reset wakeup capable flag on removal
The intel-hid device will not be able to wake up the system any more
after removing the notify handler provided by its driver, so make
its sysfs attributes reflect that.

Fixes: ef884112e5 (platform: x86: intel-hid: Wake up the system from suspend-to-idle)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-03-01 13:08:25 +02:00
Rafael J. Wysocki b758dbd576 platform/x86: intel-vbtn: Reset wakeup capable flag on removal
The intel-vbtn device will not be able to wake up the system any more
after removing the notify handler provided by its driver, so make
its sysfs attributes reflect that.

Fixes: 91f9e850d4 (platform: x86: intel-vbtn: Wake up the system from suspend-to-idle)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-03-01 13:08:25 +02:00
Rafael J. Wysocki 356b57752c platform/x86: intel-hid: Reset wakeup capable flag on removal
The intel-hid device will not be able to wake up the system any more
after removing the notify handler provided by its driver, so make
its sysfs attributes reflect that.

Fixes: ef884112e5 (platform: x86: intel-hid: Wake up the system from suspend-to-idle)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-28 14:26:27 +02:00
Rafael J. Wysocki 250b044e1a platform/x86: intel-vbtn: Reset wakeup capable flag on removal
The intel-vbtn device will not be able to wake up the system any more
after removing the notify handler provided by its driver, so make
its sysfs attributes reflect that.

Fixes: 91f9e850d4 (platform: x86: intel-vbtn: Wake up the system from suspend-to-idle)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-28 14:26:27 +02:00
Mario Limonciello de9647efea platform/x86: intel-vbtn: Only activate tablet mode switch on 2-in-1's
Some laptops such as the XPS 9360 support the intel-vbtn INT33D6
interface but don't initialize the bit that intel-vbtn uses to
represent switching tablet mode.

By running this only on real 2-in-1's it shouldn't cause false
positives.

Fixes: 30323fb6d5 ("Support tablet mode switch")
Reported-by: Jeremy Cline <jeremy@jcline.org>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Tested-by: Jeremy Cline <jeremy@jcline.org>
Tested-by: Darren Hart (VMware) <dvhart@infradead.org>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-25 08:02:40 -08:00
Mario Limonciello 027d50ccd6 platform/x86: intel-vbtn: Only activate tablet mode switch on 2-in-1's
Some laptops such as the XPS 9360 support the intel-vbtn INT33D6
interface but don't initialize the bit that intel-vbtn uses to
represent switching tablet mode.

By running this only on real 2-in-1's it shouldn't cause false
positives.

Fixes: 30323fb6d5 ("Support tablet mode switch")
Reported-by: Jeremy Cline <jeremy@jcline.org>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Tested-by: Jeremy Cline <jeremy@jcline.org>
Tested-by: Darren Hart (VMware) <dvhart@infradead.org>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-24 13:37:37 -08:00
Michał Kępień 819cddae7c platform/x86: fujitsu-laptop: Clean up constants
Align all constant values defined in the module to a common indentation.
Rename ACPI_FUJITSU_NOTIFY_CODE1 to ACPI_FUJITSU_NOTIFY_CODE as there is
only one ACPI notification code used throughout the driver.  Define all
bitmasks using the BIT() macro.  Clean up comments.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-24 13:37:36 -08:00
Michał Kępień 2f60efa1e4 platform/x86: fujitsu-laptop: Define constants for backlight power control
Use named constants instead of integers in call_fext_func() invocations
related to backlight power control in order to more clearly convey the
intent of each call.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-24 13:37:36 -08:00
Michał Kępień 7e6f97959a platform/x86: fujitsu-laptop: Do not include linux/slab.h
Do not include linux/slab.h as all module code now uses managed memory
allocations and thus neither k*alloc() nor kfree() is used.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-24 13:37:36 -08:00
Michał Kępień 6cb1192f56 platform/x86: fujitsu-laptop: Clearly distinguish module parameters
In order to improve code clarity, move declarations of variables that
are module parameters higher up and add a comment.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-24 13:37:36 -08:00
Michał Kępień 7f83d41044 platform/x86: fujitsu-laptop: Simplify error paths
Replace the last few lines of acpi_fujitsu_bl_add() with a simple return
in order to improve code readability without changing the logic.

As acpi_fujitsu_laptop_add() uses a managed memory allocation for
device-specific data, it is fine to just return immediately upon kfifo
allocation failure.  Do that instead of jumping to the end of the
function to improve code readability.  Running out of memory while
allocating the kfifo does not seem probable enough to warrant logging an
error message, so do not do it.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-24 13:37:36 -08:00
Michał Kępień a7a1ccbee3 platform/x86: fujitsu-laptop: Defer input device registration
Only register input devices after the device-specific data structures
they access are fully initialized.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-24 13:37:35 -08:00
Michał Kępień 14966e0277 platform/x86: fujitsu-laptop: Unify local variable naming
Different functions in the module use varying names (error, result,
status) for a local variable storing the return value of a function call
that has to be checked for errors.  Use a common name (ret) for all
these local variables to improve code consistency.  Merge integer
variable declarations in acpi_fujitsu_laptop_add() into one line.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-24 13:37:35 -08:00
Hans de Goede 5488bfdf9f platform/x86: silead_dmi: Add DMI match for the I.T.Works TW701 tablet
The I.T.Works TW701 7" tablet is a differently branded version of the
same generic 7" Windows tablet as the Trekstor ST70416-6. Add a DMI
match-table entry for it pointing to the Trekstor's touchscreen info.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-23 18:43:42 +02:00
Guillaume Douézan-Grard 1019b93712 platform/x86: topstar-laptop: replace licence text with SPDX tag
Replace verbatim GPLv2 license copy with SPDX identifier.

Signed-off-by: Guillaume Douézan-Grard <gdouezangrard@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-23 18:43:42 +02:00
Guillaume Douézan-Grard 7a580200d6 platform/x86: topstar-laptop: update copyright and fix some comments
Add myself as an author of the driver.

Signed-off-by: Guillaume Douézan-Grard <gdouezangrard@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-23 18:43:41 +02:00
Guillaume Douézan-Grard bf8f65da31 platform/x86: topstar-laptop: add Topstar U931/RVP7 WLAN LED workaround
Topstar U931 laptops provide a LED synced with the WLAN adapter
hard-blocking state. Unfortunately, some models seem to be defective,
making impossible to hard-block the adapter with the WLAN switch and
thus the LED is useless.

An ACPI method is available to programmatically control this switch and
it indirectly allows to control the LED.

This commit registers the LED within the corresponding subsystem, making
possible for instance to use an rfkill-based trigger to synchronize the
LED with the device state.

This workaround is enabled automatically for Topstar U931/RVP7 laptops
based on a DMI check.

Signed-off-by: Guillaume Douézan-Grard <gdouezangrard@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-23 18:43:41 +02:00
Guillaume Douézan-Grard 2c531437dd platform/x86: topstar-laptop: add platform device
* add a platform device to support further addition of a led subsystem,

* register the existing input device to this platform device.

Signed-off-by: Guillaume Douézan-Grard <gdouezangrard@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-23 18:43:41 +02:00
Guillaume Douézan-Grard 3093ced236 platform/x86: topstar-laptop: split ACPI events and input handling
* get the `acpi_device` from the `topstar_laptop` struct,

* split input registering and `sparse_keymap` events from ACPI events
handling,

* use notify, init and exit functions for ACPI and input handling

Signed-off-by: Guillaume Douézan-Grard <gdouezangrard@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-23 18:43:40 +02:00
Guillaume Douézan-Grard 66aa0d606b platform/x86: topstar-laptop: use consistent naming scheme
* use module prefix naming scheme for functions and programming
constructs,

* consistent label names

Signed-off-by: Guillaume Douézan-Grard <gdouezangrard@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-23 18:43:40 +02:00
Guillaume Douézan-Grard 82acad40ca platform/x86: topstar-laptop: revert "convert to module_acpi_driver()"
Revert commit
  15165594da ("topstar-laptop: convert to module_acpi_driver()")
to later add a platform device.

Signed-off-by: Guillaume Douézan-Grard <gdouezangrard@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-23 18:43:40 +02:00
Andy Shevchenko cedb3b2a7d platform/x86: wmi: Replace list_for_each() by list_for_each_entry()
In all cases list_for_each() followed by list_entry(),
so, replace them by list_for_each_entry() macro.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-23 18:43:39 +02: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
Andy Shevchenko 7f166addbe platform/x86: wmi: Replace kmalloc + sprintf() with kasprintf()
kasprintf() does the job of two: kmalloc() and sprintf().
Replace two calls with one.

Reviewed-by: Darren Hart (VMware) <dvhart@infradead.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-19 17:03:43 +02:00
Srinivas Pandruvada 04e4e88855 platform/x86: intel_turbo_max_3: Remove restriction for HWP platforms
On systems supporting HWP (Hardware P-States) mode, we expected to
enumerate core priority via ACPI-CPPC tables. Unfortunately deployment of
TURBO 3.0 didn't use this method to show core priority. So users are not
able to utilize this feature in HWP mode.

So remove the loading restriction of this driver for HWP enabled systems.
Even if there are some systems, which are providing the core priority via
ACPI CPPC, this shouldn't cause any conflict as the source of priority
definition is same.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reported-and-tested-and-reviewed-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-15 12:21:48 +02:00
Colin Ian King b1ca80e4a2 platform/x86: GPD pocket fan: fix spelling mistake: "Mill-celcius" -> "millicelsius"
Trivial fix to spelling mistake in MODULE_PARM_DESC text and remove
unnecessary hyphen.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-15 12:21:48 +02:00
Alexander Abrosimov c8ba9db2a7 platform/x86: dell-laptop: Removed duplicates in DMI whitelist
Fixed a mistake in which several entries were duplicated in the DMI list
from the below commit
fe486138 platform/x86: dell-laptop: Add 2-in-1 devices to the DMI whitelist

Signed-off-by: Alexander Abrosimov <alexander.n.abrosimov@gmail.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-15 12:18:33 +02:00
Laszlo Toth eca39e7f0c platform/x86: dell-laptop: fix kbd_get_state's request value
Commit 9862b43624 ("platform/x86: dell-laptop: Allocate buffer on heap
rather than globally")
broke one request, changed it back to the original value.

Tested on a Dell E6540, backlight came back.

Fixes: 9862b43624 ("platform/x86: dell-laptop: Allocate buffer on heap rather than globally")
Signed-off-by: Laszlo Toth <laszlth@gmail.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-15 12:18:33 +02:00
Aaron Ma ed5b9ba7be platform/x86: ideapad-laptop: Increase timeout to wait for EC answer
Lenovo E41-20 needs more time than 100ms to read VPC,
the funtion keys always failed responding.
Increase timeout to get the value from VPC, then
the funtion keys like mic mute key work well.

Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-15 12:18:32 +02:00
Andrey Ryabinin 6e1d8ea909 platform/x86: wmi: fix off-by-one write in wmi_dev_probe()
wmi_dev_probe() allocates one byte less than necessary, thus
subsequent sprintf() call writes trailing zero past the end
of the 'buf':

    BUG: KASAN: slab-out-of-bounds in vsnprintf+0xda4/0x1240
    Write of size 1 at addr ffff880423529caf by task kworker/1:1/32

    Call Trace:
     dump_stack+0xb3/0x14d
     print_address_description+0xd7/0x380
     kasan_report+0x166/0x2b0
     vsnprintf+0xda4/0x1240
     sprintf+0x9b/0xd0
     wmi_dev_probe+0x1c3/0x400
     driver_probe_device+0x5d1/0x990
     bus_for_each_drv+0x109/0x190
     __device_attach+0x217/0x360
     bus_probe_device+0x1ad/0x260
     deferred_probe_work_func+0x10f/0x5d0
     process_one_work+0xa8b/0x1dc0
     worker_thread+0x20d/0x17d0
     kthread+0x311/0x3d0
     ret_from_fork+0x3a/0x50

    Allocated by task 32:
     kasan_kmalloc+0xa0/0xd0
     __kmalloc+0x14f/0x3e0
     wmi_dev_probe+0x182/0x400
     driver_probe_device+0x5d1/0x990
     bus_for_each_drv+0x109/0x190
     __device_attach+0x217/0x360
     bus_probe_device+0x1ad/0x260
     deferred_probe_work_func+0x10f/0x5d0
     process_one_work+0xa8b/0x1dc0
     worker_thread+0x20d/0x17d0
     kthread+0x311/0x3d0
     ret_from_fork+0x3a/0x50

Increment allocation size to fix this.

Fixes: 44b6b76611 ("platform/x86: wmi: create userspace interface for drivers")
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-15 12:18:32 +02:00
Linus Torvalds a9a08845e9 vfs: do bulk POLL* -> EPOLL* replacement
This is the mindless scripted replacement of kernel use of POLL*
variables as described by Al, done by this script:

    for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
        L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
        for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
    done

with de-mangling cleanups yet to come.

NOTE! On almost all architectures, the EPOLL* constants have the same
values as the POLL* constants do.  But they keyword here is "almost".
For various bad reasons they aren't the same, and epoll() doesn't
actually work quite correctly in some cases due to this on Sparc et al.

The next patch from Al will sort out the final differences, and we
should be all done.

Scripted-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-02-11 14:34:03 -08:00
Linus Torvalds cc5cb5af3a platform-drivers-x86 for v4.16-3
Mellanox fixes and new system type support.
 
 The following is an automated git shortlog grouped by driver:
 
 mlx-platform:
  -  Add support for new 200G IB and Ethernet systems
  -  Add support for new msn201x system type
  -  Add support for new msn274x system type
  -  Fix power cable setting for msn21xx family
  -  Add define for the negative bus
  -  Use defines for bus assignment
 
 platform/mellanox:
  -  mlxreg-hotplug: Fix uninitialized variable
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJafyo5AAoJEKbMaAwKp364sxgIAIFi/sRACXrJsowOX7Okg4ID
 Rx4BBpynqbOXwxGfHj2Hs5Y1Y9CG6/kCQM3MJfxJmi+Mb8IseucJGVswFmsCfq/U
 IWbj7YwSfpeUOJMWGfpdUaX9RDNa8bTYT2gOx/scZXalsjLTWV1AmlZLOLwlEnK8
 s26zL7GHiFjBY7BJ0GX/atbBOrAFsjuM2QodmwMEuf8lZJSDOxwg0WSqAZHKsPM3
 /2WzeR/2jEX+XlSnwKUN62XsKRF79eZDbBxt+PF/FekAppHnkgLbBfHw7MvhZqg1
 bg2W16nqOnNBJNRHdz6gKM8TeWyr537D/uQmHafc2oyYmhUYbGLPr65q5fqZjoE=
 =VbPT
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v4.16-3' of git://github.com/dvhart/linux-pdx86

Pull x86 platform driver updates from Darren Hart:
 "Mellanox fixes and new system type support.

  Mostly data for new system types with a correction and an
  uninitialized variable fix"

[ Pulling from github because git.infradead.org currently seems to be
  down for some reason, but Darren had a backup location    - Linus ]

* tag 'platform-drivers-x86-v4.16-3' of git://github.com/dvhart/linux-pdx86:
  platform/x86: mlx-platform: Add support for new 200G IB and Ethernet systems
  platform/x86: mlx-platform: Add support for new msn201x system type
  platform/x86: mlx-platform: Add support for new msn274x system type
  platform/x86: mlx-platform: Fix power cable setting for msn21xx family
  platform/x86: mlx-platform: Add define for the negative bus
  platform/x86: mlx-platform: Use defines for bus assignment
  platform/mellanox: mlxreg-hotplug: Fix uninitialized variable
2018-02-10 13:55:33 -08:00
Linus Torvalds e9d46f74ec chrome-platform-for-linus-4.16
Moving cros_ec_dev to drivers/mfd.
 Other small maintenance fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEE6gYDF28Li+nEiKLaHwn1ewov5lgFAlp+l8YUHGJsZXVuZ0Bj
 aHJvbWl1bS5vcmcACgkQHwn1ewov5ljXzw/+MAcTYwIBdUyIZXBhA/FMYvAyouyN
 0xzi/J7raKGhewG0Art28t+KT5j4T7Rz8Pd6zas6k4lGVfvWN5YBhz0ggMyCn3Lc
 6t5aDzp4wG5OSl30Y1uA5x2mZ4uXDSskcgSCng0BooJptY1jxGwmt/97m/hxzDdH
 ChiaRab+rhMeV2K2haONHWXGPi472fqPsXOb1uyIoX2quRdt1XbWrCGGmR81Tp/e
 uQZC5DYOti1I3EYz+jOecbOkr42YIJyZxGTK6Mtk2NgUAsFNxhpg7vF6LGV39ynr
 t4BAZk0qrIY/kP0xHl13+laW3w6eh/Rnrw/mSMaeo1CZ8K0X9NDRKb7hoSPcEkVe
 Jzz6h+Gs4K2cds/VgOjjF8l/OzoZ5sIWaBoJf4tZKuEZ5JSIPeXH72k6ufg9/d72
 0ArHQunxdAuZYrq1pwizduW/h5nG0nlHI9tGx1dQ9lS5TFl82EWkj6cE5gr8kFfo
 FmUOyt0AM4ZYGqF1qgwEDXdSpbKrBA/CKB/K2xkcEl426DZlbO08TZ9bpsmX6pqb
 d9ZbN9OvZxpDmb2XIXBPWCs6z/oWEyDTa011IJPkbq7SZ2Gckrt6x5FkgIBQFR7e
 whEa9S0EMApEkCWVEF83Hpw/HL9UtLduRAMoxgjd81hJpQkBZ/jrwpU4aZOo3kAn
 20AdipHKII3+6V8=
 =YEO6
 -----END PGP SIGNATURE-----

Merge tag 'chrome-platform-for-linus-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform

Pull chrome platform updates from Benson Leung:

 - move cros_ec_dev to drivers/mfd

 - other small maintenance fixes

[ The cros_ec_dev movement came in earlier through the MFD tree  - Linus ]

* tag 'chrome-platform-for-linus-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform:
  platform/chrome: Use proper protocol transfer function
  platform/chrome: cros_ec_lpc: Add support for Google Glimmer
  platform/chrome: cros_ec_lpc: Register the driver if ACPI entry is missing.
  platform/chrome: cros_ec_lpc: remove redundant pointer request
  cros_ec: fix nul-termination for firmware build info
  platform/chrome: chromeos_laptop: make chromeos_laptop const
2018-02-10 13:50:23 -08:00
Vadim Pasternak 1bd42d94cc platform/x86: mlx-platform: Add support for new 200G IB and Ethernet systems
It adds support for new Mellanox system types of basic classes qmb7, sn34,
sn37, containing systems QMB700 (40x200GbE InfiniBand switch), SN3700
(32x200GbE and 16x400GbE Ethernet switch) and SN3410 (6x400GbE plus
48x50GbE Ethernet switch). These are the Top of the Rack systems, equipped
with Mellanox COM-Express carrier board and switch board with Mellanox
Quantum device, which supports InfiniBand switching with 40X200G ports and
line rate of up to HDR speed or with Mellanox Spectrum-2 device, which
supports Ethernet switching with 32X200G ports line rate of up to HDR
speed.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-09 17:23:20 -08:00
Vadim Pasternak a49a41482f platform/x86: mlx-platform: Add support for new msn201x system type
It adds support for new Mellanox system types of basic half unit size
class msn201x, containing system MSN2010 (18x10GbE plus 4x4x25GbE) half
and its derivatives. This is the Top of the Rack system, equipped with
Mellanox Small Form Factor carrier board and switch board with Mellanox
Spectrum device, which supports Ethernet switching with 32X100G ports line
rate of up to EDR speed.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-09 17:23:16 -08:00
Vadim Pasternak ef08e14a38 platform/x86: mlx-platform: Add support for new msn274x system type
It adds support for new Mellanox system types of basic class msn274x,
containing system MSN2740 (32x100GbE Ethernet switch with cost reduction)
and its derivatives. These are the Top of the Rack system, equipped with
Mellanox Small Form Factor carrier board and switch board with Mellanox
Spectrum device, which supports Ethernet switching with 32X100G ports line
rate of up to EDR speed.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-09 17:23:07 -08:00
Vadim Pasternak 6016f7d54b platform/x86: mlx-platform: Fix power cable setting for msn21xx family
Add dedicated structure with power cable setting for Mellanox msn21xx
family. These systems do not have a physical device for the power unit
controller. When the power cable is inserted or removed, the relevant
interrupt signal is handled, the status is updated, but no device is
associated with the signal.

Add definition for interrupt low aggregation signal. On system from
msn21xx family, low aggregation mask should be removed in order to allow
signal to hit CPU.

Fixes: 6613d18e90 ("platform/x86: mlx-platform: Move module from arch/x86")
Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-08 17:47:51 -08:00
Vadim Pasternak 1778567a20 platform/x86: mlx-platform: Add define for the negative bus
Add define for the negative bus ID in order to use it in case no hotplug
device is associated with the hotplug interrupt signal. In this case,
the signal will be handled by the mlxreg-hotplug driver, but no device
will be associated with the signal.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-08 17:45:52 -08:00
Vadim Pasternak ba814fdd0e platform/x86: mlx-platform: Use defines for bus assignment
Add defines for the bus IDs, used for hotplug device topology to improve
code readability. Defines added for FAN and power units.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-08 17:45:02 -08:00
Geert Uytterhoeven b81e830c9a platform/mellanox: mlxreg-hotplug: Fix uninitialized variable
With gcc-4.1.2:

    drivers/platform/mellanox/mlxreg-hotplug.c: In function ‘mlxreg_hotplug_health_work_helper’:
    drivers/platform/mellanox/mlxreg-hotplug.c:347: warning: ‘ret’ is used uninitialized in this function

Indeed, if mlxreg_core_item.count is zero, ret is used uninitialized.

While this is unlikely to happen (it is set to ARRAY_SIZE(...) in x86
board files), this is done in another source file, so fix this by
preinitializing ret to zero.

Fixes: c6acad68eb ("platform/mellanox: mlxreg-hotplug: Modify to use a regmap interface")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-08 17:43:37 -08:00
Andy Shevchenko 9a7c551ba7 platform/x86: samsung-laptop: Re-use DEFINE_SHOW_ATTRIBUTE() macro
...instead of open coding file operations followed by custom ->open()
callbacks per each attribute.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-07 12:50:23 +02:00
Andy Shevchenko 334c4efd29 platform/x86: ideapad-laptop: Re-use DEFINE_SHOW_ATTRIBUTE() macro
...instead of open coding file operations followed by custom ->open()
callbacks per each attribute.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-07 12:50:22 +02:00
Andy Shevchenko b04eb8aaab platform/x86: dell-laptop: Re-use DEFINE_SHOW_ATTRIBUTE() macro
...instead of open coding file operations followed by custom ->open()
callbacks per each attribute.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-07 12:50:22 +02:00
Andy Shevchenko a08f06bb7a seq_file: Introduce DEFINE_SHOW_ATTRIBUTE() helper macro
The DEFINE_SHOW_ATTRIBUTE() helper macro would be useful for current
users, which are many of them, and for new comers to decrease code
duplication.

Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Darren Hart (VMware) <dvhart@infradead.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-07 12:50:21 +02:00
Linus Torvalds cbd7b8a76b platform-drivers-x86 for v4.16-1
New model support added for Dell, Ideapad, Acer, Asus, Thinkpad, and GPD
 laptops.  Improvements to the common intel-vbtn driver, including tablet
 mode, rotate, and front button support. Intel CPU support added for
 Cannonlake and platform support for Dollar Cove power button.
 
 Overhaul of the mellanox platform driver, creating a new
 platform/mellanox directory for the newly multi-architecture regmap
 interface.
 
 Significant Intel PMC update with CannonLake support, Coffeelake update,
 CPUID enumeration, module support, new read64 API, refactoring and
 cleanups.
 
 Revert the apple-gmux iGP IO lock, addressing reported issues with
 non-binary drivers, leaving Nvidia binary driver users to comment out
 conflicting code.
 
 Miscellaneous fixes and cleanups.
 
 Previously merged during the 4.15-rc cycle:
 - e20a8e771d platform/x86: dell-laptop: Fix keyboard max lighting for Dell Latitude E6410
 - 9cd5cf3710 platform/x86: asus-wireless: send an EV_SYN/SYN_REPORT between state changes
 - 91c73e8092 platform/x86: dell-wmi: check for kmalloc() errors
 - 9a1a625918 platform/x86: wmi: Call acpi_wmi_init() later
 
 The following is an automated git shortlog grouped by driver:
 
 ACPI / LPIT:
  -  Export lpit_read_residency_count_address()
 
 Input:
  -  add KEY_ROTATE_LOCK_TOGGLE
 
 MAINTAINERS:
  -  Update tree for platform-drivers-x86
 
 x86/cpu:
  -  Add Cannonlake to Intel family
 
 acer-wireless:
  - Add Acer Wireless Radio Control driver
 
 intel_chtdc_ti_pwrbtn:
  - Add support for Dollar Cove TI power button
 
 GPD pocket fan:
  -  Add driver for GPD pocket custom fan controller
  -  Stop work on suspend
  -  Use a min-speed of 2 while charging
  -  Set speed to max on get_temp failure
 
 apple-gmux:
  -  Revert: lock iGP IO to protect from vgaarb changes
 
 alienware-wmi:
  -  lightbar LED support for Dell Inspiron 5675
 
 asus-nb-wmi:
  -  Support ALS on the Zenbook UX430UQ
 
 dell-laptop:
  -  Allocate buffer on heap rather than globally
  -  Add 2-in-1 devices to the DMI whitelist
  -  Filter out spurious keyboard backlight change events
  -  make some local functions static
  -  Use bool in struct quirk_entry for true/false fields
 
 dell-smbios:
  -  Correct notation for filtering
 
 dell-wmi:
  -  Add an event created by Dell Latitude 5495
 
 Kconfig
  - have ACPI_CMPC use depends instead of select for INPUT
 
 ideapad-laptop:
  -  Add Y720-15IKB to no_hw_rfkill
  -  add lenovo RESCUER R720-15IKBN to no_hw_rfkill_list
  -  Use __func__ instead of write_ec_cmd in pr_err
  -  Remove unnecessary else
 
 intel-hid:
  -  add a DMI quirk to support Wacom MobileStudio Pro
 
 intel-vbtn:
  -  Replace License by SDPX identifier
  -  Remove redundant inclusions
  -  Support tablet mode switch
  -  Simplify autorelease logic
  -  support panel front button
  -  support KEY_ROTATE_LOCK_TOGGLE
  -  Support separate press/release events
  -  support SW_TABLET_MODE
 
 intel_int0002_vgpio:
  -  Remove IRQF_NO_THREAD irq flag
 
 intel_pmc_core:
  -  Special case for Coffeelake
  -  Add CannonLake PCH support
  -  Read base address from LPIT
  -  Remove unused header file
  -  Convert to ICPU macro
  -  Substitute PCI with CPUID enumeration
  -  Refactor debugfs entries
  -  Update Kconfig
  -  Fix file permission warnings
  -  Change driver to a module
  -  Fix kernel doc for pmc_dev
  -  Remove unused variable
  -  Remove unused EXPORTED API
 
 intel_pmc_ipc:
  -  Add read64 API
 
 intel_telemetry:
  -  Remove redundancies
  -  Improve S0ix logs
  -  Fix suspend stats
 
 mlx-platform:
  -  Fix an ERR_PTR vs NULL issue
  -  Add hotplug device unregister to error path
  -  fix module aliases
  -  Add IO access verification callbacks
  -  Document pdev_hotplug field
  -  Allow compilation for 32 bit arch
 
 platform/mellanox:
  -  mlxreg-hotplug: Add check for negative adapter number
  -  mlxreg-hotplug: Enable building for ARM
  -  mlxreg-hotplug: Modify to use a regmap interface
  -  Group create/destroy with attribute functions
  -  Rename i2c bus to nr
  -  mlxreg-hotplug: Remove unused wait.h include
  -  Move Mellanox platform hotplug driver to platform/mellanox
 
 pmc_atom:
  -  introduce DEFINE_SHOW_ATTRIBUTE() macro
 
 samsung-laptop:
  -  Grammar s/are can/can/
 
 silead_dmi:
  -  Add Teclast X3 Plus tablet support
  -  Add entry for newer BIOS for Trekstor Surftab 7.0
  -  Add entry for the Teclast X98 Plus II
  -  Add entry for the Trekstor Primebook C13
  -  Add entry for the Chuwi Vi8 tablet
  -  add entry for Chuwi Hi8 tablet
  -  Add support for the Onda oBook 20 Plus tablet
  -  Add touchscreen info for SurfTab twin 10.1
 
 thinkpad_acpi:
  -  suppress warning about palm detection
  -  Accept flat mode for type 4 multi mode status
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJaegMmAAoJEKbMaAwKp364TvUH/3D9qNtsbXpZuc3ZMNHjIysU
 hdW6hOVfBN0Rk049mjw7nWv/udhWZ/6ChJDlXHX0ZugtNGnRnzbdtWGg4y38pDF1
 LRuKjWfDeyMeJ11itD2xcxEaE6YsseWCKGZJ5D3T+sN4+1jgS4RLAa9cUJMl8QAo
 xZsT1MKpmGuj5eTLf5GgOVL2yfMZhZHabt3kGRY0eQqNqZBgpJw/GQNI1l6v4nAH
 MHPA7Gtj4HXHK8jGviZXpD9tg/iwahiUjGugG4HcxbMcpJ96a8CGyeaXmq2FlfNC
 /PpmVvhVVqzLuXKWAI+DZFLAiwIvPpxzVfOKF2Lty5Rejxf7pdmHq7aCNcALys0=
 =cKm9
 -----END PGP SIGNATURE-----

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

Pull x86 platform-driver updates from Darren Hart:
 "New model support added for Dell, Ideapad, Acer, Asus, Thinkpad, and
  GPD laptops. Improvements to the common intel-vbtn driver, including
  tablet mode, rotate, and front button support. Intel CPU support added
  for Cannonlake and platform support for Dollar Cove power button.

  Overhaul of the mellanox platform driver, creating a new
  platform/mellanox directory for the newly multi-architecture regmap
  interface.

  Significant Intel PMC update with CannonLake support, Coffeelake
  update, CPUID enumeration, module support, new read64 API, refactoring
  and cleanups.

  Revert the apple-gmux iGP IO lock, addressing reported issues with
  non-binary drivers, leaving Nvidia binary driver users to comment out
  conflicting code.

  Miscellaneous fixes and cleanups"

* tag 'platform-drivers-x86-v4.16-1' of git://git.infradead.org/linux-platform-drivers-x86: (81 commits)
  platform/x86: mlx-platform: Fix an ERR_PTR vs NULL issue
  platform/x86: intel_pmc_core: Special case for Coffeelake
  platform/x86: intel_pmc_core: Add CannonLake PCH support
  x86/cpu: Add Cannonlake to Intel family
  platform/x86: intel_pmc_core: Read base address from LPIT
  ACPI / LPIT: Export lpit_read_residency_count_address()
  platform/x86: intel-vbtn: Replace License by SDPX identifier
  platform/x86: intel-vbtn: Remove redundant inclusions
  platform/x86: intel-vbtn: Support tablet mode switch
  platform/x86: dell-laptop: Allocate buffer on heap rather than globally
  platform/x86: intel_pmc_core: Remove unused header file
  platform/x86: mlx-platform: Add hotplug device unregister to error path
  platform/x86: mlx-platform: fix module aliases
  platform/mellanox: mlxreg-hotplug: Add check for negative adapter number
  platform/x86: mlx-platform: Add IO access verification callbacks
  platform/x86: mlx-platform: Document pdev_hotplug field
  platform/x86: mlx-platform: Allow compilation for 32 bit arch
  platform/mellanox: mlxreg-hotplug: Enable building for ARM
  platform/mellanox: mlxreg-hotplug: Modify to use a regmap interface
  platform/mellanox: Group create/destroy with attribute functions
  ...
2018-02-06 15:30:52 -08:00
Dan Carpenter 8a0f5b6f33 platform/x86: mlx-platform: Fix an ERR_PTR vs NULL issue
devm_ioport_map() returns NULL on error but we accidentally check for
error pointers instead.

Fixes: c6acad68eb ("platform/mellanox: mlxreg-hotplug: Modify to use a regmap interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Vadim Pasternak <vadimp@melanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-02-06 07:42:38 -08:00
Rajneesh Bhardwaj 661405bd81 platform/x86: intel_pmc_core: Special case for Coffeelake
Intel CoffeeLake SoC uses CPU ID of KabyLake but has Cannonlake PCH, so in
this case PMC register details from Cannonlake PCH must be used.

In order to identify whether the given platform is Coffeelake, scan for the
Sunrisepoint PMC PCI Id.

	 KBL CPUID	SPT PCIID
------------------------------------
KBL	|	Y	|	Y   |
------------------------------------
CFL	|	Y	|	N   |
------------------------------------

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-04 15:55:53 +02:00
Rajneesh Bhardwaj 291101f6a7 platform/x86: intel_pmc_core: Add CannonLake PCH support
This adds support for Cannonlake PCH which is used by Cannonlake and
Coffeelake SoCs.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-04 15:55:53 +02:00
Srinivas Pandruvada 745698c37c platform/x86: intel_pmc_core: Read base address from LPIT
Read SLP_S0 address from ACPI LPIT table when present and use PMC
specific SLP_S0 offset to get the base address of PMC MMIO.

Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-04 15:55:52 +02:00
Linus Torvalds 47fcc0360c Driver Core updates for 4.16-rc1
Here is the set of "big" driver core patches for 4.16-rc1.
 
 The majority of the work here is in the firmware subsystem, with reworks
 to try to attempt to make the code easier to handle in the long run, but
 no functional change.  There's also some tree-wide sysfs attribute
 fixups with lots of acks from the various subsystem maintainers, as well
 as a handful of other normal fixes and changes.
 
 And finally, some license cleanups for the driver core and sysfs code.
 
 All have been in linux-next for a while with no reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWnLvPw8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ynNzACgkzjPoBytJWbpWFt6SR6L33/u4kEAnRFvVCGL
 s6ygQPQhZIjKk2Lxa2hC
 =Zihy
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here is the set of "big" driver core patches for 4.16-rc1.

  The majority of the work here is in the firmware subsystem, with
  reworks to try to attempt to make the code easier to handle in the
  long run, but no functional change. There's also some tree-wide sysfs
  attribute fixups with lots of acks from the various subsystem
  maintainers, as well as a handful of other normal fixes and changes.

  And finally, some license cleanups for the driver core and sysfs code.

  All have been in linux-next for a while with no reported issues"

* tag 'driver-core-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (48 commits)
  device property: Define type of PROPERTY_ENRTY_*() macros
  device property: Reuse property_entry_free_data()
  device property: Move property_entry_free_data() upper
  firmware: Fix up docs referring to FIRMWARE_IN_KERNEL
  firmware: Drop FIRMWARE_IN_KERNEL Kconfig option
  USB: serial: keyspan: Drop firmware Kconfig options
  sysfs: remove DEBUG defines
  sysfs: use SPDX identifiers
  drivers: base: add coredump driver ops
  sysfs: add attribute specification for /sysfs/devices/.../coredump
  test_firmware: fix missing unlock on error in config_num_requests_store()
  test_firmware: make local symbol test_fw_config static
  sysfs: turn WARN() into pr_warn()
  firmware: Fix a typo in fallback-mechanisms.rst
  treewide: Use DEVICE_ATTR_WO
  treewide: Use DEVICE_ATTR_RO
  treewide: Use DEVICE_ATTR_RW
  sysfs.h: Use octal permissions
  component: add debugfs support
  bus: simple-pm-bus: convert bool SIMPLE_PM_BUS to tristate
  ...
2018-02-01 10:00:28 -08:00
Andy Shevchenko 00f49ee797 platform/x86: intel-vbtn: Replace License by SDPX identifier
Replace License short header by SPDX identifier.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Darren Hart (VMware) <dvhart@infradead.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-01 15:29:50 +02:00
Andy Shevchenko bd1b27e2c8 platform/x86: intel-vbtn: Remove redundant inclusions
Some headers are not needed since the driver can be built as module.
Remove them.

While here, sort headers alphabetically.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Darren Hart (VMware) <dvhart@infradead.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-01 15:29:50 +02:00
Marco Martin 30323fb6d5 platform/x86: intel-vbtn: Support tablet mode switch
On some laptop like the Dell Inspiron 7000 series tablet mode switch
implemented in Intel ACPI, the events to enter and exit the tablet mode
are 0xCC and 0xCD

This initializes the tablet/laptop mode at the correct value
if the system booted in tablet mode (or the intel-vbtn module
loaded with the device in tablet mode)

Cc: platform-driver-x86@vger.kernel.org
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: "Pali Rohár" <pali.rohar@gmail.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Mario Limonciello <mario_limonciello@dell.com>
Cc: Andy Shevchenko <andy@infradead.org>
Cc: Stefan Brüns<stefan.bruens@rwth-aachen.de>
Signed-off-by: Marco Martin <notmart@gmail.com>
Reviewed-by: Mario Limonciello <mario.limonciello@dell.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
[andy: fixed style of comments, indentation, and massaged commit message]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-01 15:26:11 +02:00
Mario Limonciello 9862b43624 platform/x86: dell-laptop: Allocate buffer on heap rather than globally
There is no longer a need for the buffer to be defined in
first 4GB physical address space.

Furthermore there may be race conditions with multiple different functions
working on a module wide buffer causing incorrect results.

Fixes: 549b4930f0
Suggested-by: Pali Rohar <pali.rohar@gmail.com>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-01 15:26:11 +02:00
Rajneesh Bhardwaj 941691ef21 platform/x86: intel_pmc_core: Remove unused header file
Recently sent patch 'platform/x86: intel_pmc_core: Remove unused EXPORTED
API' missed to remove the header file 'arch/x86/include/asm/pmc_core.h'
which was solely used to declare the EXPORTED API
'intel_pmc_slp_s0_counter_read'. This patch provides the errata fix for the
same.

Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-02-01 15:26:11 +02:00
Vadim Pasternak 4726098bcc platform/x86: mlx-platform: Add hotplug device unregister to error path
Add hotplug platform driver un-registration in case regmap cache
synchronization failed. In such case hotplug platform driver
registration should be rolled back.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-01-31 12:54:56 -08:00
Ivan Vecera 580d834fe1 platform/x86: mlx-platform: fix module aliases
Missing prefix 'pn' in MODULE_ALIAS lines causes the module to
not load automatically. The driver should use MODULE_DEVICE_TABLE
together with existing mlxplat_dmi_table instead.

Fixes: 6613d18e90 ("platform/x86: mlx-platform: Move module from arch/x86")
Cc: Vadim Pasternak <vadimp@mellanox.com>
Cc: Bjørn Mork <bjorn@mork.no>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Acked-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-01-31 11:13:17 -08:00
Vadim Pasternak 7805fa8d78 platform/mellanox: mlxreg-hotplug: Add check for negative adapter number
Verify before creation of hotplug device if the associated adapter number
is negative. It could be in case hotplug event is not associated with
hotplug device.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2018-01-31 10:36:50 -08:00