Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH 0/5] Input: tsc2007 - drop platform data support and cleanups
@ 2026-11-12  6:50 Dmitry Torokhov
  2026-11-12  6:50 ` [PATCH 1/5] Input: tsc2007 - drop platform data support Dmitry Torokhov
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-12  6:50 UTC (permalink / raw)
  To: Svyatoslav Ryhel, H . Nikolaus Schaller,
	John Paul Adrian Glaubitz, Yoshinori Sato, Rich Felker
  Cc: Andy Shevchenko, Andreas Kemnade, Johannes Kirchmair, Yuki Horii,
	Geert Uytterhoeven, Kuninori Morimoto, linux-input, linux-sh,
	linux-kernel

Now that all in-tree boards using tsc2007 (including SuperH ecovec24)
have been converted to generic device properties, this series drops
legacy platform data support and its header file, removes redundant
memory barriers, fixes minor coding style issues, skips registering a
non-functional input device when no interrupt is wired (when the chip is
used purely as an IIO ADC), and uses IRQF_NO_AUTOEN when requesting the
threaded interrupt.

Thanks.

Dmitry Torokhov (5):
  Input: tsc2007 - drop platform data support
  Input: tsc2007 - remove unneeded memory barriers
  Input: tsc2007 - fix minor coding style issues
  Input: tsc2007 - do not register input device without IRQ
  Input: tsc2007 - use IRQF_NO_AUTOEN when requesting interrupt

 arch/sh/boards/mach-ecovec24/setup.c     |   1 -
 drivers/input/touchscreen/tsc2007.h      |   5 +-
 drivers/input/touchscreen/tsc2007_core.c | 183 ++++++++---------------
 include/linux/platform_data/tsc2007.h    |  23 ---
 4 files changed, 60 insertions(+), 152 deletions(-)
 delete mode 100644 include/linux/platform_data/tsc2007.h

-- 
2.56.0.567.gdb80ae8cd5-goog


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] Input: tsc2007 - drop platform data support
  2026-11-12  6:50 [PATCH 0/5] Input: tsc2007 - drop platform data support and cleanups Dmitry Torokhov
@ 2026-11-12  6:50 ` Dmitry Torokhov
  2026-11-12  6:50 ` [PATCH 2/5] Input: tsc2007 - remove unneeded memory barriers Dmitry Torokhov
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-12  6:50 UTC (permalink / raw)
  To: Svyatoslav Ryhel, H . Nikolaus Schaller,
	John Paul Adrian Glaubitz, Yoshinori Sato, Rich Felker
  Cc: Andy Shevchenko, Andreas Kemnade, Johannes Kirchmair, Yuki Horii,
	Geert Uytterhoeven, Kuninori Morimoto, linux-input, linux-sh,
	linux-kernel

Now that all in-tree board files (including SuperH ecovec24) have been
converted to generic device properties, legacy platform data support
is no longer needed.

Remove the platform data structure and associated hardware callbacks
from the driver, check the pen-down GPIO directly, and remove the
unused platform data header file.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/sh/boards/mach-ecovec24/setup.c     |  1 -
 drivers/input/touchscreen/tsc2007.h      |  4 --
 drivers/input/touchscreen/tsc2007_core.c | 89 +++---------------------
 include/linux/platform_data/tsc2007.h    | 23 ------
 4 files changed, 10 insertions(+), 107 deletions(-)
 delete mode 100644 include/linux/platform_data/tsc2007.h

diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index f662a296a54c..1e41ed9d2cce 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -24,7 +24,6 @@
 #include <linux/gpio/machine.h>
 #include <linux/platform_data/gpio_backlight.h>
 #include <linux/platform_data/tmio.h>
-#include <linux/platform_data/tsc2007.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
 #include <linux/regulator/fixed.h>
diff --git a/drivers/input/touchscreen/tsc2007.h b/drivers/input/touchscreen/tsc2007.h
index e346fb4f7552..f65186b8e709 100644
--- a/drivers/input/touchscreen/tsc2007.h
+++ b/drivers/input/touchscreen/tsc2007.h
@@ -65,7 +65,6 @@ struct tsc2007 {
 	struct i2c_client	*client;
 
 	struct touchscreen_properties prop;
-	u16			model;
 	u16			x_plate_ohms;
 	u16			max_rt;
 	unsigned long		poll_period; /* in jiffies */
@@ -79,9 +78,6 @@ struct tsc2007 {
 	wait_queue_head_t	wait;
 	bool			stopped;
 
-	int			(*get_pendown_state)(struct device *);
-	void			(*clear_penirq)(void);
-
 	struct mutex		mlock;
 };
 
diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index e8d87cf00f8e..b3c4c0c9c42d 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -25,7 +25,6 @@
 #include <linux/i2c.h>
 #include <linux/math64.h>
 #include <linux/property.h>
-#include <linux/platform_data/tsc2007.h>
 #include "tsc2007.h"
 
 int tsc2007_xfer(struct tsc2007 *tsc, u8 cmd)
@@ -97,15 +96,15 @@ bool tsc2007_is_pen_down(struct tsc2007 *ts)
 	 *
 	 * The only safe way to check for the pen up condition is in the
 	 * work function by reading the pen signal state (it's a GPIO
-	 * and IRQ). Unfortunately such callback is not always available,
-	 * in that case we assume that the pen is down and expect caller
-	 * to fall back on the pressure reading.
+	 * and IRQ). When the GPIO is not available, we assume that the
+	 * pen is down and expect caller to fall back on the pressure
+	 * reading.
 	 */
 
-	if (!ts->get_pendown_state)
+	if (!ts->gpiod)
 		return true;
 
-	return ts->get_pendown_state(&ts->client->dev);
+	return gpiod_get_value_cansleep(ts->gpiod);
 }
 
 static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
@@ -126,11 +125,11 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
 
 		rt = tsc2007_calculate_resistance(ts, &tc);
 
-		if (!rt && !ts->get_pendown_state) {
+		if (!rt && !ts->gpiod) {
 			/*
 			 * If pressure reported is 0 and we don't have
-			 * callback to check pendown state, we have to
-			 * assume that pen was lifted up.
+			 * GPIO to check pendown state, we have to assume
+			 * that pen was lifted up.
 			 */
 			break;
 		}
@@ -166,9 +165,6 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
 	input_report_abs(input, ABS_PRESSURE, 0);
 	input_sync(input);
 
-	if (ts->clear_penirq)
-		ts->clear_penirq();
-
 	return IRQ_HANDLED;
 }
 
@@ -210,14 +206,6 @@ static void tsc2007_close(struct input_dev *input_dev)
 	tsc2007_stop(ts);
 }
 
-static int tsc2007_get_pendown_state_gpio(struct device *dev)
-{
-	struct i2c_client *client = to_i2c_client(dev);
-	struct tsc2007 *ts = i2c_get_clientdata(client);
-
-	return gpiod_get_value_cansleep(ts->gpiod);
-}
-
 static int tsc2007_probe_properties(struct device *dev, struct tsc2007 *ts)
 {
 	u32 val32;
@@ -252,49 +240,14 @@ static int tsc2007_probe_properties(struct device *dev, struct tsc2007 *ts)
 	if (IS_ERR(ts->gpiod))
 		return PTR_ERR(ts->gpiod);
 
-	if (ts->gpiod)
-		ts->get_pendown_state = tsc2007_get_pendown_state_gpio;
-	else
+	if (!ts->gpiod)
 		dev_dbg(dev, "Pen down GPIO is not specified in properties\n");
 
 	return 0;
 }
 
-static int tsc2007_probe_pdev(struct device *dev, struct tsc2007 *ts,
-			      const struct tsc2007_platform_data *pdata,
-			      const struct i2c_device_id *id)
-{
-	ts->model             = pdata->model;
-	ts->x_plate_ohms      = pdata->x_plate_ohms;
-	ts->max_rt            = pdata->max_rt ? : MAX_12BIT;
-	ts->poll_period       = msecs_to_jiffies(pdata->poll_period ? : 1);
-	ts->get_pendown_state = pdata->get_pendown_state;
-	ts->clear_penirq      = pdata->clear_penirq;
-	ts->fuzzx             = pdata->fuzzx;
-	ts->fuzzy             = pdata->fuzzy;
-	ts->fuzzz             = pdata->fuzzz;
-
-	if (pdata->x_plate_ohms == 0) {
-		dev_err(dev, "x_plate_ohms is not set up in platform data\n");
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-static void tsc2007_call_exit_platform_hw(void *data)
-{
-	struct device *dev = data;
-	const struct tsc2007_platform_data *pdata = dev_get_platdata(dev);
-
-	pdata->exit_platform_hw();
-}
-
 static int tsc2007_probe(struct i2c_client *client)
 {
-	const struct i2c_device_id *id = i2c_client_get_device_id(client);
-	const struct tsc2007_platform_data *pdata =
-		dev_get_platdata(&client->dev);
 	struct tsc2007 *ts;
 	struct input_dev *input_dev;
 	int err;
@@ -307,10 +260,7 @@ static int tsc2007_probe(struct i2c_client *client)
 	if (!ts)
 		return -ENOMEM;
 
-	if (pdata)
-		err = tsc2007_probe_pdev(&client->dev, ts, pdata, id);
-	else
-		err = tsc2007_probe_properties(&client->dev, ts);
+	err = tsc2007_probe_properties(&client->dev, ts);
 	if (err)
 		return err;
 
@@ -318,8 +268,6 @@ static int tsc2007_probe(struct i2c_client *client)
 	if (!input_dev)
 		return -ENOMEM;
 
-	i2c_set_clientdata(client, ts);
-
 	ts->client = client;
 	ts->irq = client->irq;
 	ts->input = input_dev;
@@ -346,23 +294,6 @@ static int tsc2007_probe(struct i2c_client *client)
 	input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT,
 			     ts->fuzzz, 0);
 
-	if (pdata) {
-		if (pdata->exit_platform_hw) {
-			err = devm_add_action(&client->dev,
-					      tsc2007_call_exit_platform_hw,
-					      &client->dev);
-			if (err) {
-				dev_err(&client->dev,
-					"Failed to register exit_platform_hw action, %d\n",
-					err);
-				return err;
-			}
-		}
-
-		if (pdata->init_platform_hw)
-			pdata->init_platform_hw();
-	}
-
 	if (ts->irq) {
 		err = devm_request_threaded_irq(&client->dev, ts->irq,
 						NULL, tsc2007_soft_irq,
diff --git a/include/linux/platform_data/tsc2007.h b/include/linux/platform_data/tsc2007.h
deleted file mode 100644
index a0ca52c41ccb..000000000000
--- a/include/linux/platform_data/tsc2007.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __LINUX_I2C_TSC2007_H
-#define __LINUX_I2C_TSC2007_H
-
-/* linux/platform_data/tsc2007.h */
-
-struct tsc2007_platform_data {
-	u16	model;				/* 2007. */
-	u16	x_plate_ohms;	/* must be non-zero value */
-	u16	max_rt; /* max. resistance above which samples are ignored */
-	unsigned long poll_period; /* time (in ms) between samples */
-	int	fuzzx; /* fuzz factor for X, Y and pressure axes */
-	int	fuzzy;
-	int	fuzzz;
-
-	int	(*get_pendown_state)(struct device *);
-	/* If needed, clear 2nd level interrupt source */
-	void	(*clear_penirq)(void);
-	int	(*init_platform_hw)(void);
-	void	(*exit_platform_hw)(void);
-};
-
-#endif
-- 
2.56.0.567.gdb80ae8cd5-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] Input: tsc2007 - remove unneeded memory barriers
  2026-11-12  6:50 [PATCH 0/5] Input: tsc2007 - drop platform data support and cleanups Dmitry Torokhov
  2026-11-12  6:50 ` [PATCH 1/5] Input: tsc2007 - drop platform data support Dmitry Torokhov
@ 2026-11-12  6:50 ` Dmitry Torokhov
  2026-11-12  6:50 ` [PATCH 3/5] Input: tsc2007 - fix minor coding style issues Dmitry Torokhov
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-12  6:50 UTC (permalink / raw)
  To: Svyatoslav Ryhel, H . Nikolaus Schaller,
	John Paul Adrian Glaubitz, Yoshinori Sato, Rich Felker
  Cc: Andy Shevchenko, Andreas Kemnade, Johannes Kirchmair, Yuki Horii,
	Geert Uytterhoeven, Kuninori Morimoto, linux-input, linux-sh,
	linux-kernel

The driver invokes mb() after setting the stopped flag in tsc2007_stop()
and tsc2007_open(). These mandatory barriers lack pairing barriers on
the reader side and are unnecessary.

The wait queue operations wake_up() and wait_event_timeout(), along
with disable_irq() and enable_irq(), already provide the required
synchronization and memory ordering when stopping and starting the
touchscreen worker thread. Remove the redundant barriers.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/tsc2007_core.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index b3c4c0c9c42d..51e4d985afcc 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -171,7 +171,6 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
 static void tsc2007_stop(struct tsc2007 *ts)
 {
 	ts->stopped = true;
-	mb();
 	wake_up(&ts->wait);
 
 	if (ts->irq)
@@ -184,7 +183,6 @@ static int tsc2007_open(struct input_dev *input_dev)
 	int err;
 
 	ts->stopped = false;
-	mb();
 
 	if (ts->irq)
 		enable_irq(ts->irq);
-- 
2.56.0.567.gdb80ae8cd5-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] Input: tsc2007 - fix minor coding style issues
  2026-11-12  6:50 [PATCH 0/5] Input: tsc2007 - drop platform data support and cleanups Dmitry Torokhov
  2026-11-12  6:50 ` [PATCH 1/5] Input: tsc2007 - drop platform data support Dmitry Torokhov
  2026-11-12  6:50 ` [PATCH 2/5] Input: tsc2007 - remove unneeded memory barriers Dmitry Torokhov
