diff options
author | Rong Dian <b38775@freescale.com> | 2012-07-05 11:19:28 +0800 |
---|---|---|
committer | Terry Lv <r65388@freescale.com> | 2012-07-25 13:10:28 +0800 |
commit | 1c4bcf798c61e9276b0b77dc3b9abe408e1f1a90 (patch) | |
tree | d51622a56a6ff563fb30f00dea8da68305c0638b /drivers/input | |
parent | c228501542e50e70b8844b5f09c278c1996e1214 (diff) |
ENGR00215797: max11801:don't update wrong ADC data when I2C is unavailable
If fail to communicate with I2C2 in any potential possibility,
driver doesn't update wrong ADC sample data into buf for battery.
Signed-off-by: Rong Dian <b38775@freescale.com>
Diffstat (limited to 'drivers/input')
-rwxr-xr-x | drivers/input/touchscreen/max11801_ts.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/input/touchscreen/max11801_ts.c b/drivers/input/touchscreen/max11801_ts.c index 48ee3600a03b..a1ac2d204295 100755 --- a/drivers/input/touchscreen/max11801_ts.c +++ b/drivers/input/touchscreen/max11801_ts.c @@ -106,6 +106,7 @@ struct max11801_data { }; struct i2c_client *max11801_client; unsigned int max11801_workmode; +u8 aux_buf[AUX_BUFSIZE]; static int max11801_dcm_write_command(struct i2c_client *client, int command) { @@ -115,7 +116,6 @@ static int max11801_dcm_write_command(struct i2c_client *client, int command) static u32 max11801_dcm_sample_aux(struct i2c_client *client) { u8 temp_buf; - u8 aux_buf[AUX_BUFSIZE]; int ret; int aux = 0; u32 sample_data = 0; @@ -124,15 +124,17 @@ static u32 max11801_dcm_sample_aux(struct i2c_client *client) mdelay(5); ret = i2c_smbus_read_i2c_block_data(client, FIFO_RD_AUX_MSB, 1, &temp_buf); - aux_buf[0] = temp_buf; if (ret < 1) printk(KERN_DEBUG "FIFO_RD_AUX_MSB read fails\n"); + else + aux_buf[0] = temp_buf; mdelay(5); ret = i2c_smbus_read_i2c_block_data(client, FIFO_RD_AUX_LSB, 1, &temp_buf); - aux_buf[1] = temp_buf; if (ret < 1) printk(KERN_DEBUG "FIFO_RD_AUX_LSB read fails\n"); + else + aux_buf[1] = temp_buf; aux = (aux_buf[0] << 4) + (aux_buf[1] >> 4); /* |