From bf7f61e0de3246fa83b6177ae8fb9ea25f1f0b48 Mon Sep 17 00:00:00 2001 From: Ravi Vembu Date: Tue, 27 Aug 2019 09:17:55 -0500 Subject: [PATCH] cci_intf: Update driver for 4.19 kernel Update the cci_intf driver used for sending CCI commands from the shell to the Linux 4.19 kernel Change-Id: I5de934badc2ad2b25cb7148e9abbc95492ba48d5 Signed-off-by: Ravi Vembu Mot-CRs-Fixed: (CR) Reviewed-on: https://gerrit.mot.com/1411444 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Submit-Approved: Jira Key --- .../camera/cam_sensor_module/cam_cci/Kbuild | 6 ++++- .../cam_sensor_module/cam_cci/cci_intf.c | 23 ++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/Kbuild b/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/Kbuild index 242c13da5e4f..3da778fe1a02 100644 --- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/Kbuild +++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_cci/Kbuild @@ -1,4 +1,8 @@ -KERNEL_SOURCE_PATH ?= kernel/msm-4.9 +ifeq ($(TARGET_KERNEL_VERSION),$(filter $(TARGET_KERNEL_VERSION),4.19)) + KERNEL_SOURCE_PATH ?= kernel/msm-4.19 +else + KERNEL_SOURCE_PATH ?= kernel/msm-4.9 +endif EXTRA_CFLAGS += -Wall EXTRA_CFLAGS += -I$(TOP)/motorola/kernel/modules/include 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 258fd7a3900e..f8c45ddc6a3e 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 @@ -16,18 +16,23 @@ #include #include +#include #include #include #include static int32_t cci_intf_xfer( struct msm_cci_intf_xfer *xfer, - int cmd) + unsigned int cmd) { int32_t rc, rc2; 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(xfer->cci_bus), +#else .cci_subdev = cam_cci_get_subdev(), +#endif .cci_i2c_master = xfer->cci_bus, .sid = xfer->slave_addr, }; @@ -50,7 +55,11 @@ 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(xfer->cci_bus), +#else rc = v4l2_subdev_call(cam_cci_get_subdev(), +#endif core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl); if (rc < 0) { pr_err("%s: cci init fail (%d)\n", __func__, rc); @@ -68,7 +77,11 @@ static int32_t cci_intf_xfer( CAMERA_SENSOR_I2C_TYPE_WORD); 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(xfer->cci_bus), +#else rc = v4l2_subdev_call(cam_cci_get_subdev(), +#endif core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl); if (rc < 0) { pr_err("%s: cci read fail (%d)\n", __func__, rc); @@ -100,7 +113,11 @@ static int32_t cci_intf_xfer( cci_ctrl.cfg.cci_i2c_write_cfg.data_type = 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(xfer->cci_bus), +#else rc = v4l2_subdev_call(cam_cci_get_subdev(), +#endif core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl); kfree(reg_conf_tbl); if (rc < 0) { @@ -118,7 +135,11 @@ static int32_t cci_intf_xfer( 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(xfer->cci_bus), +#else rc2 = v4l2_subdev_call(cam_cci_get_subdev(), +#endif core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl); if (rc2 < 0) { pr_err("%s: cci release fail (%d)\n", __func__, rc2);