1
0
Fork 0
Commit Graph

4256 Commits (rM2-mainline)

Author SHA1 Message Date
Hans de Goede 2ebe01e25b platform/x86: hp-wmi: Disable tablet-mode reporting by default
Recently userspace has started making more use of SW_TABLET_MODE
(when an input-dev reports this).

Specifically recent GNOME3 versions will:

1.  When SW_TABLET_MODE is reported and is reporting 0:
1.1 Disable accelerometer-based screen auto-rotation
1.2 Disable automatically showing the on-screen keyboard when a
    text-input field is focussed

2.  When SW_TABLET_MODE is reported and is reporting 1:
2.1 Ignore input-events from the builtin keyboard and touchpad
    (this is for 360° hinges style 2-in-1s where the keyboard and
     touchpads are accessible on the back of the tablet when folded
     into tablet-mode)

This means that claiming to support SW_TABLET_MODE when it does not
actually work / reports correct values has bad side-effects.

The check in the hp-wmi code which is used to decide if the input-dev
should claim SW_TABLET_MODE support, only checks if the
HPWMI_HARDWARE_QUERY is supported. It does *not* check if the hardware
actually is capable of reporting SW_TABLET_MODE.

This leads to the hp-wmi input-dev claiming SW_TABLET_MODE support,
while in reality it will always report 0 as SW_TABLET_MODE value.
This has been seen on a "HP ENVY x360 Convertible 15-cp0xxx" and
this likely is the case on a whole lot of other HP models.

This problem causes both auto-rotation and on-screen keyboard
support to not work on affected x360 models.

There is no easy fix for this, but since userspace expects
SW_TABLET_MODE reporting to be reliable when advertised it is
better to not claim/report SW_TABLET_MODE support at all, then
to claim to support it while it does not work.

To avoid the mentioned problems, add a new enable_tablet_mode_sw
module-parameter which defaults to false.

Note I've made this an int using the standard -1=auto, 0=off, 1=on
triplett, with the hope that in the future we can come up with a
better way to detect SW_TABLET_MODE support. ATM the default
auto option just does the same as off.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1918255
Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mark Gross <mgross@linux.intel.com>
Link: https://lore.kernel.org/r/20210120124941.73409-1-hdegoede@redhat.com
2021-01-25 21:45:59 +01:00
Hans de Goede 26173179fa platform/x86: intel-vbtn: Eval VBDL after registering our notifier
The VBDL ACPI method enables button/switch reporting through the
intel-vbtn device. In some cases the embedded-controller (EC) might
call Notify() on the intel-vbtn device immediately after the
the VBDL call to make sure that the OS is synced with the EC's
button and switch state.

If we register our notify_handler after evaluating VBDL this means
that we might miss the Notify() calls made by the EC to sync the
state.

E.g. the HP Stream x360 Convertible PC 11 has a VGBS method which
always returns 0, independent of the actual SW_TABLET_MODE state
of the device; and immediately after the VBDL call it calls
Notify(0xCD) or Notify(0xCC) to report the actual state.

Move the evaluation of VBDL to after registering our notify_handler
so that we don't miss any events.

Cc: Elia Devito <eliadevito@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210115161850.117614-4-hdegoede@redhat.com
2021-01-25 21:34:36 +01:00
Hans de Goede 3a2f53cd03 platform/x86: intel-vbtn: Add alternative method to enable switches
Some 2-in-1s have a broken VGBS method, so we cannot get an initial
state for the switches from them. Reporting the wrong initial state for
SW_TABLET_MODE causes serious problems (touchpad and/or keyboard events
being ignored by userspace when reporting SW_TABLET_MODE=1), so on these
devices we cannot register an input-dev for the switches at probe time.

We can however register an input-dev for the switches as soon as we
receive the first switches event, because then we will know the state.

Note this mirrors the behavior of recent changs to the intel-hid driver
which also registers a separate switches input-dev on receiving the
first event on machines with a broken VGBS method.

Cc: Elia Devito <eliadevito@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210115161850.117614-3-hdegoede@redhat.com
2021-01-25 21:34:32 +01:00
Hans de Goede 034b8c2e7b platform/x86: intel-vbtn: Create 2 separate input-devs for buttons and switches
Create 2 separate input-devs for buttons and switches, this is a
preparation for dynamically registering the switches-input device
for devices which are not on the switches allow-list, but do make
Notify() calls with an event value from the switches sparse-keymap.

This also brings the intel-vbtn driver inline with the intel-hid
driver which is doing the same thing.

Cc: Elia Devito <eliadevito@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210115161850.117614-2-hdegoede@redhat.com
2021-01-25 21:34:28 +01:00
Hans de Goede 5862b4df66 platform/x86: intel-vbtn: Rework wakeup handling in notify_handler()
Rework the wakeup path inside notify_handler() to special case the
buttons (KE_KEY) case instead of the switches case.

In case of a button wake event we want to skip reporting this,
mirroring how the drivers/acpi/button.c code skips the reporting
in the wakeup case (suspended flag set) too.

The reason to skip reporting in this case is that some Linux
desktop-environments will immediately resuspend if we report an
evdev event for the power-button press on wakeup.

Before this commit the skipping of the button-press was done
in a round-about way: In case of a wakeup the regular
sparse_keymap_report_event() would always be skipped by
an early return, and then to avoid not reporting switch changes
on wakeup there was a special KE_SW path with a duplicate
sparse_keymap_report_event() call.

This commit refactors the wakeup handling to explicitly skip the
reporting for button wake events, while using the regular
reporting path for non button (switches) wakeup events.

No intentional functional impact.

Cc: Elia Devito <eliadevito@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210115161850.117614-1-hdegoede@redhat.com
2021-01-25 21:34:18 +01:00
Andy Shevchenko a507e5d90f platform/x86: intel_scu_wdt: Get rid of custom x86 model comparison
Switch the platform code to use x86_id_table and accompanying API
instead of custom comparison against x86 CPU model.

This is one of the last users of custom API for that and following
changes will remove it for the good.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
2021-01-25 20:05:32 +02:00
Andy Shevchenko 55627c70db platform/x86: intel_scu_wdt: Drop SCU notification
Since SCU code along with the Intel MID watchdog driver has been refactored
in a way that latter will be probed only after the former has been come
to live, the notification code is bogus and not needed. Remove it for good.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
2021-01-25 20:05:32 +02:00
Andy Shevchenko 18365d686e platform/x86: intel_scu_wdt: Move driver from arch/x86
The ACPI-enabled Intel MID platforms neither have WDAT table nor proper IDs
to instantiate watchdog device. In order to keep them working move the board
code from arch/x86 to drivers/platform/x86.

Note, the complete SFI support is going to be removed, that's why PDx86
has been chosen as a new home for it. This is the only device which needs
additional code so far.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
2021-01-25 20:05:32 +02:00
Andy Shevchenko ae1527948f platform/x86: intel_mid_powerbtn: Remove driver for deprecated platform
Intel Moorestown and Medfield are quite old Intel Atom based
32-bit platforms, which were in limited use in some Android phones,
tablets and consumer electronics more than eight years ago.

There are no bugs or problems ever reported outside from Intel
for breaking any of that platforms for years. It seems no real
users exists who run more or less fresh kernel on it. The commit
05f4434bc1 ("ASoC: Intel: remove mfld_machine") also in align
with this theory.

Due to above and to reduce a burden of supporting outdated drivers
we remove the support of outdated platforms completely.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
2021-01-25 20:05:31 +02:00
Andy Shevchenko bbb284c007 platform/x86: intel_mid_thermal: Remove driver for deprecated platform
Intel Moorestown and Medfield are quite old Intel Atom based
32-bit platforms, which were in limited use in some Android phones,
tablets and consumer electronics more than eight years ago.

There are no bugs or problems ever reported outside from Intel
for breaking any of that platforms for years. It seems no real
users exists who run more or less fresh kernel on it. The commit
05f4434bc1 ("ASoC: Intel: remove mfld_machine") also in align
with this theory.

Due to above and to reduce a burden of supporting outdated drivers
we remove the support of outdated platforms completely.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
2021-01-25 20:05:31 +02:00
Gwendal Grignou 4daeb395f1 platform/chrome: cros_ec: Call interrupt bottom half at probe time
While the AP was powered off, the EC may have send messages.
If the message is not serviced within 3s, the EC stops sending message.
Unlock the EC by purging stale messages at probe time.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20210122054637.1422289-3-gwendal@chromium.org
2021-01-22 08:50:27 +01:00
Gwendal Grignou 24c69043be platform/chrome: cros_ec: Call interrupt bottom half in ISH or RPMSG mode
Call the same bottom half for all EC protocols (threaded code).

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20210122054637.1422289-2-gwendal@chromium.org
2021-01-22 08:50:27 +01:00
Pi-Hsun Shih 4c2e9b3e18 platform/chrome: cros_ec_sysfs: Add cold-ap-off to sysfs reboot.
Add cold-ap-off to ChromeOS EC sysfs reboot file option, corresponds to
the EC_REBOOT_COLD_AP_OFF flag, that will reset EC and keep AP off.

Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20201221041231.14516-2-pihsun@chromium.org
2021-01-20 16:19:17 +01:00
Rikard Falkeborn d7c1fef7fd platform/chrome: Constify static attribute_group structs
The only usage of these is to print their name in a dev_err-message, and
to pass their address to sysfs_create_group() and sysfs_remove_group(),
both which takes pointers to const. Make them const to allow the compiler
to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20210109001748.58036-1-rikard.falkeborn@gmail.com
2021-01-20 16:19:17 +01:00
Evan Benn 852405d8ef platform/chrome: cros_ec_proto: Add LID and BATTERY to default mask
After 'platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT'
some of the flags are not quite correct.
LID_CLOSED is used to suspend the device, so it makes sense to ignore that.
BATTERY events are also frequent and causing spurious wakes on elm/hana
mt8173 devices.

Fixes: c214e564ac ("platform/chrome: cros_ec_proto: ignore unnecessary wakeups on old ECs")
Signed-off-by: Evan Benn <evanbenn@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20201209220306.2.I3291bf83e4884c206b097ede34780e014fa3e265@changeid
2021-01-20 16:19:17 +01:00
Evan Benn 0944ea07ba platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT
The host_event_code enum is 1-based, use EC_HOST_EVENT_MASK not BIT to
generate the intended mask. This patch changes the behaviour of the
mask, a following patch will restore the intended behaviour:
'Add LID and BATTERY to default mask'

Fixes: c214e564ac ("platform/chrome: cros_ec_proto: ignore unnecessary wakeups on old ECs")
Signed-off-by: Evan Benn <evanbenn@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20201209220306.1.I6133572c0ab3c6b95426f804bac2d3833e24acb1@changeid
2021-01-20 16:19:17 +01:00
Daniel Lezcano b39d2dd5b5 thermal/core: Remove ms based delay fields
The code does no longer use the ms unit based fields to set the
delays as they are replaced by the jiffies.

Remove them and replace their user to use the jiffies version instead.

Cc: Thara Gopinath <thara.gopinath@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Reviewed-by: Peter Kästle <peter@piie.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201216220337.839878-3-daniel.lezcano@linaro.org
2021-01-19 22:23:49 +01:00
Jeannie Stevenson 173aac2fef platform/x86: thinkpad_acpi: Add P53/73 firmware to fan_quirk_table for dual fan control
This commit enables dual fan control for the new Lenovo P53 and P73
laptop models.

Signed-off-by: Jeannie Stevenson <jeanniestevenson@protonmail.com>
Link: https://lore.kernel.org/r/Pn_Xii4XYpQRFtgkf4PbNgieE89BAkHgLI1kWIq-zFudwh2A1DY5J_DJVHK06rMW_hGPHx_mPE33gd8mg9-8BxqJTaSC6hhPqAsfZlcNGH0=@protonmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-18 21:42:01 +01:00
Hans de Goede d35c9a029a platform/x86: hp-wmi: Don't log a warning on HPWMI_RET_UNKNOWN_COMMAND errors
The recently added thermal policy support makes a
hp_wmi_perform_query(0x4c, ...) call on older devices which do not
support thermal policies this causes the following warning to be
logged (seen on a HP Stream x360 Convertible PC 11):

[   26.805305] hp_wmi: query 0x4c returned error 0x3

Error 0x3 is HPWMI_RET_UNKNOWN_COMMAND error. This commit silences
the warning for unknown-command errors, silencing the new warning.

Cc: Elia Devito <eliadevito@gmail.com>
Fixes: 81c93798ef ("platform/x86: hp-wmi: add support for thermal policy")
Link: https://lore.kernel.org/r/20210114232744.154886-1-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-18 21:41:53 +01:00
Jeannie Stevenson c47c042942 platform/x86: thinkpad_acpi: Add P53/73 firmware to fan_quirk_table for dual fan control
This commit enables dual fan control for the new Lenovo P53 and P73
laptop models.

Signed-off-by: Jeannie Stevenson <jeanniestevenson@protonmail.com>
Link: https://lore.kernel.org/r/Pn_Xii4XYpQRFtgkf4PbNgieE89BAkHgLI1kWIq-zFudwh2A1DY5J_DJVHK06rMW_hGPHx_mPE33gd8mg9-8BxqJTaSC6hhPqAsfZlcNGH0=@protonmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-18 21:39:28 +01:00
Hans de Goede dbd7dd8f88 platform/x86: hp-wmi: Don't log a warning on HPWMI_RET_UNKNOWN_COMMAND errors
The recently added thermal policy support makes a
hp_wmi_perform_query(0x4c, ...) call on older devices which do not
support thermal policies this causes the following warning to be
logged (seen on a HP Stream x360 Convertible PC 11):

[   26.805305] hp_wmi: query 0x4c returned error 0x3

Error 0x3 is HPWMI_RET_UNKNOWN_COMMAND error. This commit silences
the warning for unknown-command errors, silencing the new warning.

Cc: Elia Devito <eliadevito@gmail.com>
Fixes: 81c93798ef ("platform/x86: hp-wmi: add support for thermal policy")
Link: https://lore.kernel.org/r/20210114232744.154886-1-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-18 21:38:43 +01:00
Hans de Goede 070222731b platform/x86: intel-vbtn: Drop HP Stream x360 Convertible PC 11 from allow-list
THe HP Stream x360 Convertible PC 11 DSDT has the following VGBS function:

            Method (VGBS, 0, Serialized)
            {
                If ((^^PCI0.LPCB.EC0.ROLS == Zero))
                {
                    VBDS = Zero
                }
                Else
                {
                    VBDS = Zero
                }

                Return (VBDS) /* \_SB_.VGBI.VBDS */
            }

Which is obviously wrong, because it always returns 0 independent of the
2-in-1 being in laptop or tablet mode. This causes the intel-vbtn driver
to initially report SW_TABLET_MODE = 1 to userspace, which is known to
cause problems when the 2-in-1 is actually in laptop mode.

