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 <martin.kepplinger@ginzinger.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by Martin Kepplinger and committed by Dmitry Torokhov e55057e8 aea415b1

+15
+15
drivers/input/touchscreen/ar1021_i2c.c
··· 18 18 #define AR1021_MAX_X 4095 19 19 #define AR1021_MAX_Y 4095 20 20 21 + #define AR1021_CMD 0x55 22 + 23 + #define AR1021_CMD_ENABLE_TOUCH 0x12 24 + 21 25 struct ar1021_i2c { 22 26 struct i2c_client *client; 23 27 struct input_dev *input; ··· 60 56 61 57 static int ar1021_i2c_open(struct input_dev *dev) 62 58 { 59 + static const u8 cmd_enable_touch[] = { 60 + AR1021_CMD, 61 + 0x01, /* number of bytes after this */ 62 + AR1021_CMD_ENABLE_TOUCH 63 + }; 63 64 struct ar1021_i2c *ar1021 = input_get_drvdata(dev); 64 65 struct i2c_client *client = ar1021->client; 66 + int error; 67 + 68 + error = i2c_master_send(ar1021->client, cmd_enable_touch, 69 + sizeof(cmd_enable_touch)); 70 + if (error < 0) 71 + return error; 65 72 66 73 enable_irq(client->irq); 67 74