summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYauhen Kharuzhy <jekhor@gmail.com>2026-02-17 21:12:27 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2026-02-18 10:05:17 +0300
commite7b53288d9ea899abc6d47a7f20065ab511a810c (patch)
tree3ddc0c2a8c88172464c4f324180a3855acdef9d6
parent710a1a8c591e93fa49946b68a4f1e25ae9687ecf (diff)
downloadlinux-e7b53288d9ea899abc6d47a7f20065ab511a810c.tar.xz
Input: drv260x - fix unbalanced regulator_disable() call
The driver acquires the 'vbat' regulator during probing but never enables it. Consequently, in the suspend method, the driver disables the regulator without enabling it first, causing an 'Unbalanced regulator_disable()' error. Enable the regulator in the probe() method and add the remove() method with regulator disabling to fix this. Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com> Link: https://patch.msgid.link/20260215141435.727872-5-jekhor@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/misc/drv260x.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index b3076aa682c4..e2089d6ac850 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c
@@ -9,6 +9,7 @@
#include <linux/acpi.h>
#include <linux/delay.h>
+#include <linux/device/devres.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/input.h>
@@ -433,6 +434,13 @@ static const struct regmap_config drv260x_regmap_config = {
.cache_type = REGCACHE_NONE,
};
+static void drv260x_power_off(void *data)
+{
+ struct drv260x_data *haptics = data;
+
+ regulator_disable(haptics->regulator);
+}
+
static int drv260x_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
@@ -498,6 +506,16 @@ static int drv260x_probe(struct i2c_client *client)
return error;
}
+ error = regulator_enable(haptics->regulator);
+ if (error) {
+ dev_err(dev, "Failed to enable regulator: %d\n", error);
+ return error;
+ }
+
+ error = devm_add_action_or_reset(dev, drv260x_power_off, haptics);
+ if (error)
+ return error;
+
haptics->enable_gpio = devm_gpiod_get_optional(dev, "enable",
GPIOD_OUT_HIGH);
if (IS_ERR(haptics->enable_gpio))