Commit 8184f9f5 authored by 陳永達's avatar 陳永達 Committed by Jean-Paul Saman

retry 3 times and print retry value.

parent 7c5c528c
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/delay.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/arch/aic23.h> #include <asm/arch/aic23.h>
#include <asm/arch/mcbsp.h> #include <asm/arch/mcbsp.h>
...@@ -108,15 +109,27 @@ int tlv320aic33_write_value(u8 reg, u16 value) ...@@ -108,15 +109,27 @@ int tlv320aic33_write_value(u8 reg, u16 value)
#endif /* CONFIG_SENSORS_TLV320AIC33 */ #endif /* CONFIG_SENSORS_TLV320AIC33 */
#ifdef CONFIG_SENSORS_TLV320AIC32 #ifdef CONFIG_SENSORS_TLV320AIC32
#define I2C_RETRY_SLEEP 200
#define I2C_RETRY_COUNT 3
int tlv320aic32_write_value(u8 reg, u16 value) int tlv320aic32_write_value(u8 reg, u16 value)
{ {
static struct i2c_client *client; static struct i2c_client *client;
u8 val = value & 0xff; u8 val = value & 0xff;
int retry = I2C_RETRY_COUNT;
int ret = -1;
client = new_client; client = new_client;
printk(KERN_ERR "%s\n",__FUNCTION__) ;
return i2c_smbus_write_byte_data(client, reg, val); while(retry--)
{
ret = i2c_smbus_write_byte_data(client, reg, val);
if (-1 != ret) break;
printk("!!!! sil9034_write retry [%d]\n", retry);
mdelay(I2C_RETRY_SLEEP);
}
return ret;
} }
int tlv320aic32_read_value(u8 reg) int tlv320aic32_read_value(u8 reg)
{ {
static struct i2c_client *client; static struct i2c_client *client;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment