Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <linmengbo0689@protonmail.com>
Acked-by: Alistair Francis <alistair@alistair23.me>
Link: https://lore.kernel.org/r/20221117190507.87535-3-linmengbo0689@protonmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Lin, Meng-Bo and committed by
Dmitry Torokhov
2f06996d fade5a92

+12 -7
+12 -7
drivers/input/touchscreen/cyttsp5.c
··· 207 207 int num_prv_rec; 208 208 struct regmap *regmap; 209 209 struct touchscreen_properties prop; 210 - struct regulator *vdd; 210 + struct regulator_bulk_data supplies[2]; 211 211 }; 212 212 213 213 /* ··· 817 817 { 818 818 struct cyttsp5 *ts = data; 819 819 820 - regulator_disable(ts->vdd); 820 + regulator_bulk_disable(ARRAY_SIZE(ts->supplies), ts->supplies); 821 821 } 822 822 823 823 static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq, ··· 840 840 init_completion(&ts->cmd_done); 841 841 842 842 /* 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); 846 849 return error; 847 850 } 848 851 ··· 853 850 if (error) 854 851 return error; 855 852 856 - error = regulator_enable(ts->vdd); 857 - if (error) 853 + error = regulator_bulk_enable(ARRAY_SIZE(ts->supplies), ts->supplies); 854 + if (error) { 855 + dev_err(ts->dev, "Failed to enable regulators, error %d\n", error); 858 856 return error; 857 + } 859 858 860 859 ts->input = devm_input_allocate_device(dev); 861 860 if (!ts->input) {