@ 2026-11-12  6:50 ` Dmitry Torokhov
  2026-11-12  6:50 ` [PATCH 4/5] Input: tsc2007 - do not register input device without IRQ Dmitry Torokhov
  2026-11-12  6:50 ` [PATCH 5/5] Input: tsc2007 - use IRQF_NO_AUTOEN when requesting interrupt Dmitry Torokhov
  4 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-12  6:50 UTC (permalink / raw)
  To: Svyatoslav Ryhel, H . Nikolaus Schaller,
	John Paul Adrian Glaubitz, Yoshinori Sato, Rich Felker
  Cc: Andy Shevchenko, Andreas Kemnade, Johannes Kirchmair, Yuki Horii,
	Geert Uytterhoeven, Kuninori Morimoto, linux-input, linux-sh,
	linux-kernel

Fix minor checkpatch warnings and checks across the tsc2007 driver:
document the mutex used to serialize I2C transfers between interrupt
handling and IIO reads, remove an unnecessary blank line following a
loop opening brace, and drop extraneous spacing after a cast.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/tsc2007.h      | 1 +
 drivers/input/touchscreen/tsc2007_core.c | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2007.h b/drivers/input/touchscreen/tsc2007.h
index f65186b8e709..e5153b420371 100644
--- a/drivers/input/touchscreen/tsc2007.h
+++ b/drivers/input/touchscreen/tsc2007.h
@@ -78,6 +78,7 @@ struct tsc2007 {
 	wait_queue_head_t	wait;
 	bool			stopped;
 
+	/* Serializes I2C transfers between the ISR and IIO reads */
 	struct mutex		mlock;
 };
 
diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index 51e4d985afcc..8197ad91ed8b 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -82,7 +82,7 @@ u32 tsc2007_calculate_resistance(struct tsc2007 *tsc, struct ts_event *tc)
 
 	if (rt > U32_MAX)
 		return U32_MAX;
-	return (u32) rt;
+	return (u32)rt;
 }
 
 bool tsc2007_is_pen_down(struct tsc2007 *ts)
@@ -115,7 +115,6 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
 	u32 rt;
 
 	while (!ts->stopped && tsc2007_is_pen_down(ts)) {
-
 		/* pen is down, continue with the measurement */
 
 		/* Serialize access between the ISR and IIO reads. */
-- 
2.56.0.567.gdb80ae8cd5-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] Input: tsc2007 - do not register input device without IRQ
  2026-11-12  6:50 [PATCH 0/5] Input: tsc2007 - drop platform data support and cleanups Dmitry Torokhov
                   ` (2 preceding siblings ...)
  2026-11-12  6:50 ` [PATCH 3/5] Input: tsc2007 - fix minor coding style issues Dmitry Torokhov
@ 2026-11-12  6:50 ` Dmitry Torokhov
  2026-11-12  6:50 ` [PATCH 5/5] Input: tsc2007 - use IRQF_NO_AUTOEN when requesting interrupt Dmitry Torokhov
  4 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-12  6:50 UTC (permalink / raw)
  To: Svyatoslav Ryhel, H . Nikolaus Schaller,
	John Paul Adrian Glaubitz, Yoshinori Sato, Rich Felker
  Cc: Andy Shevchenko, Andreas Kemnade, Johannes Kirchmair, Yuki Horii,
	Geert Uytterhoeven, Kuninori Morimoto, linux-input, linux-sh,
	linux-kernel

The driver has no polled input mode and only reports touchscreen input
events from its threaded interrupt handler. When no interrupt is wired,
the device is used solely as an IIO ADC, so registering an input device
serves no purpose and creates a non-functional input node.

Only allocate, configure, and register the input device when an
interrupt is present. This also allows removing the unnecessary
ts->irq checks in the open and stop callbacks.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/tsc2007_core.c | 95 +++++++++++++-----------
 1 file changed, 51 insertions(+), 44 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index 8197ad91ed8b..1fb2c26189ba 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -172,8 +172,7 @@ static void tsc2007_stop(struct tsc2007 *ts)
 	ts->stopped = true;
 	wake_up(&ts->wait);
 
-	if (ts->irq)
-		disable_irq(ts->irq);
+	disable_irq(ts->irq);
 }
 
 static int tsc2007_open(struct input_dev *input_dev)
@@ -182,9 +181,7 @@ static int tsc2007_open(struct input_dev *input_dev)
 	int err;
 
 	ts->stopped = false;
-
-	if (ts->irq)
-		enable_irq(ts->irq);
+	enable_irq(ts->irq);
 
 	/* Prepare for touch readings - power down ADC and enable PENIRQ */
 	err = tsc2007_xfer(ts, PWRDOWN);
@@ -243,37 +240,19 @@ static int tsc2007_probe_properties(struct device *dev, struct tsc2007 *ts)
 	return 0;
 }
 
-static int tsc2007_probe(struct i2c_client *client)
+static int tsc2007_input_configure(struct tsc2007 *ts)
 {
-	struct tsc2007 *ts;
+	struct device *dev = &ts->client->dev;
 	struct input_dev *input_dev;
 	int err;
 
-	if (!i2c_check_functionality(client->adapter,
-				     I2C_FUNC_SMBUS_READ_WORD_DATA))
-		return -EIO;
-
-	ts = devm_kzalloc_obj(&client->dev, struct tsc2007);
-	if (!ts)
-		return -ENOMEM;
-
-	err = tsc2007_probe_properties(&client->dev, ts);
-	if (err)
-		return err;
-
-	input_dev = devm_input_allocate_device(&client->dev);
+	input_dev = devm_input_allocate_device(dev);
 	if (!input_dev)
 		return -ENOMEM;
 
-	ts->client = client;
-	ts->irq = client->irq;
 	ts->input = input_dev;
 
-	init_waitqueue_head(&ts->wait);
-	mutex_init(&ts->mlock);
-
-	snprintf(ts->phys, sizeof(ts->phys),
-		 "%s/input0", dev_name(&client->dev));
+	snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(dev));
 
 	input_dev->name = "TSC2007 Touchscreen";
 	input_dev->phys = ts->phys;
@@ -291,20 +270,49 @@ static int tsc2007_probe(struct i2c_client *client)
 	input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT,
 			     ts->fuzzz, 0);
 
-	if (ts->irq) {
-		err = devm_request_threaded_irq(&client->dev, ts->irq,
-						NULL, tsc2007_soft_irq,
-						IRQF_ONESHOT,
-						client->dev.driver->name, ts);
-		if (err) {
-			dev_err(&client->dev, "Failed to request irq %d: %d\n",
-				ts->irq, err);
-			return err;
-		}
+	err = devm_request_threaded_irq(dev, ts->irq,
+					NULL, tsc2007_soft_irq,
+					IRQF_ONESHOT,
+					dev->driver->name, ts);
+	if (err) {
+		dev_err(dev, "Failed to request irq %d: %d\n", ts->irq, err);
+		return err;
+	}
 
-		tsc2007_stop(ts);
+	tsc2007_stop(ts);
+
+	err = input_register_device(input_dev);
+	if (err) {
+		dev_err(dev, "Failed to register input device: %d\n", err);
+		return err;
 	}
 
+	return 0;
+}
+
+static int tsc2007_probe(struct i2c_client *client)
+{
+	struct tsc2007 *ts;
+	int err;
+
+	if (!i2c_check_functionality(client->adapter,
+				     I2C_FUNC_SMBUS_READ_WORD_DATA))
+		return -EIO;
+
+	ts = devm_kzalloc_obj(&client->dev, struct tsc2007);
+	if (!ts)
+		return -ENOMEM;
+
+	ts->client = client;
+	ts->irq = client->irq;
+
+	init_waitqueue_head(&ts->wait);
+	mutex_init(&ts->mlock);
+
+	err = tsc2007_probe_properties(&client->dev, ts);
+	if (err)
+		return err;
+
 	/* power down the chip (TSC2007_SETUP does not ACK on I2C) */
 	err = tsc2007_xfer(ts, PWRDOWN);
 	if (err < 0) {
@@ -313,14 +321,13 @@ static int tsc2007_probe(struct i2c_client *client)
 		return err;	/* chip does not respond */
 	}
 
-	err = input_register_device(input_dev);
-	if (err) {
-		dev_err(&client->dev,
-			"Failed to register input device: %d\n", err);
-		return err;
+	if (ts->irq) {
+		err = tsc2007_input_configure(ts);
+		if (err)
+			return err;
 	}
 
-	err =  tsc2007_iio_configure(ts);
+	err = tsc2007_iio_configure(ts);
 	if (err) {
 		dev_err(&client->dev,
 			"Failed to register with IIO: %d\n", err);
-- 
2.56.0.567.gdb80ae8cd5-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] Input: tsc2007 - use IRQF_NO_AUTOEN when requesting interrupt
  2026-11-12  6:50 [PATCH 0/5] Input: tsc2007 - drop platform data support and cleanups Dmitry Torokhov
                   ` (3 preceding siblings ...)
  2026-11-12  6:50 ` [PATCH 4/5] Input: tsc2007 - do not register input device without IRQ Dmitry Torokhov
@ 2026-11-12  6:50 ` Dmitry Torokhov
  4 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-12  6:50 UTC (permalink / raw)
  To: Svyatoslav Ryhel, H . Nikolaus Schaller,
	John Paul Adrian Glaubitz, Yoshinori Sato, Rich Felker
  Cc: Andy Shevchenko, Andreas Kemnade, Johannes Kirchmair, Yuki Horii,
	Geert Uytterhoeven, Kuninori Morimoto, linux-input, linux-sh,
	linux-kernel

