public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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 2/5] input: drv260x: Add support for ACPI-enumerated devices
Date: Thu, 12 Feb 2026 01:46:52 +0200	[thread overview]
Message-ID: <20260211235902.4156624-3-jekhor@gmail.com> (raw)
In-Reply-To: <20260211235902.4156624-1-jekhor@gmail.com>

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 | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index 18360bdfe877..f613c81fa2ba 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c
@@ -15,6 +15,7 @@
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/regulator/consumer.h>
+#include <linux/acpi.h>
 
 #include <dt-bindings/input/ti-drv260x.h>
 
@@ -419,6 +420,12 @@ static const struct regmap_config drv260x_regmap_config = {
 	.cache_type = REGCACHE_NONE,
 };
 
+static const struct acpi_gpio_params enable_gpio = { 0, 0, false };
+static const struct acpi_gpio_mapping acpi_drv260x_default_gpios[] = {
+	{ "enable-gpio", &enable_gpio, 1 },
+	{ }
+};
+
 static int drv260x_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
@@ -426,6 +433,14 @@ static int drv260x_probe(struct i2c_client *client)
 	u32 voltage;
 	int error;
 
+	if (has_acpi_companion(dev)) {
+		error = devm_acpi_dev_add_driver_gpios(dev, acpi_drv260x_default_gpios);
+		if (error) {
+			dev_err(dev, "can't add GPIO ACPI mapping\n");
+			return error;
+		}
+	}
+
 	haptics = devm_kzalloc(dev, sizeof(*haptics), GFP_KERNEL);
 	if (!haptics)
 		return -ENOMEM;
@@ -484,8 +499,10 @@ static int drv260x_probe(struct i2c_client *client)
 		return error;
 	}
 
-	haptics->enable_gpio = devm_gpiod_get_optional(dev, "enable",
-						       GPIOD_OUT_HIGH);
+	haptics->enable_gpio = devm_gpiod_get_optional(dev,
+			"enable", GPIOD_OUT_HIGH);
+
+	dev_dbg(dev, "Enable gpio = 0x%p\n", haptics->enable_gpio);
 	if (IS_ERR(haptics->enable_gpio))
 		return PTR_ERR(haptics->enable_gpio);
 
@@ -606,6 +623,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 +646,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


  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 ` Yauhen Kharuzhy [this message]
2026-02-12 17:26   ` [PATCH 2/5] input: drv260x: Add support for ACPI-enumerated devices 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 ` [PATCH 5/5] input: drv260x: Don't try to disable dummy regulator Yauhen Kharuzhy
2026-02-12 17:41   ` 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-3-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