Skip to content

Commit c18b443

Browse files
osctobedtor
authored andcommitted
Input: elants - document some registers and values
Add information found in downstream kernels, to make the code less magic. Signed-off-by: Michał Mirosław <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Tested-by: Dmitry Osipenko <[email protected]> Link: https://lore.kernel.org/r/728fff020bc92be10d84cc2a7ea8af6fd99af96c.1607669375.git.mirq-linux@rere.qmqm.pl Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 3d722dd commit c18b443

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

drivers/input/touchscreen/elants_i2c.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282

8383
#define HEADER_REPORT_10_FINGER 0x62
8484

85-
/* Header (4 bytes) plus 3 fill 10-finger packets */
85+
/* Header (4 bytes) plus 3 full 10-finger packets */
8686
#define MAX_PACKET_SIZE 169
8787

8888
#define BOOT_TIME_DELAY_MS 50
@@ -97,6 +97,10 @@
9797
#define E_INFO_PHY_SCAN 0xD7
9898
#define E_INFO_PHY_DRIVER 0xD8
9999

100+
/* FW write command, 0x54 0x?? 0x0, 0x01 */
101+
#define E_POWER_STATE_SLEEP 0x50
102+
#define E_POWER_STATE_RESUME 0x58
103+
100104
#define MAX_RETRIES 3
101105
#define MAX_FW_UPDATE_RETRIES 30
102106

@@ -269,8 +273,8 @@ static int elants_i2c_calibrate(struct elants_data *ts)
269273
{
270274
struct i2c_client *client = ts->client;
271275
int ret, error;
272-
static const u8 w_flashkey[] = { 0x54, 0xC0, 0xE1, 0x5A };
273-
static const u8 rek[] = { 0x54, 0x29, 0x00, 0x01 };
276+
static const u8 w_flashkey[] = { CMD_HEADER_WRITE, 0xC0, 0xE1, 0x5A };
277+
static const u8 rek[] = { CMD_HEADER_WRITE, 0x29, 0x00, 0x01 };
274278
static const u8 rek_resp[] = { CMD_HEADER_REK, 0x66, 0x66, 0x66 };
275279

276280
disable_irq(client->irq);
@@ -1388,7 +1392,9 @@ static int __maybe_unused elants_i2c_suspend(struct device *dev)
13881392
{
13891393
struct i2c_client *client = to_i2c_client(dev);
13901394
struct elants_data *ts = i2c_get_clientdata(client);
1391-
const u8 set_sleep_cmd[] = { 0x54, 0x50, 0x00, 0x01 };
1395+
const u8 set_sleep_cmd[] = {
1396+
CMD_HEADER_WRITE, E_POWER_STATE_SLEEP, 0x00, 0x01
1397+
};
13921398
int retry_cnt;
13931399
int error;
13941400

@@ -1425,7 +1431,9 @@ static int __maybe_unused elants_i2c_resume(struct device *dev)
14251431
{
14261432
struct i2c_client *client = to_i2c_client(dev);
14271433
struct elants_data *ts = i2c_get_clientdata(client);
1428-
const u8 set_active_cmd[] = { 0x54, 0x58, 0x00, 0x01 };
1434+
const u8 set_active_cmd[] = {
1435+
CMD_HEADER_WRITE, E_POWER_STATE_RESUME, 0x00, 0x01
1436+
};
14291437
int retry_cnt;
14301438
int error;
14311439

0 commit comments

Comments
 (0)