diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-07-11 10:27:12 -0700 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-08-04 18:10:40 -0700 |
| commit | d95f0c4e5b5350c1b0ba0280004449cba79cb2ad (patch) | |
| tree | 07c316279d70200923dccd9211440e51434da154 /drivers/input/touchscreen/tsc200x-core.c | |
| parent | 8bd2aa8529aca1f39bc2bfac4f68adc47c6bd1d7 (diff) | |
| download | linux-d95f0c4e5b5350c1b0ba0280004449cba79cb2ad.tar.gz linux-d95f0c4e5b5350c1b0ba0280004449cba79cb2ad.tar.bz2 linux-d95f0c4e5b5350c1b0ba0280004449cba79cb2ad.zip | |
Input: tsc2004/5 - fix handling of VIO power supply
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.
Link: https://lore.kernel.org/r/20240711172719.1248373-1-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen/tsc200x-core.c')
| -rw-r--r-- | drivers/input/touchscreen/tsc200x-core.c | 27 |
1 files changed, 4 insertions, 23 deletions
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); |
