mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
camera: ois: add new cci read function for ois
Qcom cci read function will use kzalloc()/kfree() to alloc temp buf for cci read data. As ois vsync irq thread use cci read very frequently, so don't alloc/free temp buf when cci read. Change-Id: I67a912d6ef5ba3f1820d5b571ff5bd55f8c1f561 Signed-off-by: liuwang2 <[email protected]> Reviewed-on: https://gerrit.mot.com/2155763 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: XiaoFeng Wang <[email protected]> Reviewed-by: <[email protected]> Reviewed-by: Long Cheng <[email protected]> Reviewed-by: Zhichao Chen <[email protected]> Submit-Approved: Jira Key
This commit is contained in:
parent
d296bfbc93
commit
0d6e82462d
5 changed files with 71 additions and 1 deletions
|
|
@ -343,7 +343,7 @@ static irqreturn_t cam_ois_vsync_irq_thread(int irq, void *data)
|
|||
else
|
||||
read_len = READ_BYTE;
|
||||
|
||||
rc = camera_io_dev_read_seq(
|
||||
rc = camera_io_dev_ois_read_seq(
|
||||
&o_ctrl->io_master_info,
|
||||
PACKET_ADDR + k*READ_BYTE/2,
|
||||
read_buff + k*READ_BYTE,
|
||||
|
|
|
|||
|
|
@ -93,6 +93,39 @@ int32_t cam_camera_cci_i2c_read_seq(struct cam_sensor_cci_client *cci_client,
|
|||
return rc;
|
||||
}
|
||||
|
||||
int32_t cam_camera_cci_i2c_ois_read_seq(struct cam_sensor_cci_client *cci_client,
|
||||
uint32_t addr, uint8_t *data,
|
||||
enum camera_sensor_i2c_type addr_type,
|
||||
enum camera_sensor_i2c_type data_type,
|
||||
uint32_t num_byte)
|
||||
{
|
||||
int32_t rc = -EFAULT;
|
||||
struct cam_cci_ctrl cci_ctrl;
|
||||
|
||||
if ((addr_type >= CAMERA_SENSOR_I2C_TYPE_MAX)
|
||||
|| (data_type >= CAMERA_SENSOR_I2C_TYPE_MAX)
|
||||
|| (num_byte > I2C_REG_DATA_MAX)) {
|
||||
CAM_ERR(CAM_SENSOR, "addr_type %d num_byte %d", addr_type,
|
||||
num_byte);
|
||||
return rc;
|
||||
}
|
||||
|
||||
cci_ctrl.cmd = MSM_CCI_I2C_READ;
|
||||
cci_ctrl.cci_info = cci_client;
|
||||
cci_ctrl.cfg.cci_i2c_read_cfg.addr = addr;
|
||||
cci_ctrl.cfg.cci_i2c_read_cfg.addr_type = addr_type;
|
||||
cci_ctrl.cfg.cci_i2c_read_cfg.data_type = data_type;
|
||||
cci_ctrl.cfg.cci_i2c_read_cfg.data = data;
|
||||
cci_ctrl.cfg.cci_i2c_read_cfg.num_byte = num_byte;
|
||||
cci_ctrl.status = -EFAULT;
|
||||
rc = v4l2_subdev_call(cci_client->cci_subdev,
|
||||
core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl);
|
||||
rc = cci_ctrl.status;
|
||||
CAM_DBG(CAM_SENSOR, "addr = 0x%x, rc = %d", addr, rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int32_t cam_cci_i2c_write_table_cmd(
|
||||
struct camera_io_master *client,
|
||||
struct cam_sensor_i2c_reg_setting *write_setting,
|
||||
|
|
|
|||
|
|
@ -49,6 +49,12 @@ int32_t cam_camera_cci_i2c_read_seq(struct cam_sensor_cci_client *client,
|
|||
enum camera_sensor_i2c_type data_type,
|
||||
uint32_t num_byte);
|
||||
|
||||
int32_t cam_camera_cci_i2c_ois_read_seq(struct cam_sensor_cci_client *client,
|
||||
uint32_t addr, uint8_t *data,
|
||||
enum camera_sensor_i2c_type addr_type,
|
||||
enum camera_sensor_i2c_type data_type,
|
||||
uint32_t num_byte);
|
||||
|
||||
/**
|
||||
* @client: CCI client structure
|
||||
* @write_setting: I2C register setting
|
||||
|
|
|
|||
|
|
@ -115,6 +115,31 @@ int32_t camera_io_dev_read_seq(struct camera_io_master *io_master_info,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t camera_io_dev_ois_read_seq(struct camera_io_master *io_master_info,
|
||||
uint32_t addr, uint8_t *data,
|
||||
enum camera_sensor_i2c_type addr_type,
|
||||
enum camera_sensor_i2c_type data_type, int32_t num_bytes)
|
||||
{
|
||||
if (io_master_info->master_type == CCI_MASTER) {
|
||||
return cam_camera_cci_i2c_ois_read_seq(io_master_info->cci_client,
|
||||
addr, data, addr_type, data_type, num_bytes);
|
||||
} else if (io_master_info->master_type == I2C_MASTER) {
|
||||
return cam_qup_i2c_read_seq(io_master_info->client,
|
||||
addr, data, addr_type, num_bytes);
|
||||
} else if (io_master_info->master_type == SPI_MASTER) {
|
||||
return cam_spi_read_seq(io_master_info,
|
||||
addr, data, addr_type, num_bytes);
|
||||
} else if (io_master_info->master_type == SPI_MASTER) {
|
||||
return cam_spi_write_seq(io_master_info,
|
||||
addr, data, addr_type, num_bytes);
|
||||
} else {
|
||||
CAM_ERR(CAM_SENSOR, "Invalid Comm. Master:%d",
|
||||
io_master_info->master_type);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t camera_io_dev_write(struct camera_io_master *io_master_info,
|
||||
struct cam_sensor_i2c_reg_setting *write_setting)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -57,6 +57,12 @@ int32_t camera_io_dev_read_seq(struct camera_io_master *io_master_info,
|
|||
enum camera_sensor_i2c_type data_type,
|
||||
int32_t num_bytes);
|
||||
|
||||
int32_t camera_io_dev_ois_read_seq(struct camera_io_master *io_master_info,
|
||||
uint32_t addr, uint8_t *data,
|
||||
enum camera_sensor_i2c_type addr_type,
|
||||
enum camera_sensor_i2c_type data_type,
|
||||
int32_t num_bytes);
|
||||
|
||||
/**
|
||||
* @io_master_info: I2C/SPI master information
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue