From a40cc1f883b57245bf2b490df18765f5b986b1e4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BC=A0=E6=99=B4?= Date: Tue, 13 May 2014 11:25:07 +0800 Subject: [PATCH] rk3288:pmic:ricoh619:slove read id error for first time --- drivers/mfd/ricoh619.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/ricoh619.c b/drivers/mfd/ricoh619.c index 94a6f52d5ddc..f03ada60cd5e 100755 --- a/drivers/mfd/ricoh619.c +++ b/drivers/mfd/ricoh619.c @@ -811,6 +811,7 @@ static int ricoh619_i2c_probe(struct i2c_client *client, struct ricoh619_platform_data *pdata; int ret; uint8_t control; + int i=0; printk("%s,line=%d\n", __func__,__LINE__); ricoh619 = devm_kzalloc(&client->dev,sizeof(struct ricoh619), GFP_KERNEL); @@ -824,8 +825,22 @@ static int ricoh619_i2c_probe(struct i2c_client *client, ret = ricoh619_read(ricoh619->dev, 0x36, &control); if ((ret <0) || (control < 0) || (control == 0xff) || (control == 0) ){ - printk(KERN_INFO "The device is not ricoh619 %08x %d\n",control,ret); - goto err; + if (ret <0){ + printk(KERN_INFO "The device is not ricoh619 %08x %d\n",control,ret); + goto err; + } + else{ + do{ + ret = ricoh619_read(ricoh619->dev, 0x36, &control); + i += 1; + printk(KERN_INFO "##################:read ricoh619 0x36 error retry %08x %d\n",control,ret); + }while( ((control == 0xff) || (control == 0) ) && (i < 10)); + if ((control == 0xff) || (control == 0) ){ + ret = -ENXIO; + printk(KERN_INFO "##################The device is not ricoh619 %08x %d\n",control,ret); + goto err; + } + } } ret = ricoh619_pre_init(ricoh619); -- 2.34.1