Skip to content

Commit e55057e

Browse files
mergedtor
authored andcommitted
Input: ar1021_i2c - enable touch mode during open
The device could as well be in command mode, in which this driver cannot handle the device. When opening the device, let's make sure the device will be in the mode we expect it to be for this driver. Signed-off-by: Martin Kepplinger <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent aea415b commit e55057e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/input/touchscreen/ar1021_i2c.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
#define AR1021_MAX_X 4095
1919
#define AR1021_MAX_Y 4095
2020

21+
#define AR1021_CMD 0x55
22+
23+
#define AR1021_CMD_ENABLE_TOUCH 0x12
24+
2125
struct ar1021_i2c {
2226
struct i2c_client *client;
2327
struct input_dev *input;
@@ -56,8 +60,19 @@ static irqreturn_t ar1021_i2c_irq(int irq, void *dev_id)
5660

5761
static int ar1021_i2c_open(struct input_dev *dev)
5862
{
63+
static const u8 cmd_enable_touch[] = {
64+
AR1021_CMD,
65+
0x01, /* number of bytes after this */
66+
AR1021_CMD_ENABLE_TOUCH
67+
};
5968
struct ar1021_i2c *ar1021 = input_get_drvdata(dev);
6069
struct i2c_client *client = ar1021->client;
70+
int error;
71+
72+
error = i2c_master_send(ar1021->client, cmd_enable_touch,
73+
sizeof(cmd_enable_touch));
74+
if (error < 0)
75+
return error;
6176

6277
enable_irq(client->irq);
6378

0 commit comments

Comments
 (0)