Add Data Width to CCI_intf

Main OIS requires 16 bit writes. cci_intf only supports 8 bit writes
currently. Add a field to allow user to specify data width. Add logic to
proccess data according to that width.

Change-Id: I5da72399d9060ab60775488f36c5f72262a105a9
Reviewed-on: https://gerrit.mot.com/1488484
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jian Luan <jamesluan@motorola.com>
Reviewed-by: Rav(CR) Vembu <raviv@motorola.com>
Submit-Approved: Jira Key
(cherry picked from commit 63e2369c5c00ed0a504f9a45e0a3be381faafd55)
Reviewed-on: https://gerrit.mot.com/1488831
This commit is contained in:
liuwang2 2019-12-25 15:16:31 +08:00 • committed by Ravikumar Vembu
commit fd7c4a8b01
2 changed files with 18 additions and 5 deletions

View file

@ -99,9 +99,22 @@ static int32_t cci_intf_xfer(
goto release;
}
addr = xfer->reg.addr;
for (i = 0; i < xfer->data.count; i++) {
for (i = 0; i < xfer->data.count; i += xfer->data.width) {
reg_conf_tbl[i].reg_addr = addr++;
reg_conf_tbl[i].reg_data = xfer->data.buf[i];
if(xfer->data.width == 4) {
reg_conf_tbl[i].reg_data =
((uint32_t)(xfer->data.buf[i]) << 24) |
((uint32_t)(xfer->data.buf[i+1]) << 16) |
((uint32_t)(xfer->data.buf[i+2]) << 8) |
((uint32_t)(xfer->data.buf[i+3]));
pr_err("%s: cci writing %x", __func__, reg_conf_tbl[i].reg_data);
} else if(xfer->data.width == 2) {
reg_conf_tbl[i].reg_data =
((uint32_t)(xfer->data.buf[i]) << 8) |
((uint32_t)(xfer->data.buf[i+1]));
} else {
reg_conf_tbl[i].reg_data = xfer->data.buf[i];
}
reg_conf_tbl[i].delay = 0;
}
cci_ctrl.cmd = MSM_CCI_I2C_WRITE;
@ -110,8 +123,7 @@ static int32_t cci_intf_xfer(
(xfer->reg.width == 1 ?
CAMERA_SENSOR_I2C_TYPE_BYTE :
CAMERA_SENSOR_I2C_TYPE_WORD);
cci_ctrl.cfg.cci_i2c_write_cfg.data_type =
CAMERA_SENSOR_I2C_TYPE_BYTE;
cci_ctrl.cfg.cci_i2c_write_cfg.data_type = xfer->data.width;
cci_ctrl.cfg.cci_i2c_write_cfg.size = xfer->data.count;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0)
rc = v4l2_subdev_call(cam_cci_get_subdev(xfer->cci_device),

View file

@ -27,7 +27,8 @@ struct msm_cci_intf_register {
struct msm_cci_intf_data {
unsigned short count; /* between 1 and CCI_INTF_MAX_XFER */
unsigned char buf[MSM_CCI_INTF_MAX_XFER];
unsigned short width;
uint8_t buf[MSM_CCI_INTF_MAX_XFER];
};
struct msm_cci_intf_xfer {