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

Input: atmel_mxt_ts - add support for reset line

Provide support for controlling reset pin. If this is not driven
correctly the device will be held in reset and will not respond.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Sebastian Reichel and committed by
Dmitry Torokhov
f657b00d 8cc8446b

+24
+2
Documentation/devicetree/bindings/input/atmel,maxtouch.txt
··· 22 22 experiment to determine which bit corresponds to which input. Use 23 23 KEY_RESERVED for unused padding values. 24 24 25 + - reset-gpios: GPIO specifier for the touchscreen's reset pin (active low) 26 + 25 27 Example: 26 28 27 29 touch@4b {
+22
drivers/input/touchscreen/atmel_mxt_ts.c
··· 28 28 #include <linux/interrupt.h> 29 29 #include <linux/of.h> 30 30 #include <linux/slab.h> 31 + #include <linux/gpio/consumer.h> 31 32 #include <asm/unaligned.h> 32 33 #include <media/v4l2-device.h> 33 34 #include <media/v4l2-ioctl.h> ··· 301 300 u8 multitouch; 302 301 struct t7_config t7_cfg; 303 302 struct mxt_dbg dbg; 303 + struct gpio_desc *reset_gpio; 304 304 305 305 /* Cached parameters from object table */ 306 306 u16 T5_address; ··· 3135 3133 init_completion(&data->reset_completion); 3136 3134 init_completion(&data->crc_completion); 3137 3135 3136 + data->reset_gpio = devm_gpiod_get_optional(&client->dev, 3137 + "reset", GPIOD_OUT_LOW); 3138 + if (IS_ERR(data->reset_gpio)) { 3139 + error = PTR_ERR(data->reset_gpio); 3140 + dev_err(&client->dev, "Failed to get reset gpio: %d\n", error); 3141 + return error; 3142 + } 3143 + 3138 3144 error = devm_request_threaded_irq(&client->dev, client->irq, 3139 3145 NULL, mxt_interrupt, 3140 3146 pdata->irqflags | IRQF_ONESHOT, ··· 3150 3140 if (error) { 3151 3141 dev_err(&client->dev, "Failed to register interrupt\n"); 3152 3142 return error; 3143 + } 3144 + 3145 + if (data->reset_gpio) { 3146 + data->in_bootloader = true; 3147 + msleep(MXT_RESET_TIME); 3148 + reinit_completion(&data->bl_completion); 3149 + gpiod_set_value(data->reset_gpio, 1); 3150 + error = mxt_wait_for_completion(data, &data->bl_completion, 3151 + MXT_RESET_TIMEOUT); 3152 + if (error) 3153 + return error; 3154 + data->in_bootloader = false; 3153 3155 } 3154 3156 3155 3157 disable_irq(client->irq);