Commit graph

2345 commits

Author SHA1 Message Date
Michał Kępień a1aabd5f36 platform/x86: fujitsu-laptop: switch to a managed backlight device
Use a managed backlight device to get rid of acpi_fujitsu_bl_remove().
Change the parent of the backlight device from NULL to the FUJ02B1 ACPI
device as the latter is required for the backlight device to work.

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>
2017-04-13 10:16:05 -07:00
Michał Kępień 07acf62a40 platform/x86: fujitsu-laptop: only handle backlight when appropriate
The backlight part of fujitsu-laptop is only used by laptops which are
incapable of using the standard ACPI video interface for handling
brightness changes.  Conversely, on laptops which are capable of using
the latter, no vendor-specific ACPI calls should be made unless
explicitly requested by the user.  Bail out immediately from
acpi_fujitsu_bl_add() unless using the vendor-specific interface was
either explicitly requested by the user or automatically selected by the
kernel.

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>
2017-04-13 10:16:05 -07:00
Michał Kępień 09b29e1eda platform/x86: fujitsu-laptop: update debug message logged by call_fext_func()
Update debug message logged when the acpi_evaluate_integer() call inside
call_fext_func() fails so that it covers a broader set of possible
errors.

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>
2017-04-13 10:16:04 -07:00
Andy Shevchenko d27a7e299d platform/x86: intel_scu_ipc: Introduce intel_scu_ipc_raw_command()
A new call to SCU intel_scu_ipc_raw_command() writes SPTR and DPTR
registers before sending a command.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-04-13 10:16:04 -07:00
Andy Shevchenko 74bc77a3db platform/x86: intel_scu_ipc: Introduce SCU_DEVICE() macro
For better maintainability and readability introduce a macro
for device ID table.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-04-13 10:16:04 -07:00
Andy Shevchenko 07ac1af3fc platform/x86: intel_scu_ipc: Remove redundant subarch check
The driver is bound to the devices based on their PCI IDs.

There is no need to do an additional check.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-04-13 10:16:04 -07:00
Andy Shevchenko 822e423e62 platform/x86: intel_scu_ipc: Rearrange init sequence
Device pointer is used as a flag that everything is prepared.
Nevertheless the assignment happened quite before and there is a window
when a caller can get weird results or even crashes since not all fields
are initialized yet.

Rearrange initialization sequence in ->probe() to prepare everything
before use.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-04-13 10:16:04 -07:00
Andy Shevchenko ac207ded45 platform/x86: intel_scu_ipc: Platform data is mandatory
Fail ->probe() if there is no platform data supplied.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-04-13 10:16:03 -07:00
Dmitry Torokhov f22265b615 platform/x86: silead_dmi - abort early if DMI does not match
There is no point in registering I2C bus notifier if DMI data does not
match.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
[andy: updated due to previous patch changed]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-04-13 10:16:03 -07:00
Dmitry Torokhov e105396398 platform/x86: silead_dmi - do not treat all devices as i2c_clients
I2C bus has both i2c clients and adapter devices, so we must be careful in
notifier code and verify that we are actually dealing with an i2c client
before using it as such.

Fixes: cef9dd85ac ("platform/x86: add support for devices with Silead...")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
[andy: simplified silead_ts_dmi_add_props() change]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-04-13 10:16:03 -07:00
Santeri Toivonen f35823619d platform/x86: asus-nb-wmi: Add wapf4 quirk for the X302UA
Asus laptop X302UA starts up with Wi-Fi disabled,
without a way to enable it. Set wapf=4 to fix the problem.

Signed-off-by: Santeri Toivonen <santeri.toivonen@vatsul.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-04-13 10:14:37 -07:00
Michał Kępień f68e492c06 platform/x86: fujitsu-laptop: rename call_fext_func() arguments
Rename call_fext_func() arguments so that each argument's name signifies
its role:

  - cmd -> func: sub-function to call (flags, buttons etc.),
  - arg0 -> op: operation to perform (get, set, get capabilities etc.),
  - arg1 -> feature: feature to act on (e.g. which LED), if relevant,
  - arg2 -> state: state to set (e.g. LED on or off), if relevant.

Adjust whitespace to make checkpatch happy.

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>
2017-04-13 10:14:36 -07:00
Michał Kępień 17e2355561 platform/x86: fujitsu-laptop: simplify call_fext_func()
acpi_evaluate_integer() takes a pathname parameter which contains the
name of the entity to evaluate underneath the given handle, so calling
acpi_get_handle() beforehand is redundant.  Replace the call to
acpi_get_handle() with a call to acpi_evaluate_integer(), thus
eliminating the need for a local variable storing the handle.  Adjust
whitespace to make checkpatch happy.

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>
2017-04-13 10:14:35 -07:00
Michał Kępień b10664105d platform/x86: fujitsu-laptop: clean up local variables in call_fext_func()
Set values of FUNC call parameters in a designated initializer.  Do not
initialize status and handle variables as the values these are
initialized to have no influence on execution flow.  Use an array
variable instead of the address of the first element of that array.

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>
2017-04-13 10:14:34 -07:00
Michał Kępień 1cf034ccf9 platform/x86: fujitsu-laptop: remove keycode fields from struct fujitsu_bl
Remove the keycode[1-5] fields from struct fujitsu_bl as they are not
needed any more as a result of the sparse keymap migration.

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>
2017-04-13 10:14:32 -07:00
Michał Kępień f8c94ecd8f platform/x86: fujitsu-laptop: model-dependent sparse keymap overrides
Some laptop models need to have different keycodes assigned to hotkey
scancodes.  Change the sparse keymap upon a DMI match, before the hotkey
input device is setup.

Instead of using three different callbacks in the DMI match table,
simplify code by using the driver_data field of struct dmi_system_id to
supply the requested keymap to a common callback.  Also merge keymaps
for S6410 and S6420 as they are identical.

Rename fujitsu_dmi_table to fujitsu_laptop_dmi_table to emphasize it is
no longer used by the backlight part of fujitsu-laptop.  Adjust
whitespace to make checkpatch happy.

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>
2017-04-13 10:14:31 -07:00
Michał Kępień 527483a8e1 platform/x86: fujitsu-laptop: use a sparse keymap for hotkey event generation
Simplify hotkey event generation by using a sparse keymap.  As sparse
keymap operates on scancodes instead of keycodes, adjust variable names
and debug messages accordingly.

This patch only handles the default keymap for clarity.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
[dvhart: correct flag passed to call_fext_func in acpi_fujitsu_laptop_notify]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-04-13 10:14:30 -07:00
Michał Kępień f66735f8f8 platform/x86: fujitsu-laptop: switch to a managed hotkey input device
Use a managed input device for hotkey events in order to simplify two
error paths and one cleanup function while also reducing the number of
local variables required.  Remove double assignment to make checkpatch
happy.

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>
2017-04-13 10:14:28 -07:00
Michał Kępień 11182dbca5 platform/x86: fujitsu-laptop: refactor hotkey input device setup
Simplify error handling in acpi_fujitsu_laptop_add() by moving code
responsible for setting up the input device to a separate function.

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>
2017-04-13 10:14:27 -07:00
Michał Kępień f225267237 platform/x86: fujitsu-laptop: use a sparse keymap for brightness key events
Simplify brightness key event generation by using a sparse keymap.

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>
2017-04-13 10:14:26 -07:00
Michał Kępień f8a399dcfa platform/x86: fujitsu-laptop: switch to a managed backlight input device
Use a managed input device for brightness events in order to simplify
two error paths and one cleanup function while also reducing the number
of local variables required.  Remove double assignment to make
checkpatch happy.

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>
2017-04-13 10:14:24 -07:00
Michał Kępień 7d134e43a2 platform/x86: fujitsu-laptop: refactor backlight input device setup
Simplify error handling in acpi_fujitsu_bl_add() by moving code
responsible for setting up the input device to a separate function.

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>
2017-04-13 10:14:23 -07:00
Darren Hart 674b5d5836 Merge branch 'linux-leds/dell-laptop-changes-for-4.12'
Merge branch 'dell-laptop-changes-for-4.12' of
git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git
to avoid linux-next merge conflict with dell-laptop.c.

Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-04-13 10:14:09 -07:00
Hans de Goede 6b8e7d8f68 platform/x86: silead_dmi: Add entry for Insyde 7W tablets
Add an entry providing the necessary info to make the touchscreen work
on various tablets based on the Insyde 7W whitebox tablet.

This has been tested on a DEXP Ursus 7W tablet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-04-13 10:12:48 -07:00
Hans de Goede ae3111585e platform/x86: silead_dmi: Constify properties arrays
Now that device_add_properties takes a const property_entry * rather
then a non-const one we can constify the properties arrays.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-04-13 10:12:47 -07:00
Hans de Goede 9c656b0799 platform/x86: dell-*: Call new led hw_changed API on kbd brightness change
Make dell-wmi notify on hotkey kbd brightness changes, listen for this
in dell-laptop and call led_classdev_notify_brightness_hw_changed.

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

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-04-13 10:12:46 -07:00
Hans de Goede e5bf5df785 platform/x86: dell-laptop: Protect kbd_state against races
The kbd led code has multiple entry points each of which modifies the
kbd_state by reading it, modifying a copy, writing the copy and on
error setting the modified copy writing back the original state.

This is racy, so add a mutex protection the read-modify-write cycle
on each of the entry points.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-04-13 10:12:44 -07:00
Hans de Goede 1c7e28246e platform/x86: dell-laptop: Refactor kbd_led_triggers_store()
Return -EINVAL immediately on invalid input, rather then doing
the straight path in an if block and returning -EINVAL at the end
of the function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-04-13 10:12:43 -07:00
Hans de Goede 504b02593f platform/x86: dell-*: Add a generic dell-laptop notifier chain
There are several cases where events handled in one of the dell-* drivers
need to be propagated to another dell-* driver.

This commit adds 3 generic functions:
dell_laptop_register_notifier()
dell_laptop_unregister_notifier()
dell_laptop_call_notifier()

It currently only defines 1 action:
DELL_LAPTOP_KBD_BACKLIGHT_BRIGHTNESS_CHANGED

Which is intended to propagate kbd_backlight_brightness_changed wmi
events from dell-wmi to dell-laptop (which contains the actual kbd
backlight driver).

These functions are put in dell-smbios as both dell-wmi and dell-laptop
use smbios functions and I do not want to put the notifier head in
either driver, as that will make the 2 drivers depend on each other.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-04-13 10:12:19 -07:00
Lukas Wunner b121b051d1 apple-gmux: Don't switch external DP port on 2011+ MacBook Pros
On MacBook Pros introduced 2011 and onward, external DP ports are
combined DP/Thunderbolt ports that are no longer fully switchable
between GPUs, they can only be driven by the discrete GPU.

More specifically, the Main Link pins (which transport the actual video
and audio streams) are soldered to the discrete GPU, whereas the AUX
Channel pins are switchable. Because the integrated GPU is missing the
Main Link, external displays appear to it as phantoms which fail to
link-train.

Force the AUX channel to the discrete GPU on these models to avoid any
confusion. Document the switching policy implemented by this commit.

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Link: http://patchwork.freedesktop.org/patch/msgid/4d1fcc92d1960049e2cff997fbd2d74e45e84e49.1489145162.git.lukas@wunner.de
2017-03-30 22:42:30 +02:00
Michał Kępień 979800e73d platform/x86: fujitsu-laptop: remove pf_device field from struct fujitsu_bl
Both struct fujitsu_bl and struct fujitsu_laptop have a pf_device field.
Up until now the latter has been redundant, which is logically incorrect
because the primary function of the platform device created by
fujitsu-laptop is to provide laptop-related (not brightness-related)
attributes to userspace.

Remove the pf_device field from struct fujitsu_bl and make all module
code use the pf_device field of struct fujitsu_laptop instead.

Suggested-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Jonathan Woithe <jwoithe@just42.net>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-03-23 09:03:23 -07:00
Michał Kępień c33f4c044d platform/x86: fujitsu-laptop: only register platform device if FUJ02E3 is present
The platform device registered by fujitsu-laptop is registered
unconditionally while sysfs attributes attached to it depend on the
FUJ02E3 ACPI device being present.  Fix this by moving platform device
creation and removal to acpi_fujitsu_laptop_add() and
acpi_fujitsu_laptop_remove(), respectively.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Jonathan Woithe <jwoithe@just42.net>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-03-23 09:03:23 -07:00
Michał Kępień d811b511c1 platform/x86: fujitsu-laptop: add and remove platform device in separate functions
Platform device handling adds a lot of complexity to fujitsu_init(),
which hinders its readability.  Extract code responsible for adding and
removing the platform device to separate functions.  Adjust whitespace
to make checkpatch happy.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Jonathan Woithe <jwoithe@just42.net>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-03-23 09:03:23 -07:00
Michał Kępień b0c4b9c64e platform/x86: fujitsu-laptop: simplify platform device attribute definitions
Use the DEVICE_ATTR_RO() macro to get rid of ignore_store() and shorten
attribute definitions.  Adjust whitespace to make checkpatch happy.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Jonathan Woithe <jwoithe@just42.net>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-03-23 09:03:23 -07:00
Michał Kępień 78b2602fbb platform/x86: fujitsu-laptop: remove backlight-related attributes from the platform device
Setting backlight level using a vendor-specific interface should only be
possible when using the latter is either explicitly requested by the
user or automatically selected by the kernel.  fujitsu-laptop violates
that premise by unconditionally attaching three backlight-related
attributes to the platform device it registers.  Remove the offending
attributes from the platform device.  Update module comments to reflect
this change.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Jonathan Woithe <jwoithe@just42.net>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-03-23 09:03:22 -07:00
Pau Espin Pedrol 999ddbdf3c platform/x86: eeepc-laptop: Skip unknown key messages 0x50 0x51
Otherwise those are printed several times when (un)plugging the AC
connector.

Signed-off-by: Pau Espin Pedrol <pespin.shar@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-03-23 09:01:35 -07:00
Andy Shevchenko 562e7a4032 platform/x86: surface3_button: Propagate error from gpiod_count()
Since gpiod_count() does not return 0 anymore, we don't need to shadow
its error code and would safely propagate to the user.

While here, replace second parameter by NULL in order to prevent side
effects on _DSD enabled firmware.

Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:12 +01:00
Michał Kępień 1fe5530946 platform/x86: intel-hid: do not set parents of input devices explicitly
devm_input_allocate_device() already causes the supplied struct device
to be set as the parent of the input device, so doing it again is
redundant.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-and-tested-by: Alex Hung <alex.hung@canonical.com>
2017-03-14 22:58:12 -07:00
Michał Kępień db8f95d014 platform/x86: toshiba_acpi: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:11 -07:00
Michał Kępień c6d973f474 platform/x86: toshiba-wmi: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:11 -07:00
Michał Kępień 3f2e1a323a platform/x86: topstar-laptop: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:10 -07:00
Michał Kępień b09b9195b3 platform/x86: panasonic-laptop: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

As this reduces acpi_pcc_destroy_input() to one line, replace all calls
to that function with direct calls to input_unregister_device().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:09 -07:00
Michał Kępień 0788e3375a platform/x86: msi-wmi: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:08 -07:00
Michał Kępień 7cb8aa8caf platform/x86: msi-laptop: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

As this reduces msi_laptop_input_destroy() to one line, replace all
calls to that function with direct calls to input_unregister_device().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:07 -07:00
Michał Kępień c973d4b578 platform/x86: ideapad-laptop: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:07 -07:00
Michał Kępień 3a3c1115ce platform/x86: hp-wmi: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:06 -07:00
Michał Kępień de3c91c1ce platform/x86: eeepc-laptop: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:05 -07:00
Michał Kępień 815edfe7ad platform/x86: dell-wmi: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

As this reduces dell_wmi_input_destroy() to one line, replace all calls
to that function with direct calls to input_unregister_device().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:04 -07:00
Michał Kępień 469b017045 platform/x86: dell-wmi-aio: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:04 -07:00
Michał Kępień c2ef3a1c97 platform/x86: asus-wmi: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:03 -07:00
Michał Kępień f118b312bd platform/x86: asus-laptop: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:02 -07:00
Michał Kępień cd1aaef0b2 platform/x86: acer-wmi: remove sparse_keymap_free() calls
As sparse_keymap_setup() now uses a managed memory allocation for the
keymap copy it creates, the latter is freed automatically.  Remove all
calls to sparse_keymap_free().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:58:02 -07:00
Michał Kępień c2cddd4f7d platform/x86: fujitsu-laptop: cleanup error labels in fujitsu_init()
Error labels currently used in fujitsu_init() are really hard to follow:
some (fail_laptop) indicate which operation has failed, others
(fail_sysfs_group) indicate where unrolling should start and the rest
(fail_platform_driver) is simply confusing.  Change them to follow the
pattern used throughout the rest of the module, i.e. make every label
indicate the first unrolling operation it leads to.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-and-tested-by: Jonathan Woithe <jwoithe@just42.net>
2017-03-14 22:57:18 -07:00
Michał Kępień aea3137c2c platform/x86: fujitsu-laptop: only register backlight device if FUJ02B1 is present
As the backlight device registered by fujitsu-laptop relies on the
FUJ02B1 ACPI device being present, only register the backlight device
once that ACPI device is detected.

Suggested-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-and-tested-by: Jonathan Woithe <jwoithe@just42.net>
2017-03-14 22:57:17 -07:00
Michał Kępień 1877e267b3 platform/x86: fujitsu-laptop: sync backlight power status in acpi_fujitsu_laptop_add()
Registering an ACPI driver does not mean the device it handles has to
exist.  As the code which syncs backlight power status uses
call_fext_func(), it needs the FUJ02E3 ACPI device to be present, so
ensure that code is only run once the FUJ02E3 device is detected.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-and-tested-by: Jonathan Woithe <jwoithe@just42.net>
2017-03-14 22:57:17 -07:00
Michał Kępień b8d69c16a0 platform/x86: fujitsu-laptop: register backlight device in a separate function
Move code responsible for backlight device registration to a separate
function in order to simplify error handling and decrease indentation.
Simplify initialization of struct backlight_properties.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-and-tested-by: Jonathan Woithe <jwoithe@just42.net>
2017-03-14 22:57:16 -07:00
Michał Kępień d2aa3ae86d platform/x86: fujitsu-laptop: simplify brightness key event generation logic
Returning early when there is no brightness change allows removal of a
duplicate code block, makes the purpose of the following code clearer
and allows the condition surrounding key event generation to be removed.
Local integer variables can also be declared in a single line.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-and-tested-by: Jonathan Woithe <jwoithe@just42.net>
2017-03-14 22:57:15 -07:00
Michał Kępień 5efc800463 platform/x86: fujitsu-laptop: decrease indentation in acpi_fujitsu_bl_notify()
acpi_fujitsu_bl_notify() is pretty deeply nested, which hurts
readability.  Strip off one level of indentation by returning early when
the event code supplied as argument is not ACPI_FUJITSU_NOTIFY_CODE1.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-and-tested-by: Jonathan Woithe <jwoithe@just42.net>
2017-03-14 22:57:14 -07:00
Sven Rebhan 1f3bc53d84 platform/x86: ideapad-laptop: Add IdeaPad 310-15IKB to no_hw_rfkill
Like other Lenovo models the IdeaPad 310-15IKB does not have an hw rfkill
switch. This results in hard-blocked radios after boot, resulting in
always blocked radios rendering them unusable.

Add the IdeaPad 310-15IKB to the no_hw_rfkill DMI list and allows using
the built-in radios.

Signed-off-by: Sven Rebhan <Sven.Rebhan@googlemail.com>
[andy: massaged commit message]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:57:14 -07:00
Christian Kellner 696c6523ec platform/x86: thinkpad_acpi: add mapping for new hotkeys
The T470, X270 emits new hkey events in the 0x1311 - 0x1315 range.
According to the user manual they should launch a user selected
favorite application (star icon, 0x1311), snipping tool (0x1312,
currently ignored), enable/disable bluetooth (0x1314) and open they
keyboard settings (0x1315).

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

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

Signed-off-by: Christian Kellner <ckellner@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-14 22:57:12 -07:00
Michał Kępień faf667efdb platform/x86: intel-hid: remove redundant set_bit() call
Remove redundant set_bit() call for KEY_RFKILL as it is already made by
sparse_keymap_setup() due to KEY_RFKILL being assigned to event code 8
in intel_hid_keymap.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-and-tested-by: Alex Hung <alex.hung@canonical.com>
2017-03-14 22:57:12 -07:00
Michał Kępień 175cc9b72f platform/x86: intel-hid: use devm_input_allocate_device() for HID events input device
intel_hid_input_setup() is only called from the platform driver's .probe
callback.  Use the devm variant of input_allocate_device() for
allocating memory for the HID events input device in order to simplify
two error paths and get rid of intel_hid_input_destroy().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-and-tested-by: Alex Hung <alex.hung@canonical.com>
2017-03-14 22:57:11 -07:00
Michał Kępień 99a75e7b05 platform/x86: intel-hid: make intel_hid_set_enable() take a boolean argument
As the integer value passed to intel_hid_set_enable() is always
explicitly passed and is used solely as a boolean value, make it a bool.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-and-tested-by: Alex Hung <alex.hung@canonical.com>
2017-03-14 22:57:10 -07:00
Michał Kępień 93ed249075 platform/x86: intel-hid: simplify enabling/disabling HID events
ACPI method HDSM takes a single integer argument.  Use
acpi_execute_simple_method() instead of acpi_evaluate_object() for
calling that ACPI method to simplify code and reduce the number of local
variables inside intel_hid_set_enable().

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-and-tested-by: Alex Hung <alex.hung@canonical.com>
2017-03-14 22:57:09 -07:00
Linus Torvalds 065f3e4951 platform-drivers-x86 for v4.11-2
Asus fixes for the airplane LED and a long awaited fujitsu cleanup.
 
 asus-wmi:
  - Remove quirk_no_rfkill
  - Detect quirk_no_rfkill from the DSDT
 
 fujitsu-laptop:
  - remove redundant MODULE_ALIAS entries
  - autodetect LCD interface on all models
  - simplify acpi_bus_register_driver() error handling
  - remove redundant forward declarations
  - replace numeric values with constants
  - rename FUNC_RFKILL to FUNC_FLAGS
  - make platform-related variables match naming convention
  - replace "hotkey" with "laptop" in symbol names
  - clearly denote backlight-related symbols
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJYxd7oAAoJEKbMaAwKp364fokH+gNPpBgroix+sYnII3me24PM
 1XfhSe7dHtLZVBUiGcK+kik4n9yQVdRZUNkrocc8yxINbpVVW+Wf22BXm7g81xyr
 I+HNKKME8nlsTnG6znNJ/INITwKYsoV7mfx5aqLmsZjYpscqyU/A33J/2cIMrenk
 I8J/svO3+Gk0sk+stPv7tofci+RkE7965JFBUeZUbQ13xVrw9GiPYiSHxpB6EldZ
 qiBnmJOLgxRAvyggqX5jfXD9vl5jy9xEwQSw0emzhlTqs5QLlZjQkpKnSwbpnLQg
 u3bt+oM2sp6cnkrCJ7VL+07GCAv31inBjeZRyZalU2b8/yPQdZ42mISIVidUiec=
 =VO8n
 -----END PGP SIGNATURE-----

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

Pull x86 platform driver updates from Darren Hart:
 "Asus fixes for the airplane LED and a long awaited fujitsu cleanup.

  asus-wmi:
   - Remove quirk_no_rfkill
   - Detect quirk_no_rfkill from the DSDT

  fujitsu-laptop:
   - remove redundant MODULE_ALIAS entries
   - autodetect LCD interface on all models
   - simplify acpi_bus_register_driver() error handling
   - remove redundant forward declarations
   - replace numeric values with constants
   - rename FUNC_RFKILL to FUNC_FLAGS
   - make platform-related variables match naming convention
   - replace "hotkey" with "laptop" in symbol names
   - clearly denote backlight-related symbols"

* tag 'platform-drivers-x86-v4.11-2' of git://git.infradead.org/linux-platform-drivers-x86:
  platform/x86: asus-wmi: Remove quirk_no_rfkill
  platform/x86: asus-wmi: Detect quirk_no_rfkill from the DSDT
  platform/x86: fujitsu-laptop: remove redundant MODULE_ALIAS entries
  platform/x86: fujitsu-laptop: autodetect LCD interface on all models
  platform/x86: fujitsu-laptop: simplify acpi_bus_register_driver() error handling
  platform/x86: fujitsu-laptop: remove redundant forward declarations
  platform/x86: fujitsu-laptop: replace numeric values with constants
  platform/x86: fujitsu-laptop: rename FUNC_RFKILL to FUNC_FLAGS
  platform/x86: fujitsu-laptop: make platform-related variables match naming convention
  platform/x86: fujitsu-laptop: replace "hotkey" with "laptop" in symbol names
  platform/x86: fujitsu-laptop: clearly denote backlight-related symbols
2017-03-13 13:23:43 -07:00
João Paulo Rechi Vita d1c4e9bf73 platform/x86: asus-wmi: Remove quirk_no_rfkill
With the detection introduced in the previous patches, we don't need
these static DMI-based quirks anymore.

This reverts the following commits:
56a37a7200 "asus-wmi: Add quirk_no_rfkill_wapf4 for the Asus X456UA"
a961a285b4 "asus-wmi: Add quirk_no_rfkill_wapf4 for the Asus X456UF"
6b7ff2af52 "asus-wmi: Add quirk_no_rfkill for the Asus Z550MA"
02db9ff7af "asus-wmi: Add quirk_no_rfkill for the Asus U303LB"
2d735244b7 "asus-wmi: Add quirk_no_rfkill for the Asus N552VW"
a977e59c0c "asus-wmi: Create quirk for airplane_mode LED"

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[dvhart: minor commit message corrections]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-03-12 16:41:55 -07:00
Michał Kępień ab76838611 platform/x86: dell-wmi-led: fix coding style issues
Fix coding style issues in dell-wmi-led to make sure the module gets a
clean start in the x86 platform driver subsystem.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2017-03-06 22:07:12 +01:00
Michał Kępień 7a3319c1cd dell-led: move driver to drivers/platform/x86/dell-wmi-led.c
The dell-led driver handles a specific WMI GUID present on some Dell
laptops and as such it belongs in the x86 platform driver subsystem.
Source code is moved along with the relevant Kconfig and Makefile
entries, with some minor modifications:

  - Kconfig option is renamed from CONFIG_LEDS_DELL_NETBOOKS to
    CONFIG_DELL_WMI_LED,

  - the X86 Kconfig dependency is removed as the whole
    drivers/platform/x86 menu depends on it, so there is no need to
    duplicate it,

  - the name of the module's source file is removed from the header
    comment to avoid the need to update it in the future.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Alex Hung <alex.hung@canonical.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2017-03-06 22:07:09 +01:00
Michał Kępień 44319ab7e0 platform/x86: dell-laptop: import dell_micmute_led_set() from drivers/leds/dell-led.c
To ensure all users of dell-smbios are in drivers/platform/x86, move the
dell_micmute_led_set() method from drivers/leds/dell-led.c to
drivers/platform/x86/dell-laptop.c.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Alex Hung <alex.hung@canonical.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2017-03-06 22:07:04 +01:00
Ingo Molnar 4f17722c72 sched/headers: Prepare for new header dependencies before moving code to <linux/sched/loadavg.h>
We are going to split <linux/sched/loadavg.h> out of <linux/sched.h>, which
will have to be picked up from a couple of .c files.

Create a trivial placeholder <linux/sched/topology.h> file that just
maps to <linux/sched.h> to make this patch obviously correct and
bisectable.

Include the new header in the files that are going to need it.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-03-02 08:42:27 +01:00
João Paulo Rechi Vita 71050ae7bf platform/x86: asus-wmi: Detect quirk_no_rfkill from the DSDT
Some Asus laptops that have an airplane-mode indicator LED, also have
the WMI WLAN user bit set, and the following bits in their DSDT:

    Scope (_SB)
    {
      (...)
      Device (ATKD)
      {
        (...)
        Method (WMNB, 3, Serialized)
        {
          (...)
          If (LEqual (IIA0, 0x00010002))
          {
            OWGD (IIA1)
            Return (One)
          }
        }
      }
    }

So when asus-wmi uses ASUS_WMI_DEVID_WLAN_LED (0x00010002) to store the
wlan state, it drives the airplane-mode indicator LED (through the call
to OWGD) in an inverted fashion: the LED is ON when airplane mode is OFF
(since wlan is ON), and vice-versa.

This commit skips registering RFKill switches at all for these laptops,
to allow the asus-wireless driver to drive the airplane mode LED
correctly through the ASHS ACPI device. Relying on the presence of ASHS
and ASUS_WMI_DSTS_USER_BIT avoids adding DMI-based quirks for at least
21 different laptops.

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-26 17:01:48 +02:00
Alan Jenkins 5802d0bc3f platform/x86: fujitsu-laptop: remove redundant MODULE_ALIAS entries
MODULE_DEVICE_TABLE is all that is needed for fujitsu-laptop to be
properly autoloaded based on presence of its associated ACPI devices, so
remove redundant MODULE_ALIAS entries.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
[kempniu: rebase patch, rewrite commit message]
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
2017-02-26 17:01:48 +02:00
Alan Jenkins 5296a73613 platform/x86: fujitsu-laptop: autodetect LCD interface on all models
Presence of ACPI method SBL2 should be checked on all models rather than
just the ones with predefined hotkey keycode overrides.  Move most of
dmi_check_cb_common() to acpi_fujitsu_bl_add().  Adjust indentation to
make checkpatch happy.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
[kempniu: rebase patch, rewrite commit message]
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
2017-02-26 17:01:48 +02:00
Alan Jenkins c1d1e8a051 platform/x86: fujitsu-laptop: simplify acpi_bus_register_driver() error handling
A separate variable is not needed to handle error codes returned by
acpi_bus_register_driver().  If the latter fails, just use the value it
returned as the value returned by fujitsu_init().

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
[kempniu: rebase patch, rewrite commit message]
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
2017-02-26 17:01:07 +02:00
Alan Jenkins 8c590e339f platform/x86: fujitsu-laptop: remove redundant forward declarations
Both acpi_fujitsu_bl_notify() and acpi_fujitsu_laptop_notify() are
defined before they are first used, so remove their forward declarations
as they are redundant.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
[kempniu: rebase patch, rewrite commit message]
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
2017-02-26 17:01:07 +02:00
Alan Jenkins d3dd4480f8 platform/x86: fujitsu-laptop: replace numeric values with constants
Replace three repeating numeric values with constants to improve code
clarity.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
[kempniu: rebase patch, rewrite commit message]
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
2017-02-26 17:01:07 +02:00
Alan Jenkins 8ef27bd341 platform/x86: fujitsu-laptop: rename FUNC_RFKILL to FUNC_FLAGS
FUNC subfunction 0x1000 is currently referred to as FUNC_RFKILL, which
is misleading, because it handles more than just radio devices (also
lid, dock, LEDs).  Rename the FUNC_RFKILL constant to FUNC_FLAGS.
Replace "rfkill" with "flags" in the names of its associated fields
inside struct fujitsu_laptop.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
[kempniu: rebase patch, rewrite commit message]
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
2017-02-26 17:01:07 +02:00
Alan Jenkins 1650602691 platform/x86: fujitsu-laptop: make platform-related variables match naming convention
Replace "fujitsupf" with "fujitsu_pf" in all platform-related variable
names to match the module-wide naming convention.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
[kempniu: rebase patch, rewrite commit message]
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
2017-02-26 17:01:07 +02:00
Alan Jenkins 6942eabc14 platform/x86: fujitsu-laptop: replace "hotkey" with "laptop" in symbol names
Functions, structures, variables and constants whose names currently
contain the "hotkey" keyword are not only responsible for handling
hotkeys, but also other laptop-related features (rfkill, lid, dock,
LEDs).  Fix their naming by using a consistent "_laptop"/"_LAPTOP"
suffix/infix.  Update comments so that they reflect this change.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
[kempniu: rebase patch, rewrite commit message]
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
2017-02-26 17:01:07 +02:00
Alan Jenkins 9fc5cf6e14 platform/x86: fujitsu-laptop: clearly denote backlight-related symbols
Unify naming for all backlight-related functions, structures, variables
and constants by using a consistent "_bl"/"_BL" suffix/infix.  Adjust
indentation to make checkpatch happy.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
[kempniu: rebase patch, rewrite commit message]
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
2017-02-26 17:01:07 +02:00
Linus Torvalds 94eae80340 platform-drivers-x86 for v4.11-1
New intel_turbo_max_3 driver, providing max core frequency information to the
 scheduler. Intel PMC APL support, s0ix read API, and fixes.
 
 New Silead touchscreen platform touchscreen descriptions. Additional hotkey
 support for the intel-hid driver.
 
 New model support for dell-laptop and hp_accel.
 
 Several cleanups, especially to the fujitsu-laptop and intel_mid_powerbtn
 drivers.
 
 This tag includes the already merged branch: led_brightness_hw_changed from:
     git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds into HEAD
 Which includes the following commit:
     7de50ae leds: class: Add new optional brightness_hw_changed attribute
 needed for the thinkpad_acpi changes noted below
 
 This is the first time a pdx86 pull request has included a merge of an immutable
 branch from another subsystem, as we have previously either waited for the
 dependency to be merged, or asked the other maintainer to merge dependent
 changes. As this included three patches specifically to thinkpad_acpi, we
 decided to try the merge and apply model.
 
 platorm/x86:
  - silead depends on I2C being built-in
  - add support for devices with Silead touchscreens
  - Support Turbo Boost Max 3.0 for non HWP systems
 
 intel_turbo_max_3:
  - make it explicitly non-modular
 
 dell-laptop:
  - Add Latitude 7480 and others to the DMI whitelist
 
 intel-hid:
  - Support 5 button array
 
 thinkpad_acpi:
  - Call led_classdev_notify_brightness_hw_changed on kbd brightness change
  - Use brightness_set_blocking callback for LEDs
  - Stop setting led_classdev brightness directly
 
 acer-wmi:
  - add another KEY_WLAN keycode
  - Inform firmware that RF Button Driver is active
  - setup accelerometer when machine has appropriate notify event
 
 asus-wireless:
  - Fix indentation
  - Use per-HID HSWC parameters
 
 intel_pmc_ipc:
  - Add APL PMC PCI Id
  - read s0ix residency API
  - Remove unused iTCO_version variable
 
 alienware-wmi:
  - Remove header duplicate
 
 intel_pmc_core:
  - fix out-of-bounds accesses on stack
 
 intel_mid_powerbtn:
  - Use SCU IPC directly
  - Unify IRQ acknowledgment
  - Move comment to where it belongs
  - Unify PBSTATUS access
  - Remove snail address
  - Sort headers alphabetically
  - Join string literals
  - Enable driver for Merrifield
  - Acknowledge interrupts
  - Factor out mfld_ack()
  - Introduce driver data
  - Substitute mfld by mid
  - Convert to use devm_*()
 
 fujitsu-laptop:
  - make hotkey handling functions more similar
  - break up complex loop condition
  - move keycode processing to separate functions
  - decrease indentation in acpi_fujitsu_hotkey_notify()
  - simplify logolamp_get()
  - rework logolamp_set() to properly handle errors
  - set default trigger for radio LED to rfkill-any
 
 dell-smbios:
  - Auto-select as needed
 
 intel_mid_thermal:
  - Fix module autoload
  - Remove duplicated platform device ID
 
 mlx-platform:
  - mlxcpld-hotplug driver style fixes
 
 hp_accel:
  - Add support for HP ZBook 17
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJYsTc2AAoJEKbMaAwKp364K2UH/AnQegGMWrXWQ80vJH3jf1Kg
 nmlnXBvh3KGKF9+cdeXY2paInW/UzFB/gtwgHLIkUvqRH/L2e1zSFWMqgdk7DH7p
 oE2o0dBYiUWXUTzcxaHFvemN8/mizPaJUtlbHAesY/61uD2AC98UAR7XpoFvuXFI
 l6LEII97mxN3GrNl9/RZfI35lBxjTtCtW9j230wd/d8+vPLyy9k6AsYAeaUHp4v6
 6pW03vQM1gMSxMBevX7A4pqvBDQX70ChBLLMSAQ0qViaNHzhkqnHDCCI1J0mHQ3P
 WjyPaDeKmkjl1vHm7/SKRggHp1J/jyaI/3jwLStq5YKU8X+WbO5CtGVOm/Y0JUI=
 =ql/h
 -----END PGP SIGNATURE-----

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

Pull x86 platform driver updates from Darren Hart:
 "Big picture:

   - New intel_turbo_max_3 driver, providing max core frequency
     information to the scheduler. Intel PMC APL support, s0ix read API,
     and fixes.

   - New Silead touchscreen platform touchscreen descriptions.
     Additional hotkey support for the intel-hid driver.

   - New model support for dell-laptop and hp_accel.

   - Several cleanups, especially to the fujitsu-laptop and
     intel_mid_powerbtn drivers.

  Detail summary:

  platorm/x86:
   - silead depends on I2C being built-in
   - add support for devices with Silead touchscreens
   - Support Turbo Boost Max 3.0 for non HWP systems

  intel_turbo_max_3:
   - make it explicitly non-modular

  dell-laptop:
   - Add Latitude 7480 and others to the DMI whitelist

  intel-hid:
   - Support 5 button array

  thinkpad_acpi:
   - Call led_classdev_notify_brightness_hw_changed on kbd brightness change
   - Use brightness_set_blocking callback for LEDs
   - Stop setting led_classdev brightness directly

  acer-wmi:
   - add another KEY_WLAN keycode
   - Inform firmware that RF Button Driver is active
   - setup accelerometer when machine has appropriate notify event

  asus-wireless:
   - Fix indentation
   - Use per-HID HSWC parameters

  intel_pmc_ipc:
   - Add APL PMC PCI Id
   - read s0ix residency API
   - Remove unused iTCO_version variable

  alienware-wmi:
   - Remove header duplicate

  intel_pmc_core:
   - fix out-of-bounds accesses on stack

  intel_mid_powerbtn:
   - Use SCU IPC directly
   - Unify IRQ acknowledgment
   - Move comment to where it belongs
   - Unify PBSTATUS access
   - Remove snail address
   - Sort headers alphabetically
   - Join string literals
   - Enable driver for Merrifield
   - Acknowledge interrupts
   - Factor out mfld_ack()
   - Introduce driver data
   - Substitute mfld by mid
   - Convert to use devm_*()

  fujitsu-laptop:
   - make hotkey handling functions more similar
   - break up complex loop condition
   - move keycode processing to separate functions
   - decrease indentation in acpi_fujitsu_hotkey_notify()
   - simplify logolamp_get()
   - rework logolamp_set() to properly handle errors
   - set default trigger for radio LED to rfkill-any

  dell-smbios:
   - Auto-select as needed

  intel_mid_thermal:
   - Fix module autoload
   - Remove duplicated platform device ID

  mlx-platform:
   - mlxcpld-hotplug driver style fixes

  hp_accel:
   - Add support for HP ZBook 17"

* tag 'platform-drivers-x86-v4.11-1' of git://git.infradead.org/linux-platform-drivers-x86: (45 commits)
  platform/x86: intel_turbo_max_3: make it explicitly non-modular
  platform/x86: dell-laptop: Add Latitude 7480 and others to the DMI whitelist
  platform/x86: intel-hid: Support 5 button array
  platform/x86: thinkpad_acpi: Call led_classdev_notify_brightness_hw_changed on kbd brightness change
  platform/x86: thinkpad_acpi: Use brightness_set_blocking callback for LEDs
  platform/x86: thinkpad_acpi: Stop setting led_classdev brightness directly
  leds: class: Add new optional brightness_hw_changed attribute
  platform/x86: acer-wmi: add another KEY_WLAN keycode
  platform/x86: acer-wmi: Inform firmware that RF Button Driver is active
  platform/x86: asus-wireless: Fix indentation
  platform/x86: asus-wireless: Use per-HID HSWC parameters
  platform/x86: intel_pmc_ipc: Add APL PMC PCI Id
  platform/x86: intel_pmc_ipc: read s0ix residency API
  platform/x86: alienware-wmi: Remove header duplicate
  platform/x86: intel_mid_powerbtn: Use SCU IPC directly
  platform/x86: intel_mid_powerbtn: Unify IRQ acknowledgment
  platform/x86: intel_mid_powerbtn: Move comment to where it belongs
  platform/x86: intel_mid_powerbtn: Unify PBSTATUS access
  platform/x86: intel_pmc_core: fix out-of-bounds accesses on stack
  platform/x86: silead depends on I2C being built-in
  ...
2017-02-25 14:35:37 -08:00
Linus Torvalds 5d8a00eee2 The usual collection of new drivers, non-critical fixes, and updates
to existing clk drivers. The bulk of the work is on Allwinner and
 Rockchip SoCs, but there's also an Intel Atom driver in here too.
 
 New Drivers:
  - Tegra BPMP firmware
  - Hisilicon hi3660 SoCs
  - Rockchip rk3328 SoCs
  - Intel Atom PMC
  - STM32F746
  - IDT VersaClock 5P49V5923 and 5P49V5933
  - Marvell mv98dx3236 SoCs
  - Allwinner V3s SoCs
 
 Removed Drivers:
  - Samsung Exynos4415 SoCs
 
 Updates:
  - Migrate ABx500 to OF
  - Qualcomm IPQ4019 CPU clks and general PLL support
  - Qualcomm MSM8974 RPM
  - Rockchip non-critical fixes and clk id additions
  - Samsung Exynos4412 CPUs
  - Socionext UniPhier NAND and eMMC support
  - ZTE zx296718 i2s and other audio clks
  - Renesas CAN and MSIOF clks for R-Car M3-W
  - Renesas resets for R-Car Gen2 and Gen3 and RZ/G1
  - TI CDCE913, CDCE937, and CDCE949 clk generators
  - Marvell Armada ap806 CPU frequencies
  - STM32F4* I2S/SAI support
  - Broadcom BCM2835 DSI support
  - Allwinner sun5i and A80 conversion to new style clk bindings
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCAAGBQJYsLxxAAoJEK0CiJfG5JUl0p0P/AiBaYvrmHBx3H9jdC3iQxd2
 7luFN3OqpykmZc3xx2xO3WaZ96kwwxiMu8sj3+VQo6oCkEuOY2ru6uPiDOcF4P3+
 8ku2taoWlESDbVLebVTNJoRXBaBLaV+9BCN7AKvXpVw+/UkJI5hgr0yMdh4tgtvu
 K08tTMkDNDbA33KXuJo8/chQFqi2W6XBXk22YMkqqA8jx0F4EM759LcgUlD1YfBS
 HKkgSOgsW3Zwhl27ZEAJMthcmS4+wFaEgFBeipg/hxTLI3aQtmDtRfXwg0wkbBx2
 8sVz9SyBwkjOT9+41kve+Je94NK3blnJEjbxPASveMwyhdX1TlDQCPfrXya/1zxz
 N1By1NpA6iEYwi4hy+OtBYlcsBHztAM/+eljDY2kEDvfiKjMa44GYmgBu4n8pq+n
 75NJxws6ZkzPs5/QsLT3hvTaL1SNX6PaEW8HabDXO40ccZc4CYvFZVOXMAnKaXzZ
 31hj8EvQ5x6hci+SPYyVu6j3ipOxN96VcZqEJ+hWyyuZEMK6Up1o/0lGZFgwa0UD
 SIl7RiTFKO6ko+8hYlk1g0DGtEyWDsdso1Bw4zaHwMngM/CwjJVzpK5T2t1fJyEh
 lN5MdhcOi0nsiRWdRxOwOlHDLf93qSo87mvseU1MCEXYN1aqTV3VxSm1YU8ZgQVk
 sAjpsJqj45enfDa9BmIt
 =o8o/
 -----END PGP SIGNATURE-----

Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux

Pull clk updates from Stephen Boyd:
 "The usual collection of new drivers, non-critical fixes, and updates
  to existing clk drivers. The bulk of the work is on Allwinner and
  Rockchip SoCs, but there's also an Intel Atom driver in here too.

  New Drivers:
   - Tegra BPMP firmware
   - Hisilicon hi3660 SoCs
   - Rockchip rk3328 SoCs
   - Intel Atom PMC
   - STM32F746
   - IDT VersaClock 5P49V5923 and 5P49V5933
   - Marvell mv98dx3236 SoCs
   - Allwinner V3s SoCs

  Removed Drivers:
   - Samsung Exynos4415 SoCs

  Updates:
   - Migrate ABx500 to OF
   - Qualcomm IPQ4019 CPU clks and general PLL support
   - Qualcomm MSM8974 RPM
   - Rockchip non-critical fixes and clk id additions
   - Samsung Exynos4412 CPUs
   - Socionext UniPhier NAND and eMMC support
   - ZTE zx296718 i2s and other audio clks
   - Renesas CAN and MSIOF clks for R-Car M3-W
   - Renesas resets for R-Car Gen2 and Gen3 and RZ/G1
   - TI CDCE913, CDCE937, and CDCE949 clk generators
   - Marvell Armada ap806 CPU frequencies
   - STM32F4* I2S/SAI support
   - Broadcom BCM2835 DSI support
   - Allwinner sun5i and A80 conversion to new style clk bindings"

* tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (130 commits)
  clk: renesas: mstp: ensure register writes complete
  clk: qcom: Do not drop device node twice
  clk: mvebu: adjust clock handling for the CP110 system controller
  clk: mvebu: Expand mv98dx3236-core-clock support
  clk: zte: add i2s clocks for zx296718
  clk: sunxi-ng: sun9i-a80: Fix wrong pointer passed to PTR_ERR()
  clk: sunxi-ng: select SUNXI_CCU_MULT for sun5i
  clk: sunxi-ng: Check kzalloc() for errors and cleanup error path
  clk: tegra: Add BPMP clock driver
  clk: uniphier: add eMMC clock for LD11 and LD20 SoCs
  clk: uniphier: add NAND clock for all UniPhier SoCs
  ARM: dts: sun9i: Switch to new clock bindings
  clk: sunxi-ng: Add A80 Display Engine CCU
  clk: sunxi-ng: Add A80 USB CCU
  clk: sunxi-ng: Add A80 CCU
  clk: sunxi-ng: Support separately grouped PLL lock status register
  clk: sunxi-ng: mux: Get closest parent rate possible with CLK_SET_RATE_PARENT
  clk: sunxi-ng: mux: honor CLK_SET_RATE_NO_REPARENT flag
  clk: sunxi-ng: mux: Fix determine_rate for mux clocks with pre-dividers
  clk: qcom: SDHCI enablement on Nexus 5X / 6P
  ...
