int ret = 0;
struct fimc_is_cis *cis;
struct i2c_client *client;
- u16 val, page;
+ u16 val = 1, page;
int i;
- int retry = 200;
+ int retry;
FIMC_BUG(!subdev);
return -ENODEV;
}
+ info("OTP read start\n");
dbg_sensor(1, "%s, 1. sensor initial setting", __func__);
CALL_CISOPS(cis, cis_set_global_setting, subdev);
CALL_CISOPS(cis, cis_mode_change, subdev, 0);
fimc_is_sensor_write16(client, OTP_PAGE_CTRL, 0x0100);
/* wait 0x0A00 == 0 [0]: read completed with no errors */
- while (retry--) {
+ retry = 500;
+ while (retry > 0 && val) {
fimc_is_sensor_read16(client, OTP_PAGE_CTRL, &val);
if (val == 0)
break;
usleep_range(100, 100);
+ retry--;
}
+ if (!retry)
+ err("%s: OTP page[%d] read fail with err(%d)\n",
+ __func__, page, val);
+
for (i = 0; i < OTP_PAGE_SIZE; i++) {
fimc_is_sensor_read8(client, OTP_PAGE_BASE + i, &device->otp_cal_buf[page][i]);
dbg_sensor(2, "cal: [%d][0x%x]: %x\n", page, OTP_PAGE_BASE + i, device->otp_cal_buf[page][i]);
fimc_is_sensor_write8(client, 0x0100, 0x00);
msleep(20);
- info("OTP end!!!!!\n");
+ info("OTP read end\n");
I2C_MUTEX_UNLOCK(cis->i2c_lock);
struct i2c_client *client;
u8 val, page;
int i;
- int retry = 200;
+ int retry;
FIMC_BUG(!subdev);
return -ENODEV;
}
+ info("OTP read start\n");
dbg_sensor(1, "%s, 1. sensor initial setting", __func__);
CALL_CISOPS(cis, cis_set_global_setting, subdev);
CALL_CISOPS(cis, cis_mode_change, subdev, 0);
usleep_range(1000, 1001);
/* wait 0x0A01 == 1 [0]: read completed with no errors */
- while (retry--) {
+ retry = 500;
+ while (retry > 0) {
fimc_is_sensor_read8(client, OTP_PAGE_ERRCHK, &val);
if (val == 1)
break;
usleep_range(100, 100);
+ retry--;
}
+ if (!retry)
+ err("%s: OTP page[%d] read fail with err(%d)\n",
+ __func__, page, val);
+
for (i = 0; i < OTP_PAGE_SIZE; i++) {
fimc_is_sensor_read8(client, OTP_PAGE_BASE + i, &device->otp_cal_buf[page][i]);
dbg_sensor(2, "cal: [%d][0x%x]: %x\n", page, OTP_PAGE_BASE + i, device->otp_cal_buf[page][i]);