During earlier testing this turned out to not be a problem because the
2-in-1 would do a Notify(..., 0xCC) or Notify(..., 0xCD) soon after
the intel-vbtn driver loaded, correcting the SW_TABLET_MODE state.

Further testing however has shown that this Notify() soon after the
intel-vbtn driver loads, does not always happen. When the Notify
does not happen, then intel-vbtn reports SW_TABLET_MODE = 1 resulting in
a non-working touchpad.

IOW the tablet-mode reporting is not reliable on this device, so it
should be dropped from the allow-list, fixing the touchpad sometimes
not working.

Fixes: 8169bd3e6e ("platform/x86: intel-vbtn: Switch to an allow-list for SW_TABLET_MODE reporting")
Link: https://lore.kernel.org/r/20210114143432.31750-1-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-18 19:42:23 +01:00
Hans de Goede bbffaa9819 platform/x86: intel-vbtn: Drop HP Stream x360 Convertible PC 11 from allow-list
THe HP Stream x360 Convertible PC 11 DSDT has the following VGBS function:

            Method (VGBS, 0, Serialized)
            {
                If ((^^PCI0.LPCB.EC0.ROLS == Zero))
                {
                    VBDS = Zero
                }
                Else
                {
                    VBDS = Zero
                }

                Return (VBDS) /* \_SB_.VGBI.VBDS */
            }

Which is obviously wrong, because it always returns 0 independent of the
2-in-1 being in laptop or tablet mode. This causes the intel-vbtn driver
to initially report SW_TABLET_MODE = 1 to userspace, which is known to
cause problems when the 2-in-1 is actually in laptop mode.

During earlier testing this turned out to not be a problem because the
2-in-1 would do a Notify(..., 0xCC) or Notify(..., 0xCD) soon after
the intel-vbtn driver loaded, correcting the SW_TABLET_MODE state.

Further testing however has shown that this Notify() soon after the
intel-vbtn driver loads, does not always happen. When the Notify
does not happen, then intel-vbtn reports SW_TABLET_MODE = 1 resulting in
a non-working touchpad.

IOW the tablet-mode reporting is not reliable on this device, so it
should be dropped from the allow-list, fixing the touchpad sometimes
not working.

Fixes: 8169bd3e6e ("platform/x86: intel-vbtn: Switch to an allow-list for SW_TABLET_MODE reporting")
Link: https://lore.kernel.org/r/20210114143432.31750-1-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-18 19:26:44 +01:00
Maximilian Luz e5da18d3e6 platform/surface: aggregator: Fix kernel-doc references
Both, ssh_rtl_rx_start() and ssh_rtl_tx_start() functions, do not exist
and have been consolidated into ssh_rtl_start(). Nevertheless,
kernel-doc references the former functions. Replace those references
with references to ssh_rtl_start().

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20210114150826.19109-1-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-18 19:22:08 +01:00
Mauro Carvalho Chehab 025fe94b63 platform/surface: aggregator: fix a kernel-doc markup
A function has a different name between their prototype
and its kernel-doc markup:

	../drivers/platform/surface/aggregator/ssh_request_layer.c:1065: warning: expecting prototype for ssh_rtl_tx_start(). Prototype was for ssh_rtl_start() instead

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/4a6bf33cfbd06654d78294127f2b6d354d073089.1610610937.git.mchehab+huawei@kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-18 19:19:25 +01:00
Jiaxun Yang f419e5940f platform/x86: ideapad-laptop: Disable touchpad_switch for ELAN0634
Newer ideapads (e.g.: Yoga 14s, 720S 14) come with ELAN0634 touchpad do not
use EC to switch touchpad.

Reading VPCCMD_R_TOUCHPAD will return zero thus touchpad may be blocked
unexpectedly.
Writing VPCCMD_W_TOUCHPAD may cause a spurious key press.

Add has_touchpad_switch to workaround these machines.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: stable@vger.kernel.org # 5.4+
--
v2: Specify touchpad to ELAN0634
v3: Stupid missing ! in v2
v4: Correct acpi_dev_present usage (Hans)
Link: https://lore.kernel.org/r/20210107144438.12605-1-jiaxun.yang@flygoat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-13 11:25:26 +01:00
Maximilian Luz e94a26504f platform/surface: aggregator_cdev: Add comments regarding unchecked allocation size
CI static analysis complains about the allocation size in payload and
response buffers being unchecked. In general, these allocations should
be safe as the user-input is u16 and thus limited to U16_MAX, which is
only slightly larger than the theoretical maximum imposed by the
underlying SSH protocol.

All bounds on these values required by the underlying protocol are
enforced in ssam_request_sync() (or rather the functions called by it),
thus bounds here are only relevant for allocation.

Add comments explaining that this should be safe.

Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: 178f6ab77e ("platform/surface: Add Surface Aggregator user-space interface")
Addresses-Coverity: ("Untrusted allocation size")
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20210111154851.325404-3-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-13 10:30:21 +01:00
Maximilian Luz a403c1dfcf platform/surface: aggregator_cdev: Fix access of uninitialized variables
When copy_struct_from_user() in ssam_cdev_request() fails, we directly
jump to the 'out' label. In this case, however 'spec' and 'rsp' are not
initialized, but we still access fields of those variables. Fix this by
initializing them at the time of their declaration.

Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: 178f6ab77e ("platform/surface: Add Surface Aggregator user-space interface")
Addresses-Coverity: ("Uninitialized pointer read")
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20210111154851.325404-2-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-13 10:30:21 +01:00
Colin Ian King d26cbdd27f platform/surface: fix potential integer overflow on shift of a int
The left shift of int 32 bit integer constant 1 is evaluated using 32 bit
arithmetic and then passed as a 64 bit function argument. In the case where
func is 32 or more this can lead to an oveflow.  Avoid this by shifting
using the BIT_ULL macro instead.

