Commit d0c8b2d4 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] ivtv: setup per-device caps

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent a8187c42
...@@ -331,6 +331,7 @@ struct ivtv_stream { ...@@ -331,6 +331,7 @@ struct ivtv_stream {
struct ivtv *itv; /* for ease of use */ struct ivtv *itv; /* for ease of use */
const char *name; /* name of the stream */ const char *name; /* name of the stream */
int type; /* stream type */ int type; /* stream type */
u32 caps; /* V4L2 capabilities */
struct v4l2_fh *fh; /* pointer to the streaming filehandle */ struct v4l2_fh *fh; /* pointer to the streaming filehandle */
spinlock_t qlock; /* locks access to the queues */ spinlock_t qlock; /* locks access to the queues */
......
...@@ -754,12 +754,15 @@ static int ivtv_s_register(struct file *file, void *fh, struct v4l2_dbg_register ...@@ -754,12 +754,15 @@ static int ivtv_s_register(struct file *file, void *fh, struct v4l2_dbg_register
static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vcap) static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vcap)
{ {
struct ivtv *itv = fh2id(fh)->itv; struct ivtv_open_id *id = fh2id(file->private_data);
struct ivtv *itv = id->itv;
struct ivtv_stream *s = &itv->streams[id->type];
strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver)); strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver));
strlcpy(vcap->card, itv->card_name, sizeof(vcap->card)); strlcpy(vcap->card, itv->card_name, sizeof(vcap->card));
snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev)); snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev));
vcap->capabilities = itv->v4l2_cap; /* capabilities */ vcap->capabilities = itv->v4l2_cap | V4L2_CAP_DEVICE_CAPS;
vcap->device_caps = s->caps;
return 0; return 0;
} }
......
...@@ -78,60 +78,73 @@ static struct { ...@@ -78,60 +78,73 @@ static struct {
int num_offset; int num_offset;
int dma, pio; int dma, pio;
enum v4l2_buf_type buf_type; enum v4l2_buf_type buf_type;
u32 v4l2_caps;
const struct v4l2_file_operations *fops; const struct v4l2_file_operations *fops;
} ivtv_stream_info[] = { } ivtv_stream_info[] = {
{ /* IVTV_ENC_STREAM_TYPE_MPG */ { /* IVTV_ENC_STREAM_TYPE_MPG */
"encoder MPG", "encoder MPG",
VFL_TYPE_GRABBER, 0, VFL_TYPE_GRABBER, 0,
PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_VIDEO_CAPTURE, PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER |
V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
&ivtv_v4l2_enc_fops &ivtv_v4l2_enc_fops
}, },
{ /* IVTV_ENC_STREAM_TYPE_YUV */ { /* IVTV_ENC_STREAM_TYPE_YUV */
"encoder YUV", "encoder YUV",
VFL_TYPE_GRABBER, IVTV_V4L2_ENC_YUV_OFFSET, VFL_TYPE_GRABBER, IVTV_V4L2_ENC_YUV_OFFSET,
PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_VIDEO_CAPTURE, PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER |
V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
&ivtv_v4l2_enc_fops &ivtv_v4l2_enc_fops
}, },
{ /* IVTV_ENC_STREAM_TYPE_VBI */ { /* IVTV_ENC_STREAM_TYPE_VBI */
"encoder VBI", "encoder VBI",
VFL_TYPE_VBI, 0, VFL_TYPE_VBI, 0,
PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_VBI_CAPTURE, PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_VBI_CAPTURE,
V4L2_CAP_VBI_CAPTURE | V4L2_CAP_SLICED_VBI_CAPTURE | V4L2_CAP_TUNER |
V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
&ivtv_v4l2_enc_fops &ivtv_v4l2_enc_fops
}, },
{ /* IVTV_ENC_STREAM_TYPE_PCM */ { /* IVTV_ENC_STREAM_TYPE_PCM */
"encoder PCM", "encoder PCM",
VFL_TYPE_GRABBER, IVTV_V4L2_ENC_PCM_OFFSET, VFL_TYPE_GRABBER, IVTV_V4L2_ENC_PCM_OFFSET,
PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_PRIVATE, PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_PRIVATE,
V4L2_CAP_TUNER | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
&ivtv_v4l2_enc_fops &ivtv_v4l2_enc_fops
}, },
{ /* IVTV_ENC_STREAM_TYPE_RAD */ { /* IVTV_ENC_STREAM_TYPE_RAD */
"encoder radio", "encoder radio",
VFL_TYPE_RADIO, 0, VFL_TYPE_RADIO, 0,
PCI_DMA_NONE, 1, V4L2_BUF_TYPE_PRIVATE, PCI_DMA_NONE, 1, V4L2_BUF_TYPE_PRIVATE,
V4L2_CAP_RADIO | V4L2_CAP_TUNER,
&ivtv_v4l2_enc_fops &ivtv_v4l2_enc_fops
}, },
{ /* IVTV_DEC_STREAM_TYPE_MPG */ { /* IVTV_DEC_STREAM_TYPE_MPG */
"decoder MPG", "decoder MPG",
VFL_TYPE_GRABBER, IVTV_V4L2_DEC_MPG_OFFSET, VFL_TYPE_GRABBER, IVTV_V4L2_DEC_MPG_OFFSET,
PCI_DMA_TODEVICE, 0, V4L2_BUF_TYPE_VIDEO_OUTPUT, PCI_DMA_TODEVICE, 0, V4L2_BUF_TYPE_VIDEO_OUTPUT,
V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
&ivtv_v4l2_dec_fops &ivtv_v4l2_dec_fops
}, },
{ /* IVTV_DEC_STREAM_TYPE_VBI */ { /* IVTV_DEC_STREAM_TYPE_VBI */
"decoder VBI", "decoder VBI",
VFL_TYPE_VBI, IVTV_V4L2_DEC_VBI_OFFSET, VFL_TYPE_VBI, IVTV_V4L2_DEC_VBI_OFFSET,
PCI_DMA_NONE, 1, V4L2_BUF_TYPE_VBI_CAPTURE, PCI_DMA_NONE, 1, V4L2_BUF_TYPE_VBI_CAPTURE,
V4L2_CAP_SLICED_VBI_CAPTURE | V4L2_CAP_READWRITE,
&ivtv_v4l2_enc_fops &ivtv_v4l2_enc_fops
}, },
{ /* IVTV_DEC_STREAM_TYPE_VOUT */ { /* IVTV_DEC_STREAM_TYPE_VOUT */
"decoder VOUT", "decoder VOUT",
VFL_TYPE_VBI, IVTV_V4L2_DEC_VOUT_OFFSET, VFL_TYPE_VBI, IVTV_V4L2_DEC_VOUT_OFFSET,
PCI_DMA_NONE, 1, V4L2_BUF_TYPE_VBI_OUTPUT, PCI_DMA_NONE, 1, V4L2_BUF_TYPE_VBI_OUTPUT,
V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
&ivtv_v4l2_dec_fops &ivtv_v4l2_dec_fops
}, },
{ /* IVTV_DEC_STREAM_TYPE_YUV */ { /* IVTV_DEC_STREAM_TYPE_YUV */
"decoder YUV", "decoder YUV",
VFL_TYPE_GRABBER, IVTV_V4L2_DEC_YUV_OFFSET, VFL_TYPE_GRABBER, IVTV_V4L2_DEC_YUV_OFFSET,
PCI_DMA_TODEVICE, 0, V4L2_BUF_TYPE_VIDEO_OUTPUT, PCI_DMA_TODEVICE, 0, V4L2_BUF_TYPE_VIDEO_OUTPUT,
V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
&ivtv_v4l2_dec_fops &ivtv_v4l2_dec_fops
} }
}; };
...@@ -149,6 +162,7 @@ static void ivtv_stream_init(struct ivtv *itv, int type) ...@@ -149,6 +162,7 @@ static void ivtv_stream_init(struct ivtv *itv, int type)
s->itv = itv; s->itv = itv;
s->type = type; s->type = type;
s->name = ivtv_stream_info[type].name; s->name = ivtv_stream_info[type].name;
s->caps = ivtv_stream_info[type].v4l2_caps;
if (ivtv_stream_info[type].pio) if (ivtv_stream_info[type].pio)
s->dma = PCI_DMA_NONE; s->dma = PCI_DMA_NONE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment