# RE: \[PATCH v1\] Input: elants\_i2c: Add Elan touchscreen support

- From: ELAN 劉嘉駿 \<hidden\>
- Date: 2014-11-20 12:25:24 
- List: linux-input
- Page: https://ratatoskr.run/linux-input/2014/11/4378912
- Thread: https://ratatoskr.run/linux-input/2013/12/4173063/t.md

```text

Hi Oliver:

-----Original Message-----
From: Oliver Neukum [mailto:<redacted>] 
Sent: Thursday, November 20, 2014 6:32 PM
To: Dmitry Torokhov
Cc: scott; <redacted>; <redacted>; Vincent Wang; Jeff Chuang; Benson Leung; Benjamin Tissoires; Henrik Rydberg; David Herrmann
Subject: Re: [PATCH v1] Input: elants_i2c: Add Elan touchscreen support



> +static int elants_i2c_sw_reset(struct i2c_client *client) {
> +       const u8 soft_rst_cmd[] = { 0x77, 0x77, 0x77, 0x77 };
> +       int error;
> +
> +       error = elants_i2c_send(client, soft_rst_cmd,
> +                               sizeof(soft_rst_cmd));
> +       if (error) {
> +               dev_err(&client->dev, "software reset failed: %d\n",
> error);
> +               return error;
> +       }
> +
> +       /*
> +        * We should wait at least 10 msec (but no more than 40)
> before
> +        * sending fastboot or IAP command to the device.
> +        */
> +       msleep(30);

If timing is critical in both ways, you should take our guarantee if sufficient sleep. I suggest you sleep 11msecs.

Sorry, this is our firmware tricky but it should be sleep longer than 30ms. Actually 70ms.
(Dmitry, I need to modify this delay time to 70ms. Sorry for the changed over and over again; 
	because we consider big sensor solution which need to use more ICs and need more longer delay)

thanks,
Scott

> +static int elants_i2c_initialize(struct elants_data *ts) {
> +       struct i2c_client *client = ts->client;
> +       int error, retry_cnt;
> +       const u8 hello_packet[] = { 0x55, 0x55, 0x55, 0x55 };
> +       const u8 recov_packet[] = { 0x55, 0x55, 0x80, 0x80 };
> +       u8 buf[HEADER_SIZE];
> +

Strictly speaking you should disable preemption here.


> +       for (retry_cnt = 0; retry_cnt < MAX_RETRIES; retry_cnt++) {
> +               error = elants_i2c_sw_reset(client);
> +               if (error) {
> +                       /* Continue initializing if it's the last try
> */
> +                       if (retry_cnt < MAX_RETRIES - 1)
> +                               continue;
> +               }

	Regards
		Oliver

--
Oliver Neukum [ref]


```
