Re: [PATCH] Input: psmouse - add resync_on_resume dmi check

From: Dmitry Torokhov
Date: Tue Mar 05 2024 - 13:47:37 EST


On Mon, Mar 04, 2024 at 11:17:31AM -0600, Jonathan Denose wrote:
> I disabled the ideapad driver by rebuilding the kernel without the
> ideapad_laptop module. That does fix the suspend/resume issue!
>
> Attached are the logs. Is there a way to make this permanent?

Could you please try the patch below? Thanks!

---

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 9fbb8d31575a..2f0c143c3137 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -127,6 +127,7 @@ MODULE_PARM_DESC(unmask_kbd_data, "Unconditional enable (may reveal sensitive da
#endif

static bool i8042_present;
+static bool i8042_ready;
static bool i8042_bypass_aux_irq_test;
static char i8042_kbd_firmware_id[128];
static char i8042_aux_firmware_id[128];
@@ -190,6 +191,26 @@ void i8042_unlock_chip(void)
}
EXPORT_SYMBOL(i8042_unlock_chip);

+int i8042_device_link_add(struct device *consumer)
+{
+ if (!i8042_present)
+ return -ENODEV;
+
+ if (!i8042_platform_device || !i8042_ready)
+ return -EPROBE_DEFER;
+
+ return device_link_add(consumer, &i8042_platform_device->dev,
+ DL_FLAG_STATELESS) != NULL;
+}
+EXPORT_SYMBOL(i8042_device_link_add);
+
+void i8042_device_link_remove(struct device *consumer)
+{
+ if (i8042_platform_device)
+ device_link_remove(consumer, &i8042_platform_device->dev);
+}
+EXPORT_SYMBOL(i8042_device_link_remove);
+
int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
struct serio *serio))
{
@@ -1574,6 +1595,7 @@ static int i8042_probe(struct platform_device *dev)
*/
i8042_register_ports();

+ i8042_ready = true;
return 0;

out_fail:
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index ac037540acfc..d4d1bccbe882 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -1842,6 +1842,13 @@ static int ideapad_acpi_add(struct platform_device *pdev)
ideapad_register_rfkill(priv, i);

ideapad_sync_rfk_state(priv);
+
+ err = i8042_device_link_add(&pdev->dev);
+ if (err) {
+ dev_err(&pdev->dev, "failed to link with 8042 controller :%d", err);
+ goto i8042_link_failed;
+ }
+
ideapad_sync_touchpad_state(priv, false);

err = ideapad_dytc_profile_init(priv);
@@ -1882,7 +1889,9 @@ static int ideapad_acpi_add(struct platform_device *pdev)

backlight_failed:
ideapad_dytc_profile_exit(priv);
+ i8042_device_link_remove(&pdev->dev);

+i8042_link_failed:
for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
ideapad_unregister_rfkill(priv, i);

@@ -1909,6 +1918,7 @@ static void ideapad_acpi_remove(struct platform_device *pdev)

ideapad_backlight_exit(priv);
ideapad_dytc_profile_exit(priv);
+ i8042_device_link_remove(&pdev->dev);

for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
ideapad_unregister_rfkill(priv, i);
diff --git a/include/linux/i8042.h b/include/linux/i8042.h
index 95b07f8b77fe..ce45569f5246 100644
--- a/include/linux/i8042.h
+++ b/include/linux/i8042.h
@@ -52,12 +52,15 @@
#define I8042_CTR_AUXDIS 0x20
#define I8042_CTR_XLATE 0x40

+struct device;
struct serio;

#if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE)

void i8042_lock_chip(void);
void i8042_unlock_chip(void);
+int i8042_device_link_add(struct device *dev);
+void i8042_device_link_remove(struct device *dev);
int i8042_command(unsigned char *param, int command);
int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
struct serio *serio));
@@ -74,6 +77,15 @@ static inline void i8042_unlock_chip(void)
{
}

+int i8042_device_link_add(struct device *dev)
+{
+ return -ENODEV;
+}
+
+void i8042_device_link_remove(struct device *dev)
+{
+}
+
static inline int i8042_command(unsigned char *param, int command)
{
return -ENODEV;



Thanks.

--
Dmitry