From: 张晴 Date: Tue, 13 May 2014 03:25:07 +0000 (+0800) Subject: rk3288:pmic:ricoh619:slove read id error for first time X-Git-Tag: firefly_0821_release~5297 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a40cc1f883b57245bf2b490df18765f5b986b1e4;p=firefly-linux-kernel-4.4.55.git rk3288:pmic:ricoh619:slove read id error for first time --- 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);