Skip to content

Commit

Permalink
Input: elants - document some registers and values
Browse files Browse the repository at this point in the history
Add information found in downstream kernels, to make the code less
magic.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/728fff020bc92be10d84cc2a7ea8af6fd99af96c.1607669375.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
osctobe authored and dtor committed Dec 11, 2020
1 parent 3d722dd commit c18b443
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions drivers/input/touchscreen/elants_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

#define HEADER_REPORT_10_FINGER 0x62

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

#define BOOT_TIME_DELAY_MS 50
Expand All @@ -97,6 +97,10 @@
#define E_INFO_PHY_SCAN 0xD7
#define E_INFO_PHY_DRIVER 0xD8

/* FW write command, 0x54 0x?? 0x0, 0x01 */
#define E_POWER_STATE_SLEEP 0x50
#define E_POWER_STATE_RESUME 0x58

#define MAX_RETRIES 3
#define MAX_FW_UPDATE_RETRIES 30

Expand Down Expand Up @@ -269,8 +273,8 @@ static int elants_i2c_calibrate(struct elants_data *ts)
{
struct i2c_client *client = ts->client;
int ret, error;
static const u8 w_flashkey[] = { 0x54, 0xC0, 0xE1, 0x5A };
static const u8 rek[] = { 0x54, 0x29, 0x00, 0x01 };
static const u8 w_flashkey[] = { CMD_HEADER_WRITE, 0xC0, 0xE1, 0x5A };
static const u8 rek[] = { CMD_HEADER_WRITE, 0x29, 0x00, 0x01 };
static const u8 rek_resp[] = { CMD_HEADER_REK, 0x66, 0x66, 0x66 };

disable_irq(client->irq);
Expand Down Expand Up @@ -1388,7 +1392,9 @@ static int __maybe_unused elants_i2c_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct elants_data *ts = i2c_get_clientdata(client);
const u8 set_sleep_cmd[] = { 0x54, 0x50, 0x00, 0x01 };
const u8 set_sleep_cmd[] = {
CMD_HEADER_WRITE, E_POWER_STATE_SLEEP, 0x00, 0x01
};
int retry_cnt;
int error;

Expand Down Expand Up @@ -1425,7 +1431,9 @@ static int __maybe_unused elants_i2c_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct elants_data *ts = i2c_get_clientdata(client);
const u8 set_active_cmd[] = { 0x54, 0x58, 0x00, 0x01 };
const u8 set_active_cmd[] = {
CMD_HEADER_WRITE, E_POWER_STATE_RESUME, 0x00, 0x01
};
int retry_cnt;
int error;

Expand Down

0 comments on commit c18b443

Please sign in to comment.