From: libm1 Date: Tue, 15 Jan 2019 04:51:30 +0000 (+0800) Subject: [COMMON] fimc-is2: update ois bu24218gwl cal data control X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e443c6cdbfbfb417a0516c77a1dda6de86e9c58a;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] fimc-is2: update ois bu24218gwl cal data control The OIS cal data in DVT2 eeprom is ok to apply. But before DVT2, it is not workable data. So add logic to check whether the OIS cal data is good or not, if good, use it to write into OIS module, if wrong, will change to use dafault cal data to write into OIS module. So the ideal expected result is: using real ois cal data in EEPROM on DVT2 module and after, using dafault ois cal data on old module(before DVT2). Change-Id: I8b156021aa3acc3e21d9b073d007a4b79db2f546 Signed-off-by: libm1 --- 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 5fe7b494f80b..29f8aef4743a 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 @@ -44,6 +44,7 @@ static int ois_fw_data_size[OIS_FW_NUM] = {0,}; static u8 ois_cal_data[OIS_CAL_DATA_SIZE] = {0,}; static int ois_cal_data_size = 0; static int ois_previous_mode = 0; +static int ois_isDefaultCalData = 0; static const struct v4l2_subdev_ops subdev_ops; @@ -171,6 +172,12 @@ int fimc_is_ois_cal_open(struct fimc_is_ois *ois, char *name, int offset,int siz for(i = 0; i < size/4; i++) { info("ois cal data (%d): 0x%0x,%0x,%0x,%0x", i, buf[4*i+0], buf[4*i+1], buf[4*i+2], buf[4*i+3]); } + /* OIS cal data in buf[16]~buf[19], expected value are 0x08,0x00,0x08,0x00. If not, means wrong cal data */ + if((buf[16] != 0x08) || (buf[17] != 0x0) || (buf[18] != 0x08) || (buf[19] != 0x0)) { + err("the ois cal data in eeprom can not work, return error"); + ret = -EIO; + goto p_err; + } if (crc_enable) { crc16 = fimc_is_ois_check_crc(buf, OIS_CAL_DATA_SIZE); @@ -371,7 +378,7 @@ int fimc_is_ois_fw_update(struct v4l2_subdev *subdev) return 0; } ret = fimc_is_ois_cal_open(ois, OIS_CAL_DATA_PATH, OIS_CAL_DATA_OFFSET, OIS_CAL_DATA_SIZE, 1); -// if (ret < 0) { + if (ret < 0) { info(" switch to load default OIS Cal Data %s \n", OIS_CAL_DATA_PATH_DEFAULT); ret = fimc_is_ois_cal_open(ois, OIS_CAL_DATA_PATH_DEFAULT, OIS_CAL_DATA_OFFSET_DEFAULT, OIS_CAL_DATA_SIZE_DEFAULT, 0); @@ -379,10 +386,17 @@ int fimc_is_ois_fw_update(struct v4l2_subdev *subdev) err("OIS %s load is fail\n", OIS_CAL_DATA_PATH_DEFAULT); return 0; } -// } + ois_isDefaultCalData = 1; + } is_first_load = 0; } + if (1 == ois_isDefaultCalData) { + info("%s OIS using default cal data", __func__); + } else { + info("%s OIS using real cal data from eeprom", __func__); + } + /* OIS Firmware download */ ret = fimc_is_ois_fw_download(ois); if (ret < 0) {