mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 21:22:09 -04:00
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 <raviv@motorola.com> 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: <timwang@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
70666d5d9b
commit
bf7f61e0de
2 changed files with 27 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -16,18 +16,23 @@
|
|||
|
||||
#include <linux/module.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/version.h>
|
||||
#include <cam_cci_dev.h>
|
||||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/cci_intf.h>
|
||||
|
||||
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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue