From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org, Sebastian Reichel <sre@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/6] Input: tsc2004/5 - fix handling of VIO power supply
Date: Thu, 11 Jul 2024 10:27:12 -0700 [thread overview]
Message-ID: <20240711172719.1248373-1-dmitry.torokhov@gmail.com> (raw)
The chip needs to be powered up before calling tsc200x_stop_scan() which
communicates with it; move the call to enable the regulator earlier in
tsc200x_probe().
At the same time switch to using devm_regulator_get_enable() to simplify
error handling. This also makes sure that regulator is not shut off too
early when unbinding the driver.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/touchscreen/tsc2004.c | 6 ------
drivers/input/touchscreen/tsc2005.c | 6 ------
drivers/input/touchscreen/tsc200x-core.c | 27 ++++--------------------
drivers/input/touchscreen/tsc200x-core.h | 1 -
4 files changed, 4 insertions(+), 36 deletions(-)
diff --git a/drivers/input/touchscreen/tsc2004.c b/drivers/input/touchscreen/tsc2004.c
index b673098535ad..787f2caf4f73 100644
--- a/drivers/input/touchscreen/tsc2004.c
+++ b/drivers/input/touchscreen/tsc2004.c
@@ -42,11 +42,6 @@ static int tsc2004_probe(struct i2c_client *i2c)
tsc2004_cmd);
}
-static void tsc2004_remove(struct i2c_client *i2c)
-{
- tsc200x_remove(&i2c->dev);
-}
-
static const struct i2c_device_id tsc2004_idtable[] = {
{ "tsc2004" },
{ }
@@ -70,7 +65,6 @@ static struct i2c_driver tsc2004_driver = {
},
.id_table = tsc2004_idtable,
.probe = tsc2004_probe,
- .remove = tsc2004_remove,
};
module_i2c_driver(tsc2004_driver);
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index 1b40ce0ca1b9..6fe8b41b3ecc 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -64,11 +64,6 @@ static int tsc2005_probe(struct spi_device *spi)
tsc2005_cmd);
}
-static void tsc2005_remove(struct spi_device *spi)
-{
- tsc200x_remove(&spi->dev);
-}
-
#ifdef CONFIG_OF
static const struct of_device_id tsc2005_of_match[] = {
{ .compatible = "ti,tsc2005" },
@@ -85,7 +80,6 @@ static struct spi_driver tsc2005_driver = {
.pm = pm_sleep_ptr(&tsc200x_pm_ops),
},
.probe = tsc2005_probe,
- .remove = tsc2005_remove,
};
module_spi_driver(tsc2005_driver);
diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c
index a4c0e9db9bb9..39789a27f65b 100644
--- a/drivers/input/touchscreen/tsc200x-core.c
+++ b/drivers/input/touchscreen/tsc200x-core.c
@@ -104,8 +104,6 @@ struct tsc200x {
bool pen_down;
- struct regulator *vio;
-
struct gpio_desc *reset_gpio;
int (*tsc200x_cmd)(struct device *dev, u8 cmd);
int irq;
@@ -495,10 +493,9 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
return error;
}
- ts->vio = devm_regulator_get(dev, "vio");
- if (IS_ERR(ts->vio)) {
- error = PTR_ERR(ts->vio);
- dev_err(dev, "error acquiring vio regulator: %d", error);
+ error = devm_regulator_get_enable(dev, "vio");
+ if (error) {
+ dev_err(dev, "error acquiring vio regulator: %d\n", error);
return error;
}
@@ -554,36 +551,20 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
return error;
}
- error = regulator_enable(ts->vio);
- if (error)
- return error;
-
dev_set_drvdata(dev, ts);
error = input_register_device(ts->idev);
if (error) {
dev_err(dev,
"Failed to register input device, err: %d\n", error);
- goto disable_regulator;
+ return error;
}
irq_set_irq_wake(irq, 1);
return 0;
-
-disable_regulator:
- regulator_disable(ts->vio);
- return error;
}
EXPORT_SYMBOL_GPL(tsc200x_probe);
-void tsc200x_remove(struct device *dev)
-{
- struct tsc200x *ts = dev_get_drvdata(dev);
-
- regulator_disable(ts->vio);
-}
-EXPORT_SYMBOL_GPL(tsc200x_remove);
-
static int tsc200x_suspend(struct device *dev)
{
struct tsc200x *ts = dev_get_drvdata(dev);
diff --git a/drivers/input/touchscreen/tsc200x-core.h b/drivers/input/touchscreen/tsc200x-core.h
index 37de91efd78e..e76ba7a889dd 100644
--- a/drivers/input/touchscreen/tsc200x-core.h
+++ b/drivers/input/touchscreen/tsc200x-core.h
@@ -75,6 +75,5 @@ extern const struct attribute_group *tsc200x_groups[];
int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
struct regmap *regmap,
int (*tsc200x_cmd)(struct device *dev, u8 cmd));
-void tsc200x_remove(struct device *dev);
#endif
--
2.45.2.993.g49e7a77208-goog
next reply other threads:[~2024-07-11 17:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 17:27 Dmitry Torokhov [this message]
2024-07-11 17:27 ` [PATCH 2/6] Input: tsc2004/5 - do not hard code interrupt trigger Dmitry Torokhov
2024-07-11 17:27 ` [PATCH 3/6] Input: tsc2004/5 - fix reset handling on probe Dmitry Torokhov
2024-07-11 17:27 ` [PATCH 4/6] Input: tsc2004/5 - do not use irq_set_irq_wake() directly Dmitry Torokhov
2024-07-11 17:27 ` [PATCH 5/6] Input: tsc2004/5 - respect "wakeup-source" property Dmitry Torokhov
2024-07-11 17:27 ` [PATCH 6/6] Input: tsc2004/5 - use guard notation when acquiring mutexes/locks Dmitry Torokhov
2024-08-05 1:11 ` [PATCH 1/6] Input: tsc2004/5 - fix handling of VIO power supply 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=20240711172719.1248373-1-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sre@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
all inboxes | Powered by JetHome®