OpenCloudOS-Kernel/drivers/input/mouse
Jeffery Miller 92e24e0e57 Input: psmouse - add delay when deactivating for SMBus mode
There is a period of time between the psmouse deactivate and the
ability to communicate with the SMBus companion. Insert a
sleep after the deactivate to account for the delay and ensure
the SMBus companion is responsive.

Attempting to read from the SMBus companion too quickly was causing
the touchpad on machines with an i801_smbus companion to stop working
after a sleep/resume cycle.

On resume the rmi4_smbus would fail with errors reading the SMBus version
number:
```
[5454] i2c_i801:i801_check_post:414: i801_smbus 0000:00:1f.3: No response
smbus_result: i2c-0 a=02c f=0000 c=fd BYTE_DATA rd res=-6
rmi4_smbus 0-002c: failed to get SMBus version number!
...
rmi4_f01 rmi4-00.fn01: Failed to restore normal operation: -6.
rmi4_f01 rmi4-00.fn01: Resume failed with code -6.
rmi4_physical rmi4-00: Failed to suspend functions: -6
rmi4_smbus 0-002c: Failed to resume device: -6
```
In this case the rmi_smb_get_version fails with -ENXIO if it happens too
soon after the preceding serio_resume -> psmouse_deactivate call.

On boot this issue could cause the touchpad to stay in the limited PS/2
mode. This only reproduced in 1 in 10 boots on the Lenovo T440p.
Failures in the log on boot would show up as:
```
psmouse serio1: synaptics: Trying to set up SMBus access
[122] i2c_i801:i801_check_post:437: i801_smbus 0000:00:1f.3: No response
psmouse serio1: synaptics: SMbus companion is not ready yet
```

Experimentation on the Lenovo T440p showed that a delay of 7-12ms on
resume allowed the companion to respond.

The 30ms delay in this patch was chosen based on the linux-input message:
Link: https://lore.kernel.org/all/BYAPR03MB47572F2C65E52ED673238D41B2439@BYAPR03MB4757.namprd03.prod.outlook.com/

Signed-off-by: Jeffery Miller <jefferymiller@google.com>
Link: https://lore.kernel.org/r/20230726025256.81174-1-jefferymiller@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2023-07-25 22:07:42 -07:00
..
Kconfig input: remove pxa930_trkball driver 2023-02-01 17:23:38 +01:00
Makefile input: remove pxa930_trkball driver 2023-02-01 17:23:38 +01:00
alps.c Input: alps - fix compatibility with -funsigned-char 2023-03-19 23:07:04 -07:00
alps.h Input: psmouse - drop all unneeded functions from mouse headers 2019-08-20 14:15:36 -07:00
amimouse.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
appletouch.c Input: appletouch - initialize work before device registration 2021-12-30 21:04:04 -08:00
atarimouse.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
bcm5974.c Input: bcm5974 - set missing URB_NO_TRANSFER_DMA_MAP urb flag 2022-06-07 13:44:39 -07:00
byd.c Input: byd - fix typo in a comment 2021-12-20 00:59:50 -08:00
byd.h Input: psmouse - drop all unneeded functions from mouse headers 2019-08-20 14:15:36 -07:00
cyapa.c Input: Switch i2c drivers back to use .probe() 2023-05-17 09:59:11 -07:00
cyapa.h Input: cyapa - fix for losing events during device power transitions 2016-03-04 11:32:13 -08:00
cyapa_gen3.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
cyapa_gen5.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
cyapa_gen6.c Input: cyapa_gen6 - aligned "*" each line 2022-06-22 16:14:37 -07:00
cypress_ps2.c Input: cypress_ps2 - fix typo in comment 2022-05-21 12:48:39 -07:00
cypress_ps2.h Input: psmouse - drop all unneeded functions from mouse headers 2019-08-20 14:15:36 -07:00
elan_i2c.h Input: elan_i2c - reduce the resume time for controller in Whitebox 2021-09-06 22:30:34 -07:00
elan_i2c_core.c Input: elan_i2c - simplify with dev_err_probe() 2023-07-07 16:54:27 -07:00
elan_i2c_i2c.c Input: elan_i2c - fix firmware update on newer ICs 2020-11-11 20:13:12 -08:00
elan_i2c_smbus.c Merge branch 'next' into for-linus 2020-12-14 16:27:23 -08:00
elantech.c Input: psmouse - fix OOB access in Elantech protocol 2023-05-11 12:09:08 -07:00
elantech.h Input: elantech - fix protocol errors for some trackpoints in SMBus mode 2020-12-11 00:15:05 -08:00
focaltech.c Input: focaltech - use explicitly signed char type 2023-03-19 23:07:02 -07:00
focaltech.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
gpio_mouse.c Input: gpio_mouse - fix typos in comments 2022-06-22 15:29:35 -07:00
hgpk.c Input: hgpk - fix repeated word in a comment 2022-09-08 14:06:23 -07:00
hgpk.h Input: psmouse - drop all unneeded functions from mouse headers 2019-08-20 14:15:36 -07:00
inport.c input: drop empty comment blocks 2022-09-29 16:25:42 -07:00
lifebook.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
lifebook.h Input: psmouse - drop all unneeded functions from mouse headers 2019-08-20 14:15:36 -07:00
logibm.c input: drop empty comment blocks 2022-09-29 16:25:42 -07:00
logips2pp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
logips2pp.h Input: psmouse - drop all unneeded functions from mouse headers 2019-08-20 14:15:36 -07:00
maplemouse.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
navpoint.c Input: navpoint - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() 2023-01-09 20:25:23 -08:00
pc110pad.c input: drop empty comment blocks 2022-09-29 16:25:42 -07:00
psmouse-base.c Input: libps2 - introduce common interrupt handler 2023-05-18 11:40:32 -07:00
psmouse-smbus.c Input: psmouse - add delay when deactivating for SMBus mode 2023-07-25 22:07:42 -07:00
psmouse.h Input: libps2 - attach ps2dev instances as serio port's drvdata 2023-05-18 11:40:32 -07:00
rpcmouse.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
sentelic.c Input: sentelic - fix error return when fsp_reg_write fails 2020-08-06 17:33:43 -07:00
sentelic.h Input: psmouse - drop all unneeded functions from mouse headers 2019-08-20 14:15:36 -07:00
sermouse.c input: drop empty comment blocks 2022-09-29 16:25:42 -07:00
synaptics.c Input: libps2 - attach ps2dev instances as serio port's drvdata 2023-05-18 11:40:32 -07:00
synaptics.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
synaptics_i2c.c Input: Switch i2c drivers back to use .probe() 2023-05-17 09:59:11 -07:00
synaptics_usb.c Input: move from strlcpy with unused retval to strscpy 2022-08-18 15:44:08 -07:00
touchkit_ps2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
touchkit_ps2.h Input: psmouse - drop all unneeded functions from mouse headers 2019-08-20 14:15:36 -07:00
trackpoint.c Input: libps2 - attach ps2dev instances as serio port's drvdata 2023-05-18 11:40:32 -07:00
trackpoint.h Input: trackpoint - add new trackpoint variant IDs 2020-09-14 12:24:46 -07:00
vmmouse.c Input: vmmouse - disable vmmouse before entering suspend mode 2022-05-18 15:02:13 -07:00
vmmouse.h Input: psmouse - drop all unneeded functions from mouse headers 2019-08-20 14:15:36 -07:00
vsxxxaa.c input: drop empty comment blocks 2022-09-29 16:25:42 -07:00