Commit b3572639 authored by Dmitry Torokhov's avatar Dmitry Torokhov
Browse files

Revert "Input: psmouse - add delay when deactivating for SMBus mode"



This reverts commit 92e24e0e.

While the patch itself is correct, it uncovered an issue with fallback
to PS/2 mode, where we were leaving psmouse->fast_reconnect handler set
to psmouse_smbus_reconnect(), which caused crashes.

While discussing various approaches to fix the issue it was noted that
this patch ass undesired delay in the "fast" resume path of PS/2 device,
and it would be better to actually use "reset_delay" option defined in
struct rmi_device_platform_data and have RMI code handle it for SMBus
transport as well. So this patch is being reverted to deal with crashes
and a better solution will be merged shortly.

Reported-by: default avatarThorsten Leemhuis <linux@leemhuis.info>
Closes: https://lore.kernel.org/all/ca0109fa-c64b-43c1-a651-75b294d750a1@leemhuis.info/


Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 423622a9
Loading
Loading
Loading
Loading
+7 −12
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@

#define pr_fmt(fmt)		KBUILD_MODNAME ": " fmt

#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/libps2.h>
@@ -119,18 +118,13 @@ static psmouse_ret_t psmouse_smbus_process_byte(struct psmouse *psmouse)
	return PSMOUSE_FULL_PACKET;
}

static void psmouse_activate_smbus_mode(struct psmouse_smbus_dev *smbdev)
{
	if (smbdev->need_deactivate) {
		psmouse_deactivate(smbdev->psmouse);
		/* Give the device time to switch into SMBus mode */
		msleep(30);
	}
}

static int psmouse_smbus_reconnect(struct psmouse *psmouse)
{
	psmouse_activate_smbus_mode(psmouse->private);
	struct psmouse_smbus_dev *smbdev = psmouse->private;

	if (smbdev->need_deactivate)
		psmouse_deactivate(psmouse);

	return 0;
}

@@ -263,7 +257,8 @@ int psmouse_smbus_init(struct psmouse *psmouse,
		}
	}

	psmouse_activate_smbus_mode(smbdev);
	if (need_deactivate)
		psmouse_deactivate(psmouse);

	psmouse->private = smbdev;
	psmouse->protocol_handler = psmouse_smbus_process_byte;