lkml.org 
[lkml]   [2014]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v1] Input: elants_i2c: Add Elan touchscreen support
From
Date


> +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.


> +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 <oneukum@suse.de>



\
 
 \ /
  Last update: 2014-11-20 12:01    [W:0.101 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site