2017-02-25 14:28:06 -08:00
Paul Gortmaker af050abb5c platform/x86: intel_turbo_max_3: make it explicitly non-modular
The Kconfig currently controlling compilation of this code is:

drivers/platform/x86/Kconfig:config INTEL_TURBO_MAX_3
drivers/platform/x86/Kconfig:   bool "Intel Turbo Boost Max Technology 3.0 enumeration driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the driver there is no doubt it is builtin-only.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

We do uncover some implicit includes during build coverage that
were hidden behind the module.h which pulls in a lot of dependants.

Cc: Andy Shevchenko <andy@infradead.org>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2017-02-24 23:48:54 -08:00
Alex Hung 8d2c4538db platform/x86: dell-laptop: Add Latitude 7480 and others to the DMI whitelist
This is to support Latitude 7480 and many other newer Dell laptops.

Signed-off-by: Alex Hung <alex.hung@canonical.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2017-02-24 23:48:53 -08:00
Alex Hung bd5762a0c1 platform/x86: intel-hid: Support 5 button array
New firmwares include a feature called 5 button array that supports
super key, volume up/down, rotation lock and power button. Support
for this feature is required to fix power button on some recent
systems.

This patch was tested on a Dell Latitude 7480.

Signed-off-by: Alex Hung <alex.hung@canonical.com>
Reviewed-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2017-02-24 23:48:53 -08:00
Hans de Goede c685e20df5 platform/x86: thinkpad_acpi: Call led_classdev_notify_brightness_hw_changed on kbd brightness change
Make thinkpad_acpi call led_classdev_notify_brightness_hw_changed on the
kbd_led led_classdev registered by thinkpad_acpi when the kbd backlight
brightness is changed through the hotkey.

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

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

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

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

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

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
2017-02-24 23:48:51 -08:00
Chris Chiu 5ffa572a43 platform/x86: acer-wmi: add another KEY_WLAN keycode
Now that we have informed the firmware that the RF Button driver is
active, laptops such as the Acer TravelMate P238-M will generate
a WMI key event with code 0x86 when the Fn+F3 airplane mode key is
pressed.

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

Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Daniel Drake <drake@endlessm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-24 23:48:50 -08:00
Chris Chiu 280642c3c8 platform/x86: acer-wmi: Inform firmware that RF Button Driver is active
The same method to activate LM(Launch Manager) can also be used to
activate the RF Button driver with different bit toggled in the same
lm_status. To express that many functions this byte field can achieve,
rename the lm_status to app_status. And also the app_mask is the bit
mask which specifically indicate which bits are going to be changed.

This solves a problem where the AR9565 wifi included in the
Acer Aspire ES1-421 is permanently hard blocked according to the rfkill
GPIO read by ath9k.

Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Daniel Drake <drake@endlessm.com>
Reviewed-by: Lee, Chun-Yi <jlee@suse.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-24 23:48:49 -08:00
João Paulo Rechi Vita 4ac20e62ef platform/x86: asus-wireless: Fix indentation
Fix indentation problem introduced when this driver was first merged into
the kernel.

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-24 23:48:48 -08:00
João Paulo Rechi Vita 4b7fb9fcf9 platform/x86: asus-wireless: Use per-HID HSWC parameters
Some Asus machines use 0x4/0x5 as their LED on/off values, while others
use 0x0/0x1, as shown in the DSDT excerpts below. Luckily it seems this
behavior is tied to different HIDs, after looking at 44 DSDTs from
different Asus models.

Another small difference is that a few of them call GWBL instead of
OWGS, and SWBL instead of OWGD. That does not seem to make a difference
for asus-wireless, and is additional reasoning to not try to call these
methods directly.

Device (ASHS)                       | Device (ASHS)
{                                   | {
    Name (_HID, "ATK4002")          |     Name (_HID, "ATK4001")
    Method (HSWC, 1, Serialized)    |     Method (HSWC, 1, Serialized)
    {                               |     {
        If ((Arg0 < 0x02))          |         If ((Arg0 < 0x02))
        {                           |         {
            OWGD (Arg0)             |             OWGD (Arg0)
            Return (One)            |             Return (One)
        }                           |         }
        If ((Arg0 == 0x02))         |
        {                           |         If ((Arg0 == 0x02))
            Local0 = OWGS ()        |         {
            If (Local0)             |             Return (OWGS ())
            {                       |         }
                    Return (0x05)   |
            }                       |         If ((Arg0 == 0x03))
            Else                    |         {
            {                       |             Return (0xFF)
                    Return (0x04)   |         }
            }                       |
        }                           |         If ((Arg0 == 0x80))
        If ((Arg0 == 0x03))         |         {
        {                           |            Return (One)
            Return (0xFF)           |         }
        }                           |     }
        If ((Arg0 == 0x04))         |     Method (_STA, 0, NotSerialized)
        {                           |     {
            OWGD (Zero)             |         If ((MSOS () >= OSW8))
            Return (One)            |         {
        }                           |             Return (0x0F)
        If ((Arg0 == 0x05))         |         }
        {                           |         Else
            OWGD (One)              |         {
            Return (One)            |             Return (Zero)
        }                           |         }
        If ((Arg0 == 0x80))         |     }
        {                           | }
            Return (One)            |
        }                           |
    }                               |
    Method (_STA, 0, NotSerialized) |
    {                               |
        If ((MSOS () >= OSW8))      |
        {                           |
            Return (0x0F)           |
        }                           |
        Else                        |
        {                           |
            Return (Zero)           |
        }                           |
    }                               |
}                                   |

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-24 23:48:48 -08:00
Rajneesh Bhardwaj 23e775db8c platform/x86: intel_pmc_ipc: Add APL PMC PCI Id
This patch adds the PCI Device id for Power Management Controller on Intel
Apollo Lake platforms.

Intel PMC IPC Driver loads as a platform driver on Apollo Lake platforms
since Intel BIOS hides the PCI Configuration space for 0:13:1 and
re-enumerates it as ACPI device (INT34D2). The correct PCI Device ID should
be added if some platform firmware choses to enumerate the device via PCI
space.

Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-24 23:48:47 -08:00
Shanth Murthy 76062b4ae2 platform/x86: intel_pmc_ipc: read s0ix residency API
This patch adds a new API to indicate S0ix residency in usec. It utilizes
the PMC Global Control Registers (GCR) to read deep and shallow
S0ix residency.

PMC MMIO resources:
        o Lower 4kB: IPC1 (PMC inter-processor communication) interface
        o Upper 4kB: GCR (Global Control Registers)

This enables the power management framework to take corrective actions when
the platform fails to enter S0ix after kernel freeze as part of the suspend
to idle flow. (echo freeze > /sys/power/state).

This is expected to be used with a S0ix failsafe framework such as:
<https://lwn.net/Articles/689505/>

[rajneesh: folded in "fix division in 32-bit case" from Andy Shevchenko]
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Shanth Murthy <shanth.murthy@intel.com>
[andy: fixed kbuild error, removed "total" from variables, fixed macro]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-24 23:48:46 -08:00
Andy Shevchenko 8e4b8c7d7d platform/x86: alienware-wmi: Remove header duplicate
No need to #include <linux/acpi.h> twice. Remove second occurrence.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-24 23:48:46 -08:00
Andy Shevchenko 25b4a38fcf platform/x86: intel_mid_powerbtn: Use SCU IPC directly
On older Intel MID platforms is using SCU IPC library beneath MSIC
calls.

To make access unified between old and new platforms use SCU IPC library
directly. It's safe since serialization is done in the library.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-24 23:48:45 -08:00
Andy Shevchenko ca45ba0688 platform/x86: intel_mid_powerbtn: Unify IRQ acknowledgment
The IRQ on Intel Merrifield can be acknowledged in the similar way it's
done for previous MID platforms. Unify acknowledgment via SCU IPC.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-24 23:47:08 -08:00
Linus Torvalds c945d0227d Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 platform updates from Ingo Molnar:
 "Misc platform updates: SGI UV4 support additions, intel-mid Merrifield
  enhancements and purge of old code"

* 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (21 commits)
  x86/platform/UV/NMI: Fix uneccessary kABI breakage
  x86/platform/UV: Clean up the NMI code to match current coding style
  x86/platform/UV: Ensure uv_system_init is called when necessary
  x86/platform/UV: Initialize PCH GPP_D_0 NMI Pin to be NMI source
  x86/platform/UV: Verify NMI action is valid, default is standard
  x86/platform/UV: Add basic CPU NMI health check
  x86/platform/UV: Add Support for UV4 Hubless NMIs
  x86/platform/UV: Add Support for UV4 Hubless systems
  x86/platform/UV: Clean up the UV APIC code
  x86/platform/intel-mid: Move watchdog registration to arch_initcall()
  x86/platform/intel-mid: Don't shadow error code of mp_map_gsi_to_irq()
  x86/platform/intel-mid: Allocate RTC interrupt for Merrifield
  x86/ioapic: Return suitable error code in mp_map_gsi_to_irq()
  x86/platform/UV: Fix 2 socket config problem
  x86/platform/UV: Fix panic with missing UVsystab support
  x86/platform/intel-mid: Enable RTC on Intel Merrifield
  x86/platform/intel: Remove PMIC GPIO block support
  x86/platform/intel-mid: Make intel_scu_device_register() static
  x86/platform/intel-mid: Enable GPIO keys on Merrifield
  x86/platform/intel-mid: Get rid of duplication of IPC handler
  ...
2017-02-20 16:26:57 -08:00
Andy Shevchenko 5cb44ee2f4 platform/x86: intel_mid_powerbtn: Move comment to where it belongs
The comments is about initial interrupt acknowledgment only. So, move it
back to where it belongs.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-14 00:39:49 +02:00
Andy Shevchenko b30f3f8e10 platform/x86: intel_mid_powerbtn: Unify PBSTATUS access
The status register on Intel Merrifield can be read in the similar way
it's done for previous MID platforms. Unify access to PBSTATUS register
via SCU IPC.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-14 00:39:49 +02:00
Andrey Ryabinin 4f24ecff01 platform/x86: intel_pmc_core: fix out-of-bounds accesses on stack
pmc_core_mtpmc_link_status() an pmc_core_check_read_lock_bit() use
test_bit() on local 32-bit variable. This causes out-of-bounds
access since test_bit() expects object at least of 'unsigned long' size:

   BUG: KASAN: stack-out-of-bounds in pmc_core_probe+0x3aa/0x3b0
    Call Trace:
     __asan_report_load_n_noabort+0x5c/0x80
     pmc_core_probe+0x3aa/0x3b0
     local_pci_probe+0xf9/0x1e0
     pci_device_probe+0x27b/0x350
     driver_probe_device+0x419/0x830
     __driver_attach+0x15f/0x1d0
     bus_for_each_dev+0x129/0x1d0
     driver_attach+0x42/0x70
     bus_add_driver+0x385/0x690
     driver_register+0x1a9/0x3d0
     __pci_register_driver+0x1a2/0x290
     intel_pmc_core_driver_init+0x19/0x1b
     do_one_initcall+0x12e/0x280
     kernel_init_freeable+0x57c/0x623
     kernel_init+0x13/0x140
     ret_from_fork+0x2e/0x40

Fix this by open coding bit test. While at it, also refactor this code
a little bit.

Fixes: 173943b3da ("platform/x86: intel_pmc_core: ModPhy core lanes pg status")
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
[andy: reverted not related changes, used BIT() macro]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-14 00:39:48 +02:00
Arnd Bergmann be2eba5810 platform/x86: silead depends on I2C being built-in
The new driver cannot be a loadable module, so if I2C is loadable, we get this
link error:

drivers/platform/built-in.o: In function `silead_ts_dmi_init':
silead_dmi.c:(.init.text+0x2ef): undefined reference to `i2c_bus_type'

This makes the Kconfig dependency stricter to require I2C=y.

Fixes: 9eeda3897a85 ("platform/x86: add support for devices with Silead touchscreens")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-14 00:39:48 +02:00
Hans de Goede cef9dd85ac platform/x86: add support for devices with Silead touchscreens
On ACPI based tablets, the ACPI touchscreen node only contains info on
the gpio and the irq, and is missing any info on the axis. This info is
expected to be built into the tablet model specific version of the driver
shipped with the os-image for the device.

Add support for getting the missing info from a table built into the
driver, using dmi data to identify which entry of the table to use and
add info for the CUBE iwork8 Air and Jumper EZpad mini3 tablets on which
this code was tested / developed.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=187531
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
[dmitry.torokhov@gmail.com: Move to platform/x86]
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
[andy: fixed merge conflict]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-14 00:39:48 +02:00
Andy Shevchenko 1cfd3ba0c1 platform/x86: intel_mid_powerbtn: Remove snail address
The snail address is subject to change. This already happened once.
Remove the address completely from the file to avoid potential noise
when update.

While here, adjust copyright years and list authors.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-04 02:47:25 +01:00
Andy Shevchenko 7591b9f52d platform/x86: intel_mid_powerbtn: Sort headers alphabetically
Sort header inclusion block in alphabetical order.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-04 02:47:25 +01:00
Andy Shevchenko fdde1a8226 platform/x86: intel_mid_powerbtn: Join string literals
There is no need and bad practice for debugging to split string
literals. Join them back.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-04 02:47:24 +01:00
Andy Shevchenko 6a0f998856 platform/x86: intel_mid_powerbtn: Enable driver for Merrifield
Enable this driver to handle events from Basin Cove PMIC, which is
installed on Intel Merrifield platform.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-04 02:47:23 +01:00
Andy Shevchenko 553e9c1861 platform/x86: intel_mid_powerbtn: Acknowledge interrupts
Some platforms require interrupt to be acknowledged by clearing
MSIC_PWRBTNM bit in interrupt level 1 mask register.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-04 02:47:23 +01:00
Andy Shevchenko 4b819c6d5f platform/x86: intel_mid_powerbtn: Factor out mfld_ack()
Move Intel Medfield specific code to another callback, which will be
used later.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-04 02:47:22 +01:00
Andy Shevchenko 18934eceed platform/x86: intel_mid_powerbtn: Introduce driver data
This is preparatory patch to extend the driver in order to support other
Intel MID platform.

Here the new driver data structure is introduced with split of
->pbstat() callback.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-04 02:47:21 +01:00
Andy Shevchenko 48b44529d3 platform/x86: intel_mid_powerbtn: Substitute mfld by mid
Replace all occurrences of mfld by mid to emphasize that driver is used
for Intel MID platforms.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-04 02:47:21 +01:00
Andy Shevchenko 07d9089d39 platform/x86: intel_mid_powerbtn: Convert to use devm_*()
Convert driver to use managed resources.
This eliminates error path boilerplate and makes code neat.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-04 02:47:20 +01:00
Srinivas Pandruvada 4ec567b8dd platform/x86: Support Turbo Boost Max 3.0 for non HWP systems
On platforms supporting Intel Turbo Boost Max Technology 3.0, the
maximum turbo frequencies (turbo ratio) of some cores in a CPU package
may be higher than the other cores in the same package.  In that case,
better performance can be achieved by making the scheduler prefer to run
tasks on the CPUs with higher max turbo frequencies.

On Intel® Broadwell Xeon systems, it is optional to turn on HWP
(Hardware P-States). When HWP is not turned on, the BIOS doesn't
present required CPPC (Collaborative Processor Performance Control)
tables. This table is used to get the per CPU core maximum performance
ratio and inform scheduler (in cpufreq/intel_pstate driver).

On such systems the maximum performance ratio can be read via over
clocking (OC) mailbox interface for each CPU. This interface is not
architectural and can change for every model of processors.

