linux/drivers/hid
Hans de Goede c2035d1e55 HID: i2c-hid: Always sleep 60ms after I2C_HID_PWR_ON commands
commit eef4016243 upstream.

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=208247
Reported-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reported-and-tested-by: Andrea Borgia <andrea@borgia.bo.it>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-03 11:27:01 +02:00
..
i2c-hid HID: i2c-hid: Always sleep 60ms after I2C_HID_PWR_ON commands 2020-09-03 11:27:01 +02:00
intel-ish-hid HID: intel-ish-hid: avoid bogus uninitialized-variable warning 2020-06-24 17:50:23 +02:00
usbhid HID: usbhid: Fix race between usbhid_close() and usbhid_stop() 2020-05-14 07:58:24 +02:00
Kconfig Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid 2019-09-23 12:18:13 -07:00
Makefile HID: sb0540: add support for Creative SB0540 IR receivers 2019-09-03 16:52:04 +02:00
hid-a4tech.c HID: input: fix a4tech horizontal wheel custom usage 2019-08-05 14:37:15 +02:00
hid-accutouch.c
hid-alps.c HID: alps: support devices with report id 2 2020-07-29 10:18:36 +02:00
hid-apple.c HID: apple: Disable Fn-key key-re-mapping on clone keyboards 2020-07-29 10:18:36 +02:00
hid-appleir.c
hid-asus.c HID: asus: Ignore Asus vendor-page usage-code 0xff events 2020-02-01 09:34:41 +00:00
hid-aureal.c
hid-axff.c HID: Fix assumption that devices have inputs 2019-10-03 15:36:40 -04:00
hid-belkin.c
hid-betopff.c
hid-bigbenff.c HID: hid-bigbenff: fix race condition for scheduled work during removal 2020-03-21 08:11:49 +01:00
hid-cherry.c
hid-chicony.c
hid-cmedia.c
hid-core.c HID: core: fix off-by-one memset in hid_report_raw_event() 2020-03-05 16:43:42 +01:00
hid-corsair.c
hid-cougar.c HID: do not call hid_set_drvdata(hdev, NULL) in drivers 2019-08-22 17:11:58 +02:00
hid-cp2112.c HID: cp2112: prevent sleeping function called from invalid context 2019-08-19 14:13:00 +02:00
hid-creative-sb0540.c HID: sb0540: add support for Creative SB0540 IR receivers 2019-09-03 16:52:04 +02:00
hid-cypress.c
hid-debug.c
hid-dr.c HID: Fix assumption that devices have inputs 2019-10-03 15:36:40 -04:00
hid-elan.c
hid-elecom.c
hid-elo.c
hid-emsff.c HID: Fix assumption that devices have inputs 2019-10-03 15:36:40 -04:00
hid-ezkey.c
hid-gaff.c HID: Fix assumption that devices have inputs 2019-10-03 15:36:40 -04:00
hid-gembird.c
hid-generic.c
hid-gfrm.c HID: do not call hid_set_drvdata(hdev, NULL) in drivers 2019-08-22 17:11:58 +02:00
hid-google-hammer.c HID: google: add moonball USB id 2020-03-21 08:11:58 +01:00
hid-gt683r.c
hid-gyration.c
hid-holtek-kbd.c HID: holtek: test for sanity of intfdata 2019-08-05 14:18:42 +02:00
hid-holtek-mouse.c
hid-holtekff.c HID: Fix assumption that devices have inputs 2019-10-03 15:36:40 -04:00
hid-hyperv.c HID: hyperv: Use in-place iterator API in the channel callback 2019-10-01 14:49:41 -04:00
hid-icade.c
hid-ids.h HID: quirks: add NOGET quirk for Logitech GROUP 2020-09-03 11:26:46 +02:00
hid-input.c HID: input: Fix devices that return multiple bytes in battery report 2020-08-19 08:15:53 +02:00
hid-ite.c HID: ite: Only bind to keyboard USB interface on Acer SW5-012 keyboard dock 2020-03-05 16:43:42 +01:00
hid-jabra.c
hid-kensington.c
hid-keytouch.c
hid-kye.c
hid-lcpower.c
hid-led.c
hid-lenovo.c HID: do not call hid_set_drvdata(hdev, NULL) in drivers 2019-08-22 17:11:58 +02:00
hid-lg.c HID: logitech: Fix general protection fault caused by Logitech driver 2019-08-22 09:53:08 +02:00
hid-lg.h
hid-lg2ff.c HID: Fix assumption that devices have inputs 2019-10-03 15:36:40 -04:00
hid-lg3ff.c HID: Fix assumption that devices have inputs 2019-10-03 15:36:40 -04:00
hid-lg4ff.c HID: Fix assumption that devices have inputs 2019-10-03 15:36:40 -04:00
hid-lg4ff.h
hid-lgff.c HID: Fix assumption that devices have inputs 2019-10-03 15:36:40 -04:00
hid-logitech-dj.c Merge branch 'for-5.4/logitech' into for-linus 2019-09-22 22:39:01 +02:00
hid-logitech-hidpp.c HID: logitech-hidpp: avoid repeated "multiplier = " log messages 2020-07-22 09:33:08 +02:00
hid-macally.c
hid-magicmouse.c HID: magicmouse: do not set up autorepeat 2020-07-22 09:33:08 +02:00
hid-maltron.c
hid-mf.c
hid-microsoft.c HID: Fix assumption that devices have inputs 2019-10-03 15:36:40 -04:00
hid-monterey.c
hid-multitouch.c HID: multitouch: enable multi-input as a quirk for some devices 2020-06-07 13:18:47 +02:00
hid-nti.c
hid-ntrig.c
hid-ortek.c
hid-penmount.c
hid-petalynx.c
hid-picolcd.h
hid-picolcd_backlight.c
hid-picolcd_cir.c
hid-picolcd_core.c HID: do not call hid_set_drvdata(hdev, NULL) in drivers 2019-08-22 17:11:58 +02:00
hid-picolcd_debugfs.c
hid-picolcd_fb.c
hid-picolcd_lcd.c
hid-picolcd_leds.c
hid-pl.c
hid-plantronics.c
hid-primax.c
hid-prodikeys.c HID: prodikeys: make array keys static const, makes object smaller 2019-10-01 16:21:04 +02:00
hid-quirks.c HID: quirks: add NOGET quirk for Logitech GROUP 2020-09-03 11:26:46 +02:00
hid-redragon.c
hid-retrode.c
hid-rmi.c HID: rmi: Check that the RMI_STARTED bit is set before unregistering the RMI transport device 2020-01-04 19:18:13 +01:00
hid-roccat-arvo.c
hid-roccat-arvo.h
hid-roccat-common.c
hid-roccat-common.h
hid-roccat-isku.c
hid-roccat-isku.h
hid-roccat-kone.c
hid-roccat-kone.h
hid-roccat-koneplus.c
hid-roccat-koneplus.h
hid-roccat-konepure.c
hid-roccat-kovaplus.c
hid-roccat-kovaplus.h
hid-roccat-lua.c
hid-roccat-lua.h
hid-roccat-pyra.c
hid-roccat-pyra.h
hid-roccat-ryos.c
hid-roccat-savu.c
hid-roccat-savu.h
hid-roccat.c
hid-saitek.c
hid-samsung.c
hid-sensor-custom.c *: convert stream-like files -> stream_open, even if they use noop_llseek 2019-07-14 16:09:19 +03:00
hid-sensor-hub.c HID: do not call hid_set_drvdata(hdev, NULL) in drivers 2019-08-22 17:11:58 +02:00
hid-sjoy.c
hid-sony.c HID: sony: Fix for broken buttons on DS3 USB dongles 2020-06-07 13:18:47 +02:00
hid-speedlink.c
hid-steam.c HID: steam: fixes race in handling device list. 2020-07-29 10:18:36 +02:00
hid-steelseries.c
hid-sunplus.c
hid-tivo.c
hid-tmff.c HID: Fix assumption that devices have inputs 2019-10-03 15:36:40 -04:00
hid-topseed.c
hid-twinhan.c
hid-u2fzero.c
hid-uclogic-core.c
hid-uclogic-params.c
hid-uclogic-params.h
hid-uclogic-rdesc.c
hid-uclogic-rdesc.h
hid-udraw-ps3.c
hid-viewsonic.c
hid-waltop.c
hid-wiimote-core.c
hid-wiimote-debug.c
hid-wiimote-modules.c
hid-wiimote.h
hid-xinmo.c
hid-zpff.c HID: Fix assumption that devices have inputs 2019-10-03 15:36:40 -04:00
hid-zydacron.c
hidraw.c HID: hidraw, uhid: Always report EPOLLOUT 2020-01-17 19:48:15 +01:00
uhid.c HID: hidraw, uhid: Always report EPOLLOUT 2020-01-17 19:48:15 +01:00
wacom.h HID: wacom: generic: Treat serial number and related fields as unsigned 2019-11-06 21:37:29 +01:00
wacom_sys.c HID: wacom: Read HID_DG_CONTACTMAX directly for non-generic devices 2020-05-14 07:58:24 +02:00
wacom_wac.c HID: wacom: Report 2nd-gen Intuos Pro S center button status over BT 2020-05-14 07:58:24 +02:00
wacom_wac.h