summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c236
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.h13
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/eeprom/msm_eeprom.c4
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c1
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c216
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h5
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/msm_sensor_driver.c6
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/msm_sensor_init.c10
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/ois/msm_ois.c81
-rw-r--r--drivers/media/platform/msm/camera_v2/sensor/ois/msm_ois.h5
-rw-r--r--include/media/msm_cam_sensor.h2
-rw-r--r--include/soc/qcom/camera2.h2
-rw-r--r--include/uapi/media/msm_cam_sensor.h32
-rw-r--r--include/uapi/media/msm_camsensor_sdk.h7
14 files changed, 606 insertions, 14 deletions
diff --git a/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c b/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c
index 42f3e356fd8f..ce490495b7bb 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c
@@ -13,6 +13,9 @@
#define pr_fmt(fmt) "%s:%d " fmt, __func__, __LINE__
#include <linux/module.h>
+#ifdef CONFIG_MACH_MI
+#include <linux/firmware.h>
+#endif
#include "msm_sd.h"
#include "msm_actuator.h"
#include "msm_cci.h"
@@ -35,6 +38,9 @@ DEFINE_MSM_MUTEX(msm_actuator_mutex);
#endif
#define PARK_LENS_SMALL_STEP 3
#define MAX_QVALUE 4096
+#ifdef CONFIG_MACH_MI
+#define ACTUATOR_FW_TRANS_SIZE 32
+#endif
static struct v4l2_file_operations msm_actuator_v4l2_subdev_fops;
static int32_t msm_actuator_power_up(struct msm_actuator_ctrl_t *a_ctrl);
@@ -406,6 +412,9 @@ static int32_t msm_actuator_init_focus(struct msm_actuator_ctrl_t *a_ctrl,
(settings[i].delay * 1000) + 1000);
break;
case MSM_ACT_POLL:
+#ifdef CONFIG_MACH_MI
+ case MSM_ACT_POLL_RESULT:
+#endif
rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_poll(
&a_ctrl->i2c_client,
settings[i].reg_addr,
@@ -425,6 +434,16 @@ static int32_t msm_actuator_init_focus(struct msm_actuator_ctrl_t *a_ctrl,
settings[i].reg_data, settings[i].data_type);
break;
}
+
+#ifdef CONFIG_MACH_MI
+ if ((settings[i].i2c_operation == MSM_ACT_POLL_RESULT)
+ && (rc == 1)) {
+ pr_err("%s:%d poll fail (non-fatal) addr = 0X%X, data = 0X%X, dt = %d",
+ __func__, __LINE__, settings[i].reg_addr,
+ settings[i].reg_data, settings[i].data_type);
+ break;
+ }
+#endif
}
a_ctrl->curr_step_pos = 0;
@@ -590,6 +609,12 @@ static int32_t msm_actuator_move_focus(
int dir = move_params->dir;
int32_t num_steps = move_params->num_steps;
struct msm_camera_i2c_reg_setting reg_setting;
+#ifdef CONFIG_MACH_MI
+ enum msm_camera_i2c_reg_addr_type save_addr_type;
+
+ save_addr_type = a_ctrl->i2c_client.addr_type;
+ a_ctrl->i2c_client.addr_type = MSM_CAMERA_I2C_BYTE_ADDR;
+#endif
CDBG("called, dir %d, num_steps %d\n", dir, num_steps);
@@ -700,6 +725,9 @@ static int32_t msm_actuator_move_focus(
return rc;
}
a_ctrl->i2c_tbl_index = 0;
+#ifdef CONFIG_MACH_MI
+ a_ctrl->i2c_client.addr_type = save_addr_type;
+#endif
CDBG("Exit\n");
return rc;
@@ -1283,6 +1311,9 @@ static int32_t msm_actuator_set_param(struct msm_actuator_ctrl_t *a_ctrl,
struct reg_settings_t *init_settings = NULL;
int32_t rc = -EFAULT;
uint16_t i = 0;
+#ifdef CONFIG_MACH_MI
+ uint16_t IC_Status = 0;
+#endif
struct msm_camera_cci_client *cci_client = NULL;
CDBG("Enter\n");
@@ -1401,9 +1432,23 @@ static int32_t msm_actuator_set_param(struct msm_actuator_ctrl_t *a_ctrl,
a_ctrl->i2c_reg_tbl = NULL;
pr_err("Error actuator_init_focus\n");
return -EFAULT;
+#ifdef CONFIG_MACH_MI
+ } else if (rc == 1) {
+ kfree(a_ctrl->i2c_reg_tbl);
+ a_ctrl->i2c_reg_tbl = NULL;
+ pr_err("actuator_init_focus return 1\n");
+ return rc;
+#endif
}
}
}
+#ifdef CONFIG_MACH_MI
+ a_ctrl->i2c_client.addr_type = MSM_CAMERA_I2C_WORD_ADDR;
+ rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_read(
+ &a_ctrl->i2c_client, 0x825F, &IC_Status, MSM_CAMERA_I2C_WORD_DATA);
+ pr_err("actuator read 0x825f value is 0x%x", IC_Status);
+ a_ctrl->i2c_client.addr_type = MSM_CAMERA_I2C_BYTE_ADDR;
+#endif
/* Park lens data */
a_ctrl->park_lens = set_info->actuator_params.park_lens;
@@ -1520,6 +1565,164 @@ static int32_t msm_actuator_config(struct msm_actuator_ctrl_t *a_ctrl,
return rc;
}
+#ifdef CONFIG_MACH_MI
+static void msm_actuator_download(struct work_struct *actuator_work)
+{
+ uint16_t bytes_in_tx = 0;
+ uint16_t total_bytes = 0;
+ uint8_t *ptr = NULL;
+ int32_t rc = 0;
+ struct msm_actuator_ctrl_t *a_ctrl = NULL;
+ struct device *dev = NULL;
+ const struct firmware *fw = NULL;
+ const char *fw_name_prog = NULL;
+ const char *fw_name_coeff = NULL;
+ char name_prog[MAX_SENSOR_NAME] = {0};
+ char name_coeff[MAX_SENSOR_NAME] = {0};
+ enum msm_camera_i2c_reg_addr_type save_addr_type;
+ CDBG("Enter\n");
+
+ a_ctrl = container_of(actuator_work, struct msm_actuator_ctrl_t, actuator_work);
+ dev = &(a_ctrl->pdev->dev);
+
+ pr_err("2c_client.addr_type = %d", a_ctrl->i2c_client.addr_type);
+ save_addr_type = a_ctrl->i2c_client.addr_type;
+ a_ctrl->i2c_client.addr_type = MSM_CAMERA_I2C_BYTE_ADDR;
+
+ snprintf(name_coeff, MAX_SENSOR_NAME, "%s.coeff",
+ a_ctrl->aboard_info->actuator_name);
+
+ snprintf(name_prog, MAX_SENSOR_NAME, "%s.prog",
+ a_ctrl->aboard_info->actuator_name);
+
+ /* cast pointer as const pointer*/
+ fw_name_prog = name_prog;
+ fw_name_coeff = name_coeff;
+
+ /* Load FW */
+ rc = request_firmware(&fw, fw_name_prog, dev);
+ if (rc < 0) {
+ dev_err(dev, "Failed to locate %s\n", fw_name_prog);
+ a_ctrl->i2c_client.addr_type = save_addr_type;
+ goto release_firmware;
+ }
+
+ total_bytes = fw->size;
+ for (ptr = (uint8_t *)fw->data; total_bytes;
+ total_bytes -= bytes_in_tx, ptr += bytes_in_tx) {
+ bytes_in_tx = (total_bytes > ACTUATOR_FW_TRANS_SIZE) ? ACTUATOR_FW_TRANS_SIZE : total_bytes;
+ rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_write_seq(
+ &a_ctrl->i2c_client, a_ctrl->aboard_info->opcode.prog,
+ ptr, bytes_in_tx);
+ if (rc < 0) {
+ pr_err("Failed:remaining bytes to be downloaded:%d\n",
+ bytes_in_tx);
+ /* abort download fw and return error*/
+ goto release_firmware;
+ }
+ }
+
+ rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_write(
+ &a_ctrl->i2c_client, 0x8C, 0x01, MSM_CAMERA_I2C_BYTE_DATA);
+ if (rc < 0) {
+ pr_err("actuator write 0x01 to 0x8c failed");
+ }
+
+ a_ctrl->i2c_client.addr_type = MSM_CAMERA_I2C_WORD_ADDR;
+ rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_write(
+ &a_ctrl->i2c_client, 0x8430, 0x0D00, MSM_CAMERA_I2C_WORD_DATA);
+ a_ctrl->i2c_client.addr_type = MSM_CAMERA_I2C_BYTE_ADDR;
+ if (rc < 0) {
+ pr_err("actuator write 0x0D00 to 0x8430 failed");
+ }
+
+ pr_err("%s %d actuator load FW succeed\n", __func__, __LINE__);
+
+release_firmware:
+ release_firmware(fw);
+ a_ctrl->i2c_client.addr_type = save_addr_type;
+ CDBG("Exit\n");
+}
+
+static int32_t msm_actuator_data_config(struct msm_actuator_ctrl_t *a_ctrl,
+ struct msm_actuator_slave_info *slave_info)
+{
+ int rc = 0;
+ struct msm_camera_cci_client *cci_client = NULL;
+
+ CDBG("Enter\n");
+ if (!slave_info) {
+ pr_err("failed : invalid slave_info\n");
+ return -EINVAL;
+ }
+
+ /* fill actuator slave info*/
+ strlcpy(a_ctrl->aboard_info->actuator_name, slave_info->actuator_name,
+ sizeof(a_ctrl->aboard_info->actuator_name));
+ memcpy(&(a_ctrl->aboard_info->opcode), &(slave_info->opcode),
+ sizeof(struct msm_actuator_opcode));
+ a_ctrl->aboard_info->i2c_slaveaddr = slave_info->i2c_addr;
+
+ /* config cci_client*/
+ if (a_ctrl->act_device_type == MSM_CAMERA_PLATFORM_DEVICE) {
+ cci_client = a_ctrl->i2c_client.cci_client;
+ cci_client->sid =
+ a_ctrl->aboard_info->i2c_slaveaddr >> 1;
+ cci_client->retries = 3;
+ cci_client->id_map = 0;
+ cci_client->cci_i2c_master = a_ctrl->cci_master;
+ } else {
+ a_ctrl->i2c_client.client->addr =
+ a_ctrl->aboard_info->i2c_slaveaddr;
+ }
+
+ CDBG("Exit\n");
+ return rc;
+}
+
+static int32_t msm_actuator_config_download(struct msm_actuator_ctrl_t *a_ctrl,
+ void __user *argp)
+{
+
+ struct msm_actuator_cfg_download_data *cdata =
+ (struct msm_actuator_cfg_download_data *)argp;
+ int32_t rc = 0;
+
+ if (!a_ctrl || !cdata) {
+ pr_err("failed: Invalid data\n");
+ return -EINVAL;
+ }
+ mutex_lock(a_ctrl->actuator_mutex);
+ CDBG("Enter\n");
+ CDBG("%s type %d\n", __func__, cdata->cfgtype);
+
+ switch (cdata->cfgtype) {
+ case CFG_ACTUATOR_DATA_CONFIG:
+ rc = msm_actuator_data_config(a_ctrl, &cdata->slave_info);
+ if (rc < 0)
+ pr_err("actuator data config failed %d\n", rc);
+ break;
+ case CFG_ACTUATOR_DOWNLOAD:
+ a_ctrl->actuator_work_queue = alloc_workqueue("actautor_fw_download", WQ_HIGHPRI|WQ_UNBOUND, 0);
+ if (!a_ctrl->actuator_work_queue) {
+ pr_err("register actautor fw download workqueue failed\n");
+ rc = -ENOMEM;
+ return rc;
+ }
+ INIT_WORK(&a_ctrl->actuator_work, msm_actuator_download);
+ queue_work(a_ctrl->actuator_work_queue, &a_ctrl->actuator_work);
+
+ break;
+
+ default:
+ break;
+ }
+ mutex_unlock(a_ctrl->actuator_mutex);
+ CDBG("Exit\n");
+ return rc;
+}
+#endif
+
static int32_t msm_actuator_get_subdev_id(struct msm_actuator_ctrl_t *a_ctrl,
void *arg)
{
@@ -1544,6 +1747,9 @@ static struct msm_camera_i2c_fn_t msm_sensor_cci_func_tbl = {
.i2c_read_seq = msm_camera_cci_i2c_read_seq,
.i2c_write = msm_camera_cci_i2c_write,
.i2c_write_table = msm_camera_cci_i2c_write_table,
+#ifdef CONFIG_MACH_MI
+ .i2c_write_seq = msm_camera_cci_i2c_write_seq,
+#endif
.i2c_write_seq_table = msm_camera_cci_i2c_write_seq_table,
.i2c_write_table_w_microdelay =
msm_camera_cci_i2c_write_table_w_microdelay,
@@ -1556,6 +1762,9 @@ static struct msm_camera_i2c_fn_t msm_sensor_qup_func_tbl = {
.i2c_read_seq = msm_camera_qup_i2c_read_seq,
.i2c_write = msm_camera_qup_i2c_write,
.i2c_write_table = msm_camera_qup_i2c_write_table,
+#ifdef CONFIG_MACH_MI
+ .i2c_write_seq = msm_camera_cci_i2c_write_seq,
+#endif
.i2c_write_seq_table = msm_camera_qup_i2c_write_seq_table,
.i2c_write_table_w_microdelay =
msm_camera_qup_i2c_write_table_w_microdelay,
@@ -1572,6 +1781,15 @@ static int msm_actuator_close(struct v4l2_subdev *sd,
return -EINVAL;
}
mutex_lock(a_ctrl->actuator_mutex);
+
+#ifdef CONFIG_MACH_MI
+ if (a_ctrl->actuator_work_queue) {
+ mutex_unlock(a_ctrl->actuator_mutex);
+ destroy_workqueue(a_ctrl->actuator_work_queue);
+ mutex_lock(a_ctrl->actuator_mutex);
+ a_ctrl->actuator_work_queue = NULL;
+ }
+#endif
if (a_ctrl->act_device_type == MSM_CAMERA_PLATFORM_DEVICE &&
a_ctrl->actuator_state != ACT_DISABLE_STATE) {
rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_util(
@@ -1628,6 +1846,10 @@ static long msm_actuator_subdev_ioctl(struct v4l2_subdev *sd,
}
mutex_unlock(a_ctrl->actuator_mutex);
return msm_actuator_close(sd, NULL);
+#ifdef CONFIG_MACH_MI
+ case VIDIOC_MSM_ACTUATOR_CFG_DOWNLOAD:
+ return msm_actuator_config_download(a_ctrl, argp);
+#endif
default:
return -ENOIOCTLCMD;
}
@@ -1957,6 +2179,17 @@ static int32_t msm_actuator_platform_probe(struct platform_device *pdev)
pr_err("%s:%d failed no memory\n", __func__, __LINE__);
return -ENOMEM;
}
+
+#ifdef CONFIG_MACH_MI
+ msm_actuator_t->aboard_info = kzalloc(sizeof(struct msm_actuator_board_info),
+ GFP_KERNEL);
+ if (!(msm_actuator_t->aboard_info)) {
+ pr_err("%s:%d failed no memory\n", __func__, __LINE__);
+ kfree(msm_actuator_t);
+ return -ENOMEM;
+ }
+#endif
+
rc = of_property_read_u32((&pdev->dev)->of_node, "cell-index",
&pdev->id);
CDBG("cell-index %d, rc %d\n", pdev->id, rc);
@@ -2015,6 +2248,9 @@ static int32_t msm_actuator_platform_probe(struct platform_device *pdev)
if (!msm_actuator_t->i2c_client.cci_client) {
kfree(msm_actuator_t->vreg_cfg.cam_vreg);
kfree(msm_actuator_t);
+#ifdef CONFIG_MACH_MI
+ kfree(msm_actuator_t->aboard_info);
+#endif
pr_err("failed no memory\n");
return -ENOMEM;
}
diff --git a/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.h b/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.h
index 3b61ee0acabb..c3d9b08a1593 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.h
+++ b/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.h
@@ -72,6 +72,14 @@ struct msm_actuator_vreg {
int num_vreg;
};
+#ifdef CONFIG_MACH_MI
+struct msm_actuator_board_info {
+ char actuator_name[NAME_SIZE_MAX];
+ uint32_t i2c_slaveaddr;
+ struct msm_actuator_opcode opcode;
+};
+#endif
+
struct msm_actuator_ctrl_t {
struct i2c_driver *i2c_driver;
struct platform_driver *pdriver;
@@ -108,6 +116,11 @@ struct msm_actuator_ctrl_t {
struct msm_camera_gpio_conf *gconf;
struct msm_pinctrl_info pinctrl_info;
uint8_t cam_pinctrl_status;
+#ifdef CONFIG_MACH_MI
+ struct msm_actuator_board_info *aboard_info;
+ struct workqueue_struct *actuator_work_queue;
+ struct work_struct actuator_work;
+#endif
};
#endif
diff --git a/drivers/media/platform/msm/camera_v2/sensor/eeprom/msm_eeprom.c b/drivers/media/platform/msm/camera_v2/sensor/eeprom/msm_eeprom.c
index ad2dab41365e..1bef95898723 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/eeprom/msm_eeprom.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/eeprom/msm_eeprom.c
@@ -2033,7 +2033,11 @@ static int msm_eeprom_platform_probe(struct platform_device *pdev)
e_ctrl->cal_data.mapdata = NULL;
e_ctrl->cal_data.map = NULL;
+#ifdef CONFIG_MACH_XIAOMI_JASON
+ e_ctrl->userspace_probe = 1;
+#else
e_ctrl->userspace_probe = 0;
+#endif
e_ctrl->is_supported = 0;
if (!of_node) {
pr_err("%s dev.of_node NULL\n", __func__);
diff --git a/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c b/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c
index 00860d05671d..e1bb72b3c7e3 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/io/msm_camera_dt_util.c
@@ -144,6 +144,7 @@ int msm_camera_fill_vreg_params(struct camera_vreg_t *cam_vreg,
break;
}
}
+ break;
case CAM_V_CUSTOM2:
for (j = 0; j < num_vreg; j++) {
diff --git a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c
index d71db4c6d719..4e5c52161369 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c
@@ -203,7 +203,8 @@ int msm_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl)
sensor_i2c_client);
if (rc < 0)
return rc;
-#ifdef CONFIG_MACH_LONGCHEER
+
+#ifdef CONFIG_MACH_XIAOMI_SDM660
if (!s_ctrl->is_probe_succeed) {
rc = msm_sensor_match_vendor_id(s_ctrl);
if (rc < 0) {
@@ -212,8 +213,18 @@ int msm_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl)
msleep(20);
continue;
}
+#ifdef CONFIG_MACH_MI
+ rc = msm_sensor_match_vcm_id(s_ctrl);
+ if (rc < 0) {
+ msm_camera_power_down(power_info,
+ s_ctrl->sensor_device_type, sensor_i2c_client);
+ msleep(20);
+ continue;
+ }
+#endif
}
#endif
+
rc = msm_sensor_check_id(s_ctrl);
if (rc < 0) {
msm_camera_power_down(power_info,
@@ -228,7 +239,7 @@ int msm_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl)
return rc;
}
-#ifdef CONFIG_MACH_LONGCHEER
+#ifdef CONFIG_MACH_XIAOMI_SDM660
int msm_sensor_match_vendor_id(struct msm_sensor_ctrl_t *s_ctrl)
{
int rc = 0;
@@ -237,12 +248,16 @@ int msm_sensor_match_vendor_id(struct msm_sensor_ctrl_t *s_ctrl)
struct msm_camera_slave_info *slave_info;
const char *sensor_name;
uint16_t temp_sid = 0;
+#ifdef CONFIG_MACH_LONGCHEER
uint16_t vcmid = 0;
int have_vcmid = 0;
#ifdef CONFIG_MACH_XIAOMI_LAVENDER
uint16_t lensid = 0;
int have_lensid = 0;
#endif
+#elif defined(CONFIG_MACH_MI)
+ uint16_t moduleflag = 0;
+#endif
enum cci_i2c_master_t temp_master = MASTER_0;
if (!s_ctrl) {
@@ -282,12 +297,141 @@ int msm_sensor_match_vendor_id(struct msm_sensor_ctrl_t *s_ctrl)
sensor_i2c_client->cci_client->sid =
s_ctrl->sensordata->vendor_id_info->eeprom_slave_addr >> 1;
+#ifdef CONFIG_MACH_MI
+ if (strnstr(sensor_name, "s5k5e8", strlen(sensor_name))) {
+ /* make initial state */
+ rc = msm_camera_cci_i2c_write(
+ sensor_i2c_client,
+ 0x0A00,
+ 0x04,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ /* set page14 of otp */
+ rc = msm_camera_cci_i2c_write(
+ sensor_i2c_client,
+ 0x0A02,
+ 0x0E,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ /* set read mode of NVM controller Interface1 */
+ rc = msm_camera_cci_i2c_write(
+ sensor_i2c_client,
+ 0x0A00,
+ 0x01,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ /* the time to transfer 1page data from otp to buffer */
+ msleep(100);
+ rc = msm_camera_cci_i2c_read(
+ sensor_i2c_client,
+ 0x0A04,
+ &moduleflag,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ /* flag of Group 1 0x55 valid */
+ if (moduleflag != 0x55) {
+ rc = msm_camera_cci_i2c_read(
+ sensor_i2c_client,
+ 0x0A1E,
+ &moduleflag,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ /* flag of Group 2 0x55 valid */
+ if (moduleflag != 0x55) {
+ /* vendor id in Group3 */
+ rc = msm_camera_cci_i2c_read(
+ sensor_i2c_client,
+ 0x0A3A,
+ &vendorid,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ } else
+ /* vendor id in Group2 */
+ rc = msm_camera_cci_i2c_read(
+ sensor_i2c_client,
+ 0x0A20,
+ &vendorid,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ } else {
+ /* vendor id in Group1 */
+ rc = msm_camera_cci_i2c_read(
+ sensor_i2c_client,
+ 0x0A06,
+ &vendorid,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ }
+ /* disable NVM controller */
+ rc = msm_camera_cci_i2c_write(
+ sensor_i2c_client,
+ 0x0A00,
+ 0x00,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ } else if (strnstr(sensor_name, "s5k4h7", strlen(sensor_name))) {
+ /* make initial state */
+ rc = msm_camera_cci_i2c_write(
+ sensor_i2c_client,
+ 0x0100,
+ 0x01,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ msleep(50);
+ /* set page21 of otp */
+ rc = msm_camera_cci_i2c_write(
+ sensor_i2c_client,
+ 0x0A02,
+ 0x15,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ /* set read mode of NVM controller Interface1 */
+ rc = msm_camera_cci_i2c_write(
+ sensor_i2c_client,
+ 0x0A00,
+ 0x01,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ /* the time to transfer 1page data from otp to buffer */
+ msleep(1);
+ rc = msm_camera_cci_i2c_read(
+ sensor_i2c_client,
+ 0x0A04,
+ &moduleflag,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ /* flag of Group 1 0x55 valid */
+ if (moduleflag != 0x55) {
+ rc = msm_camera_cci_i2c_read(
+ sensor_i2c_client,
+ 0x0A1E,
+ &moduleflag,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ /* flag of Group 2 0x55 valid */
+ if (moduleflag != 0x55) {
+ /* vendor id in Group3 */
+ rc = msm_camera_cci_i2c_read(
+ sensor_i2c_client,
+ 0x0A3A,
+ &vendorid,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ } else
+ /* vendor id in Group2 */
+ rc = msm_camera_cci_i2c_read(
+ sensor_i2c_client,
+ 0x0A20,
+ &vendorid,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ } else {
+ /* vendor id in Group1 */
+ rc = msm_camera_cci_i2c_read(
+ sensor_i2c_client,
+ 0x0A06,
+ &vendorid,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ }
+ /* disable NVM controller */
+ rc = msm_camera_cci_i2c_write(
+ sensor_i2c_client,
+ 0x0A00,
+ 0x00,
+ MSM_CAMERA_I2C_BYTE_DATA);
+ } else
+#endif
rc = msm_camera_cci_i2c_read(
sensor_i2c_client,
s_ctrl->sensordata->vendor_id_info->vendor_id_addr,
&vendorid,
s_ctrl->sensordata->vendor_id_info->data_type);
+#ifdef CONFIG_MACH_LONGCHEER
if (s_ctrl->sensordata->vcm_id_info->vcm_id_addr != 0) {
msm_camera_cci_i2c_read(
sensor_i2c_client,
@@ -307,6 +451,7 @@ int msm_sensor_match_vendor_id(struct msm_sensor_ctrl_t *s_ctrl)
have_lensid = 1;
}
#endif
+#endif
sensor_i2c_client->cci_client->sid = temp_sid;
sensor_i2c_client->cci_client->cci_i2c_master = temp_master;
@@ -320,7 +465,7 @@ int msm_sensor_match_vendor_id(struct msm_sensor_ctrl_t *s_ctrl)
s_ctrl->sensordata->vendor_id_info->eeprom_slave_addr,
s_ctrl->sensordata->vendor_id_info->vendor_id_addr);
rc = -1;
- return rc;
+#ifdef CONFIG_MACH_LONGCHEER
} else {
if (have_vcmid) {
if (s_ctrl->sensordata->vcm_id_info->vcm_id != vcmid) {
@@ -346,6 +491,7 @@ int msm_sensor_match_vendor_id(struct msm_sensor_ctrl_t *s_ctrl)
}
}
#endif
+#endif
}
pr_err("%s: read vendor id: 0x%x expected id 0x%x:\n",
__func__, vendorid, s_ctrl->sensordata->vendor_id_info->vendor_id);
@@ -415,6 +561,70 @@ int msm_sensor_match_id(struct msm_sensor_ctrl_t *s_ctrl)
return rc;
}
+#ifdef CONFIG_MACH_MI
+int msm_sensor_match_vcm_id(struct msm_sensor_ctrl_t *s_ctrl)
+{
+ int rc = 0;
+ uint16_t vcmid = 0;
+ struct msm_camera_i2c_client *sensor_i2c_client;
+ struct msm_camera_slave_info *slave_info;
+ const char *sensor_name;
+ uint16_t temp_sid = 0;
+ enum cci_i2c_master_t temp_master = MASTER_0;
+ if (!s_ctrl) {
+ pr_err("%s:%d failed: %pK\n",
+ __func__, __LINE__, s_ctrl);
+ return -EINVAL;
+ }
+ sensor_i2c_client = s_ctrl->sensor_i2c_client;
+ slave_info = s_ctrl->sensordata->slave_info;
+ sensor_name = s_ctrl->sensordata->sensor_name;
+
+ if (!sensor_i2c_client || !slave_info || !sensor_name) {
+ pr_err("%s:%d failed: %pK %pK %pK\n",
+ __func__, __LINE__, sensor_i2c_client, slave_info,
+ sensor_name);
+ return -EINVAL;
+ }
+ if (s_ctrl->sensordata->vcm_id_info->eeprom_slave_addr == 0) {
+ pr_err("slave_addr =0\n");
+ return rc;
+ }
+
+ temp_master = sensor_i2c_client->cci_client->cci_i2c_master;
+ switch (s_ctrl->sensordata->vcm_id_info->cci_i2c_master) {
+ case MSM_MASTER_0:
+ sensor_i2c_client->cci_client->cci_i2c_master = MASTER_0;
+ break;
+ case MSM_MASTER_1:
+ sensor_i2c_client->cci_client->cci_i2c_master = MASTER_1;
+ break;
+ default:
+ break;
+ }
+ temp_sid = sensor_i2c_client->cci_client->sid;
+ sensor_i2c_client->cci_client->sid =
+ s_ctrl->sensordata->vcm_id_info->eeprom_slave_addr >> 1;
+ rc = msm_camera_cci_i2c_read(
+ sensor_i2c_client,
+ s_ctrl->sensordata->vcm_id_info->vcm_id_addr,
+ &vcmid,
+ s_ctrl->sensordata->vcm_id_info->data_type);
+ sensor_i2c_client->cci_client->sid = temp_sid;
+ sensor_i2c_client->cci_client->cci_i2c_master = temp_master;
+ if (rc < 0) {
+ pr_err("%s: %s: read vcm id failed\n", __func__, sensor_name);
+ return rc;
+ }
+ if (s_ctrl->sensordata->vcm_id_info->vcm_id != vcmid) {
+ rc = -1;
+ pr_err("%s: read vcm id: 0x%x expected id 0x%x:\n",
+ __func__, vcmid, s_ctrl->sensordata->vcm_id_info->vcm_id);
+ }
+ return rc;
+}
+#endif
+
static struct msm_sensor_ctrl_t *get_sctrl(struct v4l2_subdev *sd)
{
return container_of(container_of(sd, struct msm_sd_subdev, sd),
diff --git a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h
index c78044f86265..eaf4c40933d2 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h
+++ b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h
@@ -104,9 +104,12 @@ int msm_sensor_match_id(struct msm_sensor_ctrl_t *s_ctrl);
int msm_sensor_update_cfg(struct msm_sensor_ctrl_t *s_ctrl);
-#ifdef CONFIG_MACH_LONGCHEER
+#ifdef CONFIG_MACH_XIAOMI_SDM660
int msm_sensor_match_vendor_id(struct msm_sensor_ctrl_t *s_ctrl);
#endif
+#ifdef CONFIG_MACH_MI
+int msm_sensor_match_vcm_id(struct msm_sensor_ctrl_t *s_ctrl);
+#endif
int msm_sensor_free_sensor_data(struct msm_sensor_ctrl_t *s_ctrl);
diff --git a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor_driver.c b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor_driver.c
index 392e335f334b..02e33d12d35d 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor_driver.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor_driver.c
@@ -1460,7 +1460,7 @@ int32_t msm_sensor_driver_probe(void *setting,
slave_info->i2c_freq_mode = slave_info32->i2c_freq_mode;
slave_info->sensor_id_info = slave_info32->sensor_id_info;
-#ifdef CONFIG_MACH_LONGCHEER
+#ifdef CONFIG_MACH_XIAOMI_SDM660
slave_info->vendor_id_info = slave_info32->vendor_id_info;
slave_info->vcm_id_info = slave_info32->vcm_id_info;
#endif
@@ -1662,7 +1662,7 @@ int32_t msm_sensor_driver_probe(void *setting,
if (slave_info->sensor_id_info.sensor_id ==
s_ctrl->sensordata->cam_slave_info->
sensor_id_info.sensor_id &&
-#ifdef CONFIG_MACH_LONGCHEER
+#ifdef CONFIG_MACH_XIAOMI_SDM660
slave_info->vendor_id_info.vendor_id ==
s_ctrl->sensordata->cam_slave_info->
vendor_id_info.vendor_id &&
@@ -1767,7 +1767,7 @@ CSID_TG:
s_ctrl->sensordata->actuator_name = slave_info->actuator_name;
s_ctrl->sensordata->ois_name = slave_info->ois_name;
s_ctrl->sensordata->flash_name = slave_info->flash_name;
-#ifdef CONFIG_MACH_LONGCHEER
+#ifdef CONFIG_MACH_XIAOMI_SDM660
s_ctrl->sensordata->vendor_id_info = &(slave_info->vendor_id_info);
s_ctrl->sensordata->vcm_id_info = &(slave_info->vcm_id_info);
#endif
diff --git a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor_init.c b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor_init.c
index 7e3666042fde..38b651499ef3 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor_init.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor_init.c
@@ -41,6 +41,15 @@ static const struct v4l2_subdev_internal_ops msm_sensor_init_internal_ops;
static int msm_sensor_wait_for_probe_done(struct msm_sensor_init_t *s_init)
{
+#ifdef CONFIG_MACH_MI
+ int rc = 0;
+ if (s_init->module_init_status == 1) {
+ CDBG("msm_cam_get_module_init_status -2\n");
+ return 0;
+ }
+ wait_event(s_init->state_wait,
+ (s_init->module_init_status == 1));
+#else
int rc;
int tm = 20000;
if (s_init->module_init_status == 1) {
@@ -51,6 +60,7 @@ static int msm_sensor_wait_for_probe_done(struct msm_sensor_init_t *s_init)
(s_init->module_init_status == 1), msecs_to_jiffies(tm));
if (rc == 0)
pr_err("%s:%d wait timeout\n", __func__, __LINE__);
+#endif
return rc;
}
diff --git a/drivers/media/platform/msm/camera_v2/sensor/ois/msm_ois.c b/drivers/media/platform/msm/camera_v2/sensor/ois/msm_ois.c
index d3d48b0bbe4c..c9c61c2c0cca 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/ois/msm_ois.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/ois/msm_ois.c
@@ -27,12 +27,17 @@ DEFINE_MSM_MUTEX(msm_ois_mutex);
#define CDBG(fmt, args...) pr_debug(fmt, ##args)
#endif
+#ifdef CONFIG_MACH_XIAOMI_JASON
+#define OIS_FW_TRANS_SIZE (32*2)
+#endif
+
static struct v4l2_file_operations msm_ois_v4l2_subdev_fops;
static int32_t msm_ois_power_up(struct msm_ois_ctrl_t *o_ctrl);
static int32_t msm_ois_power_down(struct msm_ois_ctrl_t *o_ctrl);
static struct i2c_driver msm_ois_i2c_driver;
+#ifndef CONFIG_MACH_XIAOMI_JASON
static int32_t data_type_to_num_bytes(
enum msm_camera_i2c_data_type data_type)
{
@@ -56,6 +61,7 @@ static int32_t data_type_to_num_bytes(
}
return ret_val;
}
+#endif
static int32_t msm_ois_download(struct msm_ois_ctrl_t *o_ctrl)
{
@@ -96,7 +102,11 @@ static int32_t msm_ois_download(struct msm_ois_ctrl_t *o_ctrl)
total_bytes = fw->size;
for (ptr = (uint8_t *)fw->data; total_bytes;
total_bytes -= bytes_in_tx, ptr += bytes_in_tx) {
+#ifndef CONFIG_MACH_XIAOMI_JASON
bytes_in_tx = (total_bytes > 10) ? 10 : total_bytes;
+#else
+ bytes_in_tx = (total_bytes > OIS_FW_TRANS_SIZE) ? OIS_FW_TRANS_SIZE : total_bytes;
+#endif
rc = o_ctrl->i2c_client.i2c_func_tbl->i2c_write_seq(
&o_ctrl->i2c_client, o_ctrl->oboard_info->opcode.prog,
ptr, bytes_in_tx);
@@ -118,7 +128,11 @@ static int32_t msm_ois_download(struct msm_ois_ctrl_t *o_ctrl)
total_bytes = fw->size;
for (ptr = (uint8_t *)fw->data; total_bytes;
total_bytes -= bytes_in_tx, ptr += bytes_in_tx) {
+#ifndef CONFIG_MACH_XIAOMI_JASON
bytes_in_tx = (total_bytes > 10) ? 10 : total_bytes;
+#else
+ bytes_in_tx = (total_bytes > OIS_FW_TRANS_SIZE) ? OIS_FW_TRANS_SIZE : total_bytes;
+#endif
rc = o_ctrl->i2c_client.i2c_func_tbl->i2c_write_seq(
&o_ctrl->i2c_client, o_ctrl->oboard_info->opcode.coeff,
ptr, bytes_in_tx);
@@ -179,13 +193,24 @@ static int32_t msm_ois_write_settings(struct msm_ois_ctrl_t *o_ctrl,
uint16_t size, struct reg_settings_ois_t *settings)
{
int32_t rc = -EFAULT;
- int32_t i = 0, num_byte_seq = 0;
+ int32_t i = 0;
+#ifndef CONFIG_MACH_XIAOMI_JASON
+ int32_t num_byte_seq = 0;
uint8_t *reg_data_seq;
+#endif
struct msm_camera_i2c_seq_reg_array *reg_setting;
+#ifdef CONFIG_MACH_XIAOMI_JASON
+ enum msm_camera_i2c_reg_addr_type save_addr_type;
+
+ save_addr_type = o_ctrl->i2c_client.addr_type;
+#endif
CDBG("Enter\n");
for (i = 0; i < size; i++) {
+#ifdef CONFIG_MACH_XIAOMI_JASON
+ o_ctrl->i2c_client.addr_type = settings[i].addr_type;
+#endif
switch (settings[i].i2c_operation) {
case MSM_OIS_WRITE: {
switch (settings[i].data_type) {
@@ -201,8 +226,12 @@ static int32_t msm_ois_write_settings(struct msm_ois_ctrl_t *o_ctrl,
reg_setting =
kzalloc(sizeof(struct msm_camera_i2c_seq_reg_array),
GFP_KERNEL);
- if (!reg_setting)
+ if (!reg_setting) {
+#ifdef CONFIG_MACH_XIAOMI_JASON
+ o_ctrl->i2c_client.addr_type = save_addr_type;
+#endif
return -ENOMEM;
+ }
reg_setting->reg_addr = settings[i].reg_addr;
reg_setting->reg_data[0] = (uint8_t)
@@ -224,8 +253,12 @@ static int32_t msm_ois_write_settings(struct msm_ois_ctrl_t *o_ctrl,
reg_setting->reg_data_size);
kfree(reg_setting);
reg_setting = NULL;
- if (rc < 0)
+ if (rc < 0) {
+#ifdef CONFIG_MACH_XIAOMI_JASON
+ o_ctrl->i2c_client.addr_type = save_addr_type;
+#endif
return rc;
+ }
break;
default:
@@ -262,6 +295,7 @@ static int32_t msm_ois_write_settings(struct msm_ois_ctrl_t *o_ctrl,
break;
}
case MSM_OIS_READ: {
+#ifndef CONFIG_MACH_XIAOMI_JASON
switch (settings[i].data_type) {
case MSM_CAMERA_I2C_BYTE_DATA:
case MSM_CAMERA_I2C_WORD_DATA:
@@ -297,6 +331,7 @@ static int32_t msm_ois_write_settings(struct msm_ois_ctrl_t *o_ctrl,
settings[i].data_type);
break;
}
+#endif
break;
}
@@ -304,6 +339,9 @@ static int32_t msm_ois_write_settings(struct msm_ois_ctrl_t *o_ctrl,
break;
}
}
+#ifdef CONFIG_MACH_XIAOMI_JASON
+ o_ctrl->i2c_client.addr_type = save_addr_type;
+#endif
CDBG("Exit\n");
return rc;
}
@@ -340,6 +378,15 @@ static int32_t msm_ois_power_down(struct msm_ois_ctrl_t *o_ctrl)
CDBG("Enter\n");
if (o_ctrl->ois_state != OIS_DISABLE_STATE) {
+#ifdef CONFIG_MACH_XIAOMI_JASON
+ rc = msm_camera_clk_enable(&o_ctrl->pdev->dev,
+ o_ctrl->clk_info, o_ctrl->clk_ptr,
+ o_ctrl->clk_info_size, false);
+ if (rc < 0) {
+ pr_err("%s: clk enable failed\n", __func__);
+ return rc;
+ }
+#endif
rc = msm_ois_vreg_control(o_ctrl, 0);
if (rc < 0) {
@@ -412,7 +459,11 @@ static int32_t msm_ois_control(struct msm_ois_ctrl_t *o_ctrl,
struct msm_ois_set_info_t *set_info)
{
struct reg_settings_ois_t *settings = NULL;
+#ifndef CONFIG_MACH_XIAOMI_JASON
int32_t rc = 0, i = 0;
+#else
+ int32_t rc = 0;
+#endif
struct msm_camera_cci_client *cci_client = NULL;
CDBG("Enter\n");
@@ -455,6 +506,7 @@ static int32_t msm_ois_control(struct msm_ois_ctrl_t *o_ctrl,
set_info->ois_params.setting_size,
settings);
+#ifndef CONFIG_MACH_XIAOMI_JASON
for (i = 0; i < set_info->ois_params.setting_size; i++) {
if (set_info->ois_params.settings[i].i2c_operation
== MSM_OIS_READ) {
@@ -465,6 +517,7 @@ static int32_t msm_ois_control(struct msm_ois_ctrl_t *o_ctrl,
set_info->ois_params.settings[i].reg_data);
}
}
+#endif
kfree(settings);
if (rc < 0) {
@@ -716,6 +769,16 @@ static int32_t msm_ois_power_up(struct msm_ois_ctrl_t *o_ctrl)
return rc;
}
+#ifdef CONFIG_MACH_XIAOMI_JASON
+ rc = msm_camera_clk_enable(&o_ctrl->pdev->dev,
+ o_ctrl->clk_info, o_ctrl->clk_ptr,
+ o_ctrl->clk_info_size, true);
+ if (rc < 0) {
+ pr_err("%s: clk enable failed\n", __func__);
+ return rc;
+ }
+#endif
+
for (gpio = SENSOR_GPIO_AF_PWDM;
gpio < SENSOR_GPIO_MAX; gpio++) {
if (o_ctrl->gconf && o_ctrl->gconf->gpio_num_info &&
@@ -896,9 +959,11 @@ static long msm_ois_subdev_do_ioctl(
break;
}
break;
+#ifndef CONFIG_MACH_XIAOMI_JASON
case VIDIOC_MSM_OIS_CFG:
pr_err("%s: invalid cmd 0x%x received\n", __func__, cmd);
return -EINVAL;
+#endif
}
rc = msm_ois_subdev_ioctl(sd, cmd, parg);
@@ -981,6 +1046,16 @@ static int32_t msm_ois_platform_probe(struct platform_device *pdev)
}
}
+#ifdef CONFIG_MACH_XIAOMI_JASON
+ /*Get clocks information*/
+ rc = msm_camera_get_clk_info(pdev,
+ &msm_ois_t->clk_info,
+ &msm_ois_t->clk_ptr,
+ &msm_ois_t->clk_info_size);
+ if (rc < 0)
+ pr_err("failed: msm_camera_get_clk_info rc %d", rc);
+#endif
+
msm_ois_t->ois_v4l2_subdev_ops = &msm_ois_subdev_ops;
msm_ois_t->ois_mutex = &msm_ois_mutex;
diff --git a/drivers/media/platform/msm/camera_v2/sensor/ois/msm_ois.h b/drivers/media/platform/msm/camera_v2/sensor/ois/msm_ois.h
index 614cc6c8cd5d..502f89ac637a 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/ois/msm_ois.h
+++ b/drivers/media/platform/msm/camera_v2/sensor/ois/msm_ois.h
@@ -68,6 +68,11 @@ struct msm_ois_ctrl_t {
struct msm_pinctrl_info pinctrl_info;
uint8_t cam_pinctrl_status;
struct msm_ois_board_info *oboard_info;
+#ifdef CONFIG_MACH_XIAOMI_JASON
+ struct msm_cam_clk_info *clk_info;
+ struct clk **clk_ptr;
+ size_t clk_info_size;
+#endif
};
#endif
diff --git a/include/media/msm_cam_sensor.h b/include/media/msm_cam_sensor.h
index b35fbc5fe6d4..1bbb96124a93 100644
--- a/include/media/msm_cam_sensor.h
+++ b/include/media/msm_cam_sensor.h
@@ -37,7 +37,7 @@ struct msm_camera_sensor_slave_info32 {
enum i2c_freq_mode_t i2c_freq_mode;
enum msm_camera_i2c_reg_addr_type addr_type;
struct msm_sensor_id_info_t sensor_id_info;
-#if defined(CONFIG_MACH_LONGCHEER) && !defined(CONFIG_MACH_XIAOMI_WAYNE)
+#if defined(CONFIG_MACH_XIAOMI_SDM660) && !defined(CONFIG_MACH_XIAOMI_WAYNE)
struct msm_vendor_id_info_t vendor_id_info;
struct msm_vcm_id_info_t vcm_id_info;
#endif
diff --git a/include/soc/qcom/camera2.h b/include/soc/qcom/camera2.h
index 9349e4d3f7a9..190ace1325ed 100644
--- a/include/soc/qcom/camera2.h
+++ b/include/soc/qcom/camera2.h
@@ -195,7 +195,7 @@ struct msm_camera_sensor_board_info {
const char *special_support_sensors[MAX_SPECIAL_SUPPORT_SIZE];
int32_t special_support_size;
struct msm_camera_slave_info *slave_info;
-#ifdef CONFIG_MACH_LONGCHEER
+#ifdef CONFIG_MACH_XIAOMI_SDM660
struct msm_vendor_id_info_t *vendor_id_info;
struct msm_vcm_id_info_t *vcm_id_info;
#endif
diff --git a/include/uapi/media/msm_cam_sensor.h b/include/uapi/media/msm_cam_sensor.h
index e4b4554dd690..545a69556656 100644
--- a/include/uapi/media/msm_cam_sensor.h
+++ b/include/uapi/media/msm_cam_sensor.h
@@ -33,6 +33,9 @@
#define MAX_AF_ITERATIONS 3
#define MAX_NUMBER_OF_STEPS 47
#define MAX_REGULATOR 5
+#ifdef CONFIG_MACH_MI
+#define NAME_SIZE_MAX 64
+#endif
/*msm_flash_query_data_t query types*/
#define FLASH_QUERY_CURRENT 1
@@ -582,6 +585,31 @@ struct sensor_init_cfg_data {
} cfg;
};
+#ifdef CONFIG_MACH_MI
+enum msm_actuator_cfg_download_type_t {
+ CFG_ACTUATOR_DOWNLOAD,
+ CFG_ACTUATOR_DATA_CONFIG,
+};
+
+struct msm_actuator_opcode {
+ uint32_t prog;
+ uint32_t coeff;
+ uint32_t pheripheral;
+ uint32_t memory;
+};
+
+struct msm_actuator_slave_info {
+ char actuator_name[NAME_SIZE_MAX];
+ uint32_t i2c_addr;
+ struct msm_actuator_opcode opcode;
+};
+
+struct msm_actuator_cfg_download_data {
+ int cfgtype;
+ struct msm_actuator_slave_info slave_info;
+};
+#endif
+
#define VIDIOC_MSM_SENSOR_CFG \
_IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct sensorb_cfg_data)
@@ -633,5 +661,9 @@ struct sensor_init_cfg_data {
#define VIDIOC_MSM_LASER_LED_CFG \
_IOWR('V', BASE_VIDIOC_PRIVATE + 16, struct msm_laser_led_cfg_data_t)
+#ifdef CONFIG_MACH_MI
+#define VIDIOC_MSM_ACTUATOR_CFG_DOWNLOAD \
+ _IOWR('V', BASE_VIDIOC_PRIVATE + 17, struct msm_actuator_cfg_download_data)
+#endif
#endif
diff --git a/include/uapi/media/msm_camsensor_sdk.h b/include/uapi/media/msm_camsensor_sdk.h
index ff5fbff5d9fe..8d499af5b01b 100644
--- a/include/uapi/media/msm_camsensor_sdk.h
+++ b/include/uapi/media/msm_camsensor_sdk.h
@@ -176,6 +176,9 @@ enum msm_actuator_write_type {
enum msm_actuator_i2c_operation {
MSM_ACT_WRITE = 0,
MSM_ACT_POLL,
+#ifdef CONFIG_MACH_MI
+ MSM_ACT_POLL_RESULT,
+#endif
};
enum actuator_type {
@@ -301,7 +304,7 @@ struct msm_sensor_id_info_t {
unsigned short sensor_id_mask;
};
-#ifdef CONFIG_MACH_LONGCHEER
+#ifdef CONFIG_MACH_XIAOMI_SDM660
enum msm_cci_i2c_master_t {
MSM_MASTER_0,
MSM_MASTER_1,
@@ -349,7 +352,7 @@ struct msm_camera_sensor_slave_info {
enum i2c_freq_mode_t i2c_freq_mode;
enum msm_camera_i2c_reg_addr_type addr_type;
struct msm_sensor_id_info_t sensor_id_info;
-#if defined(CONFIG_MACH_LONGCHEER) && !defined(CONFIG_MACH_XIAOMI_WAYNE)
+#if defined(CONFIG_MACH_XIAOMI_SDM660) && !defined(CONFIG_MACH_XIAOMI_WAYNE)
struct msm_vendor_id_info_t vendor_id_info;
struct msm_vcm_id_info_t vcm_id_info;
#endif