aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-video.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-01-20 11:58:26 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-02-21 10:34:43 -0500
commit54da49f5a4c739cf8de7838e049d0f9f548008d8 (patch)
treee62a0423ada92750970b61323c166673a8bb3821 /drivers/media/video/cx88/cx88-video.c
parentc526ab91a24b79cf57b8bff2fa69db0b5f4df290 (diff)
V4L/DVB (5100): Make cx88-blackbird to work again
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx88/cx88-video.c')
-rw-r--r--drivers/media/video/cx88/cx88-video.c84
1 files changed, 54 insertions, 30 deletions
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 6fd15839ddf8..d226eb1d38fa 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -86,7 +86,7 @@ static LIST_HEAD(cx8800_devlist);
86/* ------------------------------------------------------------------- */ 86/* ------------------------------------------------------------------- */
87/* static data */ 87/* static data */
88 88
89static struct v4l2_tvnorm tvnorms[] = { 89struct v4l2_tvnorm cx88_tvnorms[] = {
90 { 90 {
91 .name = "NTSC-M", 91 .name = "NTSC-M",
92 .id = V4L2_STD_NTSC_M, 92 .id = V4L2_STD_NTSC_M,
@@ -125,6 +125,10 @@ static struct v4l2_tvnorm tvnorms[] = {
125 .id = V4L2_STD_SECAM_DK, 125 .id = V4L2_STD_SECAM_DK,
126 } 126 }
127}; 127};
128EXPORT_SYMBOL(cx88_tvnorms);
129
130unsigned int cx88_tvnormsize=ARRAY_SIZE(cx88_tvnorms);
131EXPORT_SYMBOL(cx88_tvnormsize);
128 132
129static struct v4l2_tvnorm radionorms[] = { 133static struct v4l2_tvnorm radionorms[] = {
130 { 134 {
@@ -932,10 +936,8 @@ video_mmap(struct file *file, struct vm_area_struct * vma)
932/* ------------------------------------------------------------------ */ 936/* ------------------------------------------------------------------ */
933/* VIDEO CTRL IOCTLS */ 937/* VIDEO CTRL IOCTLS */
934 938
935static int vidioc_g_ctrl (struct file *file, void *priv, 939int cx88_get_control (struct cx88_core *core, struct v4l2_control *ctl)
936 struct v4l2_control *ctl)
937{ 940{
938 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
939 struct cx88_ctrl *c = NULL; 941 struct cx88_ctrl *c = NULL;
940 u32 value; 942 u32 value;
941 int i; 943 int i;
@@ -964,8 +966,9 @@ static int vidioc_g_ctrl (struct file *file, void *priv,
964 value,c->mask, c->sreg ? " [shadowed]" : ""); 966 value,c->mask, c->sreg ? " [shadowed]" : "");
965 return 0; 967 return 0;
966} 968}
969EXPORT_SYMBOL(cx88_get_control);
967 970
968static int set_control(struct cx88_core *core, struct v4l2_control *ctl) 971int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
969{ 972{
970 struct cx88_ctrl *c = NULL; 973 struct cx88_ctrl *c = NULL;
971 u32 value,mask; 974 u32 value,mask;
@@ -1019,6 +1022,7 @@ static int set_control(struct cx88_core *core, struct v4l2_control *ctl)
1019 } 1022 }
1020 return 0; 1023 return 0;
1021} 1024}
1025EXPORT_SYMBOL(cx88_set_control);
1022 1026
1023static void init_controls(struct cx88_core *core) 1027static void init_controls(struct cx88_core *core)
1024{ 1028{
@@ -1029,7 +1033,7 @@ static void init_controls(struct cx88_core *core)
1029 ctrl.id=cx8800_ctls[i].v.id; 1033 ctrl.id=cx8800_ctls[i].v.id;
1030 ctrl.value=cx8800_ctls[i].v.default_value; 1034 ctrl.value=cx8800_ctls[i].v.default_value;
1031 1035
1032 set_control(core, &ctrl); 1036 cx88_set_control(core, &ctrl);
1033 } 1037 }
1034} 1038}
1035 1039
@@ -1179,7 +1183,6 @@ static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf)
1179} 1183}
1180#endif 1184#endif
1181 1185
1182
1183static int vidioc_reqbufs (struct file *file, void *priv, struct v4l2_requestbuffers *p) 1186static int vidioc_reqbufs (struct file *file, void *priv, struct v4l2_requestbuffers *p)
1184{ 1187{
1185 struct cx8800_fh *fh = priv; 1188 struct cx8800_fh *fh = priv;
@@ -1244,17 +1247,14 @@ static int vidioc_s_std (struct file *file, void *priv, unsigned int i)
1244 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core; 1247 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
1245 1248
1246 mutex_lock(&core->lock); 1249 mutex_lock(&core->lock);
1247 cx88_set_tvnorm(core,&tvnorms[i]); 1250 cx88_set_tvnorm(core,&cx88_tvnorms[i]);
1248 mutex_unlock(&core->lock); 1251 mutex_unlock(&core->lock);
1249 return 0; 1252 return 0;
1250} 1253}
1251 1254
1252/* only one input in this sample driver */ 1255/* only one input in this sample driver */
1253static int vidioc_enum_input (struct file *file, void *priv, 1256int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i)
1254 struct v4l2_input *i)
1255{ 1257{
1256 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
1257
1258 static const char *iname[] = { 1258 static const char *iname[] = {
1259 [ CX88_VMUX_COMPOSITE1 ] = "Composite1", 1259 [ CX88_VMUX_COMPOSITE1 ] = "Composite1",
1260 [ CX88_VMUX_COMPOSITE2 ] = "Composite2", 1260 [ CX88_VMUX_COMPOSITE2 ] = "Composite2",
@@ -1280,10 +1280,18 @@ static int vidioc_enum_input (struct file *file, void *priv,
1280 if ((CX88_VMUX_TELEVISION == INPUT(n)->type) || 1280 if ((CX88_VMUX_TELEVISION == INPUT(n)->type) ||
1281 (CX88_VMUX_CABLE == INPUT(n)->type)) 1281 (CX88_VMUX_CABLE == INPUT(n)->type))
1282 i->type = V4L2_INPUT_TYPE_TUNER; 1282 i->type = V4L2_INPUT_TYPE_TUNER;
1283 for (n = 0; n < ARRAY_SIZE(tvnorms); n++) 1283 for (n = 0; n < ARRAY_SIZE(cx88_tvnorms); n++)
1284 i->std |= tvnorms[n].id; 1284 i->std |= cx88_tvnorms[n].id;
1285 return 0; 1285 return 0;
1286} 1286}
1287EXPORT_SYMBOL(cx88_enum_input);
1288
1289static int vidioc_enum_input (struct file *file, void *priv,
1290 struct v4l2_input *i)
1291{
1292 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
1293 return cx88_enum_input (core,i);
1294}
1287 1295
1288static int vidioc_g_input (struct file *file, void *priv, unsigned int *i) 1296static int vidioc_g_input (struct file *file, void *priv, unsigned int *i)
1289{ 1297{
@@ -1318,13 +1326,20 @@ static int vidioc_queryctrl (struct file *file, void *priv,
1318 return cx8800_ctrl_query(qctrl); 1326 return cx8800_ctrl_query(qctrl);
1319} 1327}
1320 1328
1321static int vidioc_s_ctrl (struct file *file, void *priv, 1329static int vidioc_g_ctrl (struct file *file, void *priv,
1322 struct v4l2_control *ctl) 1330 struct v4l2_control *ctl)
1323{ 1331{
1324 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core; 1332 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
1333 return
1334 cx88_get_control(core,ctl);
1335}
1325 1336
1337static int vidioc_s_ctrl (struct file *file, void *priv,
1338 struct v4l2_control *ctl)
1339{
1340 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
1326 return 1341 return
1327 set_control(core,ctl); 1342 cx88_set_control(core,ctl);
1328} 1343}
1329 1344
1330static int vidioc_g_tuner (struct file *file, void *priv, 1345static int vidioc_g_tuner (struct file *file, void *priv,
@@ -1379,20 +1394,14 @@ static int vidioc_g_frequency (struct file *file, void *priv,
1379 return 0; 1394 return 0;
1380} 1395}
1381 1396
1382static int vidioc_s_frequency (struct file *file, void *priv, 1397int cx88_set_freq (struct cx88_core *core,
1383 struct v4l2_frequency *f) 1398 struct v4l2_frequency *f)
1384{ 1399{
1385 struct cx8800_fh *fh = priv;
1386 struct cx88_core *core = fh->dev->core;
1387
1388 if (unlikely(UNSET == core->tuner_type)) 1400 if (unlikely(UNSET == core->tuner_type))
1389 return -EINVAL; 1401 return -EINVAL;
1390 if (unlikely(f->tuner != 0)) 1402 if (unlikely(f->tuner != 0))
1391 return -EINVAL; 1403 return -EINVAL;
1392 if (unlikely(0 == fh->radio && f->type != V4L2_TUNER_ANALOG_TV)) 1404
1393 return -EINVAL;
1394 if (unlikely(1 == fh->radio && f->type != V4L2_TUNER_RADIO))
1395 return -EINVAL;
1396 mutex_lock(&core->lock); 1405 mutex_lock(&core->lock);
1397 core->freq = f->frequency; 1406 core->freq = f->frequency;
1398 cx88_newstation(core); 1407 cx88_newstation(core);
@@ -1403,8 +1412,25 @@ static int vidioc_s_frequency (struct file *file, void *priv,
1403 cx88_set_tvaudio(core); 1412 cx88_set_tvaudio(core);
1404 1413
1405 mutex_unlock(&core->lock); 1414 mutex_unlock(&core->lock);
1415
1406 return 0; 1416 return 0;
1407} 1417}
1418EXPORT_SYMBOL(cx88_set_freq);
1419
1420static int vidioc_s_frequency (struct file *file, void *priv,
1421 struct v4l2_frequency *f)
1422{
1423 struct cx8800_fh *fh = priv;
1424 struct cx88_core *core = fh->dev->core;
1425
1426 if (unlikely(0 == fh->radio && f->type != V4L2_TUNER_ANALOG_TV))
1427 return -EINVAL;
1428 if (unlikely(1 == fh->radio && f->type != V4L2_TUNER_RADIO))
1429 return -EINVAL;
1430
1431 return
1432 cx88_set_freq (core,f);
1433}
1408 1434
1409 1435
1410/* ----------------------------------------------------------- */ 1436/* ----------------------------------------------------------- */
@@ -1677,8 +1703,8 @@ static struct video_device cx8800_video_template =
1677 .vidioc_s_tuner = vidioc_s_tuner, 1703 .vidioc_s_tuner = vidioc_s_tuner,
1678 .vidioc_g_frequency = vidioc_g_frequency, 1704 .vidioc_g_frequency = vidioc_g_frequency,
1679 .vidioc_s_frequency = vidioc_s_frequency, 1705 .vidioc_s_frequency = vidioc_s_frequency,
1680 .tvnorms = tvnorms, 1706 .tvnorms = cx88_tvnorms,
1681 .tvnormsize = ARRAY_SIZE(tvnorms), 1707 .tvnormsize = ARRAY_SIZE(cx88_tvnorms),
1682}; 1708};
1683 1709
1684static const struct file_operations radio_fops = 1710static const struct file_operations radio_fops =
@@ -1789,7 +1815,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1789 1815
1790 /* initialize driver struct */ 1816 /* initialize driver struct */
1791 spin_lock_init(&dev->slock); 1817 spin_lock_init(&dev->slock);
1792 core->tvnorm = tvnorms; 1818 core->tvnorm = cx88_tvnorms;
1793 1819
1794 /* init video dma queues */ 1820 /* init video dma queues */
1795 INIT_LIST_HEAD(&dev->vidq.active); 1821 INIT_LIST_HEAD(&dev->vidq.active);
@@ -1870,7 +1896,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1870 1896
1871 /* initial device configuration */ 1897 /* initial device configuration */
1872 mutex_lock(&core->lock); 1898 mutex_lock(&core->lock);
1873 cx88_set_tvnorm(core,tvnorms); 1899 cx88_set_tvnorm(core,cx88_tvnorms);
1874 init_controls(core); 1900 init_controls(core);
1875 video_mux(core,0); 1901 video_mux(core,0);
1876 mutex_unlock(&core->lock); 1902 mutex_unlock(&core->lock);
@@ -2041,8 +2067,6 @@ static void cx8800_fini(void)
2041module_init(cx8800_init); 2067module_init(cx8800_init);
2042module_exit(cx8800_fini); 2068module_exit(cx8800_fini);
2043 2069
2044EXPORT_SYMBOL(cx88_do_ioctl);
2045
2046/* ----------------------------------------------------------- */ 2070/* ----------------------------------------------------------- */
2047/* 2071/*
2048 * Local variables: 2072 * Local variables: