[PATCH 07/10] Input: drv2665 - disable haptics work across suspend and resume

From: Lee Jones

Date: Fri Nov 27 2026 - 15:11:54 EST


drv2665_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 drv2665_suspend() before
entering standby (re-enabling on suspend error) and call enable_work()
unconditionally in drv2665_resume() so the disable count always remains
balanced across suspend/resume cycles.

Fixes: 4d10da13467e ("Input: add TI drv2665 haptics driver")
Closes: https://sashiko.dev/#/bug/linux-c1b30f7c-1836-440f-8a6a-75ada49be7d5
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/input/misc/drv2665.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/input/misc/drv2665.c b/drivers/input/misc/drv2665.c
index 90407f8797c7..3ade96308192 100644
--- a/drivers/input/misc/drv2665.c
+++ b/drivers/input/misc/drv2665.c
@@ -228,12 +228,15 @@ static int drv2665_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, DRV2665_CTRL_2,
DRV2665_STANDBY, DRV2665_STANDBY);
if (error) {
dev_err(dev, "Failed to set standby mode\n");
regulator_disable(haptics->regulator);
+ enable_work(&haptics->work);
return error;
}

@@ -243,6 +246,7 @@ static int drv2665_suspend(struct device *dev)
regmap_update_bits(haptics->regmap,
DRV2665_CTRL_2,
DRV2665_STANDBY, 0);
+ enable_work(&haptics->work);
return error;
}
}
@@ -253,7 +257,7 @@ static int drv2665_suspend(struct device *dev)
static int drv2665_resume(struct device *dev)
{
struct drv2665_data *haptics = dev_get_drvdata(dev);
- int error;
+ int error = 0;

guard(mutex)(&haptics->input_dev->mutex);

@@ -261,7 +265,7 @@ static int drv2665_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, DRV2665_CTRL_2,
@@ -269,12 +273,13 @@ static int drv2665_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(drv2665_pm_ops, drv2665_suspend, drv2665_resume);
--
2.56.1.839.g22a8290db9-goog