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

Input: exc3000 - add reset gpio support

Add basic support for an optional reset gpio.

Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20200805160520.456570-4-sebastian.reichel@collabora.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Sebastian Reichel and committed by
Dmitry Torokhov
27aced19 3bdd21c6

+19
+2
Documentation/devicetree/bindings/input/touchscreen/eeti,exc3000.yaml
··· 22 22 const: 0x2a 23 23 interrupts: 24 24 maxItems: 1 25 + reset-gpios: 26 + maxItems: 1 25 27 touchscreen-size-x: true 26 28 touchscreen-size-y: true 27 29 touchscreen-inverted-x: true
+17
drivers/input/touchscreen/exc3000.c
··· 8 8 */ 9 9 10 10 #include <linux/bitops.h> 11 + #include <linux/delay.h> 11 12 #include <linux/device.h> 13 + #include <linux/gpio/consumer.h> 12 14 #include <linux/i2c.h> 13 15 #include <linux/input.h> 14 16 #include <linux/input/mt.h> ··· 31 29 #define EXC3000_MT2_EVENT 0x18 32 30 33 31 #define EXC3000_TIMEOUT_MS 100 32 + 33 + #define EXC3000_RESET_MS 10 34 + #define EXC3000_READY_MS 100 34 35 35 36 static const struct i2c_device_id exc3000_id[]; 36 37 ··· 68 63 const struct eeti_dev_info *info; 69 64 struct input_dev *input; 70 65 struct touchscreen_properties prop; 66 + struct gpio_desc *reset; 71 67 struct timer_list timer; 72 68 u8 buf[2 * EXC3000_LEN_FRAME]; 73 69 }; ··· 209 203 data->info = &exc3000_info[eeti_dev_id]; 210 204 } 211 205 timer_setup(&data->timer, exc3000_timer, 0); 206 + 207 + data->reset = devm_gpiod_get_optional(&client->dev, "reset", 208 + GPIOD_OUT_HIGH); 209 + if (IS_ERR(data->reset)) 210 + return PTR_ERR(data->reset); 211 + 212 + if (data->reset) { 213 + msleep(EXC3000_RESET_MS); 214 + gpiod_set_value_cansleep(data->reset, 0); 215 + msleep(EXC3000_READY_MS); 216 + } 212 217 213 218 input = devm_input_allocate_device(&client->dev); 214 219 if (!input)