diff options
author | Rong Dian <b38775@freescale.com> | 2012-07-05 11:19:28 +0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-06-03 21:54:49 -0500 |
commit | ae7392091e57310c3fb75f058c3afb74076af5db (patch) | |
tree | 4f6a9cf8db8a0a7173f24c3ea3f9a01eb8962240 /drivers/input | |
parent | 1a8e48db5c7d0351bfe90dc19f7c90d07859348d (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); /* |