[COMMON] fimc-is2: update eeprom as KP request
authorwangdw10 <wangdw10@lenovo.com>
Mon, 25 Mar 2019 03:16:53 +0000 (11:16 +0800)
committerlingsen1 <lingsen1@lenovo.com>
Mon, 10 Jun 2019 03:24:51 +0000 (11:24 +0800)
support CRC check for DVT and PVT module

CRs-fixed: (CR)

Change-Id: Iaf1dbc640ba3ba8de992091756fd07a32663ea3e
Signed-off-by: wangdw10 <wangdw10@mt.com>
Reviewed-on: https://gerrit.mot.com/1326411
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Dawei Wang <wangdw10@motorola.com>
Reviewed-by: Zhichao Chen <chenzc2@motorola.com>
Submit-Approved: Jira Key

drivers/media/platform/exynos/fimc-is2/sensor/module_framework/eeprom/fimc-is-sensor-eeprom-gm1.c
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/ois/fimc-is-ois-bu24218gwl.c

index 969f438144b95a52664bdf591141cdb2f3650c39..584016b1a6bface42d6892da15757ae3aeed97ca 100755 (executable)
@@ -361,7 +361,8 @@ static int fimc_is_eeprom_gm1_check_ois(struct v4l2_subdev *subdev)
 {
        int ret = 0;
        u16 crc_value = 0;
-       u16 crc16 = 0;
+       u16 crc16_dvt = 0;
+       u16 crc16_pvt = 0;
        struct fimc_is_eeprom *eeprom = NULL;
 
        FIMC_BUG(!subdev);
@@ -372,11 +373,12 @@ static int fimc_is_eeprom_gm1_check_ois(struct v4l2_subdev *subdev)
 
        crc_value = ((eeprom->data[EEPROM_OIS_CRC_FST] << 8) | (eeprom->data[EEPROM_OIS_CRC_SEC]));
 
-       crc16 = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_OIS_CRC_CHK_START], EEPROM_OIS_CRC_CHK_SIZE);
-       if (crc_value != crc16)
-               err("Error to OIS CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
+       crc16_dvt = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_OIS_CRC_CHK_START], EEPROM_OIS_CRC_CHK_SIZE);
+       crc16_pvt = fimc_is_sensor_eeprom_check_crc(&eeprom->data[EEPROM_OIS_CRC_CHK_START], EEPROM_OIS_CRC_CHK_SIZE + 4);
+       if ((crc_value != crc16_dvt) && (crc_value != crc16_pvt))
+               err("Error to OIS CRC16 dvt 0x%x, pvt:0x%x, cal_buffer CRC: 0x%x", crc16_dvt, crc16_pvt, crc_value);
        else
-               info("OIS CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
+               info("OIS CRC16 dvt 0x%x, pvt:0x%x, cal_buffer CRC: 0x%x\n", crc16_dvt, crc16_pvt, crc_value);
 
        return ret;
 }
index d6ef97c2bda37cc45cf30ca2f7cbb2b9722d3a0c..a3e0331fc9b97ab9ca2a27b662515b8c6f06bb43 100644 (file)
@@ -317,7 +317,8 @@ int fimc_is_ois_fw_update(struct v4l2_subdev *subdev, struct v4l2_subdev *eeprom
        int ret = 0;
        int i = 0;
        u16 crc_value = 0;
-       u16 crc16 = 0;
+       u16 crc16_dvt = 0;
+       u16 crc16_pvt = 0;
        struct fimc_is_ois *ois = NULL;
        struct fimc_is_eeprom *eeprom= NULL;
        static int is_first_load = 1;
@@ -348,12 +349,13 @@ int fimc_is_ois_fw_update(struct v4l2_subdev *subdev, struct v4l2_subdev *eeprom
 
                crc_value = ((eeprom->data[OIS_CAL_DATA_CRC_FST] << 8) | (eeprom->data[OIS_CAL_DATA_CRC_SEC]));
 
-               crc16 = fimc_is_ois_check_crc(&eeprom->data[OIS_CAL_DATA_OFFSET], OIS_CAL_DATA_SIZE);
-               if (crc_value != crc16) {
-                       err("Error to OIS CRC16: 0x%x, cal_buffer CRC: 0x%x", crc16, crc_value);
+               crc16_dvt = fimc_is_ois_check_crc(&eeprom->data[OIS_CAL_DATA_OFFSET], OIS_CAL_DATA_SIZE);
+               crc16_pvt = fimc_is_ois_check_crc(&eeprom->data[OIS_CAL_DATA_OFFSET], OIS_CAL_DATA_SIZE + 4);
+               if ((crc_value != crc16_dvt) && (crc_value != crc16_pvt)) {
+                       err("Error to OIS CRC16 dvt 0x%x, pvt:0x%x, cal_buffer CRC: 0x%x", crc16_dvt, crc16_pvt, crc_value);
                        ret = -EINVAL;
                } else {
-                       info("OIS CRC16: 0x%x, cal_buffer CRC: 0x%x\n", crc16, crc_value);
+                       info("OIS CRC16 dvt 0x%x, pvt:0x%x, cal_buffer CRC: 0x%x", crc16_dvt, crc16_pvt, crc_value);
                        /* The eeprom table revision in DVT2 is 0x33, use it to check the OIS cal data should apply or not*/
                        if (eeprom->data[EEPROM_INFO_TABLE_REVISION] < 0x33) {
                                err("ois cal data in eeprom is wrong");