1. 25 Jan, 2021 5 commits
    • Hans de Goede's avatar
      platform/x86: hp-wmi: Disable tablet-mode reporting by default · 2ebe01e2
      Hans de Goede authored
      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: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarMark Gross <mgross@linux.intel.com>
      Link: https://lore.kernel.org/r/20210120124941.73409-1-hdegoede@redhat.com
      2ebe01e2
    • Hans de Goede's avatar
      platform/x86: intel-vbtn: Eval VBDL after registering our notifier · 26173179
      Hans de Goede authored
      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: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210115161850.117614-4-hdegoede@redhat.com
      26173179
    • Hans de Goede's avatar
      platform/x86: intel-vbtn: Add alternative method to enable switches · 3a2f53cd
      Hans de Goede authored
      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: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210115161850.117614-3-hdegoede@redhat.com
      3a2f53cd
    • Hans de Goede's avatar
      platform/x86: intel-vbtn: Create 2 separate input-devs for buttons and switches · 034b8c2e
      Hans de Goede authored
      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: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210115161850.117614-2-hdegoede@redhat.com
      034b8c2e
    • Hans de Goede's avatar
      platform/x86: intel-vbtn: Rework wakeup handling in notify_handler() · 5862b4df
      Hans de Goede authored
      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: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210115161850.117614-1-hdegoede@redhat.com
      5862b4df
  2. 18 Jan, 2021 7 commits
  3. 13 Jan, 2021 4 commits
  4. 06 Jan, 2021 9 commits
  5. 04 Jan, 2021 9 commits
  6. 27 Dec, 2020 6 commits