aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-01-20 11:59:29 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-02-21 10:34:45 -0500
commit1571720c5ecfb9b5f27aff0678e3bef0cb1821ca (patch)
tree1fd82521ba8ca34c1a3433c2e0a33b577f82da2d
parent23154f2f3b8c3c7c58548c518f28195b0d0a6c64 (diff)
V4L/DVB (5106): Do some cleanups at cx88-blackbird
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c69
1 files changed, 29 insertions, 40 deletions
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 0ba6ef39b04c..54380ddb12c5 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -956,12 +956,31 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file,
956 } 956 }
957 case VIDIOC_S_FREQUENCY: 957 case VIDIOC_S_FREQUENCY:
958 { 958 {
959 struct v4l2_frequency *f = arg;
960
959 blackbird_api_cmd(fh->dev, CX2341X_ENC_STOP_CAPTURE, 3, 0, 961 blackbird_api_cmd(fh->dev, CX2341X_ENC_STOP_CAPTURE, 3, 0,
960 BLACKBIRD_END_NOW, 962 BLACKBIRD_END_NOW,
961 BLACKBIRD_MPEG_CAPTURE, 963 BLACKBIRD_MPEG_CAPTURE,
962 BLACKBIRD_RAW_BITS_NONE); 964 BLACKBIRD_RAW_BITS_NONE);
963 965
964 cx88_do_ioctl(inode, file, 0, dev->core, cmd, arg, cx88_ioctl_hook); 966 if (UNSET == core->tuner_type)
967 return -EINVAL;
968 if (f->tuner != 0)
969 return -EINVAL;
970 if (0 == radio && f->type != V4L2_TUNER_ANALOG_TV)
971 return -EINVAL;
972 if (1 == radio && f->type != V4L2_TUNER_RADIO)
973 return -EINVAL;
974 mutex_lock(&core->lock);
975 core->freq = f->frequency;
976 cx88_newstation(core);
977 cx88_call_i2c_clients(core,VIDIOC_S_FREQUENCY,f);
978
979 /* When changing channels it is required to reset TVAUDIO */
980 msleep (10);
981 cx88_set_tvaudio(core);
982
983 mutex_unlock(&core->lock);
965 984
966 blackbird_initialize_codec(dev); 985 blackbird_initialize_codec(dev);
967 cx88_set_scale(dev->core, dev->width, dev->height, 986 cx88_set_scale(dev->core, dev->width, dev->height,
@@ -985,11 +1004,17 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file,
985 return blackbird_querymenu(dev, arg); 1004 return blackbird_querymenu(dev, arg);
986 case VIDIOC_QUERYCTRL: 1005 case VIDIOC_QUERYCTRL:
987 { 1006 {
988 struct v4l2_queryctrl *c = arg; 1007 struct v4l2_queryctrl *qctrl = arg;
989 1008
990 if (blackbird_queryctrl(dev, c) == 0) 1009 if (blackbird_queryctrl(dev, qctrl) == 0)
991 return 0; 1010 return 0;
992 return cx88_do_ioctl(inode, file, 0, dev->core, cmd, arg, mpeg_do_ioctl); 1011
1012 struct v4l2_queryctrl *qctrl = arg;
1013
1014 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id);
1015 if (unlikely(qctrl->id == 0))
1016 return -EINVAL;
1017 return cx8800_ctrl_query(qctrl);
993 } 1018 }
994 1019
995 default: 1020 default:
@@ -1164,42 +1189,6 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio,
1164 return 0; 1189 return 0;
1165 } 1190 }
1166 1191
1167
1168 /* --- controls ---------------------------------------------- */
1169 case VIDIOC_QUERYCTRL:
1170 {
1171 struct v4l2_queryctrl *qctrl = arg;
1172
1173 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id);
1174 if (unlikely(qctrl->id == 0))
1175 return -EINVAL;
1176 return cx8800_ctrl_query(qctrl);
1177 }
1178 /* --- tuner ioctls ------------------------------------------ */
1179 case VIDIOC_S_FREQUENCY:
1180 {
1181 struct v4l2_frequency *f = arg;
1182
1183 if (UNSET == core->tuner_type)
1184 return -EINVAL;
1185 if (f->tuner != 0)
1186 return -EINVAL;
1187 if (0 == radio && f->type != V4L2_TUNER_ANALOG_TV)
1188 return -EINVAL;
1189 if (1 == radio && f->type != V4L2_TUNER_RADIO)
1190 return -EINVAL;
1191 mutex_lock(&core->lock);
1192 core->freq = f->frequency;
1193 cx88_newstation(core);
1194 cx88_call_i2c_clients(core,VIDIOC_S_FREQUENCY,f);
1195
1196 /* When changing channels it is required to reset TVAUDIO */
1197 msleep (10);
1198 cx88_set_tvaudio(core);
1199
1200 mutex_unlock(&core->lock);
1201 return 0;
1202 }
1203#ifdef CONFIG_VIDEO_ADV_DEBUG 1192#ifdef CONFIG_VIDEO_ADV_DEBUG
1204 /* ioctls to allow direct acces to the cx2388x registers */ 1193 /* ioctls to allow direct acces to the cx2388x registers */
1205 case VIDIOC_INT_G_REGISTER: 1194 case VIDIOC_INT_G_REGISTER: