From 7c193ed5aaa6bc1375bf1e1a4b2ada35cd3959f4 Mon Sep 17 00:00:00 2001 From: wangdw10 Date: Mon, 25 Mar 2019 11:16:53 +0800 Subject: [PATCH] [COMMON] fimc-is2: update eeprom as KP request support CRC check for DVT and PVT module Change-Id: Iaf1dbc640ba3ba8de992091756fd07a32663ea3e Signed-off-by: wangdw10 --- .../eeprom/fimc-is-sensor-eeprom-gm1.c | 12 +++++++----- .../module_framework/ois/fimc-is-ois-bu24218gwl.c | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/eeprom/fimc-is-sensor-eeprom-gm1.c b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/eeprom/fimc-is-sensor-eeprom-gm1.c index 969f438144b9..584016b1a6bf 100755 --- a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/eeprom/fimc-is-sensor-eeprom-gm1.c +++ b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/eeprom/fimc-is-sensor-eeprom-gm1.c @@ -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; } diff --git a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/ois/fimc-is-ois-bu24218gwl.c b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/ois/fimc-is-ois-bu24218gwl.c index 71a18223b325..4ff89221dfa6 100644 --- a/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/ois/fimc-is-ois-bu24218gwl.c +++ b/drivers/media/platform/exynos/fimc-is2/sensor/module_framework/ois/fimc-is-ois-bu24218gwl.c @@ -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"); -- 2.20.1