提交 d43be757 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

[media] cx23885: fix audio input handling

Fix a bunch of v4l2-compliance errors relating to audio input handling.
Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
上级 a7d3eabd
...@@ -1153,7 +1153,7 @@ static int vidioc_querycap(struct file *file, void *priv, ...@@ -1153,7 +1153,7 @@ static int vidioc_querycap(struct file *file, void *priv,
strlcpy(cap->card, cx23885_boards[dev->board].name, strlcpy(cap->card, cx23885_boards[dev->board].name,
sizeof(cap->card)); sizeof(cap->card));
sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci)); sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci));
cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | V4L2_CAP_AUDIO;
if (dev->tuner_type != TUNER_ABSENT) if (dev->tuner_type != TUNER_ABSENT)
cap->device_caps |= V4L2_CAP_TUNER; cap->device_caps |= V4L2_CAP_TUNER;
if (vdev->vfl_type == VFL_TYPE_VBI) if (vdev->vfl_type == VFL_TYPE_VBI)
...@@ -1302,16 +1302,16 @@ int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i) ...@@ -1302,16 +1302,16 @@ int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i)
i->index = n; i->index = n;
i->type = V4L2_INPUT_TYPE_CAMERA; i->type = V4L2_INPUT_TYPE_CAMERA;
strcpy(i->name, iname[INPUT(n)->type]); strcpy(i->name, iname[INPUT(n)->type]);
i->std = CX23885_NORMS;
if ((CX23885_VMUX_TELEVISION == INPUT(n)->type) || if ((CX23885_VMUX_TELEVISION == INPUT(n)->type) ||
(CX23885_VMUX_CABLE == INPUT(n)->type)) { (CX23885_VMUX_CABLE == INPUT(n)->type)) {
i->type = V4L2_INPUT_TYPE_TUNER; i->type = V4L2_INPUT_TYPE_TUNER;
i->std = CX23885_NORMS; i->audioset = 4;
} else {
/* Two selectable audio inputs for non-tv inputs */
i->audioset = 3;
} }
/* Two selectable audio inputs for non-tv inputs */
if (INPUT(n)->type != CX23885_VMUX_TELEVISION)
i->audioset = 0x3;
if (dev->input == n) { if (dev->input == n) {
/* enum'd input matches our configured input. /* enum'd input matches our configured input.
* Ask the video decoder to process the call * Ask the video decoder to process the call
...@@ -1397,19 +1397,19 @@ static int cx23885_query_audinput(struct file *file, void *priv, ...@@ -1397,19 +1397,19 @@ static int cx23885_query_audinput(struct file *file, void *priv,
static const char *iname[] = { static const char *iname[] = {
[0] = "Baseband L/R 1", [0] = "Baseband L/R 1",
[1] = "Baseband L/R 2", [1] = "Baseband L/R 2",
[2] = "TV",
}; };
unsigned int n; unsigned int n;
dprintk(1, "%s()\n", __func__); dprintk(1, "%s()\n", __func__);
n = i->index; n = i->index;
if (n >= 2) if (n >= 3)
return -EINVAL; return -EINVAL;
memset(i, 0, sizeof(*i)); memset(i, 0, sizeof(*i));
i->index = n; i->index = n;
strcpy(i->name, iname[n]); strcpy(i->name, iname[n]);
i->capability = V4L2_AUDCAP_STEREO; i->capability = V4L2_AUDCAP_STEREO;
i->mode = V4L2_AUDMODE_AVL;
return 0; return 0;
} }
...@@ -1425,7 +1425,11 @@ static int vidioc_g_audinput(struct file *file, void *priv, ...@@ -1425,7 +1425,11 @@ static int vidioc_g_audinput(struct file *file, void *priv,
{ {
struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
i->index = dev->audinput; if ((CX23885_VMUX_TELEVISION == INPUT(dev->input)->type) ||
(CX23885_VMUX_CABLE == INPUT(dev->input)->type))
i->index = 2;
else
i->index = dev->audinput;
dprintk(1, "%s(input=%d)\n", __func__, i->index); dprintk(1, "%s(input=%d)\n", __func__, i->index);
return cx23885_query_audinput(file, priv, i); return cx23885_query_audinput(file, priv, i);
...@@ -1435,7 +1439,12 @@ static int vidioc_s_audinput(struct file *file, void *priv, ...@@ -1435,7 +1439,12 @@ static int vidioc_s_audinput(struct file *file, void *priv,
const struct v4l2_audio *i) const struct v4l2_audio *i)
{ {
struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
if (i->index >= 2)
if ((CX23885_VMUX_TELEVISION == INPUT(dev->input)->type) ||
(CX23885_VMUX_CABLE == INPUT(dev->input)->type)) {
return i->index != 2 ? -EINVAL : 0;
}
if (i->index > 1)
return -EINVAL; return -EINVAL;
dprintk(1, "%s(%d)\n", __func__, i->index); dprintk(1, "%s(%d)\n", __func__, i->index);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册