From: Yauhen Kharuzhy <jekhor@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>, linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Hans de Goede <hansg@kernel.org>,
Yauhen Kharuzhy <jekhor@gmail.com>
Subject: [PATCH 5/5] input: drv260x: Don't try to disable dummy regulator
Date: Thu, 12 Feb 2026 01:46:55 +0200 [thread overview]
Message-ID: <20260211235902.4156624-6-jekhor@gmail.com> (raw)
In-Reply-To: <20260211235902.4156624-1-jekhor@gmail.com>
Don't use a dummy regulator for 'vbat' because it cannot be disabled
during suspending.
Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
---
drivers/input/misc/drv260x.c | 44 +++++++++++++++++++++++-------------
1 file changed, 28 insertions(+), 16 deletions(-)
diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index f7bfac6d3973..e82ede54c6f6 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c
@@ -548,11 +548,17 @@ static int drv260x_probe(struct i2c_client *client)
haptics->overdrive_voltage = error ? DRV260X_DEF_OD_CLAMP_VOLT :
drv260x_calculate_voltage(voltage);
- haptics->regulator = devm_regulator_get(dev, "vbat");
+ haptics->regulator = devm_regulator_get_optional(dev, "vbat");
if (IS_ERR(haptics->regulator)) {
- error = PTR_ERR(haptics->regulator);
- dev_err(dev, "unable to get regulator, error: %d\n", error);
- return error;
+ if (PTR_ERR(haptics->regulator) == -ENODEV) {
+ haptics->regulator = NULL;
+ dev_dbg(dev, "No vbat regulator found\n");
+ } else {
+ error = PTR_ERR(haptics->regulator);
+ dev_err(dev, "unable to get regulator, error: %d\n",
+ error);
+ return error;
+ }
}
haptics->enable_gpio = devm_gpiod_get_optional(dev,
@@ -626,13 +632,15 @@ static int drv260x_suspend(struct device *dev)
gpiod_set_value(haptics->enable_gpio, 0);
- error = regulator_disable(haptics->regulator);
- if (error) {
- dev_err(dev, "Failed to disable regulator\n");
- regmap_update_bits(haptics->regmap,
- DRV260X_MODE,
- DRV260X_STANDBY_MASK, 0);
- return error;
+ if (haptics->regulator) {
+ error = regulator_disable(haptics->regulator);
+ if (error) {
+ dev_err(dev, "Failed to disable regulator\n");
+ regmap_update_bits(haptics->regmap,
+ DRV260X_MODE,
+ DRV260X_STANDBY_MASK, 0);
+ return error;
+ }
}
}
@@ -647,10 +655,12 @@ static int drv260x_resume(struct device *dev)
guard(mutex)(&haptics->input_dev->mutex);
if (input_device_enabled(haptics->input_dev)) {
- error = regulator_enable(haptics->regulator);
- if (error) {
- dev_err(dev, "Failed to enable regulator\n");
- return error;
+ if (haptics->regulator) {
+ error = regulator_enable(haptics->regulator);
+ if (error) {
+ dev_err(dev, "Failed to enable regulator\n");
+ return error;
+ }
}
error = regmap_update_bits(haptics->regmap,
@@ -658,7 +668,9 @@ static int drv260x_resume(struct device *dev)
DRV260X_STANDBY_MASK, 0);
if (error) {
dev_err(dev, "Failed to unset standby mode\n");
- regulator_disable(haptics->regulator);
+ if (haptics->regulator)
+ regulator_disable(haptics->regulator);
+
return error;
}
--
2.51.0
next prev parent reply other threads:[~2026-02-11 23:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 23:46 DRV260x: Support ACPI-enumerated devices Yauhen Kharuzhy
2026-02-11 23:46 ` [PATCH 1/5] input: drv260x: Add I2C IDs for all device variants Yauhen Kharuzhy
2026-02-11 23:46 ` [PATCH 2/5] input: drv260x: Add support for ACPI-enumerated devices Yauhen Kharuzhy
2026-02-12 17:26 ` Dmitry Torokhov
2026-02-13 20:48 ` Yauhen Kharuzhy
2026-02-11 23:46 ` [PATCH 3/5] input: drv260x: Check the device ID at initialization Yauhen Kharuzhy
2026-02-12 17:28 ` Dmitry Torokhov
2026-02-13 20:53 ` Yauhen Kharuzhy
2026-02-11 23:46 ` [PATCH 4/5] input: drv260x: Stop waiting for GO bit clearing after timeout Yauhen Kharuzhy
2026-02-12 17:34 ` Dmitry Torokhov
2026-02-13 21:00 ` Yauhen Kharuzhy
2026-02-11 23:46 ` Yauhen Kharuzhy [this message]
2026-02-12 17:41 ` [PATCH 5/5] input: drv260x: Don't try to disable dummy regulator Dmitry Torokhov
2026-02-13 21:56 ` Yauhen Kharuzhy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260211235902.4156624-6-jekhor@gmail.com \
--to=jekhor@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=hansg@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox