[PATCH 08/10] Input: drv2667 - disable haptics work across suspend and resume
From: Lee Jones
Date: Fri Nov 27 2026 - 15:12:05 EST
drv2667_suspend() puts the device into standby and disables its
regulator without stopping haptics->work. A pending or timer-scheduled
haptics worker can therefore execute I2C regmap transactions while the
chip is unpowered or the I2C bus is suspended, including when the input
device is inhibited.
Call disable_work_sync() unconditionally in drv2667_suspend() before
entering standby (re-enabling on suspend error) and call enable_work()
unconditionally in drv2667_resume() so the disable count always remains
balanced across suspend/resume cycles.
Fixes: 1c24622572d6 ("Input: add support for the DRV2667 haptic driver")
Closes: https://sashiko.dev/#/bug/linux-b8ddefd2-393d-487e-8c76-2dbc5ef46b64
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/input/misc/drv2667.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/input/misc/drv2667.c b/drivers/input/misc/drv2667.c
index 18cf689d7ef7..3326aeb9874e 100644
--- a/drivers/input/misc/drv2667.c
+++ b/drivers/input/misc/drv2667.c
@@ -405,12 +405,15 @@ static int drv2667_suspend(struct device *dev)
guard(mutex)(&haptics->input_dev->mutex);
+ disable_work_sync(&haptics->work);
+
if (input_device_enabled(haptics->input_dev)) {
error = regmap_update_bits(haptics->regmap, DRV2667_CTRL_2,
DRV2667_STANDBY, DRV2667_STANDBY);
if (error) {
dev_err(dev, "Failed to set standby mode\n");
regulator_disable(haptics->regulator);
+ enable_work(&haptics->work);
return error;
}
@@ -420,6 +423,7 @@ static int drv2667_suspend(struct device *dev)
regmap_update_bits(haptics->regmap,
DRV2667_CTRL_2,
DRV2667_STANDBY, 0);
+ enable_work(&haptics->work);
return error;
}
}
@@ -430,7 +434,7 @@ static int drv2667_suspend(struct device *dev)
static int drv2667_resume(struct device *dev)
{
struct drv2667_data *haptics = dev_get_drvdata(dev);
- int error;
+ int error = 0;
guard(mutex)(&haptics->input_dev->mutex);
@@ -438,7 +442,7 @@ static int drv2667_resume(struct device *dev)
error = regulator_enable(haptics->regulator);
if (error) {
dev_err(dev, "Failed to enable regulator\n");
- return error;
+ goto out;
}
error = regmap_update_bits(haptics->regmap, DRV2667_CTRL_2,
@@ -446,12 +450,13 @@ static int drv2667_resume(struct device *dev)
if (error) {
dev_err(dev, "Failed to unset standby mode\n");
regulator_disable(haptics->regulator);
- return error;
+ goto out;
}
-
}
- return 0;
+out:
+ enable_work(&haptics->work);
+ return error;
}
static DEFINE_SIMPLE_DEV_PM_OPS(drv2667_pm_ops, drv2667_suspend, drv2667_resume);
--
2.56.1.839.g22a8290db9-goog