Addresses-Coverity: ("Unintentional integer overflow")
Fixes: fc00bc8ac1 ("platform/surface: Add Surface ACPI Notify driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20210111144648.20498-1-colin.king@canonical.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-13 10:25:10 +01:00
Jiaxun Yang d69cd7eea9 platform/x86: ideapad-laptop: Disable touchpad_switch for ELAN0634
Newer ideapads (e.g.: Yoga 14s, 720S 14) come with ELAN0634 touchpad do not
use EC to switch touchpad.

Reading VPCCMD_R_TOUCHPAD will return zero thus touchpad may be blocked
unexpectedly.
Writing VPCCMD_W_TOUCHPAD may cause a spurious key press.

Add has_touchpad_switch to workaround these machines.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: stable@vger.kernel.org # 5.4+
--
v2: Specify touchpad to ELAN0634
v3: Stupid missing ! in v2
v4: Correct acpi_dev_present usage (Hans)
Link: https://lore.kernel.org/r/20210107144438.12605-1-jiaxun.yang@flygoat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-13 10:23:33 +01:00
Maximilian Luz fc00bc8ac1 platform/surface: Add Surface ACPI Notify driver
The Surface ACPI Notify (SAN) device provides an ACPI interface to the
Surface Aggregator EC, specifically the Surface Serial Hub interface.
This interface allows EC requests to be made from ACPI code and can
convert a subset of EC events back to ACPI notifications.

Specifically, this interface provides a GenericSerialBus operation
region ACPI code can execute a request by writing the request command
data and payload to this operation region and reading back the
corresponding response via a write-then-read operation. Furthermore,
this interface provides a _DSM method to be called when certain events
from the EC have been received, essentially turning them into ACPI
notifications.

The driver provided in this commit essentially takes care of translating
the request data written to the operation region, executing the request,
waiting for it to finish, and finally writing and translating back the
response (if the request has one). Furthermore, this driver takes care
of enabling the events handled via ACPI _DSM calls. Lastly, this driver
also exposes an interface providing discrete GPU (dGPU) power-on
notifications on the Surface Book 2, which are also received via the
operation region interface (but not handled by the SAN driver directly),
making them accessible to other drivers (such as a dGPU hot-plug driver
that may be added later on).

On 5th and 6th generation Surface devices (Surface Pro 5/2017, Pro 6,
Book 2, Laptop 1 and 2), the SAN interface provides full battery and
thermal subsystem access, as well as other EC based functionality. On
those models, battery and thermal sensor devices are implemented as
standard ACPI devices of that type, however, forward ACPI calls to the
corresponding Surface Aggregator EC request via the SAN interface and
receive corresponding notifications (e.g. battery information change)
from it. This interface is therefore required to provide said
functionality on those devices.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201221183959.1186143-10-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-07 00:06:39 +01:00
Maximilian Luz 178f6ab77e platform/surface: Add Surface Aggregator user-space interface
Add a misc-device providing user-space access to the Surface Aggregator
EC, mainly intended for debugging, testing, and reverse-engineering.
This interface gives user-space applications the ability to send
requests to the EC and receive the corresponding responses.

The device-file is managed by a pseudo platform-device and corresponding
driver to avoid dependence on the dedicated bus, allowing it to be
loaded in a minimal configuration.

A python library and scripts to access this device can be found at [1].

[1]: https://github.com/linux-surface/surface-aggregator-module/tree/master/scripts/ssam

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20201221183959.1186143-9-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-07 00:06:39 +01:00
Maximilian Luz eb0e90a820 platform/surface: aggregator: Add dedicated bus and device type
The Surface Aggregator EC provides varying functionality, depending on
the Surface device. To manage this functionality, we use dedicated
client devices for each subsystem or virtual device of the EC. While
some of these clients are described as standard devices in ACPI and the
corresponding client drivers can be implemented as platform drivers in
the kernel (making use of the controller API already present), many
devices, especially on newer Surface models, cannot be found there.

To simplify management of these devices, we introduce a new bus and
client device type for the Surface Aggregator subsystem. The new device
type takes care of managing the controller reference, essentially
guaranteeing its validity for as long as the client device exists, thus
alleviating the need to manually establish device links for that purpose
in the client driver (as has to be done with the platform devices).

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201221183959.1186143-7-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-07 00:06:39 +01:00
Maximilian Luz 02be44f6b5 platform/surface: aggregator: Add error injection capabilities
This commit adds error injection hooks to the Surface Serial Hub
communication protocol implementation, to:

 - simulate simple serial transmission errors,

 - drop packets, requests, and responses, simulating communication
   failures and potentially trigger retransmission timeouts, as well as

 - inject invalid data into submitted and received packets.

Together with the trace points introduced in the previous commit, these
facilities are intended to aid in testing, validation, and debugging of
the Surface Aggregator communication layer.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20201221183959.1186143-6-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-07 00:06:22 +01:00
Maximilian Luz 0d21bb8560 platform/surface: aggregator: Add trace points
Add trace points to the Surface Aggregator subsystem core. These trace
points can be used to track packets, requests, and allocations. They are
further intended for debugging and testing/validation, specifically in
combination with the error injection capabilities introduced in the
subsequent commit.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20201221183959.1186143-5-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-07 00:06:17 +01:00
Maximilian Luz 3a7081f610 platform/surface: aggregator: Add event item allocation caching
Event items are used for completing Surface Aggregator EC events, i.e.
placing event command data and payload on a workqueue for later
processing to avoid doing said processing directly on the receiver
thread. This means that event items are allocated for each incoming
event, regardless of that event being transmitted via sequenced or
unsequenced packets.

On the Surface Book 3 and Surface Laptop 3, touchpad HID input events
(unsequenced), can constitute a larger amount of traffic, and therefore
allocation of event items. This warrants caching event items to reduce
memory fragmentation. The size of the cached objects is specifically
tuned to accommodate keyboard and touchpad input events and their
payloads on those devices. As a result, this effectively also covers
most other event types. In case of a larger event payload, event item
allocation will fall back to kzalloc().

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201221183959.1186143-4-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-06 23:45:34 +01:00
Maximilian Luz 44b84ee7b4 platform/surface: aggregator: Add control packet allocation caching
Surface Serial Hub communication is, in its core, packet based. Each
sequenced packet requires to be acknowledged, via an ACK-type control
packet. In case invalid data has been received by the driver, a NAK-type
(not-acknowledge/negative acknowledge) control packet is sent,
triggering retransmission.

Control packets are therefore a core communication primitive and used
frequently enough (with every sequenced packet transmission sent by the
embedded controller, including events and request responses) that it may
warrant caching their allocations to reduce possible memory
fragmentation.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201221183959.1186143-3-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-06 23:45:33 +01:00
Maximilian Luz c167b9c7e3 platform/surface: Add Surface Aggregator subsystem
Add Surface System Aggregator Module core and Surface Serial Hub driver,
required for the embedded controller found on Microsoft Surface devices.

The Surface System Aggregator Module (SSAM, SAM or Surface Aggregator)
is an embedded controller (EC) found on 4th and later generation
Microsoft Surface devices, with the exception of the Surface Go series.
This EC provides various functionality, depending on the device in
question. This can include battery status and thermal reporting (5th and
later generations), but also HID keyboard (6th+) and touchpad input
(7th+) on Surface Laptop and Surface Book 3 series devices.

This patch provides the basic necessities for communication with the SAM
EC on 5th and later generation devices. On these devices, the EC
provides an interface that acts as serial device, called the Surface
Serial Hub (SSH). 4th generation devices, on which the EC interface is
provided via an HID-over-I2C device, are not supported by this patch.

Specifically, this patch adds a driver for the SSH device (device HID
MSHW0084 in ACPI), as well as a controller structure and associated API.
This represents the functional core of the Surface Aggregator kernel
subsystem, introduced with this patch, and will be expanded upon in
subsequent commits.

The SSH driver acts as the main attachment point for this subsystem and
sets-up and manages the controller structure. The controller in turn
provides a basic communication interface, allowing to send requests from
host to EC and receiving the corresponding responses, as well as
managing and receiving events, sent from EC to host. It is structured
into multiple layers, with the top layer presenting the API used by
other kernel drivers and the lower layers modeled after the serial
protocol used for communication.

Said other drivers are then responsible for providing the (Surface model
specific) functionality accessible through the EC (e.g. battery status
reporting, thermal information, ...) via said controller structure and
API, and will be added in future commits.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20201221183959.1186143-2-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-06 23:45:33 +01:00
Utkarsh Patel 8553a979fc
platform/chrome: cros_ec_typec: Send mux configuration acknowledgment to EC
In some corner cases downgrade of the superspeed typec device(e.g. Dell
typec Dock, apple dongle) was seen because before the SOC mux configuration
finishes, EC starts configuring the next mux state.

With this change, once the SOC mux is configured, kernel will send an
acknowledgment to EC via Host command EC_CMD_USB_PD_MUX_ACK [1].
After sending the host event EC will wait for the acknowledgment from
kernel before starting the PD negotiation for the next mux state. This
helps to have a framework to build better error handling along with the
synchronization of timing sensitive mux states.

This change also brings in corresponding EC header updates from the EC code
base [1].

[1]:
https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads/master/include/ec_commands.h

Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com>
Reviewed-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20201210060903.2205-3-utkarsh.h.patel@intel.com
2021-01-05 12:57:15 -08:00
Utkarsh Patel ba8ce51545
platform/chrome: cros_ec_typec: Parameterize cros_typec_cmds_supported()
cros_typec_cmds_supported() is currently being used to check only one
feature flag.
Add a new feature parameter to it so that it can be used to check
multiple feature flags supported in cros_ec.
Rename cros_typec_cmds_supported() to cros_typec_feature_supported().

Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com>
Reviewed-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20201210060903.2205-2-utkarsh.h.patel@intel.com
2021-01-05 12:57:15 -08:00
Prashant Malani 1563090965
platform/chrome: cros_ec_typec: Register plug altmodes
Modify the altmode registration (and unregistration) code so that it
can be used by both partners and plugs.

Then, add code to register plug altmodes using the newly parameterized
function. Also set the number of alternate modes for the plug using the
associated Type C connector class function
typec_plug_set_num_altmodes().

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20201116201150.2919178-12-pmalani@chromium.org
2021-01-05 11:07:40 -08:00
Prashant Malani f4edab68e1
platform/chrome: cros_ec_typec: Register SOP' cable plug
In order to register cable alternate modes, we need to first register a
plug object. Use the Type C connector class framework to register a SOP'
plug for this purpose.

Since a cable and plug go hand in hand, we can handle the registration
and removal together.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20201116201150.2919178-11-pmalani@chromium.org
2021-01-05 11:06:26 -08:00
Prashant Malani 5992297639
platform/chrome: cros_ec_typec: Set partner num_altmodes
Set the number of altmodes available for a registered partner using the
Type C connector class framework routine.

Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20201116201150.2919178-10-pmalani@chromium.org
2021-01-05 11:05:50 -08:00
Prashant Malani 72d6e32bd8
platform/chrome: cros_ec_typec: Store cable plug type
Use the PD VDO Type C cable plug type macro to retrieve and store the
cable plug type in the cable descriptor.

Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20201116201150.2919178-9-pmalani@chromium.org
2021-01-05 11:04:09 -08:00
Prashant Malani 8b46a212ad
platform/chrome: cros_ec_typec: Register cable
When the Chrome Embedded Controller notifies the driver that SOP'
discovery is complete, retrieve the PD discovery data and register a
cable object with the Type C connector class framework.

Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20201116201150.2919178-8-pmalani@chromium.org
2021-01-05 11:03:49 -08:00
Prashant Malani c097f229b7
platform/chrome: cros_ec_typec: Rename discovery struct
Rename the sop_disc data struct which is used to store PD discovery data
to the more generic name of disc_data. It can then be re-used to store
and process cable discovery data.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20201116201150.2919178-7-pmalani@chromium.org
2021-01-05 11:03:02 -08:00
Prashant Malani 8fab275519
platform/chrome: cros_ec_typec: Factor out PD identity parsing
Factor out the PD identity parsing code into a separate function. This
way it can be re-used for Cable PD identity parsing in future patches.

No functional changes are introduced by this patch.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20201116201150.2919178-6-pmalani@chromium.org
2021-01-05 11:01:51 -08:00
Prashant Malani a906f45d14
platform/chrome: cros_ec_typec: Make disc_done flag partner-only
Change the disc_done flag, which indicates whether PD discovery is
complete, to sop_disc_done instead, since we will process SOP and SOP'
discovery data separately.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20201116201150.2919178-5-pmalani@chromium.org
2021-01-05 10:58:59 -08:00
Shyam Sundar S K 5b56930252 platform/x86: amd-pmc: Fix CONFIG_DEBUG_FS check
lkp reported that CONFIG_DEBUG_FS was not defined because of wrong usage
if macro, correcting it now.

Fixes: 156ec4731c ("platform/x86: amd-pmc: Add AMD platform support for S2Idle")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20201230081028.2615217-1-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-04 15:57:26 +01:00
Mark Pearson aa44afab87 platform/x86: thinkpad_acpi: correct palmsensor error checking
The previous commit adding functionality for the palm sensor had a
mistake which meant the error conditions on initialisation was not checked
correctly. On some older platforms this meant that if the sensor wasn't
available an error would be returned and the driver would fail to load.

This commit corrects the error condition. Many thanks to Mario Oenning
for reporting and determining the issue

Signed-off-by: Mark Pearson <markpearson@lenovo.com>
Link: https://lore.kernel.org/r/20201230024726.7861-1-markpearson@lenovo.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-04 15:55:30 +01:00
Arnold Gozum fcd38f178b platform/x86: intel-vbtn: Support for tablet mode on Dell Inspiron 7352
The Dell Inspiron 7352 is a 2-in-1 model that has chassis-type "Notebook".
Add this model to the dmi_switches_allow_list.

Signed-off-by: Arnold Gozum <arngozum@gmail.com>
Link: https://lore.kernel.org/r/20201226205307.249659-1-arngozum@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-04 15:54:45 +01:00
Hans de Goede 46c54cf270 platform/x86: touchscreen_dmi: Add swap-x-y quirk for Goodix touchscreen on Estar Beauty HD tablet
The Estar Beauty HD (MID 7316R) tablet uses a Goodix touchscreen,
with the X and Y coordinates swapped compared to the LCD panel.

Add a touchscreen_dmi entry for this adding a "touchscreen-swapped-x-y"
device-property to the i2c-client instantiated for this device before
the driver binds.

This is the first entry of a Goodix touchscreen to touchscreen_dmi.c,
so far DMI quirks for Goodix touchscreen's have been added directly
to drivers/input/touchscreen/goodix.c. Currently there are 3
DMI tables in goodix.c:
1. rotated_screen[] for devices where the touchscreen is rotated
   180 degrees vs the LCD panel
2. inverted_x_screen[] for devices where the X axis is inverted
3. nine_bytes_report[] for devices which use a non standard touch
   report size

Arguably only 3. really needs to be inside the driver and the other
2 cases are better handled through the generic touchscreen DMI quirk
mechanism from touchscreen_dmi.c, which allows adding device-props to
any i2c-client. Esp. now that goodix.c is using the generic
touchscreen_properties code.

Alternative to the approach from this patch we could add a 4th
dmi_system_id table for devices with swapped-x-y axis to goodix.c,
but that seems undesirable.

Cc: Bastien Nocera <hadess@hadess.net>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201224135158.10976-1-hdegoede@redhat.com
2021-01-04 15:54:45 +01:00
Heikki Krogerus 9bba962755 platform/x86: i2c-multi-instantiate: Don't create platform device for INT3515 ACPI nodes
There are several reports about the tps6598x causing
interrupt flood on boards with the INT3515 ACPI node, which
then causes instability. There appears to be several
problems with the interrupt. One problem is that the
I2CSerialBus resources do not always map to the Interrupt
resource with the same index, but that is not the only
problem. We have not been able to come up with a solution
for all the issues, and because of that disabling the device
for now.

The PD controller on these platforms is autonomous, and the
purpose for the driver is primarily to supply status to the
userspace, so this will not affect any functionality.

Reported-by: Moody Salem <moody@uniswap.org>
Fixes: a3dd034a17 ("ACPI / scan: Create platform device for INT3515 ACPI nodes")
Cc: stable@vger.kernel.org
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1883511
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20201223143644.33341-1-heikki.krogerus@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-04 15:54:45 +01:00
Geert Uytterhoeven e4a02c7a0e platform/surface: SURFACE_PLATFORMS should depend on ACPI
All Microsoft Surface platform-specific device drivers depend on ACPI,
but the gatekeeper symbol SURFACE_PLATFORMS does not.  Hence when the
user is configuring a kernel without ACPI support, he is still asked
about Microsoft Surface drivers, even though this question is
irrelevant.

Fix this by moving the dependency on ACPI from the individual driver
symbols to SURFACE_PLATFORMS.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20201216133752.1321978-1-geert@linux-m68k.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-04 15:54:45 +01:00
Randy Dunlap 6a4b1f2dff platform/surface: surface_gpe: Fix non-PM_SLEEP build warnings
Fix build warnings when CONFIG_PM_SLEEP is not enabled and these
functions are not used:

../drivers/platform/surface/surface_gpe.c:189:12: warning: ‘surface_gpe_resume’ defined but not used [-Wunused-function]
 static int surface_gpe_resume(struct device *dev)
            ^~~~~~~~~~~~~~~~~~
../drivers/platform/surface/surface_gpe.c:184:12: warning: ‘surface_gpe_suspend’ defined but not used [-Wunused-function]
 static int surface_gpe_suspend(struct device *dev)
            ^~~~~~~~~~~~~~~~~~~

Fixes: 274335f1c5 ("platform/surface: Add Driver to set up lid GPEs on MS Surface device")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Maximilian Luz <luzmaximilian@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: platform-driver-x86@vger.kernel.org
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20201214233336.19782-1-rdunlap@infradead.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-01-04 15:54:27 +01:00
Linus Torvalds a088159675 chrome platform changes for 5.11
cros_ec_typec:
 * A series from Prashant for Type-C to implement TYPEC_STATUS, parsing USB PD
   Partner ID VDOs, and registering partner altmodes.
 
 cros_ec misc:
 * Don't treat RTC events as wakeup sources in cros_ec_proto
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQCtZK6p/AktxXfkOlzbaomhzOwwgUCX+JsPAAKCRBzbaomhzOw
 woHeAQD0j6D+m38NgLKr3mwVqkSwaHW7/NNmDIdXBikrRgiw0AD/c/kMZzSzwCGV
 hgSOjg3A4uPq1gyDAW+wYmjngylv3g0=
 =hT9E
 -----END PGP SIGNATURE-----

Merge tag 'tag-chrome-platform-for-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform updates from Benson Leung:
 "cros_ec_typec:

   - A series from Prashant for Type-C to implement TYPEC_STATUS,
     parsing USB PD Partner ID VDOs, and registering partner altmodes.

  cros_ec misc:

   - Don't treat RTC events as wakeup sources in cros_ec_proto"

* tag 'tag-chrome-platform-for-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
  platform/chrome: cros_ec_typec: Tolerate unrecognized mux flags
  platform/chrome: cros_ec_typec: Register partner altmodes
  platform/chrome: cros_ec_typec: Parse partner PD ID VDOs
  platform/chrome: cros_ec_typec: Introduce TYPEC_STATUS
  platform/chrome: cros_ec: Import Type C host commands
  platform/chrome: cros_ec_typec: Clear partner identity on device removal
  platform/chrome: cros_ec_typec: Fix remove partner logic
  platform/chrome: cros_ec_typec: Relocate set_port_params_v*() functions
  platform/chrome: Don't treat RTC events as wakeup sources
2020-12-23 15:06:22 -08:00
Linus Torvalds b109bc7229 Merge tag 'thermal-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux
Pull thermal updates from Daniel Lezcano:

 - Add upper and lower limits clamps for the cooling device state in the
   power allocator governor (Michael Kao)

 - Add upper and lower limits support for the power allocator governor
   (Lukasz Luba)

 - Optimize conditions testing for the trip points (Bernard Zhao)

 - Replace spin_lock_irqsave by spin_lock in hard IRQ on the rcar driver
   (Tian Tao)

 - Add MT8516 dt-bindings and device reset optional support (Fabien
   Parent)

 - Add a quiescent period to cool down the PCH when entering S0iX
   (Sumeet Pawnikar)

 - Use bitmap API instead of re-inventing the wheel on sun8i (Yangtao
   Li)

 - Remove useless NULL check in the hwmon driver (Bernard Zhao)

 - Update the current state in the cpufreq cooling device only if the
   frequency change is effective (Zhuguangqing)

 - Improve the schema validation for the rcar DT bindings (Geert
   Uytterhoeven)

 - Fix the user time unit in the documentation (Viresh Kumar)

 - Add PCI ids for Lewisburg PCH (Andres Freund)

 - Add hwmon support on amlogic (Martin Blumenstingl)

 - Fix build failure for PCH entering on in S0iX (Randy Dunlap)

 - Improve the k_* coefficient for the power allocator governor (Lukasz
   Luba)

 - Fix missing const on a sysfs attribute (Rikard Falkeborn)

 - Remove broken interrupt support on rcar to be replaced by a new one
   (Niklas Söderlund)

 - Improve the error code handling at init time on imx8mm (Fabio
   Estevam)

 - Compute interval validity once instead at each temperature reading
   iteration on acerhdf (Daniel Lezcano)

 - Add r8a779a0 support (Niklas Söderlund)

 - Add PCI ids for AlderLake PCH and mmio refactoring (Srinivas
   Pandruvada)

 - Add RFIM and mailbox support on int340x (Srinivas Pandruvada)

 - Use macro for temperature calculation on PCH (Sumeet Pawnikar)

 - Simplify return conditions at probe time on Broadcom (Zheng Yongjun)

 - Fix workload name on PCH (Srinivas Pandruvada)

 - Migrate the devfreq cooling device code to the energy model API
   (Lukasz Luba)

 - Emit a warning if the thermal_zone_device_update is called without
   the .get_temp() ops (Daniel Lezcano)

 - Add critical and hot ops for the thermal zone (Daniel Lezcano)

 - Remove notification usage when critical is reached on rcar (Daniel
   Lezcano)

 - Fix devfreq build when ENERGY_MODEL is not set (Lukasz Luba)

* tag 'thermal-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux: (45 commits)
  thermal/drivers/devfreq_cooling: Fix the build when !ENERGY_MODEL
  thermal/drivers/rcar: Remove notification usage
  thermal/core: Add critical and hot ops
  thermal/core: Emit a warning if the thermal zone is updated without ops
  drm/panfrost: Register devfreq cooling and attempt to add Energy Model
  thermal: devfreq_cooling: remove old power model and use EM
  thermal: devfreq_cooling: add new registration functions with Energy Model
  thermal: devfreq_cooling: use a copy of device status
  thermal: devfreq_cooling: change tracing function and arguments
  thermal: int340x: processor_thermal: Correct workload type name
  thermal: broadcom: simplify the return expression of bcm2711_thermal_probe()
  thermal: intel: pch: use macro for temperature calculation
  thermal: int340x: processor_thermal: Add mailbox driver
  thermal: int340x: processor_thermal: Add RFIM driver
  thermal: int340x: processor_thermal: Add AlderLake PCI device id
  thermal: int340x: processor_thermal: Refactor MMIO interface
  thermal: rcar_gen3_thermal: Add r8a779a0 support
  dt-bindings: thermal: rcar-gen3-thermal: Add r8a779a0 support
  platform/x86/drivers/acerhdf: Check the interval value when it is set
  platform/x86/drivers/acerhdf: Use module_param_cb to set/get polling interval
  ...
2020-12-15 16:21:37 -08:00
Linus Torvalds 61f914256c platform-drivers-x86 for v5.11-1
Highlights:
 - New driver for changing BIOS settings from within Linux on Dell devices,
   this introduces a new generic sysfs API for this. Lenovo is working on
   also supporting this API on their devices
 - New Intel PMT telemetry and crashlog drivers
 - Support for SW_TABLET_MODE reporting for the acer-wmi and intel-hid drivers
 - Preparation work for improving support for Microsoft Surface hardware
 - Various fixes / improvements / quirks for the panasonic-laptop and others
 
 The following is an automated git shortlog grouped by driver:
 
 ISST:
  -  Mark mmio_range_devid_0 and mmio_range_devid_1 with static keyword
  -  Change PCI device macros
  -  Allow configurable offset range
  -  Check for unaligned mmio address
 
 Intel PMT Crashlog capability driver:
  - Intel PMT Crashlog capability driver
 
 Intel PMT Telemetry capability driver:
  - Intel PMT Telemetry capability driver
 
 Intel PMT class driver:
  - Intel PMT class driver
 
 Introduce support for Systems Management Driver over WMI for Dell Systems:
  - Introduce support for Systems Management Driver over WMI for Dell Systems
 
 MAINTAINERS:
  -  new panasonic-laptop maintainer
  -  rectify DELL WMI SYSMAN DRIVERS section
 
 Merge tag 'ib-mfd-x86-v5.11' into review-hans:
  - Merge tag 'ib-mfd-x86-v5.11' into review-hans
 
 PCI:
  -  Add defines for Designated Vendor-Specific Extended Capability
 
 Revert "platform/x86:
  -  wmi: Destroy on cleanup rather than unregister"
 
 acer-wireless:
  -  send an EV_SYN/SYN_REPORT between state changes
 
 acer-wmi:
  -  Add ACER_CAP_KBD_DOCK quirk for the Aspire Switch 10E SW3-016
  -  add automatic keyboard background light toggle key as KEY_LIGHTS_TOGGLE
  -  Add support for SW_TABLET_MODE on Switch devices
  -  Add ACER_CAP_SET_FUNCTION_MODE capability flag
  -  Add new force_caps module parameter
  -  Cleanup accelerometer device handling
  -  Cleanup ACER_CAP_FOO defines
  -  Drop no-op set_quirks call from find_quirks
 
 amd-pmc:
  -  Add AMD platform support for S2Idle
 
 asus-wmi:
  -  Add userspace notification for performance mode change
  -  Add support for SW_TABLET_MODE on UX360
 
 dell-smbios-base:
  -  Fix error return code in dell_smbios_init
 
 dell-wmi-sysman:
  -  work around for BIOS bug
  -  fix init_bios_attributes() error handling
 
 docs:
  -  ABI: sysfs-class-firmware-attributes: solve some warnings
 
 i2c-multi-instantiate:
  -  Use device_get_match_data() to get driver data
  -  Simplify with dev_err_probe()
  -  Drop redundant ACPI_PTR()
 
 intel-hid:
  -  add Rocket Lake ACPI device ID
  -  Do not create SW_TABLET_MODE input-dev when a KIOX010A ACPI dev is present
  -  Add alternative method to enable switches
  -  Add support for SW_TABLET_MODE
  -  fix _DSM function index handling
 
 intel-vbtn:
  -  Fix SW_TABLET_MODE always reporting 1 on some HP x360 models
  -  Allow switch events on Acer Switch Alpha 12
  -  Support for tablet mode on HP Pavilion 13 x360 PC
 
 intel_pmc_core:
  -  Assign boolean values to a bool variable
 
 mfd:
  -  Intel Platform Monitoring Technology support
 
 mlx-platform:
  -  Fix item counter assignment for MSN2700/ComEx system
  -  Fix item counter assignment for MSN2700, MSN24xx systems
  -  remove an unused variable
  -  Remove PSU EEPROM from MSN274x platform configuration
  -  Remove PSU EEPROM from default platform configuration
 
 panasonic-laptop:
  -  Add sysfs attributes for firmware brightness registers
  -  Add support for battery charging threshold (eco mode)
  -  Resolve hotkey double trigger bug
  -  Add write support to mute
  -  Fix sticky key init bug
  -  Fix naming of platform files for consistency with other modules
  -  Split MODULE_AUTHOR() by one author per macro call
  -  Replace ACPI prints with pr_*() macros
  -  Add support for optical driver power in Y and W series
 
 platform:
  -  Add Surface platform directory
 
 platform/mellanox:
  -  mlxbf-pmc: Add Mellanox BlueField PMC driver
 
 platform/surface:
  -  gpe: Add support for 15" Intel version of Surface Laptop 3
  -  Add Driver to set up lid GPEs on MS Surface device
  -  Move Surface Pro 3 Button driver to platform/surface
  -  Move Surface 3 Power OpRegion driver to platform/surface
  -  Move Surface 3 Button driver to platform/surface
  -  Move Surface 3 WMI driver to platform/surface
 
 platform/x86/dell-wmi-sysman:
  -  Make some symbols static
  -  Make wmi_sysman_kobj_sysfs_ops static
 
 pmt:
  -  Fix a potential Oops on error in probe
 
 remove unneeded break:
  - remove unneeded break
 
 thinkpad_acpi:
  -  remove trailing semicolon in macro definition
  -  Whitelist P15 firmware for dual fan control
  -  Add palm sensor support
  -  Send tablet mode switch at wakeup time
  -  Add BAT1 is primary battery quirk for Thinkpad Yoga 11e 4th gen
  -  Do not report SW_TABLET_MODE on Yoga 11e
  -  add P1 gen3 second fan support
 
 tools/power/x86/intel-speed-select:
  -  Update version for v5.11
  -  Account for missing sysfs for die_id
  -  Read TRL from mailbox
 
 toshiba_acpi:
  -  Fix the wrong variable assignment
 
 touchscreen_dmi:
  -  Add info for the Irbis TW118 tablet
  -  Add info for the Predia Basic tablet
 
 x86/platform:
  -  classmate-laptop: add WiFi media button
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCAAyFiEEuvA7XScYQRpenhd+kuxHeUQDJ9wFAl/XTkEUHGhkZWdvZWRl
 QHJlZGhhdC5jb20ACgkQkuxHeUQDJ9z5EAf7BzqZDyFBpsDd8+o0FsjCq1DEzw0R
 lZdhZt65wSMqe0sndgfStPQG1yet8JgABgq8aCkBQLhj55hjiOUYHe5iXmylSRQn
 iWhu2xI+qYb9rhPW3lYilGcWAIfC5jrEZHFLtpXKx/p5iwCJQRvI6sV8HwcwJjnQ
 p3eyxIUEQieAtO90scqsOWZTKtT/no9UMTLbZwrO3Spv05WGopIMtkHPWYTd96pa
 6SRBdhZj3mrHHc7mRe0u4Wx2dzeUwiPLfubt/kmRPoo1HWTGE2Ck4KPqN/nSY3R2
 z882CMZjWpbwoc3OP2fK26uIHjTh45+yVH8DVZbaQW9BWIOdE87iADzuWA==
 =Df8H
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v5.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver updates from Hans de Goede:
 "Highlights:

   - New driver for changing BIOS settings from within Linux on Dell
     devices. This introduces a new generic sysfs API for this. Lenovo
     is working on also supporting this API on their devices

   - New Intel PMT telemetry and crashlog drivers

   - Support for SW_TABLET_MODE reporting for the acer-wmi and intel-hid
     drivers

   - Preparation work for improving support for Microsoft Surface
     hardware

   - Various fixes / improvements / quirks for the panasonic-laptop and
     others"

* tag 'platform-drivers-x86-v5.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (81 commits)
  platform/x86: ISST: Mark mmio_range_devid_0 and mmio_range_devid_1 with static keyword
  platform/x86: intel-hid: add Rocket Lake ACPI device ID
  x86/platform: classmate-laptop: add WiFi media button
  platform/x86: mlx-platform: Fix item counter assignment for MSN2700/ComEx system
  platform/x86: mlx-platform: Fix item counter assignment for MSN2700, MSN24xx systems
  tools/power/x86/intel-speed-select: Update version for v5.11
  tools/power/x86/intel-speed-select: Account for missing sysfs for die_id
  tools/power/x86/intel-speed-select: Read TRL from mailbox
  platform/x86: intel-hid: Do not create SW_TABLET_MODE input-dev when a KIOX010A ACPI dev is present
  platform/x86: intel-hid: Add alternative method to enable switches
  platform/x86: intel-hid: Add support for SW_TABLET_MODE
  platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting 1 on some HP x360 models
  platform/x86: ISST: Change PCI device macros
  platform/x86: ISST: Allow configurable offset range
  platform/x86: ISST: Check for unaligned mmio address
  acer-wireless: send an EV_SYN/SYN_REPORT between state changes
  platform/x86: dell-wmi-sysman: work around for BIOS bug
  platform/x86: mlx-platform: remove an unused variable
  platform/x86: thinkpad_acpi: remove trailing semicolon in macro definition
  platform/x86: dell-smbios-base: Fix error return code in dell_smbios_init
  ...
2020-12-15 16:10:17 -08:00
Linus Torvalds 605ea5aafe spi: Updates for v5.11
The big change this release has been some excellent work from Lukas
 Wunner which closes a bunch of holes in the cleanup paths for drivers,
 mainly introduced as a result of devm conversions causing bad
 interactions with the support SPI has for allocating the bus and driver
 data together.  Together with some of the other work done it feels like
 we've turned the corner on several long standing pain points with the
 API.
 
  - Many cleanups around probe/remove and error handling from Lukas
    Wunner and Uwe Kleine-König, and further fixes around PM from Zhang
    Qilong.
  - Provide a mask for which bits of the mode can safely be configured by
    drivers and use that to fix an issue with the ADS7846 driver.
  - Documentation of the expected interactions between SPI and GPIO level
    chip select polarity configuration from H. Nikolaus Schaller,
    hopefully we're pretty much at the end of sorting out the
    interactions there.  Thanks to Nikolaus, Sven Van Asbroeck and Linus
    Walleij for this.
  - DMA support for Allwinner sun6i controllers.
  - Support for Canaan K210 Designware implementations and Intel Adler Lake.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl/Xeg4ACgkQJNaLcl1U
 h9BbXQf8DwmtP/biVsB0yxag11Ac9xxDL2OdMXia/DBQZsVSxqGld4l7Bwl8CMVi
 TISCmzO1f53l3KZK5wu1C5mV8tXgCu4zrsPErEsrK2V2+s+4lWy10MOfAHqq/lBR
 L2kifZ/uoeMBaPvJqpRimM8tv2uPXPHOKsdy2G82LzMdk0OhE5p9IkL5Nc5JbKOl
 X1iWTAxtUsDb8+B57AwHSMnL4R3pb/01N0PguJJ8DGol7Oj6VcDf7nh/tqvVkEot
 Ku731oCBQwBhkZKOqd7mvQAjPyoJiFPI8nofC4Bj+a1BDlr+pRcILQ4469zaIAWT
 nPV6BoHTu/tVV63j8YhuamjWYAsS0g==
 =ezV7
 -----END PGP SIGNATURE-----

Merge tag 'spi-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi updates from Mark Brown:
 "The big change this release has been some excellent work from Lukas
  Wunner which closes a bunch of holes in the cleanup paths for drivers,
  mainly introduced as a result of devm conversions causing bad
  interactions with the support SPI has for allocating the bus and
  driver data together.

  Together with some of the other work done it feels like we've turned
  the corner on several long standing pain points with the API.

  Summary:

   - Many cleanups around probe/remove and error handling from Lukas
     Wunner and Uwe Kleine-König, and further fixes around PM from Zhang
     Qilong.

   - Provide a mask for which bits of the mode can safely be configured
     by drivers and use that to fix an issue with the ADS7846 driver.

   - Documentation of the expected interactions between SPI and GPIO
     level chip select polarity configuration from H. Nikolaus Schaller,
     hopefully we're pretty much at the end of sorting out the
     interactions there. Thanks to Nikolaus, Sven Van Asbroeck and Linus
     Walleij for this.

   - DMA support for Allwinner sun6i controllers.

   - Support for Canaan K210 Designware implementations and Intel Adler
     Lake"

* tag 'spi-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (69 commits)
  spi: dt-bindings: clarify CS behavior for spi-cs-high and gpio descriptors
  spi: Limit the spi device max speed to controller's max speed
  spi: spi-geni-qcom: Use the new method of gpio CS control
  platform/chrome: cros_ec_spi: Drop bits_per_word assignment
  platform/chrome: cros_ec_spi: Don't overwrite spi::mode
  spi: dw: Add support for the Canaan K210 SoC SPI
  spi: dw: Add support for 32-bits max xfer size
  dt-bindings: spi: dw-apb-ssi: Add Canaan K210 SPI controller
  spi: Update DT binding docs to support SiFive FU740 SoC
  spi: atmel-quadspi: Fix use-after-free on unbind
  spi: npcm-fiu: Disable clock in probe error path
  spi: ar934x: Don't leak SPI master in probe error path
  spi: mt7621: Don't leak SPI master in probe error path
  spi: mt7621: Disable clock in probe error path
  media: netup_unidvb: Don't leak SPI master in probe error path
  spi: sc18is602: Don't leak SPI master in probe error path
  spi: rb4xx: Don't leak SPI master in probe error path
  spi: gpio: Don't leak SPI master in probe error path
  spi: spi-mtk-nor: Don't leak SPI master in probe error path
  spi: mxic: Don't leak SPI master in probe error path
  ...
2020-12-15 15:51:10 -08:00
Linus Torvalds 0cee54c890 USB / Thunderbolt patches for 5.11-rc1
Here is the big USB and thunderbolt pull request for 5.11-rc1.
 
 Nothing major in here, just the grind of constant development to support
 new hardware and fix old issues:
   - thunderbolt updates for new USB4 hardware
   - cdns3 major driver updates
   - lots of typec updates and additions as more hardware is available
   - usb serial driver updates and fixes
   - other tiny USB driver updates
 
 All have been in linux-next with no reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCX9iKFQ8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+yme2gCfacEYztlnc0fh7PyyatYXgdkspbYAn2ri6mfF
 4VY86HYXKqQRDW8w/lSg
 =f8KJ
 -----END PGP SIGNATURE-----

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

Pull USB / Thunderbolt updates from Greg KH:
 "Here is the big USB and thunderbolt pull request for 5.11-rc1.

  Nothing major in here, just the grind of constant development to
  support new hardware and fix old issues:

   - thunderbolt updates for new USB4 hardware

   - cdns3 major driver updates

   - lots of typec updates and additions as more hardware is available

   - usb serial driver updates and fixes

   - other tiny USB driver updates

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

* tag 'usb-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (172 commits)
  usb: phy: convert comma to semicolon
  usb: ucsi: convert comma to semicolon
  usb: typec: tcpm: convert comma to semicolon
  usb: typec: tcpm: Update vbus_vsafe0v on init
  usb: typec: tcpci: Enable bleed discharge when auto discharge is enabled
  usb: typec: Add class for plug alt mode device
  USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition
  USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP
  USB: typec: tcpm: Fix PR_SWAP error handling
  USB: typec: tcpm: Hard Reset after not receiving a Request
  USB: gadget: f_fs: remove likely/unlikely
  usb: gadget: f_fs: Re-use SS descriptors for SuperSpeedPlus
  USB: gadget: f_midi: setup SuperSpeed Plus descriptors
  USB: gadget: f_acm: add support for SuperSpeed Plus
  USB: gadget: f_rndis: fix bitrate for SuperSpeed and above
  usb: typec: intel_pmc_mux: Configure cable generation value for USB4
  MAINTAINERS: Add myself as a reviewer for CADENCE USB3 DRD IP DRIVER
  usb: chipidea: ci_hdrc_imx: Use of_device_get_match_data()
  usb: chipidea: usbmisc_imx: Use of_device_get_match_data()
  usb: cdns3: fix NULL pointer dereference on no platform data
  ...
2020-12-15 13:54:56 -08:00
Linus Torvalds ae1c1a8fd9 - Add a new uv_sysfs driver and expose read-only information from UV BIOS
(Justin Ernst and Mike Travis)
 
 - The usual set of small fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAl/XWLkACgkQEsHwGGHe
 VUpgoQ//WnhLoyByrxyKScOLW2aCCX4sIQ2R0Mjqt4z6wHHL6OB1GIswtIWsFlpw
 UtFOhTmKV0A5q/yXIGYY1EOZPhA4wrrTesYHsOoVcJ3xdwrAarc3fzw02uKT/uQp
 sW0JxTtJ5iK0XZp+K81344sQy26iuTiLh0Lwg9lJ5mpUotW+1iSOp7LAgcN462r9
 3l8To6qWyWnnMWgJlV7jdcsswk0V2TkT/iipQITNqEGtwqRm/uFGRgK/669IbqP/
 P/qROhU1XseHxVFfPMXfFVeFjNTpkcgD11C8YeqWiHXrmBesCHIC9cd2pYfJepLJ
 F4sIh6zqt6v6z5UOD+yo8IjdmL0v9nPLJiCeiu9ES59pVIx7DsR+p005fBLTAXp8
 QpbiAhJn4ajpu78QAkkhieAvldXP2+1h42wK8HUTWKt2wPsnyGozvY71kp8UkMSd
 1Kh3mahrAN57TfvlewrMr/ynhGMMuWQHIr3ScYei0L6vF2c6f98HSiNzzZ1PiiY7
 6OwR+qISucV8ZeXMv6va5POI/T67UZjjuT5Zw0ls1LpqJ6CkGmcrCeq6qYbxK7Fy
 Vd8T/v51FknrTF0J42GMLb9ICIFmC0yAvzflTytFvWqgGEZpEEpRzmKfeC+a0G7B
 m3XEm/xE3+3TKnID+2tPSFOEU4mdwKC0+lguD7DV8aTYpdjsxXs=
 =VZBo
 -----END PGP SIGNATURE-----

Merge tag 'x86_platform_for_v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 platform updates from Borislav Petkov:

 - add a new uv_sysfs driver and expose read-only information from UV
   BIOS (Justin Ernst and Mike Travis)

 - the usual set of small fixes

* tag 'x86_platform_for_v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/platform/uv: Update sysfs documentation
  x86/platform/uv: Add deprecated messages to /proc info leaves
  x86/platform/uv: Add sysfs hubless leaves
  x86/platform/uv: Add sysfs leaves to replace those in procfs
  x86/platform/uv: Add kernel interfaces for obtaining system info
  x86/platform/uv: Make uv_pcibus_kset and uv_hubs_kset static
  x86/platform/uv: Fix an error code in uv_hubs_init()
  x86/platform/uv: Update MAINTAINERS for uv_sysfs driver
  x86/platform/uv: Update ABI documentation of /sys/firmware/sgi_uv/
  x86/platform/uv: Add new uv_sysfs platform driver
  x86/platform/uv: Add and export uv_bios_* functions
  x86/platform/uv: Remove existing /sys/firmware/sgi_uv/ interface
2020-12-14 13:27:53 -08:00
Prashant Malani 6ae9b5ffca
platform/chrome: cros_ec_typec: Tolerate unrecognized mux flags
On occasion, the Chrome Embedded Controller (EC) can send a mux
configuration which doesn't map to a particular data mode. For instance,
dedicated Type C chargers, when connected, may cause only
USB_PD_MUX_POLARITY_INVERTED to be set. This is a valid flag combination
and should not lead to a driver abort.

Modify the mux configuration handling to not return an error when an
unrecognized mux flag combination is encountered. Concordantly, make the
ensuing print a debug level print so as to not pollute the kernel logs.

Cc: Keith Short <keithshort@chromium.org>
Signed-off-by: Prashant Malani <pmalani@chromium.org>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20201106020305.767202-1-pmalani@chromium.org
2020-12-10 13:05:16 -08:00
Stephen Boyd 7a5172b799
platform/chrome: cros_ec_spi: Drop bits_per_word assignment
This is already handed by default in spi_setup() if the bits_per_word is
0, so just drop it to shave off a line.

Cc: Simon Glass <sjg@chromium.org>
Cc: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Alexandru M Stan <amstan@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20201204193540.3047030-3-swboyd@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-09 16:52:09 +00:00
Stephen Boyd 74639cbf51
platform/chrome: cros_ec_spi: Don't overwrite spi::mode
There isn't any need to overwrite the mode here in the driver with what
has been detected by the firmware, such as DT or ACPI. In fact, if we
use the SPI CS gpio descriptor feature we will overwrite the mode with
SPI_MODE_0 where it already contains SPI_MODE_0 and more importantly
SPI_CS_HIGH. Clearing the SPI_CS_HIGH bit causes the CS line to toggle
when the device is probed when it shouldn't change, confusing the driver
and making it fail to probe. Drop the assignment and let the spi core
take care of it.

Fixes: a17d94f0b6 ("mfd: Add ChromeOS EC SPI driver")
Cc: Simon Glass <sjg@chromium.org>
Cc: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Alexandru M Stan <amstan@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20201204193540.3047030-2-swboyd@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-09 16:52:08 +00:00
Zou Wei 0cd3f561ef platform/x86: ISST: Mark mmio_range_devid_0 and mmio_range_devid_1 with static keyword
Fix the following sparse warnings:

drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c:23:24: warning: symbol 'mmio_range_devid_0' was not declared. Should it be static?
drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c:28:24: warning: symbol 'mmio_range_devid_1' was not declared. Should it be static?

Signed-off-by: Zou Wei <zou_wei@huawei.com>
Link: https://lore.kernel.org/r/1607430489-116200-1-git-send-email-zou_wei@huawei.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-08 16:30:55 +01:00
Alex Hung 7067be7059 platform/x86: intel-hid: add Rocket Lake ACPI device ID
Rocket Lake has a new ACPI ID for Intel HID event filter device.

Signed-off-by: Alex Hung <alex.hung@canonical.com>
Link: https://lore.kernel.org/r/20201208020620.101455-1-alex.hung@canonical.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-08 11:18:03 +01:00
Carlo Caione aa8994fbf2 x86/platform: classmate-laptop: add WiFi media button
The WiFi media button on the Quanta NL3 reports keycodes 0x8b and 0x9b
to the platform driver. Add the mapping to support these codes.

Signed-off-by: Carlo Caione <carlo@endlessm.com>
Reviewed-by: Chris Chiu <chiu@endlessos.org>
Link: https://lore.kernel.org/r/20201208061111.29073-1-chiu@endlessos.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-08 11:18:03 +01:00
Vadim Pasternak cf791774a1 platform/x86: mlx-platform: Fix item counter assignment for MSN2700/ComEx system
Fix array names to match assignments for data items and data items
counter in 'mlxplat_mlxcpld_comex_items' structure for:
	.data = mlxplat_mlxcpld_default_pwr_items_data,
	.count = ARRAY_SIZE(mlxplat_mlxcpld_pwr),
and
	.data = mlxplat_mlxcpld_default_fan_items_data,
	.count = ARRAY_SIZE(mlxplat_mlxcpld_fan),

Replace:
- 'mlxplat_mlxcpld_pwr' by 'mlxplat_mlxcpld_default_pwr_items_data' for
   ARRAY_SIZE() calculation.
- 'mlxplat_mlxcpld_fan' by 'mlxplat_mlxcpld_default_fan_items_data'
   for ARRAY_SIZE() calculation.

Fixes: bdd6e155e0 ("platform/x86: mlx-platform: Add support for new system type")
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20201207174745.22889-3-vadimp@nvidia.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-08 11:14:49 +01:00
Vadim Pasternak ba4939f1dd platform/x86: mlx-platform: Fix item counter assignment for MSN2700, MSN24xx systems
Fix array names to match assignments for data items and data items
counter in 'mlxplat_mlxcpld_default_items' structure for:
	.data = mlxplat_mlxcpld_default_pwr_items_data,
	.count = ARRAY_SIZE(mlxplat_mlxcpld_pwr),
and
	.data = mlxplat_mlxcpld_default_fan_items_data,
	.count = ARRAY_SIZE(mlxplat_mlxcpld_fan),

Replace:
- 'mlxplat_mlxcpld_pwr' by 'mlxplat_mlxcpld_default_pwr_items_data' for
   ARRAY_SIZE() calculation.
- 'mlxplat_mlxcpld_fan' by 'mlxplat_mlxcpld_default_fan_items_data'
   for ARRAY_SIZE() calculation.

Fixes: c6acad68eb ("platform/mellanox: mlxreg-hotplug: Modify to use a regmap interface")
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20201207174745.22889-2-vadimp@nvidia.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-08 11:14:49 +01:00
Mike Travis 433e817ae1 x86/platform/uv: Add sysfs hubless leaves
Add uv_sysfs hubless leaves for UV hubless systems.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lkml.kernel.org/r/20201128034227.120869-4-mike.travis@hpe.com
2020-12-07 19:51:05 +01:00
Mike Travis 612a0063c9 x86/platform/uv: Add sysfs leaves to replace those in procfs
Add uv_sysfs leaves to display the info.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lkml.kernel.org/r/20201128034227.120869-3-mike.travis@hpe.com
2020-12-07 19:49:01 +01:00
Hans de Goede dea5b80a04 platform/x86: intel-hid: Do not create SW_TABLET_MODE input-dev when a KIOX010A ACPI dev is present
Some 360 degree hinges (yoga) style 2-in-1 devices use 2 accelerometers
to allow the OS to determine the angle between the display and the base
of the device. On Windows these are read by a special HingeAngleService
process which calls an ACPI DSM (Device Specific Method) on the
ACPI KIOX010A device node for the sensor in the display, to let the
firmware know if the 2-in-1 is in tablet- or laptop-mode so that it can
disable the kbd and touchpad to avoid spurious input in tablet-mode.

The linux kxcjk1013 driver calls the DSM for this once at probe time
to ensure that the builtin kbd and touchpad work. On some devices this
causes a "spurious" 0xcd event on the intel-hid ACPI dev. In this case
there is not a functional tablet-mode switch, so we should not register
the tablet-mode switch device.

Cc: Elia Devito <eliadevito@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201207165129.396298-1-hdegoede@redhat.com
2020-12-07 17:52:03 +01:00
Elia Devito ac32bae000 platform/x86: intel-hid: Add alternative method to enable switches
Some convertible have unreliable VGBS return, in these cases we enable
support when receiving the first event.

Signed-off-by: Elia Devito <eliadevito@gmail.com>
Link: https://lore.kernel.org/r/20201204160234.36832-1-elia@xvalue.it
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-07 17:40:40 +01:00
Elia Devito 537b0dd472 platform/x86: intel-hid: Add support for SW_TABLET_MODE
Some convertible use the intel-hid ACPI interface to report SW_TABLET_MODE,
implement this with DMI based allow-list to be sure to activate support
only on models that effectively have it.

Signed-off-by: Elia Devito <eliadevito@gmail.com>
Link: https://lore.kernel.org/r/20201204160121.36703-1-elia@xvalue.it
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-07 17:40:33 +01:00
Daniel Lezcano f34a32fae7 platform/x86/drivers/acerhdf: Check the interval value when it is set
Currently the code checks the interval value when the temperature is
read which is bad for two reasons:

 - checking and setting the interval in the get_temp callback is
   inaccurate and awful, that can be done when changing the value.

 - Changing the thermal zone structure internals is an abuse of the
   exported structure, moreover no lock is taken here.

The goal of this patch is to solve the first item by using the 'set'
function called when changing the interval. The check is done there
and removed from the get_temp function. If the thermal zone was not
initialized yet, the interval is not updated in this case as that will
happen in the init function when registering the thermal zone device.

I don't have any hardware to test the changes.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Peter Kaestle <peter@piie.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201203071738.2363701-2-daniel.lezcano@linaro.org
2020-12-07 17:04:50 +01:00
Daniel Lezcano a65181c41e platform/x86/drivers/acerhdf: Use module_param_cb to set/get polling interval
The module parameter can be set by using ops to get and set the
values. The change will allow to check the correctness of the interval
value everytime it is changed instead of checking in the get_temp
function.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Peter Kaestle <peter@piie.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201203071738.2363701-1-daniel.lezcano@linaro.org
2020-12-07 17:03:58 +01:00
Hans de Goede a4327979a1 platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting 1 on some HP x360 models
Some HP x360 models have an ACPI VGBS method which sets bit 4 instead of
bit 6 when NOT in tablet mode at boot. Inspecting all the DSDTs in my DSDT
collection shows only one other model, the Medion E1239T ever setting bit 4
and it always sets this together with bit 6.

So lets treat bit 4 as a second bit which when set indicates the device not
being in tablet-mode, as we already do for bit 6.

While at it also prefix all VGBS constant defines with "VGBS_".

Note this wrokaround was first added to the kernel as
commit d823346876 ("platform/x86: intel-vbtn: Fix SW_TABLET_MODE always
reporting 1 on the HP Pavilion 11 x360").
After commit 8169bd3e6e ("platform/x86: intel-vbtn: Switch to an
allow-list for SW_TABLET_MODE reporting") got added to the kernel this
was reverted, because with the new allow-list approach the workaround
was no longer necessary for the model on which the issue was first
reported.

But it turns out that the workaround is still necessary because some
affected models report a chassis-type of 31 which is on the allow-list.

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1894017
Fixes: 21d64817c7 ("platform/x86: intel-vbtn: Revert "Fix SW_TABLET_MODE always reporting 1 on the HP Pavilion 11 x360"")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-07 16:10:12 +01:00
Srinivas Pandruvada 7c88ab5715 platform/x86: ISST: Change PCI device macros
Use PCI_VDEVICE and PCI_DEVICE_DATA macros. No functional changes are
expected.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20201204015746.1168941-3-srinivas.pandruvada@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-07 16:10:12 +01:00
Srinivas Pandruvada 761f0ee0e8 platform/x86: ISST: Allow configurable offset range
The mmio offset range can be different based on the PCI device id. Here
for INTEL_RAPL_PRIO_DEVID_1, the range is increased from 45 to 64. Pass
the range as the driver_data. Also account for different ranges during
save/restore via suspend/resume callbacks.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20201204015746.1168941-2-srinivas.pandruvada@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-07 16:10:12 +01:00
Srinivas Pandruvada a552f204b0 platform/x86: ISST: Check for unaligned mmio address
The address should be aligned to 4 byte boundary. So send an error for
unaligned address.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20201204015746.1168941-1-srinivas.pandruvada@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-07 16:10:12 +01:00
Daniel Drake 8b105ef6ff acer-wireless: send an EV_SYN/SYN_REPORT between state changes
Sending the switch state change twice within the same frame is invalid
evdev protocol and only works if the client handles keys immediately as
well. Processing events immediately is incorrect, it forces a fake
order of events that does not exist on the device.

Recent versions of libinput changed to only process the device state and
SYN_REPORT time, so now the key event is lost.

Same fix as 'commit <bff5bf9db1c94> ("platform/x86: asus-wireless: send
an EV_SYN/SYN_REPORT between state changes")'

Signed-off-by: Daniel Drake <drake@endlessos.org>
Signed-off-by: Chris Chiu <chiu@endlessos.org>
Link: https://lore.kernel.org/r/20201207064322.13992-1-chiu@endlessos.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-07 16:10:11 +01:00
Divya Bharathi 1f7cb4665d platform/x86: dell-wmi-sysman: work around for BIOS bug
BIOS sets incorrect value (zero) when SET value passed for integer
attribute with + sign. Added workaround to remove + sign before passing
input to BIOS.

Co-developed-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Co-developed-by: Prasanth KSR <prasanth.ksr@dell.com>
Signed-off-by: Prasanth KSR <prasanth.ksr@dell.com>
Signed-off-by: Divya Bharathi <divya.bharathi@dell.com>
Link: https://lore.kernel.org/r/20201202131935.307372-1-divya.bharathi@dell.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-07 16:09:28 +01:00
Arnd Bergmann eca6ba20f3 platform/x86: mlx-platform: remove an unused variable
The only reference to the mlxplat_mlxcpld_psu[] array got removed,
so there is now a warning from clang:

drivers/platform/x86/mlx-platform.c:322:30: error: variable 'mlxplat_mlxcpld_psu' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
static struct i2c_board_info mlxplat_mlxcpld_psu[] = {

Remove the array as well and adapt the ARRAY_SIZE() call
accordingly.

Fixes: 912b341585 ("platform/x86: mlx-platform: Remove PSU EEPROM from MSN274x platform configuration")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20201203223105.1195709-1-arnd@kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-07 14:49:42 +01:00
Zou Wei 0c683e9de0 x86/platform/uv: Make uv_pcibus_kset and uv_hubs_kset static
Fix the following sparse warnings:

  drivers/platform/x86/uv_sysfs.c:22:13: warning: symbol \
	  'uv_pcibus_kset' was not declared. Should it be static?
  drivers/platform/x86/uv_sysfs.c:23:13: warning: symbol \
	  'uv_hubs_kset' was not declared. Should it be static?

Signed-off-by: Zou Wei <zou_wei@huawei.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lkml.kernel.org/r/1606734713-43919-1-git-send-email-zou_wei@huawei.com
2020-12-03 08:53:47 +01:00
Dan Carpenter 18d047bd89 x86/platform/uv: Fix an error code in uv_hubs_init()
Return -ENOMEM on allocation failure instead of returning random stack
memory contents.

Fixes: 4fc2cf1f2d ("x86/platform/uv: Add new uv_sysfs platform driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Justin Ernst <justin.ernst@hpe.com>
Link: https://lkml.kernel.org/r/X8eoN/jMAJb3H3iv@mwanda
2020-12-03 08:51:06 +01:00
Tom Rix 06706da2bb platform/x86: thinkpad_acpi: remove trailing semicolon in macro definition
The macro use will already have a semicolon.

Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20201127181024.2771890-1-trix@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-02 13:13:03 +01:00
Qinglang Miao 2425ccd30f platform/x86: dell-smbios-base: Fix error return code in dell_smbios_init
Fix to return the error code -ENODEV when fails to init wmi and
smm.

Fixes: 41e36f2f85 ("platform/x86: dell-smbios: Link all dell-smbios-* modules together")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Reviewed-by: Mario Limonciello <mario.limonciello@dell.com>
Link: https://lore.kernel.org/r/20201125065032.154125-1-miaoqinglang@huawei.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-02 13:11:03 +01:00
Carlos Garnacho fe60009903 platform/x86: intel-vbtn: Allow switch events on Acer Switch Alpha 12
This 2-in-1 model (Product name: Switch SA5-271) features a SW_TABLET_MODE
that works as it would be expected, both when detaching the keyboard and
when folding it behind the tablet body.

It used to work until the introduction of the allow list at
commit 8169bd3e6e ("platform/x86: intel-vbtn: Switch to an allow-list
for SW_TABLET_MODE reporting"). Add this model to it, so that the Virtual
Buttons device announces the EV_SW features again.

Fixes: 8169bd3e6e ("platform/x86: intel-vbtn: Switch to an allow-list for SW_TABLET_MODE reporting")
Cc: stable@vger.kernel.org
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Link: https://lore.kernel.org/r/20201201135727.212917-1-carlosg@gnome.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-12-02 13:09:41 +01:00
Greg Kroah-Hartman ebad43260d Merge 5.10-rc6 into usb-next
We need the USB fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-30 08:29:30 +01:00
Hans de Goede c9aa128080 platform/x86: touchscreen_dmi: Add info for the Irbis TW118 tablet
Add touchscreen info for the Irbis TW118 tablet.

Reported-and-tested-by: russianneuromancer <russianneuromancer@ya.ru>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201124110454.114286-1-hdegoede@redhat.com
2020-11-26 15:49:16 +01:00
Hans de Goede 0f511edc6a platform/x86: touchscreen_dmi: Add info for the Predia Basic tablet
Add touchscreen info for the Predia Basic tablet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20201015194949.50566-1-hdegoede@redhat.com
2020-11-26 15:49:02 +01:00
Max Verevkin 8b205d3e1b platform/x86: intel-vbtn: Support for tablet mode on HP Pavilion 13 x360 PC
The Pavilion 13 x360 PC has a chassis-type which does not indicate it is
a convertible, while it is actually a convertible. Add it to the
dmi_switches_allow_list.

Signed-off-by: Max Verevkin <me@maxverevkin.tk>
Link: https://lore.kernel.org/r/20201124131652.11165-1-me@maxverevkin.tk
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-26 15:48:55 +01:00
Kaixu Xia 2a72c46ac4 platform/x86: toshiba_acpi: Fix the wrong variable assignment
The commit 78429e55e4 ("platform/x86: toshiba_acpi: Clean up
variable declaration") cleans up variable declaration in
video_proc_write(). Seems it does the variable assignment in the
wrong place, this results in dead code and changes the source code
logic. Fix it by doing the assignment at the beginning of the funciton.

Fixes: 78429e55e4 ("platform/x86: toshiba_acpi: Clean up variable declaration")
Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Link: https://lore.kernel.org/r/1606024177-16481-1-git-send-email-kaixuxia@tencent.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-26 15:48:46 +01:00
Timo Witte 9e7a005ad5 platform/x86: acer-wmi: add automatic keyboard background light toggle key as KEY_LIGHTS_TOGGLE
Got a dmesg message on my AMD Renoir based Acer laptop:
"acer_wmi: Unknown key number - 0x84" when toggling keyboard
background light

Signed-off-by: Timo Witte <timo.witte@gmail.com>
Reviewed-by: "Lee, Chun-Yi" <jlee@suse.com>
Link: https://lore.kernel.org/r/20200804001423.36778-1-timo.witte@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-26 15:48:37 +01:00
Matthias Maier 80a8c3185f platform/x86: thinkpad_acpi: Whitelist P15 firmware for dual fan control
This commit enables dual fan control for the following new Lenovo
models: P15, P15v.

Signed-off-by: Matthias Maier <tamiko@43-1.org>
Link: https://lore.kernel.org/r/20201126000416.2459645-2-tamiko-ibm-acpi-devel@43-1.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-26 15:45:40 +01:00
Benjamin Berg e40cc1b476 platform/x86: thinkpad_acpi: Send tablet mode switch at wakeup time
The lid state may change while the machine is suspended. As such, we may
need to re-check the state at wake-up time (at least when waking up from
hibernation).
Add the appropriate call to the resume handler in order to sync the
SW_TABLET_MODE switch state with the hardware state.

Fixes: dda3ec0aa6 ("platform/x86: thinkpad_acpi: Implement tablet mode using GMMS method")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=210269
Signed-off-by: Benjamin Berg <bberg@redhat.com>
Acked-by: Henrique de Moraes Holschuh <hnh@hmh.eng.br>
Link: https://lore.kernel.org/r/20201123132157.866303-1-benjamin@sipsolutions.net
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-26 15:45:24 +01:00
Hans de Goede c986a70249 platform/x86: thinkpad_acpi: Add BAT1 is primary battery quirk for Thinkpad Yoga 11e 4th gen
The Thinkpad Yoga 11e 4th gen with the N3450 / Celeron CPU only has
one battery which is named BAT1 instead of the expected BAT0, add a
quirk for this. This fixes not being able to set the charging tresholds
on this model; and this alsoe fixes the following errors in dmesg:

ACPI: \_SB_.PCI0.LPCB.EC__.HKEY: BCTG evaluated but flagged as error
thinkpad_acpi: Error probing battery 2
battery: extension failed to load: ThinkPad Battery Extension
battery: extension unregistered: ThinkPad Battery Extension

Note that the added quirk is for the "R0K" BIOS versions which are
used on the Thinkpad Yoga 11e 4th gen's with a Celeron CPU, there
is a separate "R0L" BIOS for the i3/i5 based versions. This may also
need the same quirk, but if that really is necessary is unknown.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201109103550.16265-1-hdegoede@redhat.com
2020-11-26 15:44:44 +01:00
Hans de Goede f2eae1888c platform/x86: thinkpad_acpi: Do not report SW_TABLET_MODE on Yoga 11e
The Yoga 11e series has 2 accelerometers described by a BOSC0200 ACPI node.
This setup relies on a Windows service which reads both accelerometers and
then calculates the angle between the 2 halves to determine laptop / tent /
tablet mode and then reports the calculated mode back to the EC by calling
special ACPI methods on the BOSC0200 node.

The bmc150 iio driver does not support this (it involves double
calculations requiring sqrt and arccos so this really needs to be done
in userspace), as a result of this on the Yoga 11e the thinkpad_acpi
code always reports SW_TABLET_MODE=0, starting with GNOME 3.38 reporting
SW_TABLET_MODE=0 causes GNOME to:

1. Not show the onscreen keyboard when a text-input field is focussed
   with the touchscreen.
2. Disable accelerometer based auto display-rotation.

This makes sense when in laptop-mode but not when in tablet-mode. But
since for the Yoga 11e the thinkpad_acpi code always reports
SW_TABLET_MODE=0, GNOME does not know when the device is in tablet-mode.

Stop reporting the broken (always 0) SW_TABLET_MODE on Yoga 11e models
to fix this.

Note there are plans for userspace to support 360 degree hinges style
2-in-1s with 2 accelerometers and figure out the mode by itself, see:
https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/issues/216

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201106140130.46820-1-hdegoede@redhat.com
2020-11-26 15:44:35 +01:00
Iakov 'Jake' Kirilenko 15d89c9f6f platform/x86: thinkpad_acpi: add P1 gen3 second fan support
Tested on my P1 gen3, works fine with `thinkfan`. Since thinkpad_acpi fan
control is off by default, it is safe to add 2nd fan control for brave
overclockers

Signed-off-by: Iakov 'Jake' Kirilenko <jake.kirilenko@gmail.com>
Link: https://lore.kernel.org/r/20201105152556.34073-1-jake.kirilenko@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-26 15:44:09 +01:00
Vadim Pasternak 912b341585 platform/x86: mlx-platform: Remove PSU EEPROM from MSN274x platform configuration
Remove PSU EEPROM configuration for systems class equipped with
Mellanox chip Spectrum and ATOM CPU - system types MSN274x. Till now
all the systems from this class used few types of power units, all
equipped with EEPROM device with address space two bytes. Thus, all
these devices have been handled by EEPROM driver "24c02".

There is a new requirement is to support power unit replacement by "off
the shelf" device, matching electrical required parameters. Such device
can be equipped with different EEPROM type, which could be one byte
address space addressing or even could be not equipped with EEPROM.
In such case "24c02" will not work.

Fixes: ef08e14a3 ("platform/x86: mlx-platform: Add support for new msn274x system type")
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20201125101056.174708-3-vadimp@nvidia.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-26 15:26:22 +01:00
Vadim Pasternak 2bf5046bdb platform/x86: mlx-platform: Remove PSU EEPROM from default platform configuration
Remove PSU EEPROM configuration for systems class equipped with
Mellanox chip Spectrum and Celeron CPU - system types MSN2700, MSN2100.
Till now all the systems from this class used few types of power units,
all equipped with EEPROM device with address space two bytes. Thus, all
these devices have been handled by EEPROM driver "24c02".

There is a new requirement is to support power unit replacement by "off
the shelf" device, matching electrical required parameters. Such device
can be equipped with different EEPROM type, which could be one byte
address space addressing or even could be not equipped with EEPROM.
In such case "24c02" will not work.

Fixes: c6acad68e ("platform/mellanox: mlxreg-hotplug: Modify to use a regmap interface")
Fixes: ba814fdd0 ("platform/x86: mlx-platform: Use defines for bus assignment")
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20201125101056.174708-2-vadimp@nvidia.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-26 15:26:22 +01:00
Matthias Maier e8637dfca1 platform/x86: thinkpad_acpi: Whitelist P15 firmware for dual fan control
This commit enables dual fan control for the following new Lenovo
models: P15, P15v.

Signed-off-by: Matthias Maier <tamiko@43-1.org>
Link: https://lore.kernel.org/r/20201126000416.2459645-2-tamiko-ibm-acpi-devel@43-1.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-26 15:23:56 +01:00
Justin Ernst 4fc2cf1f2d x86/platform/uv: Add new uv_sysfs platform driver
Add the uv_sysfs driver to construct a read-only sysfs interface at
/sys/firmware/sgi_uv/ to expose information gathered from UV BIOS. This
information includes:

  * UV Hub descriptions, including physical location
  * Cabling layout between hubs on the fabric
  * PCI topology, including physical location of PCI cards

Together, the information provides a robust physical description of a UV
system, useful for correlating to performance data or performing remote
support.

Signed-off-by: Justin Ernst <justin.ernst@hpe.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lkml.kernel.org/r/20201125175444.279074-4-justin.ernst@hpe.com
2020-11-26 14:46:11 +01:00
Mark Pearson 1ac09656bd platform/x86: thinkpad_acpi: Add palm sensor support
Add support to thinkpad_acpi for returning the status of the palm
sensor.

This patch builds on the work done previously for the input device
implementation (which was not needed). Both lap and palm sensor are using
sysfs and they are combined into the proxsensor block.

Note: On some platforms, because of an issue in the HW implementation,
the palm sensor presence may be incorrectly advertised as always
enabled even if a palm sensor is not present. The palm sensor is
intended for WWAN transmission power control and should be available
and correct on all WWAN enabled systems. It is not recommended to use
this interface for other use cases.

Signed-off-by: Mark Pearson <markpearson@lenovo.com>
Link: https://lore.kernel.org/r/20201124181154.547518-1-markpearson@lenovo.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-25 17:22:00 +01:00
Vasiliy Kupriakov 72ceec5868 platform/x86: asus-wmi: Add userspace notification for performance mode change
When user presses Fn-F5, the driver automatically changes throttle
thermal policy (or fan boost mode, depending on laptop model).

It would be convenient for userspace software to be able to poll on
corresponding sysfs variable. For example, to show a notification about
mode change.

Note that there is currently no way to handle Fn-F5 from userspace
directly, driver does not pass it.

Signed-off-by: Vasiliy Kupriakov <rublag-ns@yandex.ru>
Link: https://lore.kernel.org/r/20200828214932.20866-2-rublag-ns@yandex.ru
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24 14:39:13 +01:00
Hans de Goede bb81dcd4ed platform/x86: touchscreen_dmi: Add info for the Irbis TW118 tablet
Add touchscreen info for the Irbis TW118 tablet.

Reported-and-tested-by: russianneuromancer <russianneuromancer@ya.ru>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201124110454.114286-1-hdegoede@redhat.com
2020-11-24 13:12:38 +01:00
Max Verevkin 07b211992d platform/x86: intel-vbtn: Support for tablet mode on HP Pavilion 13 x360 PC
The Pavilion 13 x360 PC has a chassis-type which does not indicate it is
a convertible, while it is actually a convertible. Add it to the
dmi_switches_allow_list.

Signed-off-by: Max Verevkin <me@maxverevkin.tk>
Link: https://lore.kernel.org/r/20201124131652.11165-1-me@maxverevkin.tk
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24 13:11:12 +01:00
Benjamin Berg 96adb41909 platform/x86: thinkpad_acpi: Send tablet mode switch at wakeup time
The lid state may change while the machine is suspended. As such, we may
need to re-check the state at wake-up time (at least when waking up from
hibernation).
Add the appropriate call to the resume handler in order to sync the
SW_TABLET_MODE switch state with the hardware state.

Fixes: dda3ec0aa6 ("platform/x86: thinkpad_acpi: Implement tablet mode using GMMS method")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=210269
Signed-off-by: Benjamin Berg <bberg@redhat.com>
Acked-by: Henrique de Moraes Holschuh <hnh@hmh.eng.br>
Link: https://lore.kernel.org/r/20201123132157.866303-1-benjamin@sipsolutions.net
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24 13:09:42 +01:00
Hans de Goede bf75340028 platform/x86: acer-wmi: Add ACER_CAP_KBD_DOCK quirk for the Aspire Switch 10E SW3-016
Add the Acer Aspire Switch 10E SW3-016 to the list of models which use the
Acer Switch WMI interface for reporting SW_TABLET_MODE.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201123151625.5530-1-hdegoede@redhat.com
2020-11-24 13:08:03 +01:00
Kaixu Xia 5af8be6b0c platform/x86: toshiba_acpi: Fix the wrong variable assignment
The commit 78429e55e4 ("platform/x86: toshiba_acpi: Clean up
variable declaration") cleans up variable declaration in
video_proc_write(). Seems it does the variable assignment in the
wrong place, this results in dead code and changes the source code
logic. Fix it by doing the assignment at the beginning of the funciton.

Fixes: 78429e55e4 ("platform/x86: toshiba_acpi: Clean up variable declaration")
Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Link: https://lore.kernel.org/r/1606024177-16481-1-git-send-email-kaixuxia@tencent.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24 13:07:01 +01:00
Maximilian Luz b970b732ff platform/surface: gpe: Add support for 15" Intel version of Surface Laptop 3
In addition to a 13" version, there is also a 15" (business) version of
the Surface Laptop 3 based on Intel CPUs. This version also handles
wakeup by lid via (unmarked) GPEs, so add support for it as well.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20201113223935.2073847-1-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24 13:01:53 +01:00
Dan Carpenter d3d73d25e0 platform/x86: pmt: Fix a potential Oops on error in probe
The "ns->attr_grp" pointer can be NULL so this error handling code needs
to check for that to avoid an Oops.

Fixes: e2729113ce ("platform/x86: Intel PMT class driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: David E. Box <david.e.box@linux.intel.com>
Link: https://lore.kernel.org/r/20201117072251.GC1111239@mwanda
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24 12:43:40 +01:00
Andy Shevchenko 469bc41c29 platform/x86: i2c-multi-instantiate: Use device_get_match_data() to get driver data
Use device_get_match_data() to get driver data instead of boilerplate code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20201105110530.27888-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24 11:33:22 +01:00
Andy Shevchenko a9d1c25004 platform/x86: i2c-multi-instantiate: Simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and the error value gets printed.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20201105110530.27888-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24 11:25:19 +01:00
Andy Shevchenko 6c328c347a platform/x86: i2c-multi-instantiate: Drop redundant ACPI_PTR()
The driver depends on ACPI, ACPI_PTR() resolution is always the same.
Otherwise a compiler may produce a warning.

That said, the rule of thumb either ugly ifdeffery with ACPI_PTR or
none should be used in a driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20201105110530.27888-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24 11:25:19 +01:00
Utkarsh Patel 5384cffd7b platform/chrome: cros_ec_typec: Correct the Thunderbolt rounded/non-rounded cable support
Thunderbolt rounded/non-rounded cable support is two bits value. Correcting
it as per the Thunderbolt 3 cable discover mode VDO changes done in the
Thunderbolt 3 alternate mode header.

Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
--
Changes in v2:
- Removed the fixes tag as there is no functional implication.
--
Link: https://lore.kernel.org/r/20201113202503.6559-3-utkarsh.h.patel@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-18 12:53:45 +01:00
Prashant Malani de0f49487d platform/chrome: cros_ec_typec: Register partner altmodes
Use the discovery data from the Chrome EC to register parter altmodes
with the Type C Connector Class framework. Also introduce a node
struct to keep track of the list of registered alt modes.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20201029222738.482366-8-pmalani@chromium.org
2020-11-12 21:32:09 +01:00
Prashant Malani f6f6681189 platform/chrome: cros_ec_typec: Parse partner PD ID VDOs
Use EC_CMD_TYPE_DISCOVERY to retrieve and store the discovery data for
the port partner. With that data, update the PD Identity VDO values for
the partner, which were earlier not initialized.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20201029222738.482366-7-pmalani@chromium.org
2020-11-12 21:32:09 +01:00
Prashant Malani 80f8cef60d platform/chrome: cros_ec_typec: Introduce TYPEC_STATUS
Make a call to the newly introduced EC_CMD_TYPEC_STATUS command.
Currently we just check to see if the SOP (port-partner) discovery was
done and emit a debug level print for it.

Subsequent patches will retrieve and parse the discovery data and fill
out the Type C connector class data structures.

Also check the EC_FEATURE_TYPEC_CMD feature flag at probe, and only call
the new TYPEC_STATUS command if the feature flag is supported.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20201029222738.482366-6-pmalani@chromium.org
2020-11-12 21:32:09 +01:00
Prashant Malani 514acf1cef platform/chrome: cros_ec_typec: Clear partner identity on device removal
The partner identity struct isn't reset when a partner is removed,
meaning a subsequent partner can inherit an old partner's identity VDOs
before discovery is complete. So, clear that struct when a partner
removal is detected.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20201029222738.482366-4-pmalani@chromium.org
2020-11-12 21:32:09 +01:00
Prashant Malani 7ab5a673f4 platform/chrome: cros_ec_typec: Fix remove partner logic
The cros_unregister_ports() function can be called in situations where
the partner has not been registered yet, and so its related data
structures would not have been initialized. Calling
cros_typec_remove_partner() in such a situation can lead to null pointer
dereferences. So, only call cros_typec_remove_partner() if there is a
valid registered partner pointer.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20201029222738.482366-3-pmalani@chromium.org
2020-11-12 21:32:08 +01:00
Prashant Malani 0498710be0 platform/chrome: cros_ec_typec: Relocate set_port_params_v*() functions
Move the cros_typec_set_port_params_v0/v1() functions closer to the
place where they are called, cros_typec_port_update().

While we are performing the relocation, also move cros_typec_get_mux_info()
closer to its call-site.

No functional changes are introduced by this commit.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20201029222738.482366-2-pmalani@chromium.org
2020-11-12 21:32:08 +01:00
Stephen Boyd 853c1a789f platform/chrome: Don't treat RTC events as wakeup sources
The EC sends an RTC host event when the RTC fires, but we don't need to
treat that as a wakeup event here. The RTC class already properly
handles activating and deactivating a wakeup source in rtc_update_irq()
by calling pm_stay_awake() at the start of processing and pm_relax()
once all expired RTC timers have been processed. This reduces one wakeup
increment but not much else. I noticed this while debugging RTC wakeups
and how they always incremented the wakeup count by two instead of one
because this is duplicated.

Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Guenter Roeck <groeck@chromium.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: <linux-rtc@vger.kernel.org>
Link: https://lore.kernel.org/r/20201030232523.2654478-1-swboyd@chromium.org
2020-11-12 21:24:04 +01:00
Kenneth Chan 25dd390c62 platform/x86: panasonic-laptop: Add sysfs attributes for firmware brightness registers
Panasonic laptops (at least from CF-W4 onwards) have dedicated firmware
registers for saving ac/dc and current brightness. They are a bit confusing
so here's some explanations:

AC_MIN_BRIGHT, AC_MAX_BRIGHT, DC_MIN_BRIGHT, DC_MAX_BRIGHT:
Read-only. Values: 0x01 and 0x15 respectively.

AC_CUR_BRIGHT, DC_CUR_BRIGHT:
Read-Write. 0x00-0xFF. Store user-defined AC/DC brightness. However,
they do not represent current brightness so they should be named AC_BRIGHT
and DC_BRIGHT instead.

CUR_BRIGHT (present since CF-W4):
Read-Write. 0x00-0xFF. It sets the current brightness. It won't update
itself if brightness is changed via other means, e.g. acpi_video0.

Another CUR_BRIGHT (added since CF-W5):
Read-Write. 0x01-0x15. Its value always synchronizes with current
brightness. Not implemented in this version.

Currently the backlight API interacts with AC_CUR_BRIGHT (probably because
it's the only bl register available in earlier models?). This patch adds
sysfs attributes for AC_CUR_BRIGHT, DC_CUR_BRIGHT and CUR_BRIGHT.

It also fixes the error of https://lkml.org/lkml/2020/8/19/1264.

PS: I think the backlight API should interact with CUR_BRIGHT instead of
AC_CUR_BRIGHT. But it involves complications like mapping between 0x01-0x15
or 0x00-0x14 (the backlight API) and 0x00-0xFF (CUR_BRIGHT). I'll leave the
discussion for a later version.

Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
Link: https://lore.kernel.org/r/20200821181433.17653-10-kenneth.t.chan@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10 14:49:50 +01:00
Kenneth Chan 468f96bfa3 platform/x86: panasonic-laptop: Add support for battery charging threshold (eco mode)
Add battery charging threshold (aka ECO mode) support.

NOTE: The state of ECO mode is persistent until the next POST cycle which
reset it to previous state.

Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
Link: https://lore.kernel.org/r/20200821181433.17653-9-kenneth.t.chan@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10 14:49:50 +01:00
Kenneth Chan ed83c91718 platform/x86: panasonic-laptop: Resolve hotkey double trigger bug
Sometimes double ACPI events are triggered for brightness, vol and mute
hotkeys. This patch fixes it.

Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
Link: https://lore.kernel.org/r/20200821181433.17653-8-kenneth.t.chan@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10 14:49:50 +01:00
Kenneth Chan e3a9afbbc3 platform/x86: panasonic-laptop: Add write support to mute
Add write support to the mute platform device

Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
Link: https://lore.kernel.org/r/20200821181433.17653-7-kenneth.t.chan@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10 14:49:49 +01:00
Kenneth Chan 0085635133 platform/x86: panasonic-laptop: Fix sticky key init bug
The return value of the sticky key on some models (e.g. CF-W5) do not
reflect its state. How to retrieve its state from firmware is unknown.
The safest bet is to reset it at module init and store its state in
pcc struct.

Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
Link: https://lore.kernel.org/r/20200821181433.17653-6-kenneth.t.chan@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10 14:49:34 +01:00
Kenneth Chan 80373ad0ed platform/x86: panasonic-laptop: Fix naming of platform files for consistency with other modules
Change platform device function names for consistency with other modules

Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
Link: https://lore.kernel.org/r/20200821181433.17653-5-kenneth.t.chan@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10 14:48:06 +01:00
Kenneth Chan 0119fbc021 platform/x86: panasonic-laptop: Split MODULE_AUTHOR() by one author per macro call
In reply to https://lkml.org/lkml/2020/8/19/186 to split MODULE_AUTHOR()
per macro call.

Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
Link: https://lore.kernel.org/r/20200821181433.17653-4-kenneth.t.chan@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10 14:48:00 +01:00
Kenneth Chan f1aaf91465 platform/x86: panasonic-laptop: Replace ACPI prints with pr_*() macros
Replace ACPI prints with pr_*() macros for consistency with other platform
devices.

Clean up obsolete ACPI_HOTKEY_COMPONENT code.

Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
Link: https://lore.kernel.org/r/20200821181433.17653-3-kenneth.t.chan@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10 14:47:46 +01:00
Kenneth Chan d5a81d8e86 platform/x86: panasonic-laptop: Add support for optical driver power in Y and W series
The physical optical drive switch is present in Y and W series that
switches on the drive but fails to turn it off. The idea is to be able to
toggle the drive power by software and/or hardware. This patch merges
Martin Lucina <mato@kotelna.sk>'s work that took care of the software part.

Code is also added for the physical switch to power off the drive.

Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
Link: https://lore.kernel.org/r/20200821181433.17653-2-kenneth.t.chan@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10 14:47:06 +01:00
Timo Witte 19cf70546b platform/x86: acer-wmi: add automatic keyboard background light toggle key as KEY_LIGHTS_TOGGLE
Got a dmesg message on my AMD Renoir based Acer laptop:
"acer_wmi: Unknown key number - 0x84" when toggling keyboard
background light

Signed-off-by: Timo Witte <timo.witte@gmail.com>
Reviewed-by: "Lee, Chun-Yi" <jlee@suse.com>
Link: https://lore.kernel.org/r/20200804001423.36778-1-timo.witte@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10 11:00:29 +01:00
Zhen Gong 97ab451620 platform/x86: intel-hid: fix _DSM function index handling
According to the ACPI spec 9.1.1 _DSM (Device Specific Method),
intel_hid_dsm_fn_mask, acquired from function index 0, is "a buffer
containing one bit for each function index". When validitaing fn_index,
it should be compared with corresponding bit.

This buffer is usually longer than a byte. Depending on whether
INTEL_HID_DSM_HEBC_V2_FN exist, it could be either
"Buffer (0x02) { 0xFF, 0x01 }" or "Buffer (0x02) { 0xFF, 0x03 }".
Probably it won't grow larger according to the description. On older
platforms, available functions could be fewer or not supported at all,
i.e., "Buffer (One) { 0x00 }".

Signed-off-by: Zhen Gong <zhengong@usc.edu>
Link: https://lore.kernel.org/r/CAJCLVRCyp0ASdWTx-PxsrDC9zFBPw0U2AtPip+_Hpj2r5gUPwA@mail.gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-09 15:16:30 +01:00
Kaixu Xia 3be3955315 platform/x86: intel_pmc_core: Assign boolean values to a bool variable
Fix the following coccinelle warnings:

./drivers/platform/x86/intel_pmc_core.c:932:1-16: WARNING: Assignment of 0/1 to bool variable

Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/1604753621-7387-1-git-send-email-kaixuxia@tencent.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-09 15:02:40 +01:00
Shyam Sundar S K 156ec4731c platform/x86: amd-pmc: Add AMD platform support for S2Idle
AMD Power Management Controller driver a.k.a. amd-pmc driver is the
controller which is meant for the final S2Idle transaction that goes to
the PMFW running on the AMD SMU (System Management Unit) responsible for
tuning of the VDD.

Once all the monitored list or the idle constraints are met, this driver
would go and set the OS_HINT (meaning all the devices have reached to
their lowest state possible) via the SMU mailboxes.

This driver would also provide some debug capabilities via debugfs.

Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20201105140531.2955555-1-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-09 14:39:36 +01:00
Hans de Goede 3cd420b2eb platform/x86: thinkpad_acpi: Add BAT1 is primary battery quirk for Thinkpad Yoga 11e 4th gen
The Thinkpad Yoga 11e 4th gen with the N3450 / Celeron CPU only has
one battery which is named BAT1 instead of the expected BAT0, add a
quirk for this. This fixes not being able to set the charging tresholds
on this model; and this alsoe fixes the following errors in dmesg:

ACPI: \_SB_.PCI0.LPCB.EC__.HKEY: BCTG evaluated but flagged as error
thinkpad_acpi: Error probing battery 2
battery: extension failed to load: ThinkPad Battery Extension
battery: extension unregistered: ThinkPad Battery Extension

Note that the added quirk is for the "R0K" BIOS versions which are
used on the Thinkpad Yoga 11e 4th gen's with a Celeron CPU, there
is a separate "R0L" BIOS for the i3/i5 based versions. This may also
need the same quirk, but if that really is necessary is unknown.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201109103550.16265-1-hdegoede@redhat.com
2020-11-09 14:36:50 +01:00
Hans de Goede 685489a32c platform/x86: thinkpad_acpi: Do not report SW_TABLET_MODE on Yoga 11e
The Yoga 11e series has 2 accelerometers described by a BOSC0200 ACPI node.
This setup relies on a Windows service which reads both accelerometers and
then calculates the angle between the 2 halves to determine laptop / tent /
tablet mode and then reports the calculated mode back to the EC by calling
special ACPI methods on the BOSC0200 node.

The bmc150 iio driver does not support this (it involves double
calculations requiring sqrt and arccos so this really needs to be done
in userspace), as a result of this on the Yoga 11e the thinkpad_acpi
code always reports SW_TABLET_MODE=0, starting with GNOME 3.38 reporting
SW_TABLET_MODE=0 causes GNOME to:

1. Not show the onscreen keyboard when a text-input field is focussed
   with the touchscreen.
2. Disable accelerometer based auto display-rotation.

This makes sense when in laptop-mode but not when in tablet-mode. But
since for the Yoga 11e the thinkpad_acpi code always reports
SW_TABLET_MODE=0, GNOME does not know when the device is in tablet-mode.

Stop reporting the broken (always 0) SW_TABLET_MODE on Yoga 11e models
to fix this.

Note there are plans for userspace to support 360 degree hinges style
2-in-1s with 2 accelerometers and figure out the mode by itself, see:
https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/issues/216

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201106140130.46820-1-hdegoede@redhat.com
2020-11-09 14:36:46 +01:00
Iakov 'Jake' Kirilenko c758be8e1d platform/x86: thinkpad_acpi: add P1 gen3 second fan support
Tested on my P1 gen3, works fine with `thinkfan`. Since thinkpad_acpi fan
control is off by default, it is safe to add 2nd fan control for brave
overclockers

Signed-off-by: Iakov 'Jake' Kirilenko <jake.kirilenko@gmail.com>
Link: https://lore.kernel.org/r/20201105152556.34073-1-jake.kirilenko@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-09 14:33:49 +01:00
Dan Carpenter 20f6790282 platform/x86: dell-wmi-sysman: fix init_bios_attributes() error handling
Calling release_attributes_data() while holding the "wmi_priv.mutex"
will lead to a dead lock.  The other problem is that if kzalloc() fails
then this should return -ENOMEM but currently it returns success.

Fixes: e8a60aa740 ("platform/x86: Introduce support for Systems Management Driver over WMI for Dell Systems")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20201103101735.GB1127762@mwanda
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-09 12:54:24 +01:00
Maximilian Luz 274335f1c5 platform/surface: Add Driver to set up lid GPEs on MS Surface device
Conventionally, wake-up events for a specific device, in our case the
lid device, are managed via the ACPI _PRW field. While this does not
seem strictly necessary based on ACPI spec, the kernel disables GPE
wakeups to avoid non-wakeup interrupts preventing suspend by default and
only enables GPEs associated via the _PRW field with a wake-up capable
device. This behavior has been introduced in commit f941d3e41d ("ACPI:
EC / PM: Disable non-wakeup GPEs for suspend-to-idle") and is described
in more detail in its commit message.

Unfortunately, on MS Surface devices, there is no _PRW field present on
the lid device, thus no GPE is associated with it, and therefore the GPE
responsible for sending the status-change notification to the lid gets
disabled during suspend, making it impossible to wake the device via the
lid.

This patch introduces a pseudo-device and respective driver which, based
on some DMI matching, marks the corresponding GPE of the lid device for
wake and enables it during suspend. The behavior of this driver models
the behavior of the ACPI/PM core for normal wakeup GPEs, properly
declared via the _PRW field.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20201028105427.1593764-1-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-09 11:41:30 +01:00
Hans de Goede 91de32fe6d Immutable branch between MFD and x86 due for the v5.11 merge window
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAl+ijTcACgkQUa+KL4f8
 d2E+3w//Q6gB4sQ0wrhrs+R04sP9FTj/A1XFGMitIFhESsEClcvIKzB2Qh/ZjEk4
 tHObkjIbA1FYaZdxq0MKw1kBbH400CIe3GO1Bkla2E4hONTx2bqJWqPmp099Yibl
 dMUijTSdefRrVMGUXTmSVftIPvv1lxDmc7YfmD+Y6E/MLgA9wqjXo+eOfbW6S8x/
 SoSqK86WGNJpGCaUuK1diZ/3MkZG7/PT13HKxU5cGAkXTpSjPREB9IVdxEVHLo7q
 lvOzx3FGajWqEhDhswUZqSq7hGlH9NxbM456fBu3KbUvurXjPsotBeLmu2/5+2SW
 XBrEKT31a3On3KG7FZe/F3wg85etJkVHx7C1qycAAfKRbcwu9F9Z1g0VrbwDfTDq
 mkWHbzT3qXd50gTGXpCSUeDDTLBVXP65eZUHCdyUOIDUUphx8PIlsyPsqfy0hUxe
 SEMlCfAmQ5owlBT2EGC/6v4pENJn0IjJFMl+KJsPraIyjqS5ftfcr07BjTM65h+w
 Znq3gbKYKT//xODLCkvG6NDYpvr6LsqWYPoRHKg0Gd6FvgKKjl/Bfkq9ZmeFDint
 v2qKBfB+PtGKnKhnHmI5sseaUhsxy44jQ72wmI0InSwMoEj5pZFqs0EXfJyu/YJl
 q/gu9h3u+cJWc1D41LqrOIUeyjW2/K512cKf7tAU1QpceYumgQs=
 =l+RW
 -----END PGP SIGNATURE-----

Merge tag 'ib-mfd-x86-v5.11' into review-hans

Immutable branch between MFD and x86 due for the v5.11 merge window
2020-11-09 11:39:01 +01:00
Alexander Duyck 5ef9998c96 platform/x86: Intel PMT Crashlog capability driver
Add support for the Intel Platform Monitoring Technology crashlog
interface. This interface provides a few sysfs values to allow for
controlling the crashlog telemetry interface as well as a character
driver to allow for mapping the crashlog memory region so that it can be
accessed after a crashlog has been recorded.

This driver is meant to only support the server version of the crashlog
which is identified as crash_type 1 with a version of zero. Currently no
other types are supported.

Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-11-04 11:14:38 +00:00
Alexander Duyck 68fe8e6e2c platform/x86: Intel PMT Telemetry capability driver
PMT Telemetry is a capability of the Intel Platform Monitoring Technology.
The Telemetry capability provides access to device telemetry metrics that
provide hardware performance data to users from read-only register spaces.

With this driver present the intel_pmt directory can be populated with
telem<x> devices. These devices will contain the standard intel_pmt sysfs
data and a "telem" binary sysfs attribute which can be used to access the
telemetry data.

Also create a PCI device id list for early telemetry hardware that require
workarounds for known issues.

Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Co-developed-by: David E. Box <david.e.box@linux.intel.com>
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-11-04 11:14:27 +00:00
Alexander Duyck e2729113ce platform/x86: Intel PMT class driver
Intel Platform Monitoring Technology is meant to provide a common way to
access telemetry and system metrics.

Register mappings are not provided by the driver. Instead, a GUID is read
from a header for each endpoint. The GUID identifies the device and is to
be used with an XML, provided by the vendor, to discover the available set
of metrics and their register mapping.  This allows firmware updates to
modify the register space without needing to update the driver every time
with new mappings. Firmware writes a new GUID in this case to specify the
new mapping.  Software tools with access to the associated XML file can
then interpret the changes.

The module manages access to all Intel PMT endpoints on a system,
independent of the device exporting them. It creates an intel_pmt class
to manage the devices. For each telemetry endpoint, sysfs files provide
GUID and size information as well as a pointer to the parent device the
telemetry came from. Software may discover the association between
endpoints and devices by iterating through the list in sysfs, or by looking
for the existence of the class folder under the device of interest.  A
binary sysfs attribute of the same name allows software to then read or map
the telemetry space for direct access.

Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-11-04 11:14:12 +00:00
Zou Wei 83f7a38ecd platform/x86/dell-wmi-sysman: Make some symbols static
Fix the following sparse warnings:

./passobj-attributes.c:38:23: warning: symbol 'po_is_pass_set' was not declared. Should it be static?
./passobj-attributes.c:70:23: warning: symbol 'po_current_password' was not declared. Should it be static?
./passobj-attributes.c:99:23: warning: symbol 'po_new_password' was not declared. Should it be static?
./passobj-attributes.c:103:23: warning: symbol 'po_min_pass_length' was not declared. Should it be static?
./passobj-attributes.c:107:23: warning: symbol 'po_max_pass_length' was not declared. Should it be static?
./passobj-attributes.c:116:23: warning: symbol 'po_mechanism' was not declared. Should it be static?
./passobj-attributes.c:129:23: warning: symbol 'po_role' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Link: https://lore.kernel.org/r/1604107922-14950-1-git-send-email-zou_wei@huawei.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-03 10:30:10 +01:00
Zou Wei 76adf0df04 platform/x86/dell-wmi-sysman: Make wmi_sysman_kobj_sysfs_ops static
Fix the following sparse warning:

drivers/platform/x86/dell-wmi-sysman/sysman.c:258:24: warning:
symbol 'wmi_sysman_kobj_sysfs_ops' was not declared.
Should it be static?

wmi_sysman_kobj_sysfs_ops has only call within sysman.c
It should be static

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Link: https://lore.kernel.org/r/1603971581-64135-1-git-send-email-zou_wei@huawei.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-03 10:30:10 +01:00
Hans de Goede 5c54cb6c62 platform/x86: acer-wmi: Add support for SW_TABLET_MODE on Switch devices
Add support for SW_TABLET_MODE on the Acer Switch 10 (SW5-012) and the
acer Switch 10 (S1003) models.

There is no way to detect if this is supported, so this uses DMI based
quirks setting force_caps to ACER_CAP_KBD_DOCK (these devices have no
other acer-wmi based functionality).

The new SW_TABLET_MODE functionality can be tested on devices which
are not in the DMI table by passing acer_wmi.force_caps=0x40 on the
kernel commandline.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201019185628.264473-6-hdegoede@redhat.com
2020-10-28 13:08:37 +01:00
Hans de Goede 82cb8a5c39 platform/x86: acer-wmi: Add ACER_CAP_SET_FUNCTION_MODE capability flag
Not all devices supporting WMID_GUID3 support the wmid3_set_function_mode()
call, leading to errors like these:

[   60.138358] acer_wmi: Enabling RF Button failed: 0x1 - 0xff
[   60.140036] acer_wmi: Enabling Launch Manager failed: 0x1 - 0xff

Add an ACER_CAP_SET_FUNCTION_MODE capability flag, so that these calls
can be disabled through the new force_caps mechanism.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201019185628.264473-5-hdegoede@redhat.com
2020-10-28 12:57:34 +01:00
Hans de Goede 39aa009bb6 platform/x86: acer-wmi: Add new force_caps module parameter
Add a new force_caps module parameter to allow overriding the drivers
builtin capability detection mechanism.

This can be used to for example:
-Disable rfkill functionality on devices where there is an AA OEM DMI
 record advertising non functional rfkill switches
-Force loading of the driver on devices with a missing AA OEM DMI record

Note that force_caps is -1 when unset, this allows forcing the
capability field to 0, which results in acer-wmi only providing WMI
hotkey handling while disabling all other (led, rfkill, backlight)
functionality.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201019185628.264473-4-hdegoede@redhat.com
2020-10-28 12:57:31 +01:00