msm: camera: sensor: Add support for 3B read
Newer I2C slaves have 3bytes read address. Add support to read the data from slaves that support 3 byte address. CRs-Fixed: 1013787 Change-Id: Ieb0a7aa1b1b5f23220854092dcc2119d29c57146 Signed-off-by: Rajesh Bondugula <rajeshb@codeaurora.org>
This commit is contained in:
parent
c6e1ec80cd
commit
cd9403e96d
3 changed files with 11 additions and 10 deletions
|
@ -841,13 +841,12 @@ static int32_t msm_cci_i2c_read(struct v4l2_subdev *sd,
|
|||
goto ERROR;
|
||||
}
|
||||
|
||||
if (read_cfg->addr_type == MSM_CAMERA_I2C_BYTE_ADDR)
|
||||
val = CCI_I2C_WRITE_DISABLE_P_CMD | (read_cfg->addr_type << 4) |
|
||||
((read_cfg->addr & 0xFF) << 8);
|
||||
if (read_cfg->addr_type == MSM_CAMERA_I2C_WORD_ADDR)
|
||||
val = CCI_I2C_WRITE_DISABLE_P_CMD | (read_cfg->addr_type << 4) |
|
||||
(((read_cfg->addr & 0xFF00) >> 8) << 8) |
|
||||
((read_cfg->addr & 0xFF) << 16);
|
||||
val = CCI_I2C_WRITE_DISABLE_P_CMD | (read_cfg->addr_type << 4);
|
||||
for (i = 0; i < read_cfg->addr_type; i++) {
|
||||
val |= ((read_cfg->addr >> (i << 3)) & 0xFF) <<
|
||||
((read_cfg->addr_type - i) << 3);
|
||||
}
|
||||
|
||||
rc = msm_cci_write_i2c_queue(cci_dev, val, master, queue);
|
||||
if (rc < 0) {
|
||||
CDBG("%s failed line %d\n", __func__, __LINE__);
|
||||
|
|
|
@ -90,7 +90,7 @@ struct msm_camera_cci_gpio_cfg {
|
|||
};
|
||||
|
||||
struct msm_camera_cci_i2c_read_cfg {
|
||||
uint16_t addr;
|
||||
uint32_t addr;
|
||||
enum msm_camera_i2c_reg_addr_type addr_type;
|
||||
uint8_t *data;
|
||||
uint16_t num_byte;
|
||||
|
|
|
@ -27,7 +27,8 @@ int32_t msm_camera_cci_i2c_read(struct msm_camera_i2c_client *client,
|
|||
struct msm_camera_cci_ctrl cci_ctrl;
|
||||
|
||||
if ((client->addr_type != MSM_CAMERA_I2C_BYTE_ADDR
|
||||
&& client->addr_type != MSM_CAMERA_I2C_WORD_ADDR)
|
||||
&& client->addr_type != MSM_CAMERA_I2C_WORD_ADDR
|
||||
&& client->addr_type != MSM_CAMERA_I2C_3B_ADDR)
|
||||
|| (data_type != MSM_CAMERA_I2C_BYTE_DATA
|
||||
&& data_type != MSM_CAMERA_I2C_WORD_DATA))
|
||||
return rc;
|
||||
|
@ -63,7 +64,8 @@ int32_t msm_camera_cci_i2c_read_seq(struct msm_camera_i2c_client *client,
|
|||
struct msm_camera_cci_ctrl cci_ctrl;
|
||||
|
||||
if ((client->addr_type != MSM_CAMERA_I2C_BYTE_ADDR
|
||||
&& client->addr_type != MSM_CAMERA_I2C_WORD_ADDR)
|
||||
&& client->addr_type != MSM_CAMERA_I2C_WORD_ADDR
|
||||
&& client->addr_type != MSM_CAMERA_I2C_3B_ADDR)
|
||||
|| num_byte == 0)
|
||||
return rc;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue