msm: ba: Update ba driver to latest v4l2 framework
This patch upgrades ba driver to be compatible with the latest v4l2 framework. Change-Id: Id91953f7a4a075533e7e8bedab71e5c20d4da2c1 Signed-off-by: Jingtao Chen <jingtaoc@codeaurora.org>
This commit is contained in:
parent
7a20b3af48
commit
fe4e800aeb
5 changed files with 23 additions and 91 deletions
|
@ -5,5 +5,8 @@
|
|||
config MSM_BA_V4L2
|
||||
tristate "Qualcomm technologies Inc MSM V4L2 based BA driver"
|
||||
depends on VIDEO_V4L2
|
||||
select FB_CFB_FILLRECT
|
||||
select FB_CFB_COPYAREA
|
||||
select FB_CFB_IMAGEBLIT
|
||||
---help---
|
||||
Enables support for the MSM V4L2 bridge abstraction
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -69,54 +69,6 @@ int msm_ba_querycap(void *instance, struct v4l2_capability *cap)
|
|||
}
|
||||
EXPORT_SYMBOL(msm_ba_querycap);
|
||||
|
||||
int msm_ba_g_priority(void *instance, enum v4l2_priority *prio)
|
||||
{
|
||||
struct msm_ba_inst *inst = instance;
|
||||
struct msm_ba_input *ba_input = NULL;
|
||||
int rc = 0;
|
||||
|
||||
if (!inst || !prio) {
|
||||
dprintk(BA_ERR,
|
||||
"Invalid prio, inst = 0x%p, prio = 0x%p", inst, prio);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ba_input = msm_ba_find_input(inst->sd_input.index);
|
||||
if (!ba_input) {
|
||||
dprintk(BA_ERR, "Could not find input index: %d",
|
||||
inst->sd_input.index);
|
||||
return -EINVAL;
|
||||
}
|
||||
*prio = ba_input->prio;
|
||||
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL(msm_ba_g_priority);
|
||||
|
||||
int msm_ba_s_priority(void *instance, enum v4l2_priority prio)
|
||||
{
|
||||
struct msm_ba_inst *inst = instance;
|
||||
struct msm_ba_input *ba_input = NULL;
|
||||
int rc = 0;
|
||||
|
||||
dprintk(BA_DBG, "Enter %s, prio: %d", __func__, prio);
|
||||
|
||||
if (!inst)
|
||||
return -EINVAL;
|
||||
|
||||
ba_input = msm_ba_find_input(inst->sd_input.index);
|
||||
if (!ba_input) {
|
||||
dprintk(BA_ERR, "Could not find input index: %d",
|
||||
inst->sd_input.index);
|
||||
return -EINVAL;
|
||||
}
|
||||
ba_input->prio = prio;
|
||||
inst->input_prio = prio;
|
||||
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL(msm_ba_s_priority);
|
||||
|
||||
int msm_ba_s_parm(void *instance, struct v4l2_streamparm *a)
|
||||
{
|
||||
struct msm_ba_inst *inst = instance;
|
||||
|
@ -210,8 +162,7 @@ int msm_ba_s_input(void *instance, unsigned int index)
|
|||
return -EINVAL;
|
||||
}
|
||||
if (ba_input->in_use &&
|
||||
ba_input->prio == V4L2_PRIORITY_RECORD &&
|
||||
ba_input->prio != inst->input_prio) {
|
||||
inst->event_handler.prio == V4L2_PRIORITY_RECORD) {
|
||||
dprintk(BA_WARN, "Input %d in use", index);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
@ -354,7 +305,7 @@ int msm_ba_g_fmt(void *instance, struct v4l2_format *f)
|
|||
struct msm_ba_input *ba_input = NULL;
|
||||
v4l2_std_id new_std = V4L2_STD_UNKNOWN;
|
||||
struct v4l2_dv_timings sd_dv_timings;
|
||||
struct v4l2_mbus_framefmt sd_mbus_fmt;
|
||||
struct v4l2_subdev_format sd_fmt;
|
||||
int rc = 0;
|
||||
|
||||
if (!inst || !f)
|
||||
|
@ -388,29 +339,29 @@ int msm_ba_g_fmt(void *instance, struct v4l2_format *f)
|
|||
}
|
||||
}
|
||||
|
||||
rc = v4l2_subdev_call(sd, video, g_mbus_fmt, &sd_mbus_fmt);
|
||||
rc = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sd_fmt);
|
||||
if (rc) {
|
||||
dprintk(BA_ERR, "g_mbus_fmt failed %d for sd: %s",
|
||||
dprintk(BA_ERR, "get_fmt failed %d for sd: %s",
|
||||
rc, sd->name);
|
||||
} else {
|
||||
f->fmt.pix.height = sd_mbus_fmt.height;
|
||||
f->fmt.pix.width = sd_mbus_fmt.width;
|
||||
switch (sd_mbus_fmt.code) {
|
||||
case V4L2_MBUS_FMT_YUYV8_2X8:
|
||||
f->fmt.pix.height = sd_fmt.format.height;
|
||||
f->fmt.pix.width = sd_fmt.format.width;
|
||||
switch (sd_fmt.format.code) {
|
||||
case MEDIA_BUS_FMT_YUYV8_2X8:
|
||||
f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
|
||||
break;
|
||||
case V4L2_MBUS_FMT_YVYU8_2X8:
|
||||
case MEDIA_BUS_FMT_YVYU8_2X8:
|
||||
f->fmt.pix.pixelformat = V4L2_PIX_FMT_YVYU;
|
||||
break;
|
||||
case V4L2_MBUS_FMT_VYUY8_2X8:
|
||||
case MEDIA_BUS_FMT_VYUY8_2X8:
|
||||
f->fmt.pix.pixelformat = V4L2_PIX_FMT_VYUY;
|
||||
break;
|
||||
case V4L2_MBUS_FMT_UYVY8_2X8:
|
||||
case MEDIA_BUS_FMT_UYVY8_2X8:
|
||||
f->fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY;
|
||||
break;
|
||||
default:
|
||||
dprintk(BA_ERR, "Unknown sd_mbus_fmt.code 0x%x",
|
||||
sd_mbus_fmt.code);
|
||||
sd_fmt.format.code);
|
||||
f->fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY;
|
||||
break;
|
||||
}
|
||||
|
@ -713,8 +664,8 @@ static int msm_ba_register_v4l2_subdev(struct v4l2_device *v4l2_dev,
|
|||
kfree(vdev);
|
||||
} else {
|
||||
#if defined(CONFIG_MEDIA_CONTROLLER)
|
||||
sd->entity.info.v4l.major = VIDEO_MAJOR;
|
||||
sd->entity.info.v4l.minor = vdev->minor;
|
||||
sd->entity.info.dev.major = VIDEO_MAJOR;
|
||||
sd->entity.info.dev.minor = vdev->minor;
|
||||
sd->entity.name = video_device_node_name(vdev);
|
||||
#endif
|
||||
sd->devnode = vdev;
|
||||
|
@ -893,7 +844,7 @@ void *msm_ba_open(const struct msm_ba_ext_ops *ext_ops)
|
|||
dev_ctxt->state = BA_DEV_INIT_DONE;
|
||||
inst->state = MSM_BA_DEV_INIT_DONE;
|
||||
inst->sd_input.index = 0;
|
||||
inst->input_prio = V4L2_PRIORITY_DEFAULT;
|
||||
inst->event_handler.prio = V4L2_PRIORITY_DEFAULT;
|
||||
|
||||
inst->debugfs_root =
|
||||
msm_ba_debugfs_init_inst(inst, dev_ctxt->debugfs_root);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -214,7 +214,6 @@ void msm_ba_add_inputs(struct v4l2_subdev *sd)
|
|||
input->ba_out = msm_ba_inp_cfg[i].ba_out;
|
||||
input->ba_node_addr = msm_ba_inp_cfg[i].ba_node;
|
||||
input->ba_ip_idx = i;
|
||||
input->prio = V4L2_PRIORITY_DEFAULT;
|
||||
input->input_user_type =
|
||||
msm_ba_inp_cfg[i].input_user_type;
|
||||
input->sd = sd;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -143,7 +143,6 @@ struct msm_ba_input {
|
|||
int signal_status;
|
||||
int in_use;
|
||||
int ba_out_in_use;
|
||||
enum v4l2_priority prio;
|
||||
enum msm_ba_input_usr_type input_user_type;
|
||||
};
|
||||
|
||||
|
@ -180,8 +179,6 @@ struct msm_ba_inst {
|
|||
struct msm_ba_dev *dev_ctxt;
|
||||
|
||||
struct v4l2_input sd_input;
|
||||
/* current input priority */
|
||||
enum v4l2_priority input_prio;
|
||||
struct v4l2_output sd_output;
|
||||
struct v4l2_subdev *sd;
|
||||
int state;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -83,22 +83,6 @@ static int msm_ba_v4l2_querycap(struct file *filp, void *fh,
|
|||
return msm_ba_querycap((void *)ba_inst, cap);
|
||||
}
|
||||
|
||||
static int msm_ba_v4l2_g_priority(struct file *filp, void *fh,
|
||||
enum v4l2_priority *prio)
|
||||
{
|
||||
struct msm_ba_inst *ba_inst = get_ba_inst(filp, fh);
|
||||
|
||||
return msm_ba_g_priority((void *)ba_inst, prio);
|
||||
}
|
||||
|
||||
static int msm_ba_v4l2_s_priority(struct file *filp, void *fh,
|
||||
enum v4l2_priority prio)
|
||||
{
|
||||
struct msm_ba_inst *ba_inst = get_ba_inst(filp, fh);
|
||||
|
||||
return msm_ba_s_priority((void *)ba_inst, prio);
|
||||
}
|
||||
|
||||
int msm_ba_v4l2_enum_input(struct file *file, void *fh,
|
||||
struct v4l2_input *input)
|
||||
{
|
||||
|
@ -245,8 +229,6 @@ static int msm_ba_v4l2_g_parm(struct file *file, void *fh,
|
|||
|
||||
static const struct v4l2_ioctl_ops msm_ba_v4l2_ioctl_ops = {
|
||||
.vidioc_querycap = msm_ba_v4l2_querycap,
|
||||
.vidioc_g_priority = msm_ba_v4l2_g_priority,
|
||||
.vidioc_s_priority = msm_ba_v4l2_s_priority,
|
||||
.vidioc_enum_fmt_vid_cap = msm_ba_v4l2_enum_fmt,
|
||||
.vidioc_enum_fmt_vid_out = msm_ba_v4l2_enum_fmt,
|
||||
.vidioc_s_fmt_vid_cap = msm_ba_v4l2_s_fmt,
|
||||
|
@ -286,7 +268,7 @@ static const struct v4l2_file_operations msm_ba_v4l2_ba_fops = {
|
|||
.owner = THIS_MODULE,
|
||||
.open = msm_ba_v4l2_open,
|
||||
.release = msm_ba_v4l2_close,
|
||||
.ioctl = video_ioctl2,
|
||||
.unlocked_ioctl = video_ioctl2,
|
||||
.poll = msm_ba_v4l2_poll,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue