From f67102c9bd485a12361100efd0601546ff92d4bd Mon Sep 17 00:00:00 2001 From: liuwang2 Date: Wed, 25 Dec 2019 15:16:31 +0800 Subject: [PATCH] racer: fix cci tools can not access cci-device-1 16A/OV8856 use cci-2, it use cci-device-1 and cci-master-0, modify cci driver to support access cci-2. Change-Id: I64192fe24c62d6e6791e68bab02476f2645ee63d Signed-off-by: liuwang2 Reviewed-on: https://gerrit.mot.com/1476655 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Dawei Wang Reviewed-by: Long Cheng Reviewed-by: Jian Zhang Reviewed-by: Zhuoran Xu Reviewed-by: Zhichao Chen Reviewed-by: Zhenxin Xi Submit-Approved: Jira Key --- .../msm/camera/cam_sensor_module/cam_cci/cci_intf.c | 12 ++++++------ include/media/cci_intf.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/cci_intf.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/cci_intf.c index c3b3cbb9aeb4..ff08eb3371e2 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/cci_intf.c +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/cci_intf.c @@ -29,7 +29,7 @@ static int32_t cci_intf_xfer( uint16_t addr; struct cam_sensor_cci_client cci_info = { #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) - .cci_subdev = cam_cci_get_subdev(CCI_DEVICE_0), + .cci_subdev = cam_cci_get_subdev(xfer->cci_device), #else .cci_subdev = cam_cci_get_subdev(), #endif @@ -46,7 +46,7 @@ static int32_t cci_intf_xfer( __func__, cmd, xfer->cci_bus, xfer->slave_addr, xfer->reg.width, xfer->reg.addr, xfer->data.count); - if (xfer->cci_bus > 1 || xfer->slave_addr > 0x7F || + if (xfer->cci_device > 1 || xfer->cci_bus > 1 || xfer->slave_addr > 0x7F || xfer->reg.width < 1 || xfer->reg.width > 2 || xfer->reg.addr > ((1<<(8*xfer->reg.width))-1) || xfer->data.count < 1 || @@ -56,7 +56,7 @@ static int32_t cci_intf_xfer( /* init */ cci_ctrl.cmd = MSM_CCI_INIT; #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) - rc = v4l2_subdev_call(cam_cci_get_subdev(CCI_DEVICE_0), + rc = v4l2_subdev_call(cam_cci_get_subdev(xfer->cci_device), #else rc = v4l2_subdev_call(cam_cci_get_subdev(), #endif @@ -78,7 +78,7 @@ static int32_t cci_intf_xfer( cci_ctrl.cfg.cci_i2c_read_cfg.data = xfer->data.buf; cci_ctrl.cfg.cci_i2c_read_cfg.num_byte = xfer->data.count; #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) - rc = v4l2_subdev_call(cam_cci_get_subdev(CCI_DEVICE_0), + rc = v4l2_subdev_call(cam_cci_get_subdev(xfer->cci_device), #else rc = v4l2_subdev_call(cam_cci_get_subdev(), #endif @@ -114,7 +114,7 @@ static int32_t cci_intf_xfer( CAMERA_SENSOR_I2C_TYPE_BYTE; 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(CCI_DEVICE_0), + rc = v4l2_subdev_call(cam_cci_get_subdev(xfer->cci_device), #else rc = v4l2_subdev_call(cam_cci_get_subdev(), #endif @@ -136,7 +136,7 @@ release: /* release */ cci_ctrl.cmd = MSM_CCI_RELEASE; #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0) - rc2 = v4l2_subdev_call(cam_cci_get_subdev(CCI_DEVICE_0), + rc2 = v4l2_subdev_call(cam_cci_get_subdev(xfer->cci_device), #else rc2 = v4l2_subdev_call(cam_cci_get_subdev(), #endif diff --git a/include/media/cci_intf.h b/include/media/cci_intf.h index 42f7757a73cb..f1fcffb91006 100644 --- a/include/media/cci_intf.h +++ b/include/media/cci_intf.h @@ -31,6 +31,7 @@ struct msm_cci_intf_data { }; struct msm_cci_intf_xfer { + unsigned short cci_device; /* 0 = DEVICE_0, 1 = DEVICE_1 */ unsigned short cci_bus; /* 0 = MASTER_0, 1 = MASTER_1 */ unsigned short slave_addr; /* 7-bit addr of intended device */ struct msm_cci_intf_register reg;