Request the threaded interrupt with IRQF_NO_AUTOEN so that the interrupt
line remains disabled after probe until the input device is opened by
user space. Explicitly initialize the stopped flag to true before
requesting the interrupt and drop the immediate tsc2007_stop() call.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/tsc2007_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index 1fb2c26189ba..7660504f58ff 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -270,17 +270,17 @@ static int tsc2007_input_configure(struct tsc2007 *ts)
 	input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT,
 			     ts->fuzzz, 0);
 
+	ts->stopped = true;
+
 	err = devm_request_threaded_irq(dev, ts->irq,
 					NULL, tsc2007_soft_irq,
-					IRQF_ONESHOT,
+					IRQF_ONESHOT | IRQF_NO_AUTOEN,
 					dev->driver->name, ts);
 	if (err) {
 		dev_err(dev, "Failed to request irq %d: %d\n", ts->irq, err);
 		return err;
 	}
 
-	tsc2007_stop(ts);
-
 	err = input_register_device(input_dev);
 	if (err) {
 		dev_err(dev, "Failed to register input device: %d\n", err);
-- 
2.56.0.567.gdb80ae8cd5-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-12  6:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12  6:50 [PATCH 0/5] Input: tsc2007 - drop platform data support and cleanups Dmitry Torokhov
2026-11-12  6:50 ` [PATCH 1/5] Input: tsc2007 - drop platform data support Dmitry Torokhov
2026-11-12  6:50 ` [PATCH 2/5] Input: tsc2007 - remove unneeded memory barriers Dmitry Torokhov
2026-11-12  6:50 ` [PATCH 3/5] Input: tsc2007 - fix minor coding style issues Dmitry Torokhov
2026-11-12  6:50 ` [PATCH 4/5] Input: tsc2007 - do not register input device without IRQ Dmitry Torokhov
2026-11-12  6:50 ` [PATCH 5/5] Input: tsc2007 - use IRQF_NO_AUTOEN when requesting interrupt Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox