set minimum clock frequency for 10Khz
authorkfx <kfx@rock-chips.com>
Tue, 27 Sep 2011 07:02:19 +0000 (15:02 +0800)
committerkfx <kfx@rock-chips.com>
Tue, 27 Sep 2011 07:02:58 +0000 (15:02 +0800)
drivers/i2c/busses/i2c-rk29.c

index 03715e2744c48da52cf8fdf23731db212ca33dfd..5049c1acb5d9c7c00732cd60abfb2ef503028131 100755 (executable)
@@ -539,10 +539,16 @@ static int rk29_i2c_xfer(struct i2c_adapter *adap,
        if(i2c->suspended ==1)
                return -EIO;
        */
-       if(msgs[0].scl_rate <= 400000 && msgs[0].scl_rate > 0)
+       // 400k > scl_rate > 10k
+       if(msgs[0].scl_rate <= 400000 && msgs[0].scl_rate >= 10000)
                i2c->scl_rate = msgs[0].scl_rate;
-       else
+       else if(msgs[0].scl_rate > 400000)
                i2c->scl_rate = 400000; 
+       else{
+               dev_info(i2c->dev, "Warning: msg[0].scl_rate( = %dKhz) is too low!",
+                       msgs[0].scl_rate/1000);
+               i2c->scl_rate = 10000;
+       }
        rk29_i2c_clockrate(i2c);
 
        i2c->udelay_time = RK29_UDELAY_TIME(i2c->scl_rate);