Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: elants_i2c - get product id on recovery mode for FW update

We use hw version to construct name of file holding touchscreen firmware,
so let's try reading it even if touchscreen initialization fails (the
firmware supports reading product/hardware id even when device is in
recovery/boot mode).

Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Johnny Chuang and committed by
Dmitry Torokhov
bc1d57fe c9a3a7cf

+20 -11
+20 -11
drivers/input/touchscreen/elants_i2c.c
··· 298 298 return get_unaligned_be32(buf) >> 4; 299 299 } 300 300 301 - static int elants_i2c_query_fw_id(struct elants_data *ts) 301 + static int elants_i2c_query_hw_version(struct elants_data *ts) 302 302 { 303 303 struct i2c_client *client = ts->client; 304 304 int error, retry_cnt; ··· 318 318 error, (int)sizeof(resp), resp); 319 319 } 320 320 321 - dev_err(&client->dev, 322 - "Failed to read fw id or fw id is invalid\n"); 321 + if (error) { 322 + dev_err(&client->dev, 323 + "Failed to read fw id: %d\n", error); 324 + return error; 325 + } 326 + 327 + dev_err(&client->dev, "Invalid fw id: %#04x\n", ts->hw_version); 323 328 324 329 return -EINVAL; 325 330 } ··· 513 508 static int elants_i2c_initialize(struct elants_data *ts) 514 509 { 515 510 struct i2c_client *client = ts->client; 516 - int error, retry_cnt; 511 + int error, error2, retry_cnt; 517 512 const u8 hello_packet[] = { 0x55, 0x55, 0x55, 0x55 }; 518 513 const u8 recov_packet[] = { 0x55, 0x55, 0x80, 0x80 }; 519 514 u8 buf[HEADER_SIZE]; ··· 558 553 } 559 554 } 560 555 556 + /* hw version is available even if device in recovery state */ 557 + error2 = elants_i2c_query_hw_version(ts); 561 558 if (!error) 562 - error = elants_i2c_query_fw_id(ts); 559 + error = error2; 560 + 563 561 if (!error) 564 562 error = elants_i2c_query_fw_version(ts); 563 + if (!error) 564 + error = elants_i2c_query_test_version(ts); 565 + if (!error) 566 + error = elants_i2c_query_bc_version(ts); 567 + if (!error) 568 + error = elants_i2c_query_ts_info(ts); 565 569 566 - if (error) { 570 + if (error) 567 571 ts->iap_mode = ELAN_IAP_RECOVERY; 568 - } else { 569 - elants_i2c_query_test_version(ts); 570 - elants_i2c_query_bc_version(ts); 571 - elants_i2c_query_ts_info(ts); 572 - } 573 572 574 573 return 0; 575 574 }