Commit 7b1f781f authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: psmouse - set up dependency between PS/2 and SMBus companions

When we switch from emulated PS/2 to native (RMI4 or Elan) protocols, we
create SMBus companion devices that are attached to I2C/SMBus controllers.
However, when suspending and resuming, we also need to make sure that we
take into account the PS/2 device they are associated with, so that PS/2
device is suspended after the companion and resumed before it, otherwise
companions will not work properly. Before I2C devices were marked for
asynchronous suspend/resume, this ordering happened naturally, but now we
need to enforce it by establishing device links, with PS/2 devices being
suppliers and SMBus companions being consumers.

Fixes: 172d9319 ("i2c: enable async suspend/resume on i2c client devices")
Reported-and-tested-by: default avatarHugh Dickins <hughd@google.com>
Tested-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
Link: https://lore.kernel.org/r/89456fcd-a113-4c82-4b10-a9bcaefac68f@google.com
Link: https://lore.kernel.org/r/YgwQN8ynO88CPMju@google.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent de8aa31a
...@@ -75,6 +75,8 @@ static void psmouse_smbus_detach_i2c_client(struct i2c_client *client) ...@@ -75,6 +75,8 @@ static void psmouse_smbus_detach_i2c_client(struct i2c_client *client)
"Marking SMBus companion %s as gone\n", "Marking SMBus companion %s as gone\n",
dev_name(&smbdev->client->dev)); dev_name(&smbdev->client->dev));
smbdev->dead = true; smbdev->dead = true;
device_link_remove(&smbdev->client->dev,
&smbdev->psmouse->ps2dev.serio->dev);
serio_rescan(smbdev->psmouse->ps2dev.serio); serio_rescan(smbdev->psmouse->ps2dev.serio);
} else { } else {
list_del(&smbdev->node); list_del(&smbdev->node);
...@@ -174,6 +176,8 @@ static void psmouse_smbus_disconnect(struct psmouse *psmouse) ...@@ -174,6 +176,8 @@ static void psmouse_smbus_disconnect(struct psmouse *psmouse)
kfree(smbdev); kfree(smbdev);
} else { } else {
smbdev->dead = true; smbdev->dead = true;
device_link_remove(&smbdev->client->dev,
&psmouse->ps2dev.serio->dev);
psmouse_dbg(smbdev->psmouse, psmouse_dbg(smbdev->psmouse,
"posting removal request for SMBus companion %s\n", "posting removal request for SMBus companion %s\n",
dev_name(&smbdev->client->dev)); dev_name(&smbdev->client->dev));
...@@ -270,6 +274,12 @@ int psmouse_smbus_init(struct psmouse *psmouse, ...@@ -270,6 +274,12 @@ int psmouse_smbus_init(struct psmouse *psmouse,
if (smbdev->client) { if (smbdev->client) {
/* We have our companion device */ /* We have our companion device */
if (!device_link_add(&smbdev->client->dev,
&psmouse->ps2dev.serio->dev,
DL_FLAG_STATELESS))
psmouse_warn(psmouse,
"failed to set up link with iSMBus companion %s\n",
dev_name(&smbdev->client->dev));
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment