* [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices
@ 2026-02-15 14:14 Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 1/5] input: drv260x: Add I2C IDs for all device variants Yauhen Kharuzhy
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Yauhen Kharuzhy @ 2026-02-15 14:14 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input; +Cc: linux-kernel, Hans de Goede
Lenovo Yoga Book YB1-X90 and YB1-X91 tablets use haptics controllers
DRV2604L. The X91 (Windows tablet) uses ACPI to define its configuration,
such as I2C address and GPIO connections. The X90 (Android tablet)
doesn't have it in the ACPI, but the device may be defined as an
i2c_board in the x86-android-tablets driver.
To support these variants, add an ACPI matching table and add additional
I2C IDs to the I2C matching table (the driver supports DRV2604(L),
DRV2605(L) devices).
Also, implement a timeout for waiting for calibration,
and fix the non-working suspend due to unbalanced regulator_disable() call.
Changes in v2:
- Header includes have been sorted alphabetically;
- ACPI GPIO mapping has been removed (supposed to be in the
device-specific driver like x86-android-tablets);
- Old debug session artifacts removed;
- Checking of device ID has been removed; the driver uses the same logic
for all drv260x(L) variants;
- Timeout during calibration reports an error; we don't expect that
the chip will work properly in such a case;
- Patch regarding the regulator has been reworked; now it just adds
regulator_enable()/regulator_disable() during device probing and removal.
Discussion of v1 is here:
Link: https://lore.kernel.org/all/20260211235902.4156624-1-jekhor@gmail.com/
Yauhen Kharuzhy (5):
input: drv260x: Add I2C IDs for all device variants
input: drv260x: Sort all #include alphabetically
input: drv260x: Add support for ACPI-enumerated devices
input: drv260x: Fix unbalanced regulator_disable() call
input: drv260x: Handle calibration timeout
drivers/input/misc/drv260x.c | 55 ++++++++++++++++++++++++++++++++----
1 file changed, 50 insertions(+), 5 deletions(-)
base-commit: 9845cf73f7db6094c0d8419d6adb848028f4a921
--
2.51.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/5] input: drv260x: Add I2C IDs for all device variants
2026-02-15 14:14 [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices Yauhen Kharuzhy
@ 2026-02-15 14:14 ` Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 2/5] input: drv260x: Sort all #include alphabetically Yauhen Kharuzhy
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Yauhen Kharuzhy @ 2026-02-15 14:14 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input; +Cc: linux-kernel, Hans de Goede
Add drv2604(L) and drv2605 to the list of supported I2C device IDs
for clarity.
Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
---
drivers/input/misc/drv260x.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index 96cd6a078c8a..18360bdfe877 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c
@@ -598,6 +598,9 @@ static int drv260x_resume(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(drv260x_pm_ops, drv260x_suspend, drv260x_resume);
static const struct i2c_device_id drv260x_id[] = {
+ { "drv2604" },
+ { "drv2604l" },
+ { "drv2605" },
{ "drv2605l" },
{ }
};
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/5] input: drv260x: Sort all #include alphabetically
2026-02-15 14:14 [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 1/5] input: drv260x: Add I2C IDs for all device variants Yauhen Kharuzhy
@ 2026-02-15 14:14 ` Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 3/5] input: drv260x: Add support for ACPI-enumerated devices Yauhen Kharuzhy
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Yauhen Kharuzhy @ 2026-02-15 14:14 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input; +Cc: linux-kernel, Hans de Goede
Sort all #include directives alphabetically before adding new entries.
Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
---
drivers/input/misc/drv260x.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index 18360bdfe877..c352ff2859e2 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c
@@ -7,14 +7,14 @@
* Copyright: (C) 2014 Texas Instruments, Inc.
*/
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/module.h>
#include <linux/regmap.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/gpio/consumer.h>
#include <linux/regulator/consumer.h>
+#include <linux/slab.h>
#include <dt-bindings/input/ti-drv260x.h>
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/5] input: drv260x: Add support for ACPI-enumerated devices
2026-02-15 14:14 [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 1/5] input: drv260x: Add I2C IDs for all device variants Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 2/5] input: drv260x: Sort all #include alphabetically Yauhen Kharuzhy
@ 2026-02-15 14:14 ` Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 4/5] input: drv260x: Fix unbalanced regulator_disable() call Yauhen Kharuzhy
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Yauhen Kharuzhy @ 2026-02-15 14:14 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input; +Cc: linux-kernel, Hans de Goede
Add ACPI ids and GPIO lookup mapping for drv2604 haptics device.
Found in Lenovo Yoga Book YB1-X91L tablet.
Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
---
drivers/input/misc/drv260x.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index c352ff2859e2..c4dd410c303e 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c
@@ -7,6 +7,7 @@
* Copyright: (C) 2014 Texas Instruments, Inc.
*/
+#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
@@ -606,6 +607,14 @@ static const struct i2c_device_id drv260x_id[] = {
};
MODULE_DEVICE_TABLE(i2c, drv260x_id);
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id drv260x_acpi_match[] = {
+ { "DRV2604", 0 },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, drv260x_acpi_match);
+#endif
+
static const struct of_device_id drv260x_of_match[] = {
{ .compatible = "ti,drv2604", },
{ .compatible = "ti,drv2604l", },
@@ -621,6 +630,7 @@ static struct i2c_driver drv260x_driver = {
.name = "drv260x-haptics",
.of_match_table = drv260x_of_match,
.pm = pm_sleep_ptr(&drv260x_pm_ops),
+ .acpi_match_table = ACPI_PTR(drv260x_acpi_match),
},
.id_table = drv260x_id,
};
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 4/5] input: drv260x: Fix unbalanced regulator_disable() call
2026-02-15 14:14 [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices Yauhen Kharuzhy
` (2 preceding siblings ...)
2026-02-15 14:14 ` [PATCH v2 3/5] input: drv260x: Add support for ACPI-enumerated devices Yauhen Kharuzhy
@ 2026-02-15 14:14 ` Yauhen Kharuzhy
2026-02-19 2:43 ` Dmitry Torokhov
2026-02-15 14:14 ` [PATCH v2 5/5] input: drv260x: Handle calibration timeout Yauhen Kharuzhy
2026-02-19 2:44 ` [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices Dmitry Torokhov
5 siblings, 1 reply; 10+ messages in thread
From: Yauhen Kharuzhy @ 2026-02-15 14:14 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input; +Cc: linux-kernel, Hans de Goede
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>
---
drivers/input/misc/drv260x.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index c4dd410c303e..71fbdabc6589 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c
@@ -520,19 +520,37 @@ static int drv260x_probe(struct i2c_client *client)
return error;
}
+ error = regulator_enable(haptics->regulator);
+ if (error) {
+ dev_err(dev, "Failed to enable regulator\n");
+ return error;
+ }
+
error = drv260x_init(haptics);
if (error) {
dev_err(dev, "Device init failed: %d\n", error);
- return error;
+ goto err_regulator_disable;
}
error = input_register_device(haptics->input_dev);
if (error) {
dev_err(dev, "couldn't register input device: %d\n", error);
- return error;
+ goto err_regulator_disable;
}
return 0;
+
+err_regulator_disable:
+ regulator_disable(haptics->regulator);
+
+ return error;
+}
+
+static void drv260x_remove(struct i2c_client *client)
+{
+ struct drv260x_data *haptics = i2c_get_clientdata(client);
+
+ regulator_disable(haptics->regulator);
}
static int drv260x_suspend(struct device *dev)
@@ -626,6 +644,7 @@ MODULE_DEVICE_TABLE(of, drv260x_of_match);
static struct i2c_driver drv260x_driver = {
.probe = drv260x_probe,
+ .remove = drv260x_remove,
.driver = {
.name = "drv260x-haptics",
.of_match_table = drv260x_of_match,
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 5/5] input: drv260x: Handle calibration timeout
2026-02-15 14:14 [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices Yauhen Kharuzhy
` (3 preceding siblings ...)
2026-02-15 14:14 ` [PATCH v2 4/5] input: drv260x: Fix unbalanced regulator_disable() call Yauhen Kharuzhy
@ 2026-02-15 14:14 ` Yauhen Kharuzhy
2026-02-19 2:44 ` [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices Dmitry Torokhov
5 siblings, 0 replies; 10+ messages in thread
From: Yauhen Kharuzhy @ 2026-02-15 14:14 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input; +Cc: linux-kernel, Hans de Goede
If something goes wrong during calibration (for instance, if the 'enable'
GPIO was not properly defined), the GO bit may not be cleared after some
time, causing the driver to get stuck.
To prevent this, add a timeout check to the waiting loop and return an
error if it times out.
Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
---
drivers/input/misc/drv260x.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index 71fbdabc6589..7ab891210fad 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c
@@ -166,6 +166,12 @@
#define DRV260X_AUTOCAL_TIME_500MS (2 << 4)
#define DRV260X_AUTOCAL_TIME_1000MS (3 << 4)
+/*
+ * Timeout for waiting for the GO status bit, in seconds. Should be reasonably
+ * large to wait for a auto-calibration cycle completion.
+ */
+#define DRV260X_GO_TIMEOUT_S 5
+
/**
* struct drv260x_data -
* @input_dev: Pointer to the input device
@@ -309,6 +315,7 @@ static int drv260x_init(struct drv260x_data *haptics)
{
int error;
unsigned int cal_buf;
+ unsigned long timeout;
error = regmap_write(haptics->regmap,
DRV260X_RATED_VOLT, haptics->rated_voltage);
@@ -398,6 +405,7 @@ static int drv260x_init(struct drv260x_data *haptics)
return error;
}
+ timeout = jiffies + DRV260X_GO_TIMEOUT_S * HZ;
do {
usleep_range(15000, 15500);
error = regmap_read(haptics->regmap, DRV260X_GO, &cal_buf);
@@ -407,6 +415,11 @@ static int drv260x_init(struct drv260x_data *haptics)
error);
return error;
}
+ if (time_after(jiffies, timeout)) {
+ dev_err(&haptics->client->dev,
+ "Calibration timeout. The device cannot be used.\n");
+ return -ETIMEDOUT;
+ }
} while (cal_buf == DRV260X_GO_BIT);
return 0;
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 4/5] input: drv260x: Fix unbalanced regulator_disable() call
2026-02-15 14:14 ` [PATCH v2 4/5] input: drv260x: Fix unbalanced regulator_disable() call Yauhen Kharuzhy
@ 2026-02-19 2:43 ` Dmitry Torokhov
2026-02-19 10:11 ` Yauhen Kharuzhy
0 siblings, 1 reply; 10+ messages in thread
From: Dmitry Torokhov @ 2026-02-19 2:43 UTC (permalink / raw)
To: Yauhen Kharuzhy; +Cc: linux-input, linux-kernel, Hans de Goede
Hi Yauhen,
On Sun, Feb 15, 2026 at 04:14:34PM +0200, Yauhen Kharuzhy wrote:
> +static void drv260x_remove(struct i2c_client *client)
> +{
> + struct drv260x_data *haptics = i2c_get_clientdata(client);
> +
> + regulator_disable(haptics->regulator);
> }
This will result in power being shut off the first thing during
unbinding, which is too early.
I switched this to devm_add_action_or_reset() and applied.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices
2026-02-15 14:14 [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices Yauhen Kharuzhy
` (4 preceding siblings ...)
2026-02-15 14:14 ` [PATCH v2 5/5] input: drv260x: Handle calibration timeout Yauhen Kharuzhy
@ 2026-02-19 2:44 ` Dmitry Torokhov
5 siblings, 0 replies; 10+ messages in thread
From: Dmitry Torokhov @ 2026-02-19 2:44 UTC (permalink / raw)
To: Yauhen Kharuzhy; +Cc: linux-input, linux-kernel, Hans de Goede
On Sun, Feb 15, 2026 at 04:14:30PM +0200, Yauhen Kharuzhy wrote:
> Lenovo Yoga Book YB1-X90 and YB1-X91 tablets use haptics controllers
> DRV2604L. The X91 (Windows tablet) uses ACPI to define its configuration,
> such as I2C address and GPIO connections. The X90 (Android tablet)
> doesn't have it in the ACPI, but the device may be defined as an
> i2c_board in the x86-android-tablets driver.
>
> To support these variants, add an ACPI matching table and add additional
> I2C IDs to the I2C matching table (the driver supports DRV2604(L),
> DRV2605(L) devices).
>
> Also, implement a timeout for waiting for calibration,
> and fix the non-working suspend due to unbalanced regulator_disable() call.
Applied the series with a small modification in #4.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 4/5] input: drv260x: Fix unbalanced regulator_disable() call
2026-02-19 2:43 ` Dmitry Torokhov
@ 2026-02-19 10:11 ` Yauhen Kharuzhy
2026-02-24 22:45 ` Dmitry Torokhov
0 siblings, 1 reply; 10+ messages in thread
From: Yauhen Kharuzhy @ 2026-02-19 10:11 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, Hans de Goede
On Wed, Feb 18, 2026 at 06:43:30PM -0800, Dmitry Torokhov wrote:
> Hi Yauhen,
>
> On Sun, Feb 15, 2026 at 04:14:34PM +0200, Yauhen Kharuzhy wrote:
> > +static void drv260x_remove(struct i2c_client *client)
> > +{
> > + struct drv260x_data *haptics = i2c_get_clientdata(client);
> > +
> > + regulator_disable(haptics->regulator);
> > }
>
> This will result in power being shut off the first thing during
> unbinding, which is too early.
>
> I switched this to devm_add_action_or_reset() and applied.
Do you mean that, in this case, regulator_disable() may be called before any
devm_* registered actions? Good point, thanks.
--
Yauhen Kharuzhy
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 4/5] input: drv260x: Fix unbalanced regulator_disable() call
2026-02-19 10:11 ` Yauhen Kharuzhy
@ 2026-02-24 22:45 ` Dmitry Torokhov
0 siblings, 0 replies; 10+ messages in thread
From: Dmitry Torokhov @ 2026-02-24 22:45 UTC (permalink / raw)
To: Yauhen Kharuzhy; +Cc: linux-input, linux-kernel, Hans de Goede
On Thu, Feb 19, 2026 at 12:11:47PM +0200, Yauhen Kharuzhy wrote:
> On Wed, Feb 18, 2026 at 06:43:30PM -0800, Dmitry Torokhov wrote:
> > Hi Yauhen,
> >
> > On Sun, Feb 15, 2026 at 04:14:34PM +0200, Yauhen Kharuzhy wrote:
> > > +static void drv260x_remove(struct i2c_client *client)
> > > +{
> > > + struct drv260x_data *haptics = i2c_get_clientdata(client);
> > > +
> > > + regulator_disable(haptics->regulator);
> > > }
> >
> > This will result in power being shut off the first thing during
> > unbinding, which is too early.
> >
> > I switched this to devm_add_action_or_reset() and applied.
>
> Do you mean that, in this case, regulator_disable() may be called before any
> devm_* registered actions? Good point, thanks.
>
Yes, all devm* actions are run after remove() completes.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-02-24 22:45 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-15 14:14 [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 1/5] input: drv260x: Add I2C IDs for all device variants Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 2/5] input: drv260x: Sort all #include alphabetically Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 3/5] input: drv260x: Add support for ACPI-enumerated devices Yauhen Kharuzhy
2026-02-15 14:14 ` [PATCH v2 4/5] input: drv260x: Fix unbalanced regulator_disable() call Yauhen Kharuzhy
2026-02-19 2:43 ` Dmitry Torokhov
2026-02-19 10:11 ` Yauhen Kharuzhy
2026-02-24 22:45 ` Dmitry Torokhov
2026-02-15 14:14 ` [PATCH v2 5/5] input: drv260x: Handle calibration timeout Yauhen Kharuzhy
2026-02-19 2:44 ` [PATCH v2 0/5] DRV260x: Support ACPI-enumerated devices Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox