aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2011-11-07 05:25:10 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-23 13:44:24 -0500
commitd0c8b2d400279f7d4d530ede8c7cb66f75810007 (patch)
tree004af537a39103355c4b79836095996ced3ed40f /drivers/media/video
parenta8187c42fbe594754eadd37cf16d3ad7c704869d (diff)
[media] ivtv: setup per-device caps
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.h1
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c7
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c14
3 files changed, 20 insertions, 2 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h
index 06f3d78389bf..20845d65d343 100644
--- a/drivers/media/video/ivtv/ivtv-driver.h
+++ b/drivers/media/video/ivtv/ivtv-driver.h
@@ -331,6 +331,7 @@ struct ivtv_stream {
331 struct ivtv *itv; /* for ease of use */ 331 struct ivtv *itv; /* for ease of use */
332 const char *name; /* name of the stream */ 332 const char *name; /* name of the stream */
333 int type; /* stream type */ 333 int type; /* stream type */
334 u32 caps; /* V4L2 capabilities */
334 335
335 struct v4l2_fh *fh; /* pointer to the streaming filehandle */ 336 struct v4l2_fh *fh; /* pointer to the streaming filehandle */
336 spinlock_t qlock; /* locks access to the queues */ 337 spinlock_t qlock; /* locks access to the queues */
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index c4bc48143098..b0630773e507 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -754,12 +754,15 @@ static int ivtv_s_register(struct file *file, void *fh, struct v4l2_dbg_register
754 754
755static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vcap) 755static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vcap)
756{ 756{
757 struct ivtv *itv = fh2id(fh)->itv; 757 struct ivtv_open_id *id = fh2id(file->private_data);
758 struct ivtv *itv = id->itv;
759 struct ivtv_stream *s = &itv->streams[id->type];
758 760
759 strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver)); 761 strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver));
760 strlcpy(vcap->card, itv->card_name, sizeof(vcap->card)); 762 strlcpy(vcap->card, itv->card_name, sizeof(vcap->card));
761 snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev)); 763 snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev));
762 vcap->capabilities = itv->v4l2_cap; /* capabilities */ 764 vcap->capabilities = itv->v4l2_cap | V4L2_CAP_DEVICE_CAPS;
765 vcap->device_caps = s->caps;
763 return 0; 766 return 0;
764} 767}
765 768
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index c6e28b4ebbed..e5039f4f7f07 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -78,60 +78,73 @@ static struct {
78 int num_offset; 78 int num_offset;
79 int dma, pio; 79 int dma, pio;
80 enum v4l2_buf_type buf_type; 80 enum v4l2_buf_type buf_type;
81 u32 v4l2_caps;
81 const struct v4l2_file_operations *fops; 82 const struct v4l2_file_operations *fops;
82} ivtv_stream_info[] = { 83} ivtv_stream_info[] = {
83 { /* IVTV_ENC_STREAM_TYPE_MPG */ 84 { /* IVTV_ENC_STREAM_TYPE_MPG */
84 "encoder MPG", 85 "encoder MPG",
85 VFL_TYPE_GRABBER, 0, 86 VFL_TYPE_GRABBER, 0,
86 PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_VIDEO_CAPTURE, 87 PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_VIDEO_CAPTURE,
88 V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER |
89 V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
87 &ivtv_v4l2_enc_fops 90 &ivtv_v4l2_enc_fops
88 }, 91 },
89 { /* IVTV_ENC_STREAM_TYPE_YUV */ 92 { /* IVTV_ENC_STREAM_TYPE_YUV */
90 "encoder YUV", 93 "encoder YUV",
91 VFL_TYPE_GRABBER, IVTV_V4L2_ENC_YUV_OFFSET, 94 VFL_TYPE_GRABBER, IVTV_V4L2_ENC_YUV_OFFSET,
92 PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_VIDEO_CAPTURE, 95 PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_VIDEO_CAPTURE,
96 V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER |
97 V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
93 &ivtv_v4l2_enc_fops 98 &ivtv_v4l2_enc_fops
94 }, 99 },
95 { /* IVTV_ENC_STREAM_TYPE_VBI */ 100 { /* IVTV_ENC_STREAM_TYPE_VBI */
96 "encoder VBI", 101 "encoder VBI",
97 VFL_TYPE_VBI, 0, 102 VFL_TYPE_VBI, 0,
98 PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_VBI_CAPTURE, 103 PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_VBI_CAPTURE,
104 V4L2_CAP_VBI_CAPTURE | V4L2_CAP_SLICED_VBI_CAPTURE | V4L2_CAP_TUNER |
105 V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
99 &ivtv_v4l2_enc_fops 106 &ivtv_v4l2_enc_fops
100 }, 107 },
101 { /* IVTV_ENC_STREAM_TYPE_PCM */ 108 { /* IVTV_ENC_STREAM_TYPE_PCM */
102 "encoder PCM", 109 "encoder PCM",
103 VFL_TYPE_GRABBER, IVTV_V4L2_ENC_PCM_OFFSET, 110 VFL_TYPE_GRABBER, IVTV_V4L2_ENC_PCM_OFFSET,
104 PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_PRIVATE, 111 PCI_DMA_FROMDEVICE, 0, V4L2_BUF_TYPE_PRIVATE,
112 V4L2_CAP_TUNER | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
105 &ivtv_v4l2_enc_fops 113 &ivtv_v4l2_enc_fops
106 }, 114 },
107 { /* IVTV_ENC_STREAM_TYPE_RAD */ 115 { /* IVTV_ENC_STREAM_TYPE_RAD */
108 "encoder radio", 116 "encoder radio",
109 VFL_TYPE_RADIO, 0, 117 VFL_TYPE_RADIO, 0,
110 PCI_DMA_NONE, 1, V4L2_BUF_TYPE_PRIVATE, 118 PCI_DMA_NONE, 1, V4L2_BUF_TYPE_PRIVATE,
119 V4L2_CAP_RADIO | V4L2_CAP_TUNER,
111 &ivtv_v4l2_enc_fops 120 &ivtv_v4l2_enc_fops
112 }, 121 },
113 { /* IVTV_DEC_STREAM_TYPE_MPG */ 122 { /* IVTV_DEC_STREAM_TYPE_MPG */
114 "decoder MPG", 123 "decoder MPG",
115 VFL_TYPE_GRABBER, IVTV_V4L2_DEC_MPG_OFFSET, 124 VFL_TYPE_GRABBER, IVTV_V4L2_DEC_MPG_OFFSET,
116 PCI_DMA_TODEVICE, 0, V4L2_BUF_TYPE_VIDEO_OUTPUT, 125 PCI_DMA_TODEVICE, 0, V4L2_BUF_TYPE_VIDEO_OUTPUT,
126 V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
117 &ivtv_v4l2_dec_fops 127 &ivtv_v4l2_dec_fops
118 }, 128 },
119 { /* IVTV_DEC_STREAM_TYPE_VBI */ 129 { /* IVTV_DEC_STREAM_TYPE_VBI */
120 "decoder VBI", 130 "decoder VBI",
121 VFL_TYPE_VBI, IVTV_V4L2_DEC_VBI_OFFSET, 131 VFL_TYPE_VBI, IVTV_V4L2_DEC_VBI_OFFSET,
122 PCI_DMA_NONE, 1, V4L2_BUF_TYPE_VBI_CAPTURE, 132 PCI_DMA_NONE, 1, V4L2_BUF_TYPE_VBI_CAPTURE,
133 V4L2_CAP_SLICED_VBI_CAPTURE | V4L2_CAP_READWRITE,
123 &ivtv_v4l2_enc_fops 134 &ivtv_v4l2_enc_fops
124 }, 135 },
125 { /* IVTV_DEC_STREAM_TYPE_VOUT */ 136 { /* IVTV_DEC_STREAM_TYPE_VOUT */
126 "decoder VOUT", 137 "decoder VOUT",
127 VFL_TYPE_VBI, IVTV_V4L2_DEC_VOUT_OFFSET, 138 VFL_TYPE_VBI, IVTV_V4L2_DEC_VOUT_OFFSET,
128 PCI_DMA_NONE, 1, V4L2_BUF_TYPE_VBI_OUTPUT, 139 PCI_DMA_NONE, 1, V4L2_BUF_TYPE_VBI_OUTPUT,
140 V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
129 &ivtv_v4l2_dec_fops 141 &ivtv_v4l2_dec_fops
130 }, 142 },
131 { /* IVTV_DEC_STREAM_TYPE_YUV */ 143 { /* IVTV_DEC_STREAM_TYPE_YUV */
132 "decoder YUV", 144 "decoder YUV",
133 VFL_TYPE_GRABBER, IVTV_V4L2_DEC_YUV_OFFSET, 145 VFL_TYPE_GRABBER, IVTV_V4L2_DEC_YUV_OFFSET,
134 PCI_DMA_TODEVICE, 0, V4L2_BUF_TYPE_VIDEO_OUTPUT, 146 PCI_DMA_TODEVICE, 0, V4L2_BUF_TYPE_VIDEO_OUTPUT,
147 V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
135 &ivtv_v4l2_dec_fops 148 &ivtv_v4l2_dec_fops
136 } 149 }
137}; 150};
@@ -149,6 +162,7 @@ static void ivtv_stream_init(struct ivtv *itv, int type)
149 s->itv = itv; 162 s->itv = itv;
150 s->type = type; 163 s->type = type;
151 s->name = ivtv_stream_info[type].name; 164 s->name = ivtv_stream_info[type].name;
165 s->caps = ivtv_stream_info[type].v4l2_caps;
152 166
153 if (ivtv_stream_info[type].pio) 167 if (ivtv_stream_info[type].pio)
154 s->dma = PCI_DMA_NONE; 168 s->dma = PCI_DMA_NONE;