linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "Heiko Stübner" <heiko@sntech.de>, linux-input@vger.kernel.org
Cc: Andreas Kemnade <andreas@kemnade.info>, linux-kernel@vger.kernel.org
Subject: [PATCH 03/18] Input: zforce_ts - remove support for platfrom data
Date: Fri, 23 Aug 2024 22:50:27 -0700	[thread overview]
Message-ID: <20240824055047.1706392-4-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com>

There are no in-tree users of platform data and any new ones should
either use device tree or static device properties, so let's remove
platform data support.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/zforce_ts.c   | 56 +++++++------------------
 include/linux/platform_data/zforce_ts.h | 15 -------
 2 files changed, 16 insertions(+), 55 deletions(-)
 delete mode 100644 include/linux/platform_data/zforce_ts.h

diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
index 350cec8508a3..5a8f79b800e6 100644
--- a/drivers/input/touchscreen/zforce_ts.c
+++ b/drivers/input/touchscreen/zforce_ts.c
@@ -9,21 +9,19 @@
  * Author: Pieter Truter<ptruter@intrinsyc.com>
  */
 
-#include <linux/module.h>
-#include <linux/hrtimer.h>
-#include <linux/slab.h>
-#include <linux/input.h>
-#include <linux/interrupt.h>
-#include <linux/i2c.h>
 #include <linux/delay.h>
-#include <linux/gpio/consumer.h>
 #include <linux/device.h>
-#include <linux/sysfs.h>
+#include <linux/gpio/consumer.h>
+#include <linux/i2c.h>
+#include <linux/input.h>
 #include <linux/input/mt.h>
 #include <linux/input/touchscreen.h>
-#include <linux/platform_data/zforce_ts.h>
-#include <linux/regulator/consumer.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
 #include <linux/of.h>
+#include <linux/property.h>
+#include <linux/regulator/consumer.h>
+#include <linux/slab.h>
 
 #define WAIT_TIMEOUT		msecs_to_jiffies(1000)
 
@@ -108,7 +106,6 @@ struct zforce_ts {
 	struct i2c_client	*client;
 	struct input_dev	*input;
 	struct touchscreen_properties prop;
-	const struct zforce_ts_platdata *pdata;
 	char			phys[32];
 
 	struct regulator	*reg_vdd;
@@ -702,39 +699,24 @@ static void zforce_reset(void *data)
 		regulator_disable(ts->reg_vdd);
 }
 
-static struct zforce_ts_platdata *zforce_parse_dt(struct device *dev)
+static void zforce_ts_parse_legacy_properties(struct zforce_ts *ts)
 {
-	struct zforce_ts_platdata *pdata;
-	struct device_node *np = dev->of_node;
-
-	if (!np)
-		return ERR_PTR(-ENOENT);
+	u32 x_max = 0;
+	u32 y_max = 0;
 
-	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		dev_err(dev, "failed to allocate platform data\n");
-		return ERR_PTR(-ENOMEM);
-	}
-
-	of_property_read_u32(np, "x-size", &pdata->x_max);
-	of_property_read_u32(np, "y-size", &pdata->y_max);
+	device_property_read_u32(&ts->client->dev, "x-size", &x_max);
+	input_set_abs_params(ts->input, ABS_MT_POSITION_X, 0, x_max, 0, 0);
 
-	return pdata;
+	device_property_read_u32(&ts->client->dev, "y-size", &y_max);
+	input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, y_max, 0, 0);
 }
 
 static int zforce_probe(struct i2c_client *client)
 {
-	const struct zforce_ts_platdata *pdata = dev_get_platdata(&client->dev);
 	struct zforce_ts *ts;
 	struct input_dev *input_dev;
 	int ret;
 
-	if (!pdata) {
-		pdata = zforce_parse_dt(&client->dev);
-		if (IS_ERR(pdata))
-			return PTR_ERR(pdata);
-	}
-
 	ts = devm_kzalloc(&client->dev, sizeof(struct zforce_ts), GFP_KERNEL);
 	if (!ts)
 		return -ENOMEM;
@@ -822,7 +804,6 @@ static int zforce_probe(struct i2c_client *client)
 	mutex_init(&ts->access_mutex);
 	mutex_init(&ts->command_mutex);
 
-	ts->pdata = pdata;
 	ts->client = client;
 	ts->input = input_dev;
 
@@ -837,12 +818,7 @@ static int zforce_probe(struct i2c_client *client)
 	__set_bit(EV_SYN, input_dev->evbit);
 	__set_bit(EV_ABS, input_dev->evbit);
 
-	/* For multi touch */
-	input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0,
-			     pdata->x_max, 0, 0);
-	input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0,
-			     pdata->y_max, 0, 0);
-
+	zforce_ts_parse_legacy_properties(ts);
 	touchscreen_parse_properties(input_dev, true, &ts->prop);
 	if (ts->prop.max_x == 0 || ts->prop.max_y == 0) {
 		dev_err(&client->dev, "no size specified\n");
diff --git a/include/linux/platform_data/zforce_ts.h b/include/linux/platform_data/zforce_ts.h
deleted file mode 100644
index 2463a4a856a6..000000000000
--- a/include/linux/platform_data/zforce_ts.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/* drivers/input/touchscreen/zforce.c
- *
- * Copyright (C) 2012-2013 MundoReader S.L.
- */
-
-#ifndef _LINUX_INPUT_ZFORCE_TS_H
-#define _LINUX_INPUT_ZFORCE_TS_H
-
-struct zforce_ts_platdata {
-	unsigned int x_max;
-	unsigned int y_max;
-};
-
-#endif /* _LINUX_INPUT_ZFORCE_TS_H */
-- 
2.46.0.295.g3b9ea8a38a-goog


  parent reply	other threads:[~2024-08-24  5:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-24  5:50 [PATCH 00/18] zforse_ts: assorted cleanups Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 01/18] Input: zforce_ts - use devm_add_action_or_reset() Dmitry Torokhov
2024-08-24 11:13   ` Heiko Stübner
2024-08-29 17:54     ` Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 02/18] Input: zforce_ts - simplify reporting of slot state Dmitry Torokhov
2024-08-24  5:50 ` Dmitry Torokhov [this message]
2024-08-24  5:50 ` [PATCH 04/18] Input: zforce_ts - do not explicitly set EV_SYN, etc bits Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 05/18] Input: zforce_ts - handle errors from input_mt_init_sots() Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 06/18] Input: zforce_ts - remove unneeded locking Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 07/18] Input: zforce_ts - ensure that pm_stay_awake() and pm_relax() are balanced Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 08/18] Input: zforce_ts - use guard notation when acquiring mutexes Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 09/18] Input: zforce_ts - switch to using get_unaligned_le16 Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 10/18] Input: zforce_ts - make parsing of contacts less confusing Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 11/18] Input: zforce_ts - do not ignore errors when acquiring regulator Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 12/18] Input: zforce_ts - use dev_err_probe() where appropriate Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 13/18] Input: zforce_ts - make zforce_idtable constant Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 14/18] Input: zforce_ts - stop treating VDD regulator as optional Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 15/18] Input: zforce_ts - switch to using devm_regulator_get_enable() Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 16/18] Input: zforce_ts - do not hardcode interrupt level Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 17/18] Input: zforce_ts - remove assert/deassert wrappers Dmitry Torokhov
2024-08-24  5:50 ` [PATCH 18/18] Input: zforce_ts - switch to using asynchronous probing Dmitry Torokhov
2024-09-02  8:08 ` [PATCH 00/18] zforse_ts: assorted cleanups Andreas Kemnade
2024-09-06  5:49   ` Dmitry Torokhov

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=20240824055047.1706392-4-dmitry.torokhov@gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=andreas@kemnade.info \
    --cc=heiko@sntech.de \
    --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;
as well as URLs for NNTP newsgroup(s).