[PATCH 1/5] Input: tsc2007 - drop platform data support
From: Dmitry Torokhov
Date: Thu Nov 12 2026 - 01:55:28 EST
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@xxxxxxxxx>
---
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