Skip to content

Commit 2f06996

Browse files
bolilingmeng89006dtor
authored andcommitted
Input: cyttsp5 - add handling for vddio regulator
The Cypress touchscreen controllers are often used with external pull-up for the interrupt line and the I2C lines, so we might need to enable a regulator to bring the lines into usable state. Otherwise, this might cause spurious interrupts and reading from I2C will fail. Implement support for a "vddio-supply" that is enabled by the cyttsp5 driver so that the regulator gets enabled when needed. Signed-off-by: Lin, Meng-Bo <[email protected]> Acked-by: Alistair Francis <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent fade5a9 commit 2f06996

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

drivers/input/touchscreen/cyttsp5.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ struct cyttsp5 {
207207
int num_prv_rec;
208208
struct regmap *regmap;
209209
struct touchscreen_properties prop;
210-
struct regulator *vdd;
210+
struct regulator_bulk_data supplies[2];
211211
};
212212

213213
/*
@@ -817,7 +817,7 @@ static void cyttsp5_cleanup(void *data)
817817
{
818818
struct cyttsp5 *ts = data;
819819

820-
regulator_disable(ts->vdd);
820+
regulator_bulk_disable(ARRAY_SIZE(ts->supplies), ts->supplies);
821821
}
822822

823823
static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
@@ -840,19 +840,24 @@ static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
840840
init_completion(&ts->cmd_done);
841841

842842
/* Power up the device */
843-
ts->vdd = devm_regulator_get(dev, "vdd");
844-
if (IS_ERR(ts->vdd)) {
845-
error = PTR_ERR(ts->vdd);
843+
ts->supplies[0].supply = "vdd";
844+
ts->supplies[1].supply = "vddio";
845+
error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->supplies),
846+
ts->supplies);
847+
if (error) {
848+
dev_err(ts->dev, "Failed to get regulators, error %d\n", error);
846849
return error;
847850
}
848851

849852
error = devm_add_action_or_reset(dev, cyttsp5_cleanup, ts);
850853
if (error)
851854
return error;
852855

853-
error = regulator_enable(ts->vdd);
854-
if (error)
856+
error = regulator_bulk_enable(ARRAY_SIZE(ts->supplies), ts->supplies);
857+
if (error) {
858+
dev_err(ts->dev, "Failed to enable regulators, error %d\n", error);
855859
return error;
860+
}
856861

857862
ts->input = devm_input_allocate_device(dev);
858863
if (!ts->input) {

0 commit comments

Comments
 (0)