This driver reads maximum performance ratio of each CPU and set up
the scheduler priority metrics. In this way scheduler can prefer CPU
with higher performance to schedule tasks.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2017-02-04 02:47:20 +01:00
Michał Kępień a28c7e93bf platform/x86: fujitsu-laptop: make hotkey handling functions more similar
Make two minor tweaks to acpi_fujitsu_hotkey_press() to make it more
similar to acpi_fujitsu_hotkey_release():

  * call vdbg_printk() after reporting the input event,
  * return immediately when kfifo_in_locked() fails.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2017-02-04 02:47:19 +01:00
Michał Kępień 29544f03e5 platform/x86: fujitsu-laptop: break up complex loop condition
The loop condition in acpi_fujitsu_hotkey_release() includes an
assignment, a four-argument function call and a comparison, making it
hard to read.  Separate the assignment from the comparison to improve
readability.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2017-02-04 02:47:18 +01:00
Michał Kępień 2451d19d5d platform/x86: fujitsu-laptop: move keycode processing to separate functions
acpi_fujitsu_hotkey_notify() is pretty deeply nested, which hurts
readability.  Move the keycode processing part to two separate functions
to make the code easier to understand and save a few line breaks.
Rename variable keycode_r to keycode as there is no longer any need to
differentiate between the two.  Tweak indentations to make checkpatch
happy.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2017-02-04 02:47:18 +01:00
Michał Kępień eb357cbaf7 platform/x86: fujitsu-laptop: decrease indentation in acpi_fujitsu_hotkey_notify()
acpi_fujitsu_hotkey_notify() is pretty deeply nested, which hurts
readability.  Strip off one level of indentation by returning early when
the event code supplied as argument is not ACPI_FUJITSU_NOTIFY_CODE1.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2017-02-04 02:47:17 +01:00
Michał Kępień 5c461e8e74 platform/x86: fujitsu-laptop: simplify logolamp_get()
Now that call_fext_func() is invoked by logolamp_set() for both
LOGOLAMP_POWERON and LOGOLAMP_ALWAYS for every brightness value,
logolamp_get() can be simplified to decrease indentation and number of
local variables.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-04 02:47:07 +01:00
Michał Kępień dcb50b3516 platform/x86: fujitsu-laptop: rework logolamp_set() to properly handle errors
Potential errors returned by some call_fext_func() calls inside
logolamp_set() are currently ignored.  Rework logolamp_set() to properly
handle them.  This causes one more call_fext_func() call to be made in
the LED_OFF case, though one could argue that this is logically the
right thing to do (even though the extra call is not needed to shut the
LED off).

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-04 02:46:38 +01:00
Jean Delvare 9893ae8606 platform/x86: dell-smbios: Auto-select as needed
Dell-smbios is a helper module, it serves no purpose on its own, so
do not present it as an option to the user. Instead, select it
automatically whenever a driver which needs it is selected.

Also select DCDBAS as needed, instead of depending on it, so that
the Dell driver options are always visible.

As a clean-up, I removed the "default n" statements as they are not
needed (n is the default default.)

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Michał Kępień <kernel@kempniu.pl>
Cc: Pali Rohár <pali.rohar@gmail.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-03 14:04:54 +02:00
Guenter Roeck 596c124232 platform/x86: intel_pmc_ipc: Remove unused iTCO_version variable
iTCO_version was there since the driver was introduced but never used.
Drop it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-03 14:04:53 +02:00
Javier Martinez Canillas a93151a720 platform/x86: intel_mid_thermal: Fix module autoload
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/platform/x86/intel_mid_thermal.ko | grep alias
$

After this patch:

$ modinfo drivers/platform/x86/intel_mid_thermal.ko | grep alias
alias:          platform:msic_thermal

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-03 14:04:53 +02:00
Javier Martinez Canillas 275721585b platform/x86: intel_mid_thermal: Remove duplicated platform device ID
Commit 3fca3d3d50 ("platform-x86: intel_mid_thermal: add msic_thermal
alias") added a "msic_thermal" entry to the driver's platform device ID
table since that was the platform dev name registered in some platforms
and the only dev in the platform table was "msic_sensor" (DRIVER_NAME).

But then commit 634830704d ("x86/mid/thermal: Add msic_thermal alias")
changed DRIVER_NAME from "msic_sensor" to "msic_thermal", and so there's
now duplicated entries in the platform device ID table.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-03 14:04:53 +02:00
Vadim Pasternak 9a38b67c98 platform/x86: mlx-platform: mlxcpld-hotplug driver style fixes
The patch contains several styling fixes:
  - Make names of hotplug devices shorter;
  - Change register offset assignment to defines;
  - Add defines for the all event masks;
  - Use PLATFORM_DEVID_NONE instead of -1;

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-03 14:04:53 +02:00
Ladislav Michl 3e49160760 platform/x86: hp_accel: Add support for HP ZBook 17
HP ZBook 17 laptop needs a non-standard mapping (xy_swap_yz_inverted).

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-03 14:04:53 +02:00
Lee, Chun-Yi 98d610c373 platform/x86: acer-wmi: setup accelerometer when machine has appropriate notify event
The accelerometer event relies on the ACERWMID_EVENT_GUID notify.
So, this patch changes the codes to setup accelerometer input device
when detected ACERWMID_EVENT_GUID. It avoids that the accel input
device created on every Acer machines.

In addition, patch adds a clearly parsing logic of accelerometer hid
to acer_wmi_get_handle_cb callback function. It is positive matching
the "SENR" name with "BST0001" device to avoid non-supported hardware.

Reported-by: Bjørn Mork <bjorn@mork.no>
Cc: Darren Hart <dvhart@infradead.org>
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
[andy: slightly massage commit message]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-03 14:04:53 +02:00
Micha? K?pie? 5f25b0054f platform/x86: fujitsu-laptop: set default trigger for radio LED to rfkill-any
The "radio components indicator" LED present in Lifebook E734/E744/E754
should be lit when any radio transmitter is enabled, so set its default
trigger to rfkill-any.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-03 14:04:53 +02:00
Ingo Molnar 1055e0ba56 Merge branch 'x86/urgent' into x86/platform, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-02-01 10:19:35 +01:00
Irina Tirdea 282a4e4ce5 platform/x86: Enable Atom PMC platform clocks
The BayTrail and CherryTrail platforms provide platform clocks
through their Power Management Controller (PMC).

The SoC supports up to 6 clocks (PMC_PLT_CLK[0..5]) with a
frequency of either 19.2 MHz (PLL) or 25 MHz (XTAL) for BayTrail
and a frequency of 19.2 MHz (XTAL) for CherryTrail. These clocks
are available for general system use, where appropriate. For example,
the usage for platform clocks suggested in the datasheet is the
following:
  PLT_CLK[0..2] - Camera
  PLT_CLK[3] - Audio Codec
  PLT_CLK[4] -
  PLT_CLK[5] - COMMs

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2017-01-26 16:21:59 -08:00
Irina Tirdea 80a7581f38 arch/x86/platform/atom: Move pmc_atom to drivers/platform/x86
The pmc_atom driver does not contain any architecture specific
code. It only enables the SoC Power Management Controller driver
for BayTrail and CherryTrail platforms.

Move the pmc_atom driver from arch/x86/platform/atom to
drivers/platform/x86. Also clean-up and reorder include files by
alphabetical order in pmc_atom.h

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2017-01-26 16:21:27 -08:00
Zach Ploskey cfee5d6376 platform/x86: ideapad-laptop: handle ACPI event 1
On Ideapad laptops, ACPI event 1 is currently not handled. Many models
log "ideapad_laptop: Unknown event: 1" every 20 seconds or so while
running on battery power. Some convertible laptops receive this event
when switching in and out of tablet mode.

This adds and additional case for event 1 in ideapad_acpi_notify to call
ideapad_input_report(priv, vpc_bit), so that the event is reported to
userspace and we avoid unnecessary logging.

Fixes bug #107481 (https://bugzilla.kernel.org/show_bug.cgi?id=107481)
Fixes bug #65751 (https://bugzilla.kernel.org/show_bug.cgi?id=65751)

Signed-off-by: Zach Ploskey <zach@ploskey.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-01-22 12:47:06 +02:00
Andy Shevchenko 5a00b6c243 platform/x86: intel_mid_powerbtn: Set IRQ_ONESHOT
The commit 1c6c69525b ("genirq: Reject bogus threaded irq requests")
starts refusing misconfigured interrupt handlers. This makes
intel_mid_powerbtn not working anymore.

Add a mandatory flag to a threaded IRQ request in the driver.

Fixes: 1c6c69525b ("genirq: Reject bogus threaded irq requests")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-01-21 01:45:34 +02:00
Benjamin Tissoires e95ac4574b platform/x86: surface3-wmi: fix uninitialized symbol
The patch 3dda3b3798: "platform/x86: Add custom surface3 platform
device for controlling LID" from Nov 25, 2016, leads to the following
static checker warning:

        drivers/platform/x86/surface3-wmi.c:168 s3_wmi_check_platform_device()
        error: uninitialized symbol 'ts_adev'.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-01-21 01:43:42 +02:00
Arnd Bergmann 44e6861646 platform/x86: surface3-wmi: Shut up unused-function warning
The newly added driver guards its "resume" callback with an
warning in some configurations:

drivers/platform/x86/surface3-wmi.c:248:12: error: 's3_wmi_resume' defined but not used [-Werror=unused-function]

Using a __maybe_unused annotation without an #ifdef avoids the mistake more
reliably.

Fixes: 3dda3b3798 ("platform/x86: Add custom surface3 platform device for controlling LID")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2017-01-21 01:43:42 +02:00
Dan Carpenter 63d762b88c platform/x86: mlx-platform: free first dev on error
There is an off-by-one error so we don't unregister priv->pdev_mux[0].
Also it's slightly simpler as a while loop instead of a for loop.

Fixes: 58cbbee239 ("x86/platform/mellanox: Introduce support for Mellanox systems platform")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-01-21 01:43:42 +02:00
Andy Shevchenko a665ece8b4 x86/platform/intel: Remove PMIC GPIO block support
Moorestown support was removed by commit:

  1a8359e411 ("x86/mid: Remove Intel Moorestown")

Remove this leftover.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: platform-driver-x86@vger.kernel.org
Link: http://lkml.kernel.org/r/20170112112331.93236-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-01-14 08:30:45 +01:00
Micha? K?pie? a608a9d52f platform/x86: fujitsu-laptop: use brightness_set_blocking for LED-setting callbacks
All LED-setting functions in fujitsu-laptop are currently assigned to
the brightness_set callback, which is incorrect because they can sleep
(due to their use of call_fext_func(), which in turn issues ACPI calls)
and the documentation (in include/linux/leds.h) clearly states they must
not.  Assign them to brightness_set_blocking instead and change them to
match the expected function prototype.

This change makes it possible to use Fujitsu-specific LEDs with "heavy"
triggers, like disk-activity or phy0rx.

Fixes: 3a40708609 ("fujitsu-laptop: Add BL power, LED control and radio state information")
Fixes: 4f62568c1f ("fujitsu-laptop: Support radio LED")
Fixes: d6b88f64b0 ("fujitsu-laptop: Add support for eco LED")
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-28 12:38:10 +02:00
Randy Dunlap f6c5c1f96d platform/x86: fix surface3_button build errors
Fix build errors when I2C=m and SURFACE_3_BUTTON=y.
The driver uses i2c interfaces so it should depend on I2C.

drivers/built-in.o: In function `surface3_driver_init':
surface3_button.c:(.init.text+0x75cb0): undefined reference to `i2c_register_driver'
drivers/built-in.o: In function `surface3_driver_exit':
surface3_button.c:(.exit.text+0x31a8): undefined reference to `i2c_del_driver'

Fixes: 1a64b719d3 (platform/x86: Introduce button support for the Surface 3)

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Cc: platform-driver-x86@vger.kernel.org
Cc: Darren Hart <dvhart@infradead.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-28 12:36:45 +02:00
Thomas Gleixner 8b0e195314 ktime: Cleanup ktime_set() usage
ktime_set(S,N) was required for the timespec storage type and is still
useful for situations where a Seconds and Nanoseconds part of a time value
needs to be converted. For anything where the Seconds argument is 0, this
is pointless and can be replaced with a simple assignment.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
2016-12-25 17:21:22 +01:00
Linus Torvalds 7c0f6ba682 Replace <asm/uaccess.h> with <linux/uaccess.h> globally
This was entirely automated, using the script by Al:

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

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

Requested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-24 11:46:01 -08:00
Linus Torvalds 8421c60446 platform-drivers-x86 for 4.10-2
Move and add registration for the mlx-platform driver. Introduce button and lid
 drivers for the surface3 (different from the surface3-pro). Add BXT PMIC TMU
 support. Add Y700 to existing ideapad-laptop quirk.
 
 ideapad-laptop:
  - Add Y700 15-ACZ to no_hw_rfkill DMI list
 
 surface3_button:
  - Introduce button support for the Surface 3
 
 surface3-wmi:
  - Add custom surface3 platform device for controlling LID
  - Balance locking on error path
 
 mlx-platform:
  - Add mlxcpld-hotplug driver registration
  - Fix semicolon.cocci warnings
  - Move module from arch/x86
 
 platform/x86:
  - Add Whiskey Cove PMIC TMU support
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJYVxXxAAoJEKbMaAwKp364mDAIAL750zoO/liY1qfFGktkY2zS
 xknJqh4UeIVW6iN9hEq7jQD3jkFl7hNuXgFyogLZgJQge8gfufsOD7ljkhp2wVF2
 3Ir437f4GdcUeuhO6PwuPZnn++Y6oH2rLZc1d+5anZRikW470tnXitrXs5hsqG57
 74KiSFa+v+Uj1kqU4Gjt0QDSfmQc185Wn5xieHPpZrcjDaut+N4t06+MDMcH7fjk
 6nJ+tvo/dreZojA+AklljaNB2BioIGbEOGamnxOJ9Rjs0jV2d0A1c/6XBHDe+Xtu
 SkWqvjdrLOSxAjErBpB97VYnYihjCDXfl+DIABOdumGO6hJz01DvbZ+VVLwGM0E=
 =YH31
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v4.10-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86

Pull more x86 platform driver updates from Darren Hart:
 "Move and add registration for the mlx-platform driver. Introduce
  button and lid drivers for the surface3 (different from the
  surface3-pro). Add BXT PMIC TMU support. Add Y700 to existing
  ideapad-laptop quirk.

  Summary:

  ideapad-laptop:
   - Add Y700 15-ACZ to no_hw_rfkill DMI list

  surface3_button:
   - Introduce button support for the Surface 3

  surface3-wmi:
   - Add custom surface3 platform device for controlling LID
   - Balance locking on error path

  mlx-platform:
   - Add mlxcpld-hotplug driver registration
   - Fix semicolon.cocci warnings
   - Move module from arch/x86

  platform/x86:
   - Add Whiskey Cove PMIC TMU support"

* tag 'platform-drivers-x86-v4.10-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86:
  platform/x86: surface3-wmi: Balance locking on error path
  platform/x86: Add Whiskey Cove PMIC TMU support
  platform/x86: ideapad-laptop: Add Y700 15-ACZ to no_hw_rfkill DMI list
  platform/x86: Introduce button support for the Surface 3
  platform/x86: Add custom surface3 platform device for controlling LID
  platform/x86: mlx-platform: Add mlxcpld-hotplug driver registration
  platform/x86: mlx-platform: Fix semicolon.cocci warnings
  platform/x86: mlx-platform: Move module from arch/x86
2016-12-18 15:45:33 -08:00
Andy Shevchenko 83da6b5991 platform/x86: surface3-wmi: Balance locking on error path
There is a possibility that lock will be left acquired.
Consolidate error path under out_free_unlock label.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-18 14:56:43 -08:00
Nilesh Bacchewar 957ae50981 platform/x86: Add Whiskey Cove PMIC TMU support
This adds TMU (Time Management Unit) support for Intel BXT platform.
It enables the alarm wake-up functionality in the TMU unit of Whiskey Cove
PMIC.

Signed-off-by: Nilesh Bacchewar <nilesh.bacchewar@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
[andy: resolve merge conflict in Kconfig]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-18 14:56:37 -08:00
velemas e297046875 platform/x86: ideapad-laptop: Add Y700 15-ACZ to no_hw_rfkill DMI list
Like other Y700 models Lenovo Y700 15-ACZ does not have a physical rfkill switch.
ideapad-laptop wrongly reports all radios as blocked by hardware which causes
wireless network connections to fail.

Add this model without an rfkill switch to the no_hw_rfkill list.

Signed-off-by: Artiom Vaskov <velemas@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-16 23:30:26 +02:00
Benjamin Tissoires 1a64b719d3 platform/x86: Introduce button support for the Surface 3
The Surface 3 is not following the ACPI spec for PNP0C40, but nearly.
The device is connected to a I2C device that might have some magic
but we don't know about.
Just create the device after the enumeration and use the declared GPIOs
to provide button support.

This driver is just an adaptation of drivers/input/misc/soc_button_array.c

The Surface Pro 3 is using an ACPI driver and matches against the bid
of the device ("VGBI"). To prevent this incompatible driver to be used
on the Surface Pro, we add a match on the Surface 3 bid "TEV2".

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

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-16 23:30:26 +02:00
Benjamin Tissoires 3dda3b3798 platform/x86: Add custom surface3 platform device for controlling LID
The LID state provided by ACPI on the Surface 3 is not accurate.
The ACPI node doesn't get notified on LID open, which means the
LID input switch stays close most of the time.

Fortunatelly, there is a WMI method which directly queries the
GPIO underneath the LID state, so it's far more reliable than ACPI.
To get the notifications that the LID was opened/closed, we can
rely on the ACPI notification of the touchscreen: the DSDT shows
that the touchscreen will get notified on close/open as it also
controls its _STA method.

Note that we need to set the tag "power-switch" to the LID
input node through a udev rule for logind to accept it:

SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="surface3-wmi", \
	TAG+="power-switch"

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-16 23:30:25 +02:00
Vadim Pasternak afc4715901 platform/x86: mlx-platform: Add mlxcpld-hotplug driver registration
Add calls for mlxcpld-hotplug platform driver registration/unregistration
and add platform hotplug data configurations. This driver, when registered
within system will handle system hot-plug events for the power suppliers,
power cables and fans (insertion and removing). These events are
controlled through CPLD Lattice device.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-16 23:30:25 +02:00
kbuild test robot c3886c9d60 platform/x86: mlx-platform: Fix semicolon.cocci warnings
drivers/platform/x86/mlx-platform.c:219:2-3: Unneeded semicolon

 Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

CC: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-16 23:30:25 +02:00
Vadim Pasternak 6613d18e90 platform/x86: mlx-platform: Move module from arch/x86
Since mlx-platform is not an architectural driver, it is moved out
of arch/x86/platform to drivers/platform/x86.
Relevant Makefile and Kconfig are updated.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-16 23:30:24 +02:00
Linus Torvalds e18bf801f1 platform-drivers-x86 for 4.10-1
Introduce one new driver for Mellanox platforms. Add support for various new
 models to existing drivers via quirks, hotkeys, etc. Significant updates to
 intel_pmc_core in support of Kabylake and Sunrise Point PCH power management
 debug. Some cleanup and refactoring across various drivers.
 
 dell-laptop:
  - Use brightness_set_blocking for kbd_led_level_set
 
 thinkpad_acpi:
  - Initialize local in_tablet_mode and type
  - Fix old style declaration GCC warning
  - Adding new hotkey ID for Lenovo thinkpad
  - Add support for X1 Yoga (2016) Tablet Mode
  - Move tablet detection into separate function
 
 asus-nb-wmi:
  - Add X45U quirk
  - Make use of dmi->ident
 
 asus-wmi:
  - Set specified XUSB2PR value for X550LB
 
 intel_mid_thermal:
  - Fix suspend handlers unused warning
 
 intel-vbtn:
  - Switch to use devm_input_allocate_device
 
 dell-wmi:
  - Add events created by Dell Rugged 2-in-1s
  - Adjust wifi catcher to emit KEY_WLAN
 
 intel_pmc_core:
  - Add KBL CPUID support
  - Add LTR IGNORE debug feature
  - Add MPHY PLL clock gating status
  - ModPhy core lanes pg status
  - Add PCH IP Power Gating Status
  - Fix PWRMBASE mask and mmio reg len
 
 acer-wmi:
  - Only supports AMW0_GUID1 on acer family
 
 mlx-platform:
  - Introduce support for Mellanox hotplug driver
 
 platform/x86:
  - Use ACPI_FAILURE at appropriate places
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJYUwFxAAoJEKbMaAwKp3645GkH/RjsE8jubyerhlKqgG4UZaRA
 2a2NnCOI1fuDqSV0bgIo4rzMHeHHjR8Hosz6HXkb3cC67QNfae3Xasr2+vqzqqKd
 hJFUL/y6JmAhLUcPVp49HWOLrYLKM12iLyEidPOor4r/qWrarLtVEyvX5O8VEy01
 +cM29+KcZnHjtQQoDaVwWZ1bEbLVNRlSrQ/YZivGBPXJBsvnz1Wq5xPuGHDm660X
 rVw8h1GojPwctiNWTpw2VlMUz8Ho0yXMBAPTpEJOzlFR8FTaSD6XQqm/uZ5w8ToJ
 Sn12XavaKeQSki7VVTmouL+L4Ams0Ygz8pgDd3ynhN6U/hFfTWbGhdRCILxmSRk=
 =iHwp
 -----END PGP SIGNATURE-----

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

Pull x86 platform driver updates from Darrent Hart:
 "Introduce one new driver for Mellanox platforms. Add support for
  various new models to existing drivers via quirks, hotkeys, etc.
  Significant updates to intel_pmc_core in support of Kabylake and
  Sunrise Point PCH power management debug. Some cleanup and refactoring
  across various drivers.

  Detailed summary:

  dell-laptop:
   - Use brightness_set_blocking for kbd_led_level_set

  thinkpad_acpi:
   - Initialize local in_tablet_mode and type
   - Fix old style declaration GCC warning
   - Adding new hotkey ID for Lenovo thinkpad
   - Add support for X1 Yoga (2016) Tablet Mode
   - Move tablet detection into separate function

  asus-nb-wmi:
   - Add X45U quirk
   - Make use of dmi->ident

  asus-wmi:
   - Set specified XUSB2PR value for X550LB

  intel_mid_thermal:
   - Fix suspend handlers unused warning

  intel-vbtn:
   - Switch to use devm_input_allocate_device

  dell-wmi:
   - Add events created by Dell Rugged 2-in-1s
   - Adjust wifi catcher to emit KEY_WLAN

  intel_pmc_core:
   - Add KBL CPUID support
   - Add LTR IGNORE debug feature
   - Add MPHY PLL clock gating status
   - ModPhy core lanes pg status
   - Add PCH IP Power Gating Status
   - Fix PWRMBASE mask and mmio reg len

  acer-wmi:
   - Only supports AMW0_GUID1 on acer family

  mlx-platform:
   - Introduce support for Mellanox hotplug driver

  platform/x86:
   - Use ACPI_FAILURE at appropriate places"

* tag 'platform-drivers-x86-v4.10-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86: (22 commits)
  platform/x86: thinkpad_acpi: Initialize local in_tablet_mode and type
  platform/x86: dell-laptop: Use brightness_set_blocking for kbd_led_level_set
  platform/x86: thinkpad_acpi: Fix old style declaration GCC warning
  platform/x86: thinkpad_acpi: Adding new hotkey ID for Lenovo thinkpad
  platform/x86: thinkpad_acpi: Add support for X1 Yoga (2016) Tablet Mode
  platform/x86: thinkpad_acpi: Move tablet detection into separate function
  platform/x86: asus-nb-wmi.c: Add X45U quirk
  platform/x86: asus-nb-wmi: Make use of dmi->ident
  platform/x86: asus-wmi: Set specified XUSB2PR value for X550LB
  platform/x86: intel_mid_thermal: Fix suspend handlers unused warning
  platform/x86: intel-vbtn: Switch to use devm_input_allocate_device
  platform/x86: Use ACPI_FAILURE at appropriate places
  platform/x86: dell-wmi: Add events created by Dell Rugged 2-in-1s
  platform/x86: dell-wmi: Adjust wifi catcher to emit KEY_WLAN
  platform/x86: intel_pmc_core: Add KBL CPUID support
  platform/x86: intel_pmc_core: Add LTR IGNORE debug feature
  platform/x86: intel_pmc_core: Add MPHY PLL clock gating status
  platform/x86: intel_pmc_core: ModPhy core lanes pg status
  platform/x86: intel_pmc_core: Add PCH IP Power Gating Status
  platform/x86: intel_pmc_core: Fix PWRMBASE mask and mmio reg len
  ...
2016-12-15 13:31:25 -08:00
Darren Hart cb2bf25145 platform/x86: thinkpad_acpi: Initialize local in_tablet_mode and type
linux-next reported in_tablet_mode and type may be used uninitialized
after:

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

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

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

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Lyude <lyude@redhat.com>
2016-12-15 12:31:48 -08:00
Hans de Goede 1d161d4cd7 platform/x86: dell-laptop: Use brightness_set_blocking for kbd_led_level_set
kbd_led_level_set uses dell_smbios call which blocks, so the kbd_led
classdev should use the brightness_set_blocking callback.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-12-13 09:29:08 -08:00
Tobias Klauser bb55a2ee76 platform/x86: thinkpad_acpi: Fix old style declaration GCC warning
Fix an [-Wold-style-declaration] GCC warning by moving the inline
keyword before the return type.

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

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

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-12-13 09:29:07 -08:00
Lyude b03f4d4946 platform/x86: thinkpad_acpi: Add support for X1 Yoga (2016) Tablet Mode
For whatever reason, the X1 Yoga doesn't support the normal method of
querying for tablet mode. Instead of providing the MHKG method under the
hotkey handle, we're instead given the CMMD method under the EC handle.
Values on this handle are either 0x1, laptop mode, or 0x6, tablet mode.

Tested-by: Daniel Martin <consume.noise@gmail.com>
Signed-off-by: Lyude <lyude@redhat.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-12-13 09:29:06 -08:00
Lyude b318002838 platform/x86: thinkpad_acpi: Move tablet detection into separate function
The hotkey events and ACPI handles used for detecting tablet mode on a
few of the newer thinkpad models (Yoga X1 and the Yoga 260 specifically)
have been changed around, so unfortunately this means we're definitely
going to need to probe for multiple types of tablet mode support. Since
the hotkey_init() is already a lot larger than it should be, let's split
up this detection into its own function to make things a little easier
to read.

As well, since we're going to have multiple types of tablet modes, make
hotkey_tablet into an enum so we can also use it to indicate the type of
tablet mode reporting the machine supports.

Suggested by Daniel Martin <consume.noise@gmail.com>
Signed-off-by: Lyude <lyude@redhat.com>
Cc: Daniel Martin <consume.noise@gmail.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-12-13 09:29:05 -08:00
Marcos Paulo de Souza e74e259939 platform/x86: asus-nb-wmi.c: Add X45U quirk
Without this patch, the Asus X45U wireless card can't be turned
on (hard-blocked), but after a suspend/resume it just starts working.

Following this bug report[1], there are other cases like this one, but
this Asus is the only model that I can test.

[1] https://ubuntuforums.org/showthread.php?t=2181558

Cc: stable@vger.kernel.org # 4.4.x-
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-13 09:29:04 -08:00
Marcos Paulo de Souza 085370eb19 platform/x86: asus-nb-wmi: Make use of dmi->ident
Make use of dmi->ident as other drivers do, like fujitsu, intel,
hp and samsung.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-13 09:29:04 -08:00
Kai-Chuan Hsieh 8023eff10e platform/x86: asus-wmi: Set specified XUSB2PR value for X550LB
The bluetooth adapter Atheros AR3012 can't be enumerated
and make the bluetooth function broken.

T:  Bus=02 Lev=01 Prnt=01 Port=05 Cnt=02 Dev#=  5 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=13d3 ProdID=3362 Rev=00.02
S:  Manufacturer=Atheros Communications
S:  Product=Bluetooth USB Host Controller
S:  SerialNumber=Alaska Day 2006
C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

The error is:

 usb 2-6: device not accepting address 7, error -62
 usb usb2-port6: unable to enumerate USB device

It is caused by adapter's connected port is mapped to xHC
controller, but the xHCI is not supported by the usb device.

The output of 'sudo lspci -nnxxx -s 00:14.0':

 00:14.0 USB controller [0c03]: Intel Corporation 8 Series USB xHCI HC [8086:9c31] (rev 04)
 00: 86 80 31 9c 06 04 90 02 04 30 03 0c 00 00 00 00
 10: 04 00 a0 f7 00 00 00 00 00 00 00 00 00 00 00 00
 20: 00 00 00 00 00 00 00 00 00 00 00 00 43 10 1f 20
 30: 00 00 00 00 70 00 00 00 00 00 00 00 0b 01 00 00
 40: fd 01 36 80 89 c6 0f 80 00 00 00 00 00 00 00 00
 50: 5f 2e ce 0f 00 00 00 00 00 00 00 00 00 00 00 00
 60: 30 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 70: 01 80 c2 c1 08 00 00 00 00 00 00 00 00 00 00 00
 80: 05 00 87 00 0c a0 e0 fe 00 00 00 00 a1 41 00 00
 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 a0: 00 01 04 00 00 00 00 00 00 00 00 00 00 00 00 00
 b0: 0f 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
 c0: 03 c0 30 00 00 00 00 00 03 0c 00 00 00 00 00 00
 d0: f9 01 00 00 f9 01 00 00 0f 00 00 00 0f 00 00 00
 e0: 00 08 00 00 00 00 00 00 00 00 00 00 d8 d8 00 00
 f0: 00 00 00 00 00 00 00 00 b1 0f 04 08 00 00 00 00

By referencing Intel Platform Controller Hub(PCH) datasheet,
the xHC USB 2.0 Port Routing(XUSB2PR) at offset 0xD0-0xD3h
decides the setting of mapping the port to EHCI controller or
xHC controller. And the port mapped to xHC will enable xHCI
during bus resume.

The setting of disabling bluetooth adapter's connected port is
0x000001D9. The value can be obtained by few times 1 bit flip
operation. The suited configuration should have the 'lsusb -t'
result with bluetooth using ehci:

/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/9p, 480M
    |__ Port 5: Dev 2, If 0, Class=Video, Driver=uvcvideo, 480M
    |__ Port 5: Dev 2, If 1, Class=Video, Driver=uvcvideo, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
        |__ Port 6: Dev 3, If 0, Class=Wireless, Driver=btusb, 12M
        |__ Port 6: Dev 3, If 1, Class=Wireless, Driver=btusb, 12M

Signed-off-by: Kai-Chuan Hsieh <kai.chiuan@gmail.com>
Acked-by: Corentin Chary <corentin.chary@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
[andy: resolve merge conflict in asus-wmi.h]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-13 09:29:03 -08:00
Borislav Petkov b4aca383f9 platform/x86: intel_mid_thermal: Fix suspend handlers unused warning
Fix:

  drivers/platform/x86/intel_mid_thermal.c:424:12: warning: ‘mid_thermal_resume’
  defined but not used [-Wunused-function]
   static int mid_thermal_resume(struct device *dev)
              ^
  drivers/platform/x86/intel_mid_thermal.c:436:12: warning: ‘mid_thermal_suspend’
  defined but not used [-Wunused-function]
   static int mid_thermal_suspend(struct device *dev)
              ^

which I see during randbuilds here.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Darren Hart <dvhart@infradead.org>
Cc: platform-driver-x86@vger.kernel.org
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-13 09:29:02 -08:00
Axel Lin bb9ad48484 platform/x86: intel-vbtn: Switch to use devm_input_allocate_device
Use devm_input_allocate_device to simplify the error handling code.
This conversion also makes input_register_device() to be called after
acpi_remove_notify_handler. This avoid a small window that it's possible
to call notify_handler after unregister input device.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-13 09:29:01 -08:00
Axel Lin 3526ecadc8 platform/x86: Use ACPI_FAILURE at appropriate places
Use ACPI_FAILURE() to replace !ACPI_SUCCESS(), this avoid !! operations.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-13 09:29:01 -08:00
Mario Limonciello 5dc444b804 platform/x86: dell-wmi: Add events created by Dell Rugged 2-in-1s
The Dell Rugged 7202 has 3 programmable buttons (labeled P1, P2, P3)
and a detachable keyboard/mouse dock.

Signed-off-by: Mario Limonciello <mario_limonciello@dell.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-13 09:29:00 -08:00
Mario Limonciello 915ac0574c platform/x86: dell-wmi: Adjust wifi catcher to emit KEY_WLAN
Wifi catcher is a slider switch, that when slid past the on position
will emit an event that is intended for launching a wifi application
or applet when the machine is turned on.

Signed-off-by: Mario Limonciello <mario_limonciello@dell.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-13 09:28:59 -08:00
Rajneesh Bhardwaj daf5d1433d platform/x86: intel_pmc_core: Add KBL CPUID support
This patch adds Kabylake CPU support for pmc_core driver.

Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-12-13 09:28:58 -08:00
Rajneesh Bhardwaj 9c2ee19987 platform/x86: intel_pmc_core: Add LTR IGNORE debug feature
SPT LTR_IGN register provides a means to make the PMC ignore the LTR values
reported by the individual PCH devices.

echo <IP Offset> > /sys/kernel/debug/pmc_core/ltr_ignore.

When a particular IP Offset bit is set the PMC will ignore the LTR value
reported by the corresponding IP when the PMC performs the latency
coalescing.

IP Offset	IP Name
0		SPA
1		SPB
2		SATA
3		GBE
4		XHCI
5		RSVD
6		ME
7		EVA
8		SPC
9		Azalia/ADSP
10		RSVD
11		LPSS
12		SPD
13		SPE
14		Camera
15		ESPI
16		SCC
17		ISH

Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
[dvhart: pmc_core_ltr_ignore_write local declaration order cleanup]
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-12-13 09:28:58 -08:00
Rajneesh Bhardwaj fe74822757 platform/x86: intel_pmc_core: Add MPHY PLL clock gating status
ModPhy Common lanes can provide the clock gating status for the important
system PLLs such as Gen2 USB3PCIE2 PLL, DMIPCIE3 PLL, SATA PLL and MIPI
PLL.

On SPT, in addition to the crystal oscillator clock, the 100Mhz Gen2
USB3PCI2 PLL clock is used as the PLL reference clock and Gen2 PLL idling
is a necessary condition for the platform to go into low power states like
PC10 and S0ix.

Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-12-13 09:28:57 -08:00
Rajneesh Bhardwaj 173943b3da platform/x86: intel_pmc_core: ModPhy core lanes pg status
The PCH implements a number of High Speed I/O (HSIO) lanes that are split
between PCIe*, USB 3.0, SATA, GbE, USB OTG and SSIC. This patch shows the
current power gating status of the available ModPhy Core lanes. This is
done by sending a message to the PMC (MTPMC) that contains the XRAM
register offset for the MPHY_CORE_STS_0 and MPHY_CORE_STS_1 and then by
reading the response sent by the PMC (MFPMC).

While enabling low power modes we often encounter situations when the
ModPhy lanes are not power gated and it becomes hard to debug which lane is
active and which is not in the absence of an external hardware debugger
(JTAG/ITP). This patch eliminates the dependency on an external hardware
debugger for reading the ModPhy Lanes power gating status.

This patch requires PMC_READ_DISABLE setting to be disabled in the platform
bios.

cat /sys/kernel/debug/pmc_core/mphy_lanes_power_gating_status

Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-12-13 09:28:56 -08:00
Rajneesh Bhardwaj 0bdfaf429d platform/x86: intel_pmc_core: Add PCH IP Power Gating Status
This patch adds the support for reading the power gating status of various
devices present on Sunrise Point PCH. This is intended to be used for
debugging purpose while tuning the platform for power optimizations and
also to understand which devices (on PCH) are blocking the system to enter
a low power state.

Power Management Controller on Sunrise Point PCH provides access to "PGD
PFET Enable Ack Status Registers (ppfear)". This patch reads and decodes
this register and dumps the output in formatted manner showing various
devices present on the PCH and their "Power Gating" status.

Further documentation can be found in Intel 7th Gen Core family mobile u/y
processor io datasheet volume 2.

Sample output (stripped and not in order):

cat /sys/kernel/debug/pmc_core/pch_ip_power_gating_status
PMC				State: Not Power gated
OPI-DMI				State: Not Power gated
XHCI				State: Power gated
LPSS				State: Power gated
CSME_PSF			State: Not power gated

Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-12-13 09:28:55 -08:00
Rajneesh Bhardwaj 8434709ba7 platform/x86: intel_pmc_core: Fix PWRMBASE mask and mmio reg len
On Sunrise Point PCH, the Power Management Controller provides 4K bytes of
memory space for various power management and debug registers. This fix is
needed to access power management & debug registers that are mapped at a
higher offset.

Also, this provides a fix for correctly masking the PWRMBASE as the initial
bits (0-11) are reserved.

Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-12-13 09:28:54 -08:00
Lee, Chun-Yi 5241b1938a platform/x86: acer-wmi: Only supports AMW0_GUID1 on acer family
The AMW0_GUID1 wmi is not only found on Acer family but also other
machines like Lenovo, Fujitsu and Medion. In the past, acer-wmi handled
those non-Acer machines by quirks list.

But actually acer-wmi driver was loaded on any machine that had
AMW0_GUID1. This behavior is strange because those machines should be
supported by appropriate wmi drivers. e.g. fujitsu-laptop,
ideapad-laptop.

This patch adds the logic to check the machine that has AMW0_GUID1
should be in Acer/Packard Bell/Gateway white list. But, it still keeps
the quirk list of those supported non-acer machines for backward
compatibility.

Tested-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-12-13 09:28:48 -08:00
Linus Torvalds 86e4ee760e ACPI fix for v4.9-rc5
Fix a recent regression in the 8250_dw serial driver introduced by
 adding a quirk for the APM X-Gene SoC to it which uncovered an issue
 related to the handling of built-in device properties in the core
 ACPI device enumeration code (Heikki Krogerus).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCAAGBQJYJlm+AAoJEILEb/54YlRxpsEP/3IspBg3tGvSDu3YoErtTrQ8
 Te1x9DlHrCiSPacxep0r/NdHcOdmnXaTp6Uo5GMqyvtICSJoe3+nsgwQwy66YzHZ
 HxRxs3NpgeHx7v2vtNZA0CJNOLocmJEunN670to/bsuz0hPcVdZbkZpI7GnRQ6wc
 72h9XLc5Fknr1UDTLYh3ZD3Iw1OQfrG/LOx8bdsfkP2g6HqPZwGBuVIbEQ/q9bkP
 PGd37DrMg9nXfM2wuwKmx2zqJQTceENsW+U5OjzmF2Sy6nFndYWzoRtc6whiKQcc
 CqNSyYsfzodXyUjwa5kI0D6N+jm49T9dBTznKJelsk0BxijELiskwEnjNJAVzDr7
 0A0yDGMvFWShjUqFAc0+uBlTs3yV0Sdjawfm1uE+lCmZId0mN4MTcMNd3MfusQs+
 dL7+pULrrB2UJvLyPiKCkuMVWngLWTnk72tnRlyJXbsc4oX+ljyXqwgn9iAq7Sjn
 vq/pECOKQj0fcLTm2TnKr+VyjPUCul6PDRqFyUGvEa8CjjrrS2piWsg5zBXFQNoM
 f95jliHgT10YQAVtbUKePavXz04GjzTNyLPPPxXT0jEVhLWkHVBtLNCjEX3LZdwW
 duc7ofc4Es9BQ21EDxcwGPeAygVSSuHGOr5Jq+WNdSTEa3sUk+63cqY59rrEAIfy
 cZgEpvlcP3kcgO8U0fF1
 =XF0E
 -----END PGP SIGNATURE-----

Merge tag 'acpi-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI fix from Rafael Wysocki:
 "Fix a recent regression in the 8250_dw serial driver introduced by
  adding a quirk for the APM X-Gene SoC to it which uncovered an issue
  related to the handling of built-in device properties in the core ACPI
  device enumeration code (Heikki Krogerus)"

* tag 'acpi-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI / platform: Add support for build-in properties
2016-11-11 17:02:01 -08:00
Rafael J. Wysocki 66f5854c68 Merge branch 'device-properties'
* device-properties:
  ACPI / platform: Add support for build-in properties
2016-11-11 23:23:02 +01:00
Heikki Krogerus 1571875bee ACPI / platform: Add support for build-in properties
We have a couple of drivers, acpi_apd.c and acpi_lpss.c,
that need to pass extra build-in properties to the devices
they create. Previously the drivers added those properties
to the struct device which is member of the struct
acpi_device, but that does not work. Those properties need
to be assigned to the struct device of the platform device
instead in order for them to become available to the
drivers.

To fix this, this patch changes acpi_create_platform_device
function to take struct property_entry pointer as parameter.

Fixes: 20a875e2e8 (serial: 8250_dw: Add quirk for APM X-Gene SoC)
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Tested-by: Yazen Ghannam <yazen.ghannam@amd.com>
Tested-by: Jérôme de Bretagne <jerome.debretagne@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-11-10 00:30:29 +01:00
Vadim Pasternak 304887041d platform/x86: Introduce support for Mellanox hotplug driver
Enable system support for the Mellanox Technologies hotplug platform
driver, which provides support for the next Mellanox basic systems:
"msx6710", "msx6720", "msb7700", "msn2700", "msx1410", "msn2410",
"msb7800", "msn2740", "msn2100" and also various number of derivative
systems from the above basic types.
This driver handles hot-plug events for the power suppliers, power
cables and fans for the above systems.

The Kconfig currently controlling compilation of this code is:
driver/platform/x86:config MLX_CPLD_PLATFORM
                       tristate "Mellanox platform hotplug driver support"

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-10-23 07:52:57 -07:00
Azael Avalos 1c80e9603f toshiba-wmi: Fix loading the driver on non Toshiba laptops
Bug 150611 uncovered that the WMI ID used by the toshiba-wmi driver
is not Toshiba specific, and as such, the driver was being loaded
on non Toshiba laptops too.

This patch adds a DMI matching list checking for TOSHIBA as the
vendor, refusing to load if it is not.

Also the WMI GUID was renamed, dropping the TOSHIBA_ prefix, to
better reflect that such GUID is not a Toshiba specific one.

Cc: <stable@vger.kernel.org> # 4.4+
Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-10-19 13:25:54 -07:00
Mika Westerberg 446647d4b9 ideapad-laptop: Add another DMI entry for Yoga 900
This particular laptop has its motherboard replaced and after that, even
with the latest BIOS, some DMI identification strings have become
"INVALID". This includes DMI_PRODUCT_VERSION which results Wifi being
blocked.

It seems that DMI_BOARD_NAME is still valid so use that as an
alternative for Lenovo Yoga 900.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-10-19 13:08:39 -07:00
Linus Torvalds c3f8f7fa8b platform-drivers-x86 for 4.9-2
Fix a Kconfig issue leading potential link failure, and
 add a DMI match for an existing quirk.
 
 asus-wmi:
  - add SERIO_I8042 dependency
 
 ideapad-laptop:
  - Add Lenovo Yoga 910-13IKB to no_hw_rfkill dmi list
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJYB7xbAAoJEKbMaAwKp364JZ0IAKbnhIY5UuwIxbShgbKR6o/H
 QOosQwHx+ZzGW4jtYRCEMU1uJH5B4CESMlUzPMJSqkpAz4yZyvaLnMnNL1C2QQkV
 vzn92owyeuNm1VmWxCBL5EbowcMQyAlWtZik9JEwz9G1nlSOlgOhjH4mfugePJLr
 2sCGyfenzXM3otTTB5eGqKg6+4upmf/H8I3HQlu8TUnISslFHahf9czOaFWKwrK6
 tm4nWHzx/nx4PcPQm+EvWT5mlsg/+DhFtyzJIqPZypmBuXR2MRaomqe8AugAXcst
 iVHxve7CWrw/Oiaa4tESdS/P2KhnLzVbDjUaOyAMLyBu670xBnlieH6Q4jJjd4Y=
 =yZrl
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v4.9-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86

Pull x86 platform driver fixes from Darren Hart:
 "Fix a Kconfig issue leading potential link failure, and add a DMI
  match for an existing quirk.

  asus-wmi:
   - add SERIO_I8042 dependency

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

* tag 'platform-drivers-x86-v4.9-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86:
  platform/x86: asus-wmi: add SERIO_I8042 dependency
  platform/x86: ideapad-laptop: Add Lenovo Yoga 910-13IKB to no_hw_rfkill dmi list
2016-10-19 11:45:06 -07:00
Linus Torvalds 44dc8c9d68 platform-drivers-x86 for 4.9-1
Cleanups, refactoring, and a couple bug fixes.
 
 intel_pmc_core:
  - avoid boot time warning for !CONFIG_DEBUGFS_FS
 
 intel_pmc_ipc:
  - Convert to use platform_device_register_full
 
 asus-wmi:
  - Filter buggy scan codes on ASUS Q500A
 
 toshiba_bluetooth:
  - Decouple an error checking status code
 
 toshiba_haps:
  - Change logging level from info to debug
  - Split ACPI and HDD protection error handling
 
 asus-laptop:
  - get rid of parse_arg()
 
 asus-wmi:
  - fix asus ux303ub brightness issue
 
 toshiba_acpi:
  - Fix typo in *_cooling_method_set function
  - Change error checking logic from TCI functions
  - Clean up variable declaration
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJX/fUeAAoJEKbMaAwKp364UxoIAMA2UWY9qepIvVW+BA/4vTOH
 jqzLVtH0SnhAe1esjsZ3f2r8F0riXEz/pLWcE7cjV7nbmWQDGvSBAJHyALg5d7CJ
 lAaMjo+glxy2p/0HgHNWvlgXEhRSsc1slbIJMzwk8XWfX39o+LGU0MNar8uRtQML
 TRCFJ73d5maQcQIsZ4hPbPJjzHK3ExyLLimXj5fsFXYnIMBF5YsTfiwdTEnDQmm/
 8FIO+fdogSU+LOrS0/CKrpzB/TchapCdvqn0hTJEdRP9wSqHL4c1nk2c0EVywTZT
 cwHi3ABvoS7Q2gHl58Y02jeEl3e9rFJQ79Sk3Wxr58mpfqy+w1SwPsjyfnXOB4c=
 =AwRb
 -----END PGP SIGNATURE-----

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

Pull x86 platform drivers updates from Darren Hart:
 "Cleanups, refactoring, and a couple bug fixes.

  intel_pmc_core:
   - avoid boot time warning for !CONFIG_DEBUGFS_FS

  intel_pmc_ipc:
   - Convert to use platform_device_register_full

  asus-wmi:
   - Filter buggy scan codes on ASUS Q500A

  toshiba_bluetooth:
   - Decouple an error checking status code

  toshiba_haps:
   - Change logging level from info to debug
   - Split ACPI and HDD protection error handling

  asus-laptop:
   - get rid of parse_arg()

  asus-wmi:
   - fix asus ux303ub brightness issue

  toshiba_acpi:
   - Fix typo in *_cooling_method_set function
   - Change error checking logic from TCI functions
   - Clean up variable declaration"

* tag 'platform-drivers-x86-v4.9-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86:
  platform/x86: intel_pmc_core: avoid boot time warning for !CONFIG_DEBUGFS_FS
  platform/x86: intel_pmc_ipc: Convert to use platform_device_register_full
  platform/x86: asus-wmi: Filter buggy scan codes on ASUS Q500A
  platform/x86: toshiba_bluetooth: Decouple an error checking status code
  platform/x86: toshiba_haps: Change logging level from info to debug
  platform/x86: toshiba_haps: Split ACPI and HDD protection error handling
  platform/x86: asus-laptop: get rid of parse_arg()
  platform/x86: asus-wmi: fix asus ux303ub brightness issue
  platform/x86: toshiba_acpi: Fix typo in *_cooling_method_set function
  platform/x86: toshiba_acpi: Change error checking logic from TCI functions
  platform/x86: toshiba_acpi: Clean up variable declaration
2016-10-13 16:52:39 -07:00
Arnd Bergmann ea893695ec platform/x86: asus-wmi: add SERIO_I8042 dependency
A recent bugfix added a call to i8042_install_filter but did
not add the dependency, leading to possible link errors:

drivers/platform/built-in.o: In function `asus_nb_wmi_quirks':
asus-nb-wmi.c:(.text+0x23af): undefined reference to `i8042_install_filter'

This adds a dependency on SERIO_I8042||SERIO_I8042=n to indicate
that we can build the driver when the i8042 driver is disabled,
but it cannot be built-in when that is a loadable module.

Fixes: b5643539b8 ("platform/x86: asus-wmi: Filter buggy scan codes on ASUS Q500A")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-10-12 22:59:33 +02:00
Linus Torvalds 2d2474a194 Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal managament updates from Zhang Rui:

 - Enhance thermal "userspace" governor to export the reason when a
   thermal event is triggered and delivered to user space. From Srinivas
   Pandruvada

 - Introduce a single TSENS thermal driver for the different versions of
   the TSENS IP that exist, on different qcom msm/apq SoCs'. Support for
   msm8916, msm8960, msm8974 and msm8996 families is also added. From
   Rajendra Nayak

 - Introduce hardware-tracked trip points support to the device tree
   thermal sensor framework. The framework supports an arbitrary number
   of trip points. Whenever the current temperature is changed, the trip
   points immediately below and above the current temperature are found,
   driver callback is invoked to program the hardware to get notified
   when either of the two trip points are triggered. Hardware-tracked
   trip points support for rockchip thermal driver is also added at the
   same time. From Sascha Hauer, Caesar Wang

 - Introduce a new thermal driver, which enables TMU (Thermal Monitor
   Unit) on QorIQ platform. From Jia Hongtao

 - Introduce a new thermal driver for Maxim MAX77620. From Laxman
   Dewangan

 - Introduce a new thermal driver for Intel platforms using WhiskeyCove
   PMIC. From Bin Gao

 - Add mt2701 chip support to MTK thermal driver. From Dawei Chien

 - Enhance Tegra thermal driver to enable soctherm node and set
   "critical", "hot" trips, for Tegra124, Tegra132, Tegra210. From Wei
   Ni

 - Add resume support for tango thermal driver. From Marc Gonzalez

 - several small fixes and improvements for rockchip, qcom, imx, rcar,
   mtk thermal drivers and thermal core code. From Caesar Wang, Keerthy,
   Rocky Hao, Wei Yongjun, Peter Robinson, Bui Duc Phuc, Axel Lin, Hugh
   Kang

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (48 commits)
  thermal: int3403: Process trip change notification
  thermal: int340x: New Interface to read trip and notify
  thermal: user_space gov: Add additional information in uevent
  thermal: Enhance thermal_zone_device_update for events
  arm64: tegra: set hot trips for Tegra210
  arm64: tegra: set critical trips for Tegra210
  arm64: tegra: add soctherm node for Tegra210
  arm64: tegra: set hot trips for Tegra132
  arm64: tegra: set critical trips for Tegra132
  arm64: tegra: use tegra132-soctherm for Tegra132
  arm: tegra: set hot trips for Tegra124
  arm: tegra: set critical trips for Tegra124
  thermal: tegra: add hw-throttle for Tegra132
  thermal: tegra: add hw-throttle function
  of: Add bindings of hw throttle for Tegra soctherm
  thermal: mtk_thermal: Check return value of devm_thermal_zone_of_sensor_register
  thermal: Add Mediatek thermal driver for mt2701.
  dt-bindings: thermal: Add binding document for Mediatek thermal controller
  thermal: max77620: Add thermal driver for reporting junction temp
  thermal: max77620: Add DT binding doc for thermal driver
  ...
2016-10-12 11:05:23 -07:00
Brian Masney 40c30bbf33 platform/x86: ideapad-laptop: Add Lenovo Yoga 910-13IKB to no_hw_rfkill dmi list
The Lenovo Yoga 910-13IKB does not have a hw rfkill switch, and trying
to read the hw rfkill switch through the ideapad module causes it to
always report as blocked.

This commit adds the Lenovo Yoga 910-13IKB to the no_hw_rfkill dmi list,
fixing the WiFI breakage.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-10-12 01:17:47 -07:00
Arnd Bergmann 127595ed21 platform/x86: intel_pmc_core: avoid boot time warning for !CONFIG_DEBUGFS_FS
While looking at a patch that introduced a compile-time warning
"‘pmc_core_dev_state_get’ defined but not used" (I sent a patch
for debugfs to fix it), I noticed that the same patch caused
it in intel_pmc_core also introduced a bogus run-time warning:
"PMC Core: debugfs register failed".

The problem is the IS_ERR_OR_NULL() check that as usual gets
things wrong: when CONFIG_DEBUGFS_FS is disabled,
debugfs_create_dir() fails with an error code, and we don't
need to warn about it, unlike the case in which it returns
NULL.

This reverts the driver to the previous state of not warning
about CONFIG_DEBUGFS_FS being disabled. I chose not to
restore the driver to making a runtime error in debugfs
fatal in pmc_core_probe().

Fixes: df2294fb64 ("intel_pmc_core: Convert to DEFINE_DEBUGFS_ATTRIBUTE")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-10-12 01:12:28 -07:00
Linus Torvalds 4cdf8dbe2d Merge branch 'work.uaccess2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull uaccess.h prepwork from Al Viro:
 "Preparations to tree-wide switch to use of linux/uaccess.h (which,
  obviously, will allow to start unifying stuff for real). The last step
  there, ie

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

  is not taken here - I would prefer to do it once just before or just
  after -rc1.  However, everything should be ready for it"

* 'work.uaccess2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  remove a stray reference to asm/uaccess.h in docs
  sparc64: separate extable_64.h, switch elf_64.h to it
  score: separate extable.h, switch module.h to it
  mips: separate extable.h, switch module.h to it
  x86: separate extable.h, switch sections.h to it
  remove stray include of asm/uaccess.h from cacheflush.h
  mn10300: remove a bogus processor.h->uaccess.h include
  xtensa: split uaccess.h into C and asm sides
  bonding: quit messing with IOCTL
  kill __kernel_ds_p off
  mn10300: finish verify_area() off
  frv: move HAVE_ARCH_UNMAPPED_AREA to pgtable.h
  exceptions: detritus removal
2016-10-11 23:38:39 -07:00
Linus Torvalds 101105b171 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull more vfs updates from Al Viro:
 ">rename2() work from Miklos + current_time() from Deepa"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  fs: Replace current_fs_time() with current_time()
  fs: Replace CURRENT_TIME_SEC with current_time() for inode timestamps
  fs: Replace CURRENT_TIME with current_time() for inode timestamps
  fs: proc: Delete inode time initializations in proc_alloc_inode()
  vfs: Add current_time() api
  vfs: add note about i_op->rename changes to porting
  fs: rename "rename2" i_op to "rename"
  vfs: remove unused i_op->rename
  fs: make remaining filesystems use .rename2
  libfs: support RENAME_NOREPLACE in simple_rename()
  fs: support RENAME_NOREPLACE for local filesystems
  ncpfs: fix unused variable warning
