[9610] fimc-is2: Buffer modification in case of otp data error at 2x5 module
authorDohyun Kim <dh5.kim@samsung.com>
Thu, 16 May 2019 08:52:49 +0000 (17:52 +0900)
committerKim Gunho <gunho.kim@samsung.com>
Wed, 7 Aug 2019 13:00:33 +0000 (22:00 +0900)
Change-Id: Ic4e74070efecf34fa3d7943faf2ea124dd87968f
Signed-off-by: Dohyun Kim <dh5.kim@samsung.com>
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/cis/fimc-is-cis-2x5sp.c

index 959cca6d9f8540c0a9ba1162cc767490e33fe8d8..4bca438cf9107c7358e6d73f89aafbd4904d7abb 100644 (file)
@@ -205,6 +205,8 @@ int sensor_2x5sp_cis_otp_check_crc(struct v4l2_subdev *subdev,
                crc_value = ((device->otp_cal_buf[254][60] << 8) | (device->otp_cal_buf[254][61]));
                crc16 = sensor_cis_otp_get_crc16(&check_buf[OTP_GRP1_AWB_CRC_START], OTP_GRP1_AWB_CRC_SIZE);
                if (crc_value != crc16) {
+                       sensor_cis_otp_data_set(&check_buf[OTP_GRP1_AWB_CRC_START], "awb",
+                               OTP_GRP1_AWB_CRC_SIZE, 0xff);
                        err("GR1: Error to AWB CRC16 : 0x%x, cal buffer CRC: 0x%x", crc16, crc_value);
                        ret = -EINVAL;
                } else
@@ -213,6 +215,8 @@ int sensor_2x5sp_cis_otp_check_crc(struct v4l2_subdev *subdev,
                crc_value = ((device->otp_cal_buf[254][62] << 8) | (device->otp_cal_buf[254][63]));
                crc16 = sensor_cis_otp_get_crc16(&check_buf[OTP_GRP1_LSC_XTC_CRC_START], OTP_GRP1_LSC_XTC_CRC_SIZE);
                if (crc_value != crc16) {
+                       sensor_cis_otp_data_set(&check_buf[OTP_GRP1_LSC_XTC_CRC_START], "lsc_xtc",
+                               OTP_GRP1_LSC_XTC_CRC_SIZE, 0xff);
                        err("GR1: Error to LSC & XTC CRC16 : 0x%x, cal buffer CRC: 0x%x", crc16, crc_value);
                        ret = -EINVAL;
                } else
@@ -223,6 +227,8 @@ int sensor_2x5sp_cis_otp_check_crc(struct v4l2_subdev *subdev,
                crc_value = ((device->otp_cal_buf[255][60] << 8) | (device->otp_cal_buf[255][61]));
                crc16 = sensor_cis_otp_get_crc16(&check_buf[OTP_GRP2_AWB_CRC_START], OTP_GRP2_AWB_CRC_SIZE);
                if (crc_value != crc16) {
+                       sensor_cis_otp_data_set(&check_buf[OTP_GRP2_AWB_CRC_START], "awb",
+                               OTP_GRP2_AWB_CRC_SIZE, 0xff);
                        err("GR2: Error to AWB CRC16 : 0x%x, cal buffer CRC: 0x%x", crc16, crc_value);
                        ret = -EINVAL;
                } else
@@ -231,6 +237,8 @@ int sensor_2x5sp_cis_otp_check_crc(struct v4l2_subdev *subdev,
                crc_value = ((device->otp_cal_buf[255][62] << 8) | (device->otp_cal_buf[255][63]));
                crc16 = sensor_cis_otp_get_crc16(&check_buf[OTP_GRP2_LSC_XTC_CRC_START], OTP_GRP2_LSC_XTC_CRC_SIZE);
                if (crc_value != crc16) {
+                       sensor_cis_otp_data_set(&check_buf[OTP_GRP2_LSC_XTC_CRC_START], "lsc_xtc",
+                               OTP_GRP2_LSC_XTC_CRC_SIZE, 0xff);
                        err("GR2: Error to LSC & XTC CRC16 : 0x%x, cal buffer CRC: 0x%x", crc16, crc_value);
                        ret = -EINVAL;
                } else
@@ -387,6 +395,7 @@ int sensor_2x5sp_cis_otp(struct v4l2_subdev *subdev, struct fimc_is_device_senso
                /* OTP data read */
                ret = sensor_2x5sp_cis_otp_read(subdev, device);
                if (ret < 0) {
+                       sensor_cis_otp_data_set(&otp_buf[0], "all", OTP_PAGE_SIZE * 256, 0xff);
                        err("Don't read to 2x5 OTP data");
                        goto p_err;
                }
@@ -394,6 +403,7 @@ int sensor_2x5sp_cis_otp(struct v4l2_subdev *subdev, struct fimc_is_device_senso
                /* Write to OTP data at file */
                ret = sensor_cis_otp_write_file(OTP_DATA_PATH, (void *)device->otp_cal_buf, OTP_PAGE_SIZE * 256);
                if (ret < 0) {
+                       sensor_cis_otp_data_set(&otp_buf[0], "all", OTP_PAGE_SIZE * 256, 0xff);
                        err("2x5 OTP data don't file write");
                        goto p_err;
                }
@@ -405,6 +415,7 @@ int sensor_2x5sp_cis_otp(struct v4l2_subdev *subdev, struct fimc_is_device_senso
                otp_group = sensor_2x5sp_cis_otp_check(device, i);
                if (otp_group < 0) {
                        if (i == OTP_GROUP_ONE) {
+                               sensor_cis_otp_data_set(&otp_buf[0], "all", OTP_PAGE_SIZE * 256, 0xff);
                                err("All OTP data are invalid, check module");
                                goto p_err;
                        } else {