Skip to content

Commit 27aced1

Browse files
sredtor
authored andcommitted
Input: exc3000 - add reset gpio support
Add basic support for an optional reset gpio. Reviewed-by: Enric Balletbo i Serra <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]> Acked-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 3bdd21c commit 27aced1

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

Documentation/devicetree/bindings/input/touchscreen/eeti,exc3000.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ properties:
2222
const: 0x2a
2323
interrupts:
2424
maxItems: 1
25+
reset-gpios:
26+
maxItems: 1
2527
touchscreen-size-x: true
2628
touchscreen-size-y: true
2729
touchscreen-inverted-x: true

drivers/input/touchscreen/exc3000.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
*/
99

1010
#include <linux/bitops.h>
11+
#include <linux/delay.h>
1112
#include <linux/device.h>
13+
#include <linux/gpio/consumer.h>
1214
#include <linux/i2c.h>
1315
#include <linux/input.h>
1416
#include <linux/input/mt.h>
@@ -30,6 +32,9 @@
3032

3133
#define EXC3000_TIMEOUT_MS 100
3234

35+
#define EXC3000_RESET_MS 10
36+
#define EXC3000_READY_MS 100
37+
3338
static const struct i2c_device_id exc3000_id[];
3439

3540
struct eeti_dev_info {
@@ -63,6 +68,7 @@ struct exc3000_data {
6368
const struct eeti_dev_info *info;
6469
struct input_dev *input;
6570
struct touchscreen_properties prop;
71+
struct gpio_desc *reset;
6672
struct timer_list timer;
6773
u8 buf[2 * EXC3000_LEN_FRAME];
6874
};
@@ -204,6 +210,17 @@ static int exc3000_probe(struct i2c_client *client)
204210
}
205211
timer_setup(&data->timer, exc3000_timer, 0);
206212

213+
data->reset = devm_gpiod_get_optional(&client->dev, "reset",
214+
GPIOD_OUT_HIGH);
215+
if (IS_ERR(data->reset))
216+
return PTR_ERR(data->reset);
217+
218+
if (data->reset) {
219+
msleep(EXC3000_RESET_MS);
220+
gpiod_set_value_cansleep(data->reset, 0);
221+
msleep(EXC3000_READY_MS);
222+
}
223+
207224
input = devm_input_allocate_device(&client->dev);
208225
if (!input)
209226
return -ENOMEM;

0 commit comments

Comments
 (0)