[PATCH v2 1/2] Input: drv260x: Restore configuration after device close
From: Maurizio Casciano <hidden>
Date: 2026-08-27 23:16:45
Also in:
lkml
Subsystem:
input (keyboard, mouse, joystick, touchscreen) drivers, the rest · Maintainers:
Dmitry Torokhov, Linus Torvalds
The enable GPIO resets volatile device registers when it is lowered. The input close callback lowers that GPIO, but the next open currently starts playback without restoring the actuator configuration. Raise the enable GPIO, observe the startup delay and reinitialize the controller when the input device is opened. Keep the configured actuator mode unchanged during playback so later initialization follows the mode selected by firmware. Reported-by: Sashiko AI review <sashiko-bot@kernel.org> Link: https://lore.kernel.org/linux-input/20260827182855.DE8E91F000E9@smtp.kernel.org/ (local) Signed-off-by: Maurizio Casciano <redacted> --- drivers/input/misc/drv260x.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index 6c5c4c53753b..f26a9052edd2 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c@@ -243,8 +243,6 @@ static int drv260x_haptics_play(struct input_dev *input, void *data, { struct drv260x_data *haptics = input_get_drvdata(input); - haptics->mode = DRV260X_LRA_NO_CAL_MODE; - /* Scale u16 magnitude into u8 register value */ if (effect->u.rumble.strong_magnitude > 0) haptics->magnitude = effect->u.rumble.strong_magnitude >> 8;
@@ -426,6 +424,21 @@ static int drv260x_init(struct drv260x_data *haptics) return 0; } +static int drv260x_open(struct input_dev *input) +{ + struct drv260x_data *haptics = input_get_drvdata(input); + int error; + + gpiod_set_value(haptics->enable_gpio, 1); + usleep_range(250, 500); + + error = drv260x_init(haptics); + if (error) + gpiod_set_value(haptics->enable_gpio, 0); + + return error; +} + static const struct regmap_config drv260x_regmap_config = { .reg_bits = 8, .val_bits = 8,
@@ -528,6 +541,7 @@ static int drv260x_probe(struct i2c_client *client) } haptics->input_dev->name = "drv260x:haptics"; + haptics->input_dev->open = drv260x_open; haptics->input_dev->close = drv260x_close; input_set_drvdata(haptics->input_dev, haptics); input_set_capability(haptics->input_dev, EV_FF, FF_RUMBLE);
--
2.53.0