/* All calibration data is zero set only Address section is invalid CRC */
fimc_is_eeprom_cal_data_set(eeprom->data, "all",
- EEPROM_ADD_CRC_SEC, EEPROM_DATA_SIZE, 0xff);
+ EEPROM_ADD_CRC_FST, EEPROM_DATA_SIZE, 0xff);
/*Set all cal_status to ERROR if Address cal data invalid*/
for (int i = 0; i < CAMERA_CRC_INDEX_MAX; i++)
/* All calibration data is 0xff set but exception Address section */
fimc_is_eeprom_cal_data_set(eeprom->data, "Information - End",
- EEPROM_INFO_CRC_SEC, EEPROM_ADD_CAL_SIZE, 0xff);
+ EEPROM_INFO_CRC_FST, EEPROM_ADD_CAL_SIZE, 0xff);
sensor->cal_status[CAMERA_CRC_INDEX_MNF] = CRC_ERROR;
} else {
err("%s(): 12A10 EEPROM AWB section CRC check fail(%d)", __func__, ret);
fimc_is_eeprom_cal_data_set(eeprom->data, "AWB",
- EEPROM_AWB_CRC_SEC, EEPROM_AWB_CAL_SIZE, 0xff);
+ EEPROM_AWB_CRC_FST, EEPROM_AWB_CAL_SIZE, 0xff);
sensor->cal_status[CAMERA_CRC_INDEX_AWB] = CRC_ERROR;
} else {
err("%s(): 12A10 EEPROM AF section CRC check fail(%d)", __func__, ret);
fimc_is_eeprom_cal_data_set(eeprom->data, "AF",
- EEPROM_AF_CRC_SEC, EEPROM_AF_CAL_SIZE, 0xff);
+ EEPROM_AF_CRC_FST, EEPROM_AF_CAL_SIZE, 0xff);
sensor->cal_status[CAMERA_CRC_INDEX_AF] = CRC_ERROR;
} else {
err("%s(): 12A10 EEPROM LSC section CRC check fail(%d)", __func__, ret);
fimc_is_eeprom_cal_data_set(eeprom->data, "LSC",
- EEPROM_LSC_CRC_SEC, EEPROM_LSC_CAL_SIZE, 0xff);
+ EEPROM_LSC_CRC_FST, EEPROM_LSC_CAL_SIZE, 0xff);
} else
info("12A10 EEPROM LSC section CRC check success\n");
err("%s(): 12A10 EEPROM PDAF section CRC check fail(%d)", __func__, ret);
fimc_is_eeprom_cal_data_set(eeprom->data, "PDAF",
- EEPROM_PDAF_CRC_SEC, EEPROM_PDAF_CAL_SIZE, 0xff);
+ EEPROM_PDAF_CRC_FST, EEPROM_PDAF_CAL_SIZE, 0xff);
sensor->cal_status[CAMERA_CRC_INDEX_PDAF] = CRC_ERROR;
} else {
err("%s(): 12A10 EEPROM AE section CRC check fail(%d)", __func__, ret);
fimc_is_eeprom_cal_data_set(eeprom->data, "AE",
- EEPROM_AE_CRC_SEC, EEPROM_AE_CAL_SIZE, 0xff);
+ EEPROM_AE_CRC_FST, EEPROM_AE_CAL_SIZE, 0xff);
} else
info("12A10 EEPROM AE section CRC check success\n");
err("%s(): EEPROM Dual section check fail(%d)", __func__, ret);
fimc_is_eeprom_cal_data_set(eeprom->data, "DUAL",
- EEPROM_DUAL_CRC_SEC, EEPROM_DUAL_CAL_SIZE, 0xff);
+ EEPROM_DUAL_CRC_FST, EEPROM_DUAL_CAL_SIZE, 0xff);
sensor->cal_status[CAMERA_CRC_INDEX_DUAL] = CRC_ERROR;
} else {
err("%s(): EEPROM SFR section CRC check fail(%d)", __func__, ret);
fimc_is_eeprom_cal_data_set(eeprom->data, "SFR",
- EEPROM_SFR_CRC_SEC, EEPROM_SFR_CAL_SIZE, 0xff);
+ EEPROM_SFR_CRC_FST, EEPROM_SFR_CAL_SIZE, 0xff);
} else
info("12A10 EEPROM SFR section CRC check success\n");
crc_value = ((eeprom->data[EEPROM_INFO_CRC_SEC] << 8) | (eeprom->data[EEPROM_INFO_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_INFO_CRC_CHK_START], EEPROM_INFO_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to INFO CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("INFO CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
crc_value = ((eeprom->data[EEPROM_AWB_CRC_SEC] << 8) | (eeprom->data[EEPROM_AWB_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_AWB_CRC_CHK_START], EEPROM_AWB_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to AWB CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("AWB CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
crc_value = ((eeprom->data[EEPROM_AF_CRC_SEC] << 8) | (eeprom->data[EEPROM_AF_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_AF_CRC_CHK_START], EEPROM_AF_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to AF CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("AF CRC16: %x, cal_buffer CRC: %x\n", crc16, crc_value);
return ret;
crc_value = ((eeprom->data[EEPROM_AE_CRC_SEC] << 8) | (eeprom->data[EEPROM_AE_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_AE_CRC_CHK_START], EEPROM_AE_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to AE CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("AE CRC16: %x, cal_buffer CRC: %x\n", crc16, crc_value);
return ret;
crc_value = ((eeprom->data[EEPROM_LSC_CRC_SEC] << 8) | (eeprom->data[EEPROM_LSC_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_LSC_CRC_CHK_START], EEPROM_LSC_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to LSC CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("LSC CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
crc_value = ((eeprom->data[EEPROM_PDAF_CRC_SEC] << 8) | (eeprom->data[EEPROM_PDAF_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_PDAF_CRC_CHK_START], EEPROM_PDAF_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to PDAF CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("PDAF CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
crc_value = ((eeprom->data[EEPROM_DUAL_CRC_SEC] << 8) | (eeprom->data[EEPROM_DUAL_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_DUAL_CRC_CHK_START], EEPROM_DUAL_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to DUAL CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("DUAL CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
crc_value = ((eeprom->data[EEPROM_DUAL_VER_CRC_SEC] << 8) | (eeprom->data[EEPROM_DUAL_VER_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_DUAL_VER_CRC_CHK_START], EEPROM_DUAL_VER_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to DUAL VER CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("DUAL VER CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
crc_value = ((eeprom->data[EEPROM_SFR_CRC_SEC] << 8) | (eeprom->data[EEPROM_SFR_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_SFR_CRC_CHK_START], EEPROM_SFR_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to SFR CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("SFR CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
/* All calibration data is zero set only Address section is invalid CRC */
fimc_is_eeprom_cal_data_set(eeprom->data, "all",
- EEPROM_ADD_CRC_SEC, EEPROM_DATA_SIZE, 0xff);
+ EEPROM_ADD_CRC_FST, EEPROM_DATA_SIZE, 0xff);
/*Set all cal_status to ERROR if Address cal data invalid*/
for (int i = 0; i < CAMERA_CRC_INDEX_MAX; i++)
/* All calibration data is 0xff set but exception Address section */
fimc_is_eeprom_cal_data_set(eeprom->data, "Information - End",
- EEPROM_INFO_CRC_SEC, EEPROM_ADD_CAL_SIZE, 0xff);
+ EEPROM_INFO_CRC_FST, EEPROM_ADD_CAL_SIZE, 0xff);
sensor->cal_status[CAMERA_CRC_INDEX_MNF] = CRC_ERROR;
err("%s(): 12A10FF EEPROM AWB section CRC check fail(%d)", __func__, ret);
fimc_is_eeprom_cal_data_set(eeprom->data, "AWB",
- EEPROM_AWB_CRC_SEC, EEPROM_AWB_CAL_SIZE, 0xff);
+ EEPROM_AWB_CRC_FST, EEPROM_AWB_CAL_SIZE, 0xff);
sensor->cal_status[CAMERA_CRC_INDEX_AWB] = CRC_ERROR;
err("%s(): 12A10FF EEPROM LSC section CRC check fail(%d)", __func__, ret);
fimc_is_eeprom_cal_data_set(eeprom->data, "LSC",
- EEPROM_LSC_CRC_SEC, EEPROM_LSC_CAL_SIZE, 0xff);
+ EEPROM_LSC_CRC_FST, EEPROM_LSC_CAL_SIZE, 0xff);
} else
info("12A10FF EEPROM LSC section CRC check success\n");
err("%s(): EEPROM SFR section CRC check fail(%d)", __func__, ret);
fimc_is_eeprom_cal_data_set(eeprom->data, "SFR",
- EEPROM_SFR_CRC_SEC, EEPROM_SFR_CAL_SIZE, 0xff);
+ EEPROM_SFR_CRC_FST, EEPROM_SFR_CAL_SIZE, 0xff);
} else
info("12A10FF EEPROM SFR section CRC check success\n");
- /* Write file to serial number of Information calibration data */
- ret = fimc_is_eeprom_file_write(EEPROM_SERIAL_NUM_DATA_PATH,
- (void *)&eeprom->data[EEPROM_INFO_SERIAL_NUM_START], EEPROM_INFO_SERIAL_NUM_SIZE);
- if (ret < 0)
- err("%s(), DUAL cal file write fail(%d)", __func__, ret);
-
return ret;
}
crc_value = ((eeprom->data[EEPROM_INFO_CRC_SEC] << 8) | (eeprom->data[EEPROM_INFO_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_INFO_CRC_CHK_START], EEPROM_INFO_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to INFO CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("INFO CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
crc_value = ((eeprom->data[EEPROM_AWB_CRC_SEC] << 8) | (eeprom->data[EEPROM_AWB_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_AWB_CRC_CHK_START], EEPROM_AWB_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to AWB CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("AWB CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
crc_value = ((eeprom->data[EEPROM_LSC_CRC_SEC] << 8) | (eeprom->data[EEPROM_LSC_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_LSC_CRC_CHK_START], EEPROM_LSC_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to LSC CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("LSC CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
crc_value = ((eeprom->data[EEPROM_SFR_CRC_SEC] << 8) | (eeprom->data[EEPROM_SFR_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_SFR_CRC_CHK_START], EEPROM_SFR_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to SFR CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("SFR CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
int ret = 0;
struct fimc_is_eeprom *eeprom;
struct i2c_client *client;
+ char serial_id[EEPROM_INFO_SERIAL_NUM_SIZE + 1];
+ char serial_id_dump[EEPROM_INFO_SERIAL_NUM_SIZE + 1];
FIMC_BUG(!subdev);
return ret;
}
+ I2C_MUTEX_LOCK(eeprom->i2c_lock);
+ ret = fimc_is_eeprom_module_read(client, EEPROM_INFO_SERIAL_NUM_START, serial_id, EEPROM_INFO_SERIAL_NUM_SIZE);
+ if (ret < 0) {
+ err("%s(): eeprom i2c read failed(%d)\n", __func__, ret);
+ I2C_MUTEX_UNLOCK(eeprom->i2c_lock);
+ return ret;
+ }
+ I2C_MUTEX_UNLOCK(eeprom->i2c_lock);
+ serial_id[EEPROM_INFO_SERIAL_NUM_SIZE] = '\0';
+
/*
* If already read at EEPROM data in module
* don't again read at EEPROM but there isn't file or
*/
ret = fimc_is_eeprom_file_read(EEPROM_DATA_PATH, (void *)eeprom->data, EEPROM_DATA_SIZE);
if (ret) {
+ I2C_MUTEX_LOCK(eeprom->i2c_lock);
/* I2C read to Sensor EEPROM cal data */
ret = fimc_is_eeprom_module_read(client, EEPROM_ADD_CRC_FST, eeprom->data, EEPROM_DATA_SIZE);
if (ret < 0) {
err("%s(): eeprom i2c read failed(%d)\n", __func__, ret);
+ I2C_MUTEX_UNLOCK(eeprom->i2c_lock);
return ret;
}
+ I2C_MUTEX_UNLOCK(eeprom->i2c_lock);
/* CRC check to each section cal data */
ret = CALL_EEPROMOPS(eeprom, eeprom_check_all_crc, subdev);
return ret;
}
} else {
- /* CRC check to each section cal data */
- ret = CALL_EEPROMOPS(eeprom, eeprom_check_all_crc, subdev);
- if (ret < 0)
- err("%s(): eeprom data invalid(%d)\n", __func__, ret);
+ memcpy(serial_id_dump, &eeprom->data[EEPROM_INFO_SERIAL_NUM_START],
+ EEPROM_INFO_SERIAL_NUM_SIZE);
+ serial_id_dump[EEPROM_INFO_SERIAL_NUM_SIZE] = '\0';
+
+ if(memcmp(serial_id, serial_id_dump, EEPROM_INFO_SERIAL_NUM_SIZE))
+ {
+ /* Read Sensor EEPROM cause change a module */
+ info("%s() : Different new module, so read eeprom\n", __func__);
+
+ I2C_MUTEX_LOCK(eeprom->i2c_lock);
+ /* I2C read to Sensor EEPROM cal data */
+ ret = fimc_is_eeprom_module_read(client, EEPROM_ADD_CRC_FST, eeprom->data, EEPROM_DATA_SIZE);
+ if (ret < 0) {
+ err("%s(): eeprom i2c read failed(%d)\n", __func__, ret);
+ I2C_MUTEX_UNLOCK(eeprom->i2c_lock);
+ return ret;
+ }
+ I2C_MUTEX_UNLOCK(eeprom->i2c_lock);
+
+ /* CRC check to each section cal data */
+ ret = CALL_EEPROMOPS(eeprom, eeprom_check_all_crc, subdev);
+ if (ret < 0)
+ err("%s(): eeprom data invalid(%d)\n", __func__, ret);
+
+ /* Write file to Cal data */
+ ret = fimc_is_eeprom_file_write(EEPROM_DATA_PATH, (void *)eeprom->data, EEPROM_DATA_SIZE);
+ if (ret < 0) {
+ err("%s(), eeprom file write fail(%d)\n", __func__, ret);
+ return ret;
+ }
+ } else {
+ info("%s(): Same module and file dump so use file dump data\n", __func__);
+
+ /* CRC check to each section cal data */
+ ret = CALL_EEPROMOPS(eeprom, eeprom_check_all_crc, subdev);
+ if (ret < 0)
+ err("%s(): eeprom data invalid(%d)\n", __func__, ret);
+ }
}
return ret;
#define FIMC_IS_EEPROM_12A10FF_H
#define EEPROM_DATA_PATH "/data/vendor/camera/dump_12a10ff_eeprom_data.bin"
-#define EEPROM_SERIAL_NUM_DATA_PATH "/data/vendor/camera/serial_number_12a10ff.bin"
/* Total Cal data size */
#define EEPROM_DATA_SIZE SZ_8K
/* All calibration data is zero set only Address section is invalid CRC */
fimc_is_eeprom_cal_data_set(eeprom->data, "all",
- EEPROM_ADD_CRC_SEC, EEPROM_DATA_SIZE, 0xff);
+ EEPROM_ADD_CRC_FST, EEPROM_DATA_SIZE, 0xff);
/*Set all cal_status to ERROR if Address cal data invalid*/
for (int i = 0; i < CAMERA_CRC_INDEX_MAX; i++)
/* All calibration data is 0xff set but exception Address section */
fimc_is_eeprom_cal_data_set(eeprom->data, "Information - End",
- EEPROM_INFO_CRC_SEC, EEPROM_ADD_CAL_SIZE, 0xff);
+ EEPROM_INFO_CRC_FST, EEPROM_ADD_CAL_SIZE, 0xff);
sensor->cal_status[CAMERA_CRC_INDEX_MNF] = CRC_ERROR;
err("%s(): 16885C EEPROM AWB section CRC check fail(%d)", __func__, ret);
fimc_is_eeprom_cal_data_set(eeprom->data, "AWB",
- EEPROM_AWB_CRC_SEC, EEPROM_AWB_CAL_SIZE, 0xff);
+ EEPROM_AWB_CRC_FST, EEPROM_AWB_CAL_SIZE, 0xff);
sensor->cal_status[CAMERA_CRC_INDEX_AWB] = CRC_ERROR;
err("%s(): 16885C EEPROM LSC section CRC check fail(%d)", __func__, ret);
fimc_is_eeprom_cal_data_set(eeprom->data, "LSC",
- EEPROM_LSC_CRC_SEC, EEPROM_LSC_CAL_SIZE, 0xff);
+ EEPROM_LSC_CRC_FST, EEPROM_LSC_CAL_SIZE, 0xff);
} else
info("16885C EEPROM LSC section CRC check success\n");
err("%s(): EEPROM SFR section CRC check fail(%d)", __func__, ret);
fimc_is_eeprom_cal_data_set(eeprom->data, "SFR",
- EEPROM_SFR_CRC_SEC, EEPROM_SFR_CAL_SIZE, 0xff);
+ EEPROM_SFR_CRC_FST, EEPROM_SFR_CAL_SIZE, 0xff);
} else
info("16885C EEPROM SFR section CRC check success\n");
- /* Write file to serial number of Information calibration data */
- ret = fimc_is_eeprom_file_write(EEPROM_SERIAL_NUM_DATA_PATH,
- (void *)&eeprom->data[EEPROM_INFO_SERIAL_NUM_START], EEPROM_INFO_SERIAL_NUM_SIZE);
- if (ret < 0)
- err("%s(), DUAL cal file write fail(%d)", __func__, ret);
-
return ret;
}
crc_value = ((eeprom->data[EEPROM_INFO_CRC_SEC] << 8) | (eeprom->data[EEPROM_INFO_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_INFO_CRC_CHK_START], EEPROM_INFO_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to INFO CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("INFO CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
crc_value = ((eeprom->data[EEPROM_AWB_CRC_SEC] << 8) | (eeprom->data[EEPROM_AWB_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_AWB_CRC_CHK_START], EEPROM_AWB_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to AWB CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("AWB CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
crc_value = ((eeprom->data[EEPROM_LSC_CRC_SEC] << 8) | (eeprom->data[EEPROM_LSC_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_LSC_CRC_CHK_START], EEPROM_LSC_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to LSC CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("LSC CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
crc_value = ((eeprom->data[EEPROM_SFR_CRC_SEC] << 8) | (eeprom->data[EEPROM_SFR_CRC_FST]));
crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_SFR_CRC_CHK_START], EEPROM_SFR_CRC_CHK_SIZE);
- if (crc_value != crc16)
+ if (crc_value != crc16) {
err("Error to SFR CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
- else
+
+ ret = -EINVAL;
+ } else
info("SFR CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
return ret;
*/
ret = fimc_is_eeprom_file_read(EEPROM_DATA_PATH, (void *)eeprom->data, EEPROM_DATA_SIZE);
if (ret) {
+ I2C_MUTEX_LOCK(eeprom->i2c_lock);
/* I2C read to Sensor EEPROM cal data */
ret = fimc_is_eeprom_module_read(client, EEPROM_ADD_CRC_FST, eeprom->data, EEPROM_DATA_SIZE);
if (ret < 0) {
err("%s(): eeprom i2c read failed(%d)\n", __func__, ret);
+ I2C_MUTEX_UNLOCK(eeprom->i2c_lock);
return ret;
}
+ I2C_MUTEX_UNLOCK(eeprom->i2c_lock);
/* CRC check to each section cal data */
ret = CALL_EEPROMOPS(eeprom, eeprom_check_all_crc, subdev);
#define FIMC_IS_EEPROM_16885C_H
#define EEPROM_DATA_PATH "/data/vendor/camera/dump_16885c_eeprom_data.bin"
-#define EEPROM_SERIAL_NUM_DATA_PATH "/data/vendor/camera/serial_number_16885c.bin"
/* Total Cal data size */
#define EEPROM_DATA_SIZE SZ_8K
int i;
/* value setting to (name) cal data section */
- for (i = addr; i < size; i++)
+ for (i = addr; i < addr + size; i++)
data[i] = value;
info("%s() Done: %s calibration data is %d set\n", __func__, name, value);