forked from rubenslte/android_kernel_samsung_msm8226
msm: camera: extend reg_settings_t structure
extend reg_settings_t structure to be able to add more functionality in actuator driver like poll and delay between two write i2c transactions because some actuator drivers need of this operations Change-Id: I792d1757e53c62f2eeef73d1b97f5e5b7ad13b1c Signed-off-by: Vasko Kalanoski <vaskok@codeaurora.org> Signed-off-by: Aditya Jonnalagadda <ajonnala@codeaurora.org>
This commit is contained in:
committed by
Aditya Jonnalagadda
parent
4d6def696f
commit
5c417eadf9
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
@@ -127,31 +127,63 @@ static void msm_actuator_parse_i2c_params(struct msm_actuator_ctrl_t *a_ctrl,
|
||||
}
|
||||
|
||||
static int32_t msm_actuator_init_focus(struct msm_actuator_ctrl_t *a_ctrl,
|
||||
uint16_t size, enum msm_actuator_data_type type,
|
||||
struct reg_settings_t *settings)
|
||||
uint16_t size, struct reg_settings_t *settings)
|
||||
{
|
||||
int32_t rc = -EFAULT;
|
||||
int32_t i = 0;
|
||||
CDBG("Enter\n");
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
switch (type) {
|
||||
case MSM_ACTUATOR_BYTE_DATA:
|
||||
rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_write(
|
||||
&a_ctrl->i2c_client,
|
||||
settings[i].reg_addr,
|
||||
settings[i].reg_data, MSM_CAMERA_I2C_BYTE_DATA);
|
||||
break;
|
||||
case MSM_ACTUATOR_WORD_DATA:
|
||||
rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_write(
|
||||
&a_ctrl->i2c_client,
|
||||
settings[i].reg_addr,
|
||||
settings[i].reg_data, MSM_CAMERA_I2C_WORD_DATA);
|
||||
break;
|
||||
default:
|
||||
pr_err("Unsupport data type: %d\n", type);
|
||||
break;
|
||||
switch (settings[i].i2c_operation) {
|
||||
case MSM_ACT_WRITE: {
|
||||
switch (settings[i].data_type) {
|
||||
case MSM_ACTUATOR_BYTE_DATA:
|
||||
rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_write(
|
||||
&a_ctrl->i2c_client,
|
||||
settings[i].reg_addr,
|
||||
settings[i].reg_data,
|
||||
MSM_CAMERA_I2C_BYTE_DATA);
|
||||
break;
|
||||
case MSM_ACTUATOR_WORD_DATA:
|
||||
rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_write(
|
||||
&a_ctrl->i2c_client,
|
||||
settings[i].reg_addr,
|
||||
settings[i].reg_data,
|
||||
MSM_CAMERA_I2C_WORD_DATA);
|
||||
break;
|
||||
default:
|
||||
pr_err("Unsupport data type: %d\n",
|
||||
settings[i].i2c_operation);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case MSM_ACT_POLL: {
|
||||
switch (settings[i].data_type) {
|
||||
case MSM_ACTUATOR_BYTE_DATA:
|
||||
rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_poll(
|
||||
&a_ctrl->i2c_client,
|
||||
settings[i].reg_addr,
|
||||
settings[i].reg_data,
|
||||
MSM_CAMERA_I2C_BYTE_DATA);
|
||||
break;
|
||||
case MSM_ACTUATOR_WORD_DATA:
|
||||
rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_poll(
|
||||
&a_ctrl->i2c_client,
|
||||
settings[i].reg_addr,
|
||||
settings[i].reg_data,
|
||||
MSM_CAMERA_I2C_WORD_DATA);
|
||||
break;
|
||||
default:
|
||||
pr_err("Unsupport data type: %d\n",
|
||||
settings[i].i2c_operation);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (0 != settings[i].delay)
|
||||
msleep(settings[i].delay);
|
||||
|
||||
if (rc < 0)
|
||||
break;
|
||||
}
|
||||
@@ -544,7 +576,6 @@ static int32_t msm_actuator_init(struct msm_actuator_ctrl_t *a_ctrl,
|
||||
}
|
||||
rc = a_ctrl->func_tbl->actuator_init_focus(a_ctrl,
|
||||
set_info->actuator_params.init_setting_size,
|
||||
a_ctrl->i2c_data_type,
|
||||
init_settings);
|
||||
kfree(init_settings);
|
||||
if (rc < 0) {
|
||||
@@ -644,6 +675,7 @@ static struct msm_camera_i2c_fn_t msm_sensor_cci_func_tbl = {
|
||||
.i2c_write_table_w_microdelay =
|
||||
msm_camera_cci_i2c_write_table_w_microdelay,
|
||||
.i2c_util = msm_sensor_cci_i2c_util,
|
||||
.i2c_poll = msm_camera_cci_i2c_poll,
|
||||
};
|
||||
|
||||
static struct msm_camera_i2c_fn_t msm_sensor_qup_func_tbl = {
|
||||
@@ -654,6 +686,7 @@ static struct msm_camera_i2c_fn_t msm_sensor_qup_func_tbl = {
|
||||
.i2c_write_seq_table = msm_camera_qup_i2c_write_seq_table,
|
||||
.i2c_write_table_w_microdelay =
|
||||
msm_camera_qup_i2c_write_table_w_microdelay,
|
||||
.i2c_poll = msm_camera_qup_i2c_poll,
|
||||
};
|
||||
|
||||
static int msm_actuator_open(struct v4l2_subdev *sd,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
@@ -31,7 +31,7 @@ struct msm_actuator_func_tbl {
|
||||
int32_t (*actuator_init_step_table)(struct msm_actuator_ctrl_t *,
|
||||
struct msm_actuator_set_info_t *);
|
||||
int32_t (*actuator_init_focus)(struct msm_actuator_ctrl_t *,
|
||||
uint16_t, enum msm_actuator_data_type, struct reg_settings_t *);
|
||||
uint16_t, struct reg_settings_t *);
|
||||
int32_t (*actuator_set_default_focus) (struct msm_actuator_ctrl_t *,
|
||||
struct msm_actuator_move_params_t *);
|
||||
int32_t (*actuator_move_focus) (struct msm_actuator_ctrl_t *,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
@@ -117,4 +117,8 @@ int32_t msm_camera_qup_i2c_write_conf_tbl(
|
||||
struct msm_camera_i2c_reg_conf *reg_conf_tbl, uint16_t size,
|
||||
enum msm_camera_i2c_data_type data_type);
|
||||
|
||||
int32_t msm_camera_qup_i2c_poll(struct msm_camera_i2c_client *client,
|
||||
uint32_t addr, uint16_t data,
|
||||
enum msm_camera_i2c_data_type data_type);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -494,9 +494,18 @@ enum msm_actuator_addr_type {
|
||||
MSM_ACTUATOR_WORD_ADDR,
|
||||
};
|
||||
|
||||
enum msm_actuator_i2c_operation {
|
||||
MSM_ACT_WRITE = 0,
|
||||
MSM_ACT_POLL,
|
||||
};
|
||||
|
||||
struct reg_settings_t {
|
||||
uint16_t reg_addr;
|
||||
enum msm_actuator_addr_type addr_type;
|
||||
uint16_t reg_data;
|
||||
enum msm_actuator_data_type data_type;
|
||||
enum msm_actuator_i2c_operation i2c_operation;
|
||||
uint32_t delay;
|
||||
};
|
||||
|
||||
struct region_params_t {
|
||||
|
||||
Reference in New Issue
Block a user