2016-10-10 20:16:43 -07:00
Axel Lin ea1a76bad8 platform/x86: intel_pmc_ipc: Convert to use platform_device_register_full
Use platform_device_register_full() instead of open-coded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-09-28 16:33:04 -07:00
Mika Westerberg bba6529ea0 platform/x86: intel_pmc_ipc: Do not create iTCO watchdog when WDAT table exists
ACPI WDAT table is the preferred way to use hardware watchdog over the
native iTCO_wdt. Windows only uses this table for its hardware watchdog
implementation so we should be relatively safe to trust it has been
validated by OEMs.

Prevent iTCO watchdog creation if we detect that there is an ACPI WDAT
table.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-09-28 23:08:08 +02:00
Al Viro 45caf47007 x86: separate extable.h, switch sections.h to it
drivers/platform/x86/dell-smo8800.c is touched due to the following obscenity:
drivers/platform/x86/dell-smo8800.c ->
	linux/interrupt.h ->
		linux/hardirq.h ->
			asm/hardirq.h ->
				linux/irq.h ->
					asm/hw_irq.h ->
						asm/sections.h ->
							asm/uaccess.h
is the only chain of includes pulling asm/uaccess.h there.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2016-09-27 21:15:23 -04:00
Deepa Dinamani c2050a454c fs: Replace current_fs_time() with current_time()
current_fs_time() uses struct super_block* as an argument.
As per Linus's suggestion, this is changed to take struct
inode* as a parameter instead. This is because the function
is primarily meant for vfs inode timestamps.
Also the function was renamed as per Arnd's suggestion.

Change all calls to current_fs_time() to use the new
current_time() function instead. current_fs_time() will be
deleted.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2016-09-27 21:06:22 -04:00
Srinivas Pandruvada 0e70f466fb thermal: Enhance thermal_zone_device_update for events
Added one additional parameter to thermal_zone_device_update() to provide
caller with an optional capability to specify reason.
Currently this event is used by user space governor to trigger different
processing based on event code. Also it saves an additional call to read
temperature when the event is received.
The following events are cuurently defined:
- Unspecified event
- New temperature sample
- Trip point violated
- Trip point changed
- thermal device up and down
- thermal device power capability changed

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-09-27 14:35:21 +08:00
Oleksij Rempel b5643539b8 platform/x86: asus-wmi: Filter buggy scan codes on ASUS Q500A
Some revisions of the ASUS Q500A series have a keyboard related
issue which is reproducible only after Windows with installed ASUS
tools is started.

In this case the Linux side will have a blocked keyboard or
report incorrect or incomplete hotkey events.

To make Linux work properly again, a complete power down
(unplug power supply and remove battery) is needed.

Linux/atkbd after a clean start will get the following code on VOLUME_UP
key: {0xe0, 0x30, 0xe0, 0xb0}. After Windows, the same key will generate
this codes: {0xe1, 0x23, 0xe0, 0x30, 0xe0, 0xb0}. As result atkdb will
be confused by buggy codes.

This patch is filtering this buggy code out.

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

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Cc: Alex Henrie <alexhenrie24@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Corentin Chary <corentin.chary@gmail.com>
Cc: acpi4asus-user@lists.sourceforge.net
Cc: platform-driver-x86@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

[dvhart: Add return after pr_warn to avoid false confirmation of filter]

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-09-23 17:06:20 -07:00
Azael Avalos 28e476d743 platform/x86: toshiba_bluetooth: Decouple an error checking status code
This patch simply decouples the error checking of the ACPI status and
the actual BT status, as those two were nested in an if/else check, but
are completely unrelated.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-09-23 16:21:06 -07:00
Azael Avalos baae5f9157 platform/x86: toshiba_haps: Change logging level from info to debug
Two of the internal functions are printing an info message, one
whenever the HDD protection level changes, and another when the
driver receives an ACPI event.

This patch changes those two prints to debug, as that information
is more pertaining to debuging purposes.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-09-23 16:21:05 -07:00
Azael Avalos 5545544998 platform/x86: toshiba_haps: Split ACPI and HDD protection error handling
Currently the code checking for the ACPI status is mixed along with
the actual HDD protection status check.

This patch splits those two checks as they are not related, printing
an error string in case the ACPI call failed, and then check for
actual HDD protection status.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-09-23 16:21:05 -07:00
Giedrius Statkevičius 6f7e357bf1 platform/x86: asus-laptop: get rid of parse_arg()
parse_arg() duplicates the funcionality of kstrtoint() so use the latter
function instead. There is no funcionality change except that in the
case of input being too big -ERANGE will be returned instead of -EINVAL
which is not bad because -ERANGE makes more sense here. The check for
!count is already done by the sysfs core so no need to duplicate it
again. Also, add some minor corrections to error handling to accommodate
the change in return values (parse_arg returned count if everything
succeeded whereas kstrtoint returns 0 in the same situation)

As a result of this patch asus-laptop.ko size is reduced by almost 1%:
add/remove: 0/1 grow/shrink: 1/6 up/down: 1/-149 (-148)
function                                     old     new   delta
__UNIQUE_ID_vermagic0                         69      70      +1
ls_switch_store                              133     117     -16
ledd_store                                   175     159     -16
display_store                                157     141     -16
ls_level_store                               193     176     -17
gps_store                                    200     178     -22
sysfs_acpi_set.isra                          148     125     -23
parse_arg.part                                39       -     -39
Total: Before=19160, After=19012, chg -0.77%

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-09-23 16:20:44 -07:00
zino lin 999d4376c6 platform/x86: asus-wmi: fix asus ux303ub brightness issue
acpi_video0 doesn't work, asus-wmi brightness interface doesn't work, too.
So, we use native brightness interface to handle the brightness adjustion,
and add quirk_asus_ux303ub.

Signed-off-by: zino lin <linzino7@gmail.com>
Acked-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-09-23 16:20:34 -07:00
Azael Avalos fa1bc2a09f platform/x86: toshiba_acpi: Fix typo in *_cooling_method_set function
This patch simply fixes a typo in the error string printed in
the *_cooling_method_set function.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-08-31 17:33:33 -07:00
Azael Avalos 513ee146f6 platform/x86: toshiba_acpi: Change error checking logic from TCI functions
Currently the success/error checking logic is intermixed, making the
code a bit cumbersome to understand.

This patch changes the affected functions to first check for errors
and take appropriate actions, then check for the supported features.

This patch also separates the error check from the acpi_status and
the tci_raw function call error check, as those two are completely
unrelated and were nested in if/else statements.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-08-31 17:33:32 -07:00
Azael Avalos 78429e55e4 platform/x86: toshiba_acpi: Clean up variable declaration
This patch moves all the multiple line variable declaration to a
single line declaration (except variables being initialized)
following the reverse tree order, to conform to the practices
of the kernel.

[dvhart: corrected a couple minor inconsistencies in declaration ordering]

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-08-31 17:32:54 -07:00