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

Input: edt-ft5x06 - add support for regulator

Add the support for enabling optional regulator that may be used as VCC
source.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
Signed-off-by: Ondrej Jirman <megous@megous.com>
Reviewed-by: Rob Herring <robh@kernel.org> # bindings
Link: https://lore.kernel.org/r/20191029005806.3577376-2-megous@megous.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Mylène Josserand and committed by
Dmitry Torokhov
7448bfec a1b92973

+31
+1
Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
··· 30 30 Optional properties: 31 31 - reset-gpios: GPIO specification for the RESET input 32 32 - wake-gpios: GPIO specification for the WAKE input 33 + - vcc-supply: Regulator that supplies the touchscreen 33 34 34 35 - pinctrl-names: should be "default" 35 36 - pinctrl-0: a phandle pointing to the pin settings for the
+30
drivers/input/touchscreen/edt-ft5x06.c
··· 28 28 #include <linux/input/mt.h> 29 29 #include <linux/input/touchscreen.h> 30 30 #include <asm/unaligned.h> 31 + #include <linux/regulator/consumer.h> 31 32 32 33 #define WORK_REGISTER_THRESHOLD 0x00 33 34 #define WORK_REGISTER_REPORT_RATE 0x08 ··· 89 88 struct touchscreen_properties prop; 90 89 u16 num_x; 91 90 u16 num_y; 91 + struct regulator *vcc; 92 92 93 93 struct gpio_desc *reset_gpio; 94 94 struct gpio_desc *wake_gpio; ··· 1038 1036 } 1039 1037 } 1040 1038 1039 + static void edt_ft5x06_disable_regulator(void *arg) 1040 + { 1041 + struct edt_ft5x06_ts_data *data = arg; 1042 + 1043 + regulator_disable(data->vcc); 1044 + } 1045 + 1041 1046 static int edt_ft5x06_ts_probe(struct i2c_client *client, 1042 1047 const struct i2c_device_id *id) 1043 1048 { ··· 1072 1063 } 1073 1064 1074 1065 tsdata->max_support_points = chip_data->max_support_points; 1066 + 1067 + tsdata->vcc = devm_regulator_get(&client->dev, "vcc"); 1068 + if (IS_ERR(tsdata->vcc)) { 1069 + error = PTR_ERR(tsdata->vcc); 1070 + if (error != -EPROBE_DEFER) 1071 + dev_err(&client->dev, 1072 + "failed to request regulator: %d\n", error); 1073 + return error; 1074 + } 1075 + 1076 + error = regulator_enable(tsdata->vcc); 1077 + if (error < 0) { 1078 + dev_err(&client->dev, "failed to enable vcc: %d\n", error); 1079 + return error; 1080 + } 1081 + 1082 + error = devm_add_action_or_reset(&client->dev, 1083 + edt_ft5x06_disable_regulator, 1084 + tsdata); 1085 + if (error) 1086 + return error; 1075 1087 1076 1088 tsdata->reset_gpio = devm_gpiod_get_optional(&client->dev, 1077 1089 "reset", GPIOD_OUT_HIGH);