Skip to content

Commit 3d765ae

Browse files
tuxedo-wsedtor
authored andcommitted
Input: i8042 - add forcenorestore quirk to leave controller untouched even on s3
On s3 resume the i8042 driver tries to restore the controller to a known state by reinitializing things, however this can confuse the controller with different effects. Mostly occasionally unresponsive keyboards after resume. These issues do not rise on s0ix resume as here the controller is assumed to preserved its state from before suspend. This patch adds a quirk for devices where the reinitialization on s3 resume is not needed and might be harmful as described above. It does this by using the s0ix resume code path at selected locations. This new quirk goes beyond what the preexisting reset=never quirk does, which only skips some reinitialization steps. Signed-off-by: Werner Sembach <[email protected]> Cc: [email protected] Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 7ce7c22 commit 3d765ae

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

drivers/input/serio/i8042-acpipnpio.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ static inline void i8042_write_command(int val)
8383
#define SERIO_QUIRK_KBDRESET BIT(12)
8484
#define SERIO_QUIRK_DRITEK BIT(13)
8585
#define SERIO_QUIRK_NOPNP BIT(14)
86+
#define SERIO_QUIRK_FORCENORESTORE BIT(15)
8687

8788
/* Quirk table for different mainboards. Options similar or identical to i8042
8889
* module parameters.
@@ -1694,6 +1695,8 @@ static void __init i8042_check_quirks(void)
16941695
if (quirks & SERIO_QUIRK_NOPNP)
16951696
i8042_nopnp = true;
16961697
#endif
1698+
if (quirks & SERIO_QUIRK_FORCENORESTORE)
1699+
i8042_forcenorestore = true;
16971700
}
16981701
#else
16991702
static inline void i8042_check_quirks(void) {}
@@ -1727,7 +1730,7 @@ static int __init i8042_platform_init(void)
17271730

17281731
i8042_check_quirks();
17291732

1730-
pr_debug("Active quirks (empty means none):%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
1733+
pr_debug("Active quirks (empty means none):%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
17311734
i8042_nokbd ? " nokbd" : "",
17321735
i8042_noaux ? " noaux" : "",
17331736
i8042_nomux ? " nomux" : "",
@@ -1747,10 +1750,11 @@ static int __init i8042_platform_init(void)
17471750
"",
17481751
#endif
17491752
#ifdef CONFIG_PNP
1750-
i8042_nopnp ? " nopnp" : "");
1753+
i8042_nopnp ? " nopnp" : "",
17511754
#else
1752-
"");
1755+
"",
17531756
#endif
1757+
i8042_forcenorestore ? " forcenorestore" : "");
17541758

17551759
retval = i8042_pnp_init();
17561760
if (retval)

drivers/input/serio/i8042.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ module_param_named(nopnp, i8042_nopnp, bool, 0);
115115
MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings");
116116
#endif
117117

118+
static bool i8042_forcenorestore;
119+
module_param_named(forcenorestore, i8042_forcenorestore, bool, 0);
120+
MODULE_PARM_DESC(forcenorestore, "Force no restore on s3 resume, copying s2idle behaviour");
121+
118122
#define DEBUG
119123
#ifdef DEBUG
120124
static bool i8042_debug;
@@ -1232,7 +1236,7 @@ static int i8042_pm_suspend(struct device *dev)
12321236
{
12331237
int i;
12341238

1235-
if (pm_suspend_via_firmware())
1239+
if (!i8042_forcenorestore && pm_suspend_via_firmware())
12361240
i8042_controller_reset(true);
12371241

12381242
/* Set up serio interrupts for system wakeup. */
@@ -1248,7 +1252,7 @@ static int i8042_pm_suspend(struct device *dev)
12481252

12491253
static int i8042_pm_resume_noirq(struct device *dev)
12501254
{
1251-
if (!pm_resume_via_firmware())
1255+
if (i8042_forcenorestore || !pm_resume_via_firmware())
12521256
i8042_interrupt(0, NULL);
12531257

12541258
return 0;
@@ -1271,7 +1275,7 @@ static int i8042_pm_resume(struct device *dev)
12711275
* not restore the controller state to whatever it had been at boot
12721276
* time, so we do not need to do anything.
12731277
*/
1274-
if (!pm_suspend_via_firmware())
1278+
if (i8042_forcenorestore || !pm_suspend_via_firmware())
12751279
return 0;
12761280

12771281
/*

0 commit comments

Comments
 (0)