mirror of https://gitee.com/openkylin/linux.git
[media] cx18: add device_caps support
This was missing in this driver, so add this functionality. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
1fb69bfd29
commit
dfdf780b46
|
@ -57,7 +57,8 @@
|
||||||
/* V4L2 capability aliases */
|
/* V4L2 capability aliases */
|
||||||
#define CX18_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \
|
#define CX18_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \
|
||||||
V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | \
|
V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | \
|
||||||
V4L2_CAP_VBI_CAPTURE | V4L2_CAP_SLICED_VBI_CAPTURE)
|
V4L2_CAP_STREAMING | V4L2_CAP_VBI_CAPTURE | \
|
||||||
|
V4L2_CAP_SLICED_VBI_CAPTURE)
|
||||||
|
|
||||||
struct cx18_card_video_input {
|
struct cx18_card_video_input {
|
||||||
u8 video_type; /* video input type */
|
u8 video_type; /* video input type */
|
||||||
|
|
|
@ -379,6 +379,7 @@ struct cx18_stream {
|
||||||
const char *name; /* name of the stream */
|
const char *name; /* name of the stream */
|
||||||
int type; /* stream type */
|
int type; /* stream type */
|
||||||
u32 handle; /* task handle */
|
u32 handle; /* task handle */
|
||||||
|
u32 v4l2_dev_caps; /* device capabilities */
|
||||||
unsigned int mdl_base_idx;
|
unsigned int mdl_base_idx;
|
||||||
|
|
||||||
u32 id;
|
u32 id;
|
||||||
|
|
|
@ -393,15 +393,16 @@ static int cx18_querycap(struct file *file, void *fh,
|
||||||
struct v4l2_capability *vcap)
|
struct v4l2_capability *vcap)
|
||||||
{
|
{
|
||||||
struct cx18_open_id *id = fh2id(fh);
|
struct cx18_open_id *id = fh2id(fh);
|
||||||
|
struct cx18_stream *s = video_drvdata(file);
|
||||||
struct cx18 *cx = id->cx;
|
struct cx18 *cx = id->cx;
|
||||||
|
|
||||||
strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver));
|
strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver));
|
||||||
strlcpy(vcap->card, cx->card_name, sizeof(vcap->card));
|
strlcpy(vcap->card, cx->card_name, sizeof(vcap->card));
|
||||||
snprintf(vcap->bus_info, sizeof(vcap->bus_info),
|
snprintf(vcap->bus_info, sizeof(vcap->bus_info),
|
||||||
"PCI:%s", pci_name(cx->pci_dev));
|
"PCI:%s", pci_name(cx->pci_dev));
|
||||||
vcap->capabilities = cx->v4l2_cap; /* capabilities */
|
vcap->capabilities = cx->v4l2_cap; /* capabilities */
|
||||||
if (id->type == CX18_ENC_STREAM_TYPE_YUV)
|
vcap->device_caps = s->v4l2_dev_caps; /* device capabilities */
|
||||||
vcap->capabilities |= V4L2_CAP_STREAMING;
|
vcap->capabilities |= V4L2_CAP_DEVICE_CAPS;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,11 +58,14 @@ static struct {
|
||||||
int vfl_type;
|
int vfl_type;
|
||||||
int num_offset;
|
int num_offset;
|
||||||
int dma;
|
int dma;
|
||||||
|
u32 caps;
|
||||||
} cx18_stream_info[] = {
|
} cx18_stream_info[] = {
|
||||||
{ /* CX18_ENC_STREAM_TYPE_MPG */
|
{ /* CX18_ENC_STREAM_TYPE_MPG */
|
||||||
"encoder MPEG",
|
"encoder MPEG",
|
||||||
VFL_TYPE_GRABBER, 0,
|
VFL_TYPE_GRABBER, 0,
|
||||||
PCI_DMA_FROMDEVICE,
|
PCI_DMA_FROMDEVICE,
|
||||||
|
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
|
||||||
|
V4L2_CAP_AUDIO | V4L2_CAP_TUNER
|
||||||
},
|
},
|
||||||
{ /* CX18_ENC_STREAM_TYPE_TS */
|
{ /* CX18_ENC_STREAM_TYPE_TS */
|
||||||
"TS",
|
"TS",
|
||||||
|
@ -73,11 +76,15 @@ static struct {
|
||||||
"encoder YUV",
|
"encoder YUV",
|
||||||
VFL_TYPE_GRABBER, CX18_V4L2_ENC_YUV_OFFSET,
|
VFL_TYPE_GRABBER, CX18_V4L2_ENC_YUV_OFFSET,
|
||||||
PCI_DMA_FROMDEVICE,
|
PCI_DMA_FROMDEVICE,
|
||||||
|
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
|
||||||
|
V4L2_CAP_STREAMING | V4L2_CAP_AUDIO | V4L2_CAP_TUNER
|
||||||
},
|
},
|
||||||
{ /* CX18_ENC_STREAM_TYPE_VBI */
|
{ /* CX18_ENC_STREAM_TYPE_VBI */
|
||||||
"encoder VBI",
|
"encoder VBI",
|
||||||
VFL_TYPE_VBI, 0,
|
VFL_TYPE_VBI, 0,
|
||||||
PCI_DMA_FROMDEVICE,
|
PCI_DMA_FROMDEVICE,
|
||||||
|
V4L2_CAP_VBI_CAPTURE | V4L2_CAP_SLICED_VBI_CAPTURE |
|
||||||
|
V4L2_CAP_READWRITE | V4L2_CAP_TUNER
|
||||||
},
|
},
|
||||||
{ /* CX18_ENC_STREAM_TYPE_PCM */
|
{ /* CX18_ENC_STREAM_TYPE_PCM */
|
||||||
"encoder PCM audio",
|
"encoder PCM audio",
|
||||||
|
@ -93,6 +100,7 @@ static struct {
|
||||||
"encoder radio",
|
"encoder radio",
|
||||||
VFL_TYPE_RADIO, 0,
|
VFL_TYPE_RADIO, 0,
|
||||||
PCI_DMA_NONE,
|
PCI_DMA_NONE,
|
||||||
|
V4L2_CAP_RADIO | V4L2_CAP_TUNER
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -260,6 +268,7 @@ static void cx18_stream_init(struct cx18 *cx, int type)
|
||||||
s->handle = CX18_INVALID_TASK_HANDLE;
|
s->handle = CX18_INVALID_TASK_HANDLE;
|
||||||
|
|
||||||
s->dma = cx18_stream_info[type].dma;
|
s->dma = cx18_stream_info[type].dma;
|
||||||
|
s->v4l2_dev_caps = cx18_stream_info[type].caps;
|
||||||
s->buffers = cx->stream_buffers[type];
|
s->buffers = cx->stream_buffers[type];
|
||||||
s->buf_size = cx->stream_buf_size[type];
|
s->buf_size = cx->stream_buf_size[type];
|
||||||
INIT_LIST_HEAD(&s->buf_pool);
|
INIT_LIST_HEAD(&s->buf_pool);
|
||||||
|
|
Loading…
Reference in New Issue