// HTC_START static int s5k6a2ya_read_fuseid(struct sensor_cfg_data *cdata, struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc; unsigned short i, j, value; unsigned short OTP[10] = {0}; struct msm_camera_i2c_client *s5k6a2ya_msm_camera_i2c_client = s_ctrl->sensor_i2c_client; pr_info("%s: sensor OTP information:\n", __func__); rc = msm_camera_i2c_write_b(s5k6a2ya_msm_camera_i2c_client, 0x3602, 0x00); /* Page select */ if (rc < 0) pr_info("%s: i2c_write_b 0x3602 fail\n", __func__); rc = msm_camera_i2c_write_b(s5k6a2ya_msm_camera_i2c_client, 0x3600, 0x01); /* Read mode */ if (rc < 0) pr_info("%s: i2c_write_b 0x3600 fail\n", __func__); mdelay(5); for (i = 0; i < 10; i++) { for (j = 0; j < 5; j++) { rc = msm_camera_i2c_read_b(s5k6a2ya_msm_camera_i2c_client, 0x3604 + i + (10 * j), &value); if (rc < 0) pr_info("%s: i2c_read_b %x fail\n", __func__, (0x3604 + i + (10 * j))); if (value != 00) { OTP[i] = value; break; } } } rc = msm_camera_i2c_write_b(s5k6a2ya_msm_camera_i2c_client, 0x3600, 0x00); /* Finish */ if (rc < 0) pr_info("%s: i2c_write_b 0x3600 fail\n", __func__); pr_info("%s: Vender ID = 0x%x, Lens ID = 0x%x, Version = 0x%x\n", __func__, OTP[0], OTP[1], OTP[2]); pr_info("%s: ModuleFuseID= %x%x%x%x%x%x%x\n", __func__, OTP[3], OTP[4], OTP[5], OTP[6], OTP[7], OTP[8], OTP[9]); cdata->cfg.fuse.fuse_id_word1 = OTP[0] << 8 | OTP[1]; cdata->cfg.fuse.fuse_id_word2 = OTP[3] << 8 | OTP[4]; cdata->cfg.fuse.fuse_id_word3 = OTP[5] << 8 | OTP[6]; cdata->cfg.fuse.fuse_id_word4 = OTP[7] << 8 | OTP[8]; pr_info("%s: fuse->fuse_id_word1:0x%8x\n", __func__, cdata->cfg.fuse.fuse_id_word1); pr_info("%s: fuse->fuse_id_word2:0x%8x\n", __func__, cdata->cfg.fuse.fuse_id_word2); pr_info("%s: fuse->fuse_id_word3:0x%8x\n", __func__, cdata->cfg.fuse.fuse_id_word3); pr_info("%s: fuse->fuse_id_word4:0x%8x\n", __func__, cdata->cfg.fuse.fuse_id_word4); return 0; }
static int ov5693_read_fuseid_once(void) { struct msm_camera_i2c_client *ov5693_msm_camera_i2c_client = ov5693_s_ctrl.sensor_i2c_client; int i; unsigned short bank_addr; int count = 0, dirty = 0; msm_camera_i2c_write_b(ov5693_msm_camera_i2c_client, 0x0100, 0x01); for (i = 0; i < 5; i++) { bank_addr = 0xC0 + (0x14 - i); pr_info("ov5693_read_fuseid_once bank_addr=0x%x\n", bank_addr); msm_camera_i2c_write_b(ov5693_msm_camera_i2c_client, 0x3d84, bank_addr); msm_camera_i2c_write_b(ov5693_msm_camera_i2c_client, 0x3d81, 0x01); msleep(3); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d00, &fuse_id[0]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d01, &fuse_id[1]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d02, &fuse_id[2]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d03, &fuse_id[3]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d04, &fuse_id[4]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d05, &fuse_id[5]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d06, &fuse_id[6]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d07, &fuse_id[7]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d08, &fuse_id[8]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d09, &fuse_id[9]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d0A, &fuse_id[10]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d0B, &fuse_id[11]); for (count = 0; count < MAX_FUSE_ID_INFO; count++) { if (fuse_id[count] != 0) { dirty = 1; break; } } if (dirty) { OTP[0] = fuse_id[0]; OTP[1] = fuse_id[1]; OTP[2] = fuse_id[4]; OTP[3] = fuse_id[5]; OTP[4] = fuse_id[6]; OTP[5] = fuse_id[7]; OTP[6] = fuse_id[8]; OTP[7] = fuse_id[9]; fuseid_read_once = 1; break; } } msm_camera_i2c_write_b(ov5693_msm_camera_i2c_client, 0x0100, 0x00); return 0; }
static int ov5693_read_fuseid_once(void) { struct msm_camera_i2c_client *ov5693_msm_camera_i2c_client = ov5693_s_ctrl.sensor_i2c_client; int i; unsigned short bank_addr; int count = 0, dirty = 0; /* Get OTP fuse id for OV sensor */ msm_camera_i2c_write_b(ov5693_msm_camera_i2c_client, 0x0100, 0x01); for (i = 0; i < 5; i++) { bank_addr = 0xC0 + (0x14 - i); /* Read from Bank 20(0x14) to Bank 16(0x10) */ pr_info("[CAM]ov5693_read_fuseid_once bank_addr=0x%x\n", bank_addr); msm_camera_i2c_write_b(ov5693_msm_camera_i2c_client, 0x3d84, bank_addr); msm_camera_i2c_write_b(ov5693_msm_camera_i2c_client, 0x3d81, 0x01); msleep(3); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d00, &fuse_id[0]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d01, &fuse_id[1]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d02, &fuse_id[2]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d03, &fuse_id[3]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d04, &fuse_id[4]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d05, &fuse_id[5]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d06, &fuse_id[6]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d07, &fuse_id[7]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d08, &fuse_id[8]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d09, &fuse_id[9]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d0A, &fuse_id[10]); msm_camera_i2c_read_b(ov5693_msm_camera_i2c_client, 0x3d0B, &fuse_id[11]); for (count = 0; count < MAX_FUSE_ID_INFO; count++) { if (fuse_id[count] != 0) { dirty = 1; break; } } if (dirty) { OTP[0] = fuse_id[0]; /* Module Vendor */ OTP[1] = fuse_id[1]; /* Lens */ OTP[2] = fuse_id[4]; /* Module Fuse ID A */ OTP[3] = fuse_id[5]; /* Module Fuse ID B */ OTP[4] = fuse_id[6]; /* Module Fuse ID C */ OTP[5] = fuse_id[7]; /* Module Fuse ID D */ OTP[6] = fuse_id[8]; /* Module Fuse ID E */ OTP[7] = fuse_id[9]; /* Module Fuse ID F */ fuseid_read_once = 1; break; } } msm_camera_i2c_write_b(ov5693_msm_camera_i2c_client, 0x0100, 0x00); return 0; }
static int imx175_read_vcm_clib(struct sensor_cfg_data *cdata, struct msm_sensor_ctrl_t *s_ctrl) { uint8_t rc=0; unsigned short info_value = 0; struct msm_camera_i2c_client *imx175_msm_camera_i2c_client = s_ctrl->sensor_i2c_client; vcm_clib =0; vcm_clib_min = 0; vcm_clib_med = 0; vcm_clib_max = 0; pr_info("%s: sensor OTP information:\n", __func__); rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x3A1C, 0x00); if (rc < 0) pr_err("%s: i2c_write_b 0x3A1C fail\n", __func__); rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A00, 0x04); if (rc < 0) pr_err("%s: i2c_write_b 0x0A00 (Start) fail\n", __func__); mdelay(4); vcm_clib =0; rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A02, 5); if (rc < 0) pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, 5); rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A00, 0x01); if (rc < 0) pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__); rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A04), &info_value); if (rc < 0) pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04)); else { pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; } rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A05), &info_value); if (rc < 0) pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A05)); else { pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; } if(vcm_clib >> 8 == 0x03) { uint32_t p; rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A0C), &info_value); if (rc < 0) pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A0C)); else { pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; } rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A0D), &info_value); if (rc < 0) pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A0D)); else { pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; } p=((vcm_clib & 0x0000FFFF) ) >> 3 ; vcm_clib_min= p - 20; vcm_clib_max= p + 26; vcm_clib_med= (vcm_clib_max + vcm_clib_min)/2 -26/4; pr_info("%s: VCM clib=0x%x, [Sharp] (p=%d) min/med/max=%d %d %d\n" , __func__, vcm_clib, p, vcm_clib_min, vcm_clib_med, vcm_clib_max); } else {
{ pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; } p=((vcm_clib & 0x0000FFFF) ) >> 3 ; vcm_clib_min= p - 20; vcm_clib_max= p + 26; vcm_clib_med= (vcm_clib_max + vcm_clib_min)/2 -26/4; pr_info("%s: VCM clib=0x%x, [Sharp] (p=%d) min/med/max=%d %d %d\n" , __func__, vcm_clib, p, vcm_clib_min, vcm_clib_med, vcm_clib_max); } else { vcm_clib =0; rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A02, 16); if (rc < 0) pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, 16); rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A00, 0x01); if (rc < 0) pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__); rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A04), &info_value); if (rc < 0) pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04)); else { pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; }
static void s5k3h2yx_read_vcm_clib(struct msm_sensor_ctrl_t *s_ctrl) { uint8_t rc=0; unsigned short info_value = 0; struct msm_camera_i2c_client *s5k3h2yx_msm_camera_i2c_client = s_ctrl->sensor_i2c_client; vcm_clib =0; vcm_clib_min = 0; vcm_clib_med = 0; vcm_clib_max = 0; pr_info("%s: sensor OTP information:\n", __func__); /* testmode disable */ rc = msm_camera_i2c_write_b(s5k3h2yx_msm_camera_i2c_client, 0x3A1C, 0x00); if (rc < 0) pr_err("%s: i2c_write_b 0x3A1C fail\n", __func__); /* Initialize */ rc = msm_camera_i2c_write_b(s5k3h2yx_msm_camera_i2c_client, 0x0A00, 0x04); if (rc < 0) pr_err("%s: i2c_write_b 0x0A00 (Start) fail\n", __func__); mdelay(4); vcm_clib =0; rc = msm_camera_i2c_write_b(s5k3h2yx_msm_camera_i2c_client, 0x0A02, 5); if (rc < 0) pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, 5); /* Set Read Mode */ rc = msm_camera_i2c_write_b(s5k3h2yx_msm_camera_i2c_client, 0x0A00, 0x01); if (rc < 0) pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__); rc = msm_camera_i2c_read_b(s5k3h2yx_msm_camera_i2c_client, (0x0A04), &info_value); if (rc < 0) pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04)); else { pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; } rc = msm_camera_i2c_read_b(s5k3h2yx_msm_camera_i2c_client, (0x0A05), &info_value); if (rc < 0) pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A05)); else { pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; } //parsing into min/med/max if(vcm_clib >> 8 == 0x03)//SHARP { uint32_t p; rc = msm_camera_i2c_read_b(s5k3h2yx_msm_camera_i2c_client, (0x0A0C), &info_value); if (rc < 0) pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A0C)); else { pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; } rc = msm_camera_i2c_read_b(s5k3h2yx_msm_camera_i2c_client, (0x0A0D), &info_value); if (rc < 0) pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A0D)); else { pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; } p=((vcm_clib & 0x0000FFFF) ) >> 3 ; vcm_clib_min= p - 20; vcm_clib_max= p + 26; vcm_clib_med= (vcm_clib_max + vcm_clib_min)/2 -26/4; pr_info("%s: VCM clib=0x%x, [Sharp] (p=%d) min/med/max=%d %d %d\n" , __func__, vcm_clib, p, vcm_clib_min, vcm_clib_med, vcm_clib_max); } else {
{ pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; } p=((vcm_clib & 0x0000FFFF) ) >> 3 ; vcm_clib_min= p - 20; vcm_clib_max= p + 26; vcm_clib_med= (vcm_clib_max + vcm_clib_min)/2 -26/4; pr_info("%s: VCM clib=0x%x, [Sharp] (p=%d) min/med/max=%d %d %d\n" , __func__, vcm_clib, p, vcm_clib_min, vcm_clib_med, vcm_clib_max); } else { vcm_clib =0; rc = msm_camera_i2c_write_b(s5k3h2yx_msm_camera_i2c_client, 0x0A02, 16); if (rc < 0) pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, 16); /* Set Read Mode */ rc = msm_camera_i2c_write_b(s5k3h2yx_msm_camera_i2c_client, 0x0A00, 0x01); if (rc < 0) pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__); rc = msm_camera_i2c_read_b(s5k3h2yx_msm_camera_i2c_client, (0x0A04), &info_value); if (rc < 0) pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04)); else { pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; }
int32_t ov5693_sensor_setting(struct msm_sensor_ctrl_t *s_ctrl, int update_type, int res) { int rc = 0; int rc1 = 0, rc2 = 0; unsigned short f_value = 0; unsigned short m_value = 0; struct msm_camera_sensor_info *sdata = NULL; pr_info(" %s\n", __func__); if (s_ctrl && s_ctrl->sensordata) sdata = s_ctrl->sensordata; else { pr_err(" %s: s_ctrl sensordata NULL\n", __func__); return (-1); } ov5693_s_ctrl.mirror_flip = CAMERA_SENSOR_NONE; rc = msm_sensor_setting_parallel_ov(s_ctrl, update_type, res); if (update_type == MSM_SENSOR_UPDATE_PERIODIC) { rc1 = msm_camera_i2c_read_b(ov5693_s_ctrl.sensor_i2c_client, OV5693_REG_FLIP, &f_value); if (rc1 < 0) pr_info("%s: msm_camera_i2c_read_b 0x%x fail\n", __func__, OV5693_REG_FLIP); rc2 = msm_camera_i2c_read_b(ov5693_s_ctrl.sensor_i2c_client, OV5693_REG_MIRROR, &m_value); if (rc2 < 0) pr_info("%s: msm_camera_i2c_read_b 0x%x fail\n", __func__, OV5693_REG_MIRROR); pr_info(" f_value = 0x%x m_value = 0x%x", f_value, m_value); if (sdata->sensor_platform_info->mirror_flip == CAMERA_SENSOR_MIRROR_FLIP) { pr_info(" CAMERA_SENSOR_MIRROR_FLIP"); f_value |= 0x42; m_value |= 0x1E; } else if (sdata->sensor_platform_info->mirror_flip == CAMERA_SENSOR_MIRROR) { pr_info(" CAMERA_SENSOR_MIRROR"); f_value &= 0xFD; m_value |= 0x1E; } else if (sdata->sensor_platform_info->mirror_flip == CAMERA_SENSOR_FLIP) { pr_info(" CAMERA_SENSOR_FLIP"); f_value |= 0x42; m_value &= 0xF9; } else { pr_info(" CAMERA_SENSOR_NONE"); f_value &= 0xFD; m_value &= 0xF9; } pr_info(" New f_value = 0x%x m_value = 0x%x", f_value, m_value); rc1 = msm_camera_i2c_write_b(ov5693_s_ctrl.sensor_i2c_client, OV5693_REG_FLIP, f_value); if (rc1 < 0) pr_info("%s: msm_camera_i2c_read_b 0x%x fail\n", __func__, OV5693_REG_FLIP); rc2 = msm_camera_i2c_write_b(ov5693_s_ctrl.sensor_i2c_client, OV5693_REG_MIRROR, m_value); if (rc2 < 0) pr_info("%s: msm_camera_i2c_read_b 0x%x fail\n", __func__, OV5693_REG_MIRROR); } return rc; }
{ pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; } p=((vcm_clib & 0x0000FFFF) ) >> 3 ; vcm_clib_min= p - 20; vcm_clib_max= p + 26; vcm_clib_med= (vcm_clib_max + vcm_clib_min)/2 -26/4; pr_info("%s: VCM clib=0x%x, [Sharp] (p=%d) min/med/max=%d %d %d\n" , __func__, vcm_clib, p, vcm_clib_min, vcm_clib_med, vcm_clib_max); } else { vcm_clib =0; rc = msm_camera_i2c_write_b(ov8838_msm_camera_i2c_client, 0x0A02, 16); if (rc < 0) pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, 16); rc = msm_camera_i2c_write_b(ov8838_msm_camera_i2c_client, 0x0A00, 0x01); if (rc < 0) pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__); rc = msm_camera_i2c_read_b(ov8838_msm_camera_i2c_client, (0x0A04), &info_value); if (rc < 0) pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04)); else { pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value); vcm_clib = (vcm_clib << 8) | info_value; }