1. 29 10月, 2020 1 次提交
    • H
      HID: i2c-hid: Put ACPI enumerated devices in D3 on shutdown · 5c7e02a8
      Hans de Goede 提交于
      The i2c-hid driver would quietly fail to probe the i2c-hid sensor-hub
      with an ACPI device-id of SMO91D0 every other boot.
      
      Specifically, the i2c_smbus_read_byte() "Make sure there is something at
      this address" check would fail every other boot.
      
      It seems that the BIOS does not properly reset/power-cycle the device
      leaving it in a confused state where it refuses to respond to i2c-xfers.
      On boots where probing the device failed, the driver-core puts the device
      in D3 after the probe-failure, which causes the probe to succeed the next
      boot.
      
      Putting the device in D3 from the shutdown-handler fixes the sensors not
      working every other boot.
      
      This has been tested on both a Lenovo Miix 2-10 and a Dell Venue 8 Pro 5830
      both of which use an i2c-hid sensor-hub with an ACPI id of SMO91D0.
      
      Note that it is safe to call acpi_device_set_power() with a NULL pointer
      as first argument, so on none ACPI enumerated devices this change is a
      no-op.
      
      Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      5c7e02a8
  2. 16 10月, 2020 1 次提交
  3. 23 9月, 2020 1 次提交
  4. 09 9月, 2020 1 次提交
    • D
      HID: i2c-hid: Prefer asynchronous probe · eafb2203
      Douglas Anderson 提交于
      Adding printouts to the i2c_hid_probe() function shows that it takes
      quite some time.  It used to take about 70 ms, but after commit
      eef40162 ("HID: i2c-hid: Always sleep 60ms after I2C_HID_PWR_ON
      commands") it takes about 190 ms.  This is not tons of time but it's
      not trivial.  Because we haven't yet specified that we'd prefer
      asynchronous probe for this driver then, if the driver is builtin to
      the kernel, we'll wait for this driver to finish before we start
      probes for more drivers.  Let's set the flag to enable asynchronous
      for this driver so that other drivers aren't blocked from probing
      until we finish.
      
      Since this driver can be configured as a module and modules are
      always asynchronously probed this is quite a safe change and will
      benefit anyone who has a reason to build this driver into the kernel
      instead of using it as a module.
      
      [jkosina@suse.cz: drop spurious whitespace addition]
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      eafb2203
  5. 17 8月, 2020 1 次提交
    • H
      HID: i2c-hid: Always sleep 60ms after I2C_HID_PWR_ON commands · eef40162
      Hans de Goede 提交于
      Before this commit i2c_hid_parse() consists of the following steps:
      
      1. Send power on cmd
      2. usleep_range(1000, 5000)
      3. Send reset cmd
      4. Wait for reset to complete (device interrupt, or msleep(100))
      5. Send power on cmd
      6. Try to read HID descriptor
      
      Notice how there is an usleep_range(1000, 5000) after the first power-on
      command, but not after the second power-on command.
      
      Testing has shown that at least on the BMAX Y13 laptop's i2c-hid touchpad,
      not having a delay after the second power-on command causes the HID
      descriptor to read as all zeros.
      
      In case we hit this on other devices too, the descriptor being all zeros
      can be recognized by the following message being logged many, many times:
      
      hid-generic 0018:0911:5288.0002: unknown main item tag 0x0
      
      At the same time as the BMAX Y13's touchpad issue was debugged,
      Kai-Heng was working on debugging some issues with Goodix i2c-hid
      touchpads. It turns out that these need a delay after a PWR_ON command
      too, otherwise they stop working after a suspend/resume cycle.
      According to Goodix a delay of minimal 60ms is needed.
      
      Having multiple cases where we need a delay after sending the power-on
      command, seems to indicate that we should always sleep after the power-on
      command.
      
      This commit fixes the mentioned issues by moving the existing 1ms sleep to
      the i2c_hid_set_power() function and changing it to a 60ms sleep.
      
      Cc: stable@vger.kernel.org
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208247Reported-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Reported-and-tested-by: NAndrea Borgia <andrea@borgia.bo.it>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      eef40162
  6. 30 4月, 2020 1 次提交
  7. 13 12月, 2019 1 次提交
    • P
      HID: Add quirk for incorrect input length on Lenovo Y720 · fd091376
      Pavel Balan 提交于
      Apply it to the Lenovo Y720 gaming laptop I2C peripheral then.
      
      This fixes dmesg being flooded with errors visible on un-suspend
      in Linux Mint 19 Cinnamon.
      
      Example of error log:
      
      <...>
      [    4.326588] i2c_hid i2c-ITE33D1:00: i2c_hid_get_input: incomplete report (2/4)
      [    4.326845] i2c_hid i2c-ITE33D1:00: i2c_hid_get_input: incomplete report (2/4)
      [    4.327095] i2c_hid i2c-ITE33D1:00: i2c_hid_get_input: incomplete report (2/4)
      [    4.327341] i2c_hid i2c-ITE33D1:00: i2c_hid_get_input: incomplete report (2/4)
      [    4.327609] i2c_hid i2c-ITE33D1:00: i2c_hid_get_input: incomplete report (2/4)
      <...>
      
      Example of fixed log (debug on)
      
      <...>
      [ 3731.333183] i2c_hid i2c-ITE33D1:00: input: 02 00
      [ 3731.333581] i2c_hid i2c-ITE33D1:00: input: 02 00
      [ 3731.333842] i2c_hid i2c-ITE33D1:00: input: 02 00
      [ 3731.334107] i2c_hid i2c-ITE33D1:00: input: 02 00
      [ 3731.334367] i2c_hid i2c-ITE33D1:00: input: 02 00
      <...>
      
      [jkosina@suse.cz: rebase onto more recent codebase]
      Signed-off-by: NPavel Balan <admin@kryma.net>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      fd091376
  8. 15 11月, 2019 3 次提交
  9. 03 11月, 2019 1 次提交
    • H
      HID: i2c-hid: Send power-on command after reset · 43b7029f
      Hans de Goede 提交于
      Before commit 67b18dfb ("HID: i2c-hid: Remove runtime power
      management"), any i2c-hid touchscreens would typically be runtime-suspended
      between the driver loading and Xorg or a Wayland compositor opening it,
      causing it to be resumed again. This means that before this change,
      we would call i2c_hid_set_power(OFF), i2c_hid_set_power(ON) before the
      graphical session would start listening to the touchscreen.
      
      It turns out that at least some SIS touchscreens, such as the one found
      on the Asus T100HA, need a power-on command after reset, otherwise they
      will not send any events.
      
      Fixes: 67b18dfb ("HID: i2c-hid: Remove runtime power management")
      Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      43b7029f
  10. 18 10月, 2019 1 次提交
    • K
      HID: i2c-hid: Remove runtime power management · 67b18dfb
      Kai-Heng Feng 提交于
      Runtime power management in i2c-hid brings lots of issues, such as:
      - When transitioning from display manager to desktop session, i2c-hid
      was closed and opened, so the device was set to SLEEP and ON in a short
      period. Vendors confirmed that their devices can't handle fast ON/SLEEP
      command because Windows doesn't have this behavior.
      
      - When rebooting, i2c-hid was closed, and the driver core put the device
      back to full power before shutdown. This behavior also triggers a quick
      SLEEP and ON commands that some devices can't handle, renders an
      unusable touchpad after reboot.
      
      - Most importantly, my power meter reports little to none energy saving
      when i2c-hid is runtime suspended.
      
      So let's remove runtime power management since there is no actual
      benefit.
      Signed-off-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Acked-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      67b18dfb
  11. 04 9月, 2019 1 次提交
  12. 11 4月, 2019 1 次提交
  13. 01 4月, 2019 1 次提交
  14. 21 1月, 2019 1 次提交
  15. 14 1月, 2019 1 次提交
  16. 19 11月, 2018 1 次提交
    • K
      HID: i2c-hid: Disable runtime PM for LG touchscreen · 86c31524
      Kai-Heng Feng 提交于
      LG touchscreen (1fd2:8001) stops working after reboot:
      [ 4.859153] i2c_hid i2c-SAPS2101:00: i2c_hid_get_input: incomplete report (64/66)
      [ 4.936070] i2c_hid i2c-SAPS2101:00: i2c_hid_get_input: incomplete report (64/66)
      [ 9.948224] i2c_hid i2c-SAPS2101:00: failed to reset device.
      
      The device in question stops working after receives SLEEP, ON, SLEEP
      commands in a short period. The scenario is like this:
      - Once the desktop session closes, it also closed the hid device, so the
      device gets runtime suspended and receives a SLEEP command.
      - Before calling shutdown callback, it gets runtime resumed and received
      an ON command.
      - In the shutdown callback, it receives another SLEEP command.
      
      I failed to find a reliable interval between ON/SLEEP commands that can
      make it work, so let's simply disable runtime PM for the device.
      Signed-off-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      86c31524
  17. 26 10月, 2018 1 次提交
  18. 30 9月, 2018 1 次提交
  19. 24 9月, 2018 1 次提交
    • H
      HID: i2c-hid: Remove RESEND_REPORT_DESCR quirk and its handling · afbb1169
      Hans de Goede 提交于
      Commit 52cf93e6 ("HID: i2c-hid: Don't reset device upon system resume")
      removes the need for the RESEND_REPORT_DESCR quirk for Raydium devices, but
      kept it for the SIS device id 10FB touchscreens, as the author of that
      commit could not determine if the quirk is still necessary there.
      
      I've tested suspend/resume on a Toshiba Click Mini L9W-B which is the
      device for which this quirk was added in the first place and with the
      "Don't reset device upon system resume" fix the quirk is no longer
      necessary, so this commit removes it.
      
      Note even better I also had some other devices with SIS touchscreens which
      suspend/resume issues, where the RESEND_REPORT_DESCR quirk did not help.
      
      I've also tested these devices with the "Don't reset device upon system
      resume" fix and I'm happy to report that that fix also fixes touchscreen
      resume on the following devices:
      
      Asus T100HA
      Asus T200TA
      Peaq C1010
      
      Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
      Acked-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      afbb1169
  20. 14 9月, 2018 1 次提交
  21. 06 9月, 2018 1 次提交
    • K
      HID: i2c-hid: Don't reset device upon system resume · 52cf93e6
      Kai-Heng Feng 提交于
      Raydium touchscreen triggers interrupt storm after system-wide suspend:
      
      	[ 179.085033] i2c_hid i2c-CUST0000:00: i2c_hid_get_input: incomplete report (58/65535)
      
      According to Raydium, Windows driver does not reset the device after system
      resume.
      
      The HID over I2C spec does specify a reset should be used at intialization, but
      it doesn't specify if reset is required for system suspend.
      
      Tested this patch on other i2c-hid touchpanels I have and those touchpanels do
      work after S3 without doing reset. If any regression happens to other
      touchpanel vendors, we can use quirk for Raydium devices.
      
      There's still one device uses I2C_HID_QUIRK_RESEND_REPORT_DESCR so keep it
      there.
      
      Cc: Aaron Ma <aaron.ma@canonical.com>
      Cc: AceLan Kao <acelan.kao@canonical.com>
      Signed-off-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      52cf93e6
  22. 28 8月, 2018 1 次提交
  23. 09 7月, 2018 1 次提交
    • J
      HID: i2c-hid: Fix "incomplete report" noise · ef6eaf27
      Jason Andryuk 提交于
      Commit ac75a041 ("HID: i2c-hid: fix size check and type usage") started
      writing messages when the ret_size is <= 2 from i2c_master_recv.  However, my
      device i2c-DLL07D1 returns 2 for a short period of time (~0.5s) after I stop
      moving the pointing stick or touchpad.  It varies, but you get ~50 messages
      each time which spams the log hard.
      
      [  95.925055] i2c_hid i2c-DLL07D1:01: i2c_hid_get_input: incomplete report (83/2)
      
      This has also been observed with a i2c-ALP0017.
      
      [ 1781.266353] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
      
      Only print the message when ret_size is totally invalid and less than 2 to cut
      down on the log spam.
      
      Fixes: ac75a041 ("HID: i2c-hid: fix size check and type usage")
      Reported-by: NJohn Smith <john-s-84@gmx.net>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJason Andryuk <jandryuk@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      ef6eaf27
  24. 25 6月, 2018 2 次提交
  25. 30 5月, 2018 1 次提交
  26. 15 5月, 2018 1 次提交
  27. 09 5月, 2018 1 次提交
  28. 19 4月, 2018 1 次提交
  29. 16 4月, 2018 2 次提交
  30. 12 4月, 2018 1 次提交
  31. 16 2月, 2018 2 次提交
  32. 21 11月, 2017 1 次提交
  33. 09 11月, 2017 1 次提交
    • H
      HID: i2c-hid: Add no-irq-after-reset quirk for 0911:5288 device · 402946a8
      Hans de Goede 提交于
      Several cheap Apollo Lake based laptops / 2-in-1s use an i2c-hid mt
      touchpad which is advertised by the DSDT with an ACPI HID of "SYNA3602",
      this touchpad can be found on e.g. the Cube Thinker and the EZBook 3 Pro.
      
      On my "T-bao Tbook air" the i2c-hid driver fails to bind to this touchpad:
      "i2c_hid i2c-SYNA3602:00: failed to reset device.".
      
      After some debuging this it seems that this touchpad simply never sends
      an interrupt after a reset as expected by the i2c hid driver. This commit
      adds a quirk for this device, making i2c_hid_command sleep 100ms after
      a reset instead of waiting for an irq, fixing i2c-hid failing to bind to
      this touchpad.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      402946a8
  34. 14 9月, 2017 1 次提交
  35. 27 7月, 2017 1 次提交
    • J
      HID: introduce hid_is_using_ll_driver · fc2237a7
      Jason Gerecke 提交于
      Although HID itself is transport-agnostic, occasionally a driver may
      want to interact with the low-level transport that a device is connected
      through. To do this, we need to know what kind of bus is in use. The
      first guess may be to look at the 'bus' field of the 'struct hid_device',
      but this field may be emulated in some cases (e.g. uhid).
      
      More ideally, we can check which ll_driver a device is using. This
      function introduces a 'hid_is_using_ll_driver' function and makes the
      'struct hid_ll_driver' of the four most common transports accessible
      through hid.h.
      Signed-off-by: NJason Gerecke <jason.gerecke@wacom.com>
      Acked-By: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      fc2237a7