aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-06-22 05:17:48 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-06 16:19:10 -0400
commit4b1e2e4ddfa2847559e8e63bb4ac4b2310465561 (patch)
treebd34dc36516013b9c350d59863807b893a05b20f /drivers/media
parente325b24478a8c0af906110174eb7c74fcb455b34 (diff)
[media] v4l2-ioctl.c: use the new table for std/tuner/modulator ioctls
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/v4l2-ioctl.c430
1 files changed, 220 insertions, 210 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 78ff09f559be..4d2d0d6590fb 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -364,6 +364,68 @@ static void v4l_print_buftype(const void *arg, bool write_only)
364 pr_cont("type=%s\n", prt_names(*(u32 *)arg, v4l2_type_names)); 364 pr_cont("type=%s\n", prt_names(*(u32 *)arg, v4l2_type_names));
365} 365}
366 366
367static void v4l_print_modulator(const void *arg, bool write_only)
368{
369 const struct v4l2_modulator *p = arg;
370
371 if (write_only)
372 pr_cont("index=%u, txsubchans=0x%x", p->index, p->txsubchans);
373 else
374 pr_cont("index=%u, name=%s, capability=0x%x, "
375 "rangelow=%u, rangehigh=%u, txsubchans=0x%x\n",
376 p->index, p->name, p->capability,
377 p->rangelow, p->rangehigh, p->txsubchans);
378}
379
380static void v4l_print_tuner(const void *arg, bool write_only)
381{
382 const struct v4l2_tuner *p = arg;
383
384 if (write_only)
385 pr_cont("index=%u, audmode=%u\n", p->index, p->audmode);
386 else
387 pr_cont("index=%u, name=%s, type=%u, capability=0x%x, "
388 "rangelow=%u, rangehigh=%u, signal=%u, afc=%d, "
389 "rxsubchans=0x%x, audmode=%u\n",
390 p->index, p->name, p->type,
391 p->capability, p->rangelow,
392 p->rangehigh, p->signal, p->afc,
393 p->rxsubchans, p->audmode);
394}
395
396static void v4l_print_frequency(const void *arg, bool write_only)
397{
398 const struct v4l2_frequency *p = arg;
399
400 pr_cont("tuner=%u, type=%u, frequency=%u\n",
401 p->tuner, p->type, p->frequency);
402}
403
404static void v4l_print_standard(const void *arg, bool write_only)
405{
406 const struct v4l2_standard *p = arg;
407
408 pr_cont("index=%u, id=0x%Lx, name=%s, fps=%u/%u, "
409 "framelines=%u\n", p->index,
410 (unsigned long long)p->id, p->name,
411 p->frameperiod.numerator,
412 p->frameperiod.denominator,
413 p->framelines);
414}
415
416static void v4l_print_std(const void *arg, bool write_only)
417{
418 pr_cont("std=0x%08Lx\n", *(const long long unsigned *)arg);
419}
420
421static void v4l_print_hw_freq_seek(const void *arg, bool write_only)
422{
423 const struct v4l2_hw_freq_seek *p = arg;
424
425 pr_cont("tuner=%u, type=%u, seek_upward=%u, wrap_around=%u, spacing=%u\n",
426 p->tuner, p->type, p->seek_upward, p->wrap_around, p->spacing);
427}
428
367static void v4l_print_u32(const void *arg, bool write_only) 429static void v4l_print_u32(const void *arg, bool write_only)
368{ 430{
369 pr_cont("value=%u\n", *(const u32 *)arg); 431 pr_cont("value=%u\n", *(const u32 *)arg);
@@ -861,6 +923,153 @@ static int v4l_streamoff(const struct v4l2_ioctl_ops *ops,
861 return ops->vidioc_streamoff(file, fh, *(unsigned int *)arg); 923 return ops->vidioc_streamoff(file, fh, *(unsigned int *)arg);
862} 924}
863 925
926static int v4l_g_tuner(const struct v4l2_ioctl_ops *ops,
927 struct file *file, void *fh, void *arg)
928{
929 struct video_device *vfd = video_devdata(file);
930 struct v4l2_tuner *p = arg;
931
932 p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
933 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
934 return ops->vidioc_g_tuner(file, fh, p);
935}
936
937static int v4l_s_tuner(const struct v4l2_ioctl_ops *ops,
938 struct file *file, void *fh, void *arg)
939{
940 struct video_device *vfd = video_devdata(file);
941 struct v4l2_tuner *p = arg;
942
943 p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
944 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
945 return ops->vidioc_s_tuner(file, fh, p);
946}
947
948static int v4l_g_frequency(const struct v4l2_ioctl_ops *ops,
949 struct file *file, void *fh, void *arg)
950{
951 struct video_device *vfd = video_devdata(file);
952 struct v4l2_frequency *p = arg;
953
954 p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
955 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
956 return ops->vidioc_g_frequency(file, fh, p);
957}
958
959static int v4l_s_frequency(const struct v4l2_ioctl_ops *ops,
960 struct file *file, void *fh, void *arg)
961{
962 struct video_device *vfd = video_devdata(file);
963 struct v4l2_frequency *p = arg;
964 enum v4l2_tuner_type type;
965
966 type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
967 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
968 if (p->type != type)
969 return -EINVAL;
970 return ops->vidioc_s_frequency(file, fh, p);
971}
972
973static int v4l_enumstd(const struct v4l2_ioctl_ops *ops,
974 struct file *file, void *fh, void *arg)
975{
976 struct video_device *vfd = video_devdata(file);
977 struct v4l2_standard *p = arg;
978 v4l2_std_id id = vfd->tvnorms, curr_id = 0;
979 unsigned int index = p->index, i, j = 0;
980 const char *descr = "";
981
982 /* Return norm array in a canonical way */
983 for (i = 0; i <= index && id; i++) {
984 /* last std value in the standards array is 0, so this
985 while always ends there since (id & 0) == 0. */
986 while ((id & standards[j].std) != standards[j].std)
987 j++;
988 curr_id = standards[j].std;
989 descr = standards[j].descr;
990 j++;
991 if (curr_id == 0)
992 break;
993 if (curr_id != V4L2_STD_PAL &&
994 curr_id != V4L2_STD_SECAM &&
995 curr_id != V4L2_STD_NTSC)
996 id &= ~curr_id;
997 }
998 if (i <= index)
999 return -EINVAL;
1000
1001 v4l2_video_std_construct(p, curr_id, descr);
1002 return 0;
1003}
1004
1005static int v4l_g_std(const struct v4l2_ioctl_ops *ops,
1006 struct file *file, void *fh, void *arg)
1007{
1008 struct video_device *vfd = video_devdata(file);
1009 v4l2_std_id *id = arg;
1010
1011 /* Calls the specific handler */
1012 if (ops->vidioc_g_std)
1013 return ops->vidioc_g_std(file, fh, arg);
1014 if (vfd->current_norm) {
1015 *id = vfd->current_norm;
1016 return 0;
1017 }
1018 return -ENOTTY;
1019}
1020
1021static int v4l_s_std(const struct v4l2_ioctl_ops *ops,
1022 struct file *file, void *fh, void *arg)
1023{
1024 struct video_device *vfd = video_devdata(file);
1025 v4l2_std_id *id = arg, norm;
1026 int ret;
1027
1028 norm = (*id) & vfd->tvnorms;
1029 if (vfd->tvnorms && !norm) /* Check if std is supported */
1030 return -EINVAL;
1031
1032 /* Calls the specific handler */
1033 ret = ops->vidioc_s_std(file, fh, &norm);
1034
1035 /* Updates standard information */
1036 if (ret >= 0)
1037 vfd->current_norm = norm;
1038 return ret;
1039}
1040
1041static int v4l_querystd(const struct v4l2_ioctl_ops *ops,
1042 struct file *file, void *fh, void *arg)
1043{
1044 struct video_device *vfd = video_devdata(file);
1045 v4l2_std_id *p = arg;
1046
1047 /*
1048 * If nothing detected, it should return all supported
1049 * standard.
1050 * Drivers just need to mask the std argument, in order
1051 * to remove the standards that don't apply from the mask.
1052 * This means that tuners, audio and video decoders can join
1053 * their efforts to improve the standards detection.
1054 */
1055 *p = vfd->tvnorms;
1056 return ops->vidioc_querystd(file, fh, arg);
1057}
1058
1059static int v4l_s_hw_freq_seek(const struct v4l2_ioctl_ops *ops,
1060 struct file *file, void *fh, void *arg)
1061{
1062 struct video_device *vfd = video_devdata(file);
1063 struct v4l2_hw_freq_seek *p = arg;
1064 enum v4l2_tuner_type type;
1065
1066 type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
1067 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1068 if (p->type != type)
1069 return -EINVAL;
1070 return ops->vidioc_s_hw_freq_seek(file, fh, p);
1071}
1072
864struct v4l2_ioctl_info { 1073struct v4l2_ioctl_info {
865 unsigned int ioctl; 1074 unsigned int ioctl;
866 u32 flags; 1075 u32 flags;
@@ -927,14 +1136,14 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
927 IOCTL_INFO_FNC(VIDIOC_STREAMOFF, v4l_streamoff, v4l_print_buftype, INFO_FL_PRIO), 1136 IOCTL_INFO_FNC(VIDIOC_STREAMOFF, v4l_streamoff, v4l_print_buftype, INFO_FL_PRIO),
928 IOCTL_INFO(VIDIOC_G_PARM, INFO_FL_CLEAR(v4l2_streamparm, type)), 1137 IOCTL_INFO(VIDIOC_G_PARM, INFO_FL_CLEAR(v4l2_streamparm, type)),
929 IOCTL_INFO(VIDIOC_S_PARM, INFO_FL_PRIO), 1138 IOCTL_INFO(VIDIOC_S_PARM, INFO_FL_PRIO),
930 IOCTL_INFO(VIDIOC_G_STD, 0), 1139 IOCTL_INFO_FNC(VIDIOC_G_STD, v4l_g_std, v4l_print_std, 0),
931 IOCTL_INFO(VIDIOC_S_STD, INFO_FL_PRIO), 1140 IOCTL_INFO_FNC(VIDIOC_S_STD, v4l_s_std, v4l_print_std, INFO_FL_PRIO),
932 IOCTL_INFO(VIDIOC_ENUMSTD, INFO_FL_CLEAR(v4l2_standard, index)), 1141 IOCTL_INFO_FNC(VIDIOC_ENUMSTD, v4l_enumstd, v4l_print_standard, INFO_FL_CLEAR(v4l2_standard, index)),
933 IOCTL_INFO_FNC(VIDIOC_ENUMINPUT, v4l_enuminput, v4l_print_enuminput, INFO_FL_CLEAR(v4l2_input, index)), 1142 IOCTL_INFO_FNC(VIDIOC_ENUMINPUT, v4l_enuminput, v4l_print_enuminput, INFO_FL_CLEAR(v4l2_input, index)),
934 IOCTL_INFO(VIDIOC_G_CTRL, INFO_FL_CTRL), 1143 IOCTL_INFO(VIDIOC_G_CTRL, INFO_FL_CTRL),
935 IOCTL_INFO(VIDIOC_S_CTRL, INFO_FL_PRIO | INFO_FL_CTRL), 1144 IOCTL_INFO(VIDIOC_S_CTRL, INFO_FL_PRIO | INFO_FL_CTRL),
936 IOCTL_INFO(VIDIOC_G_TUNER, INFO_FL_CLEAR(v4l2_tuner, index)), 1145 IOCTL_INFO_FNC(VIDIOC_G_TUNER, v4l_g_tuner, v4l_print_tuner, INFO_FL_CLEAR(v4l2_tuner, index)),
937 IOCTL_INFO(VIDIOC_S_TUNER, INFO_FL_PRIO), 1146 IOCTL_INFO_FNC(VIDIOC_S_TUNER, v4l_s_tuner, v4l_print_tuner, INFO_FL_PRIO),
938 IOCTL_INFO_STD(VIDIOC_G_AUDIO, vidioc_g_audio, v4l_print_audio, 0), 1147 IOCTL_INFO_STD(VIDIOC_G_AUDIO, vidioc_g_audio, v4l_print_audio, 0),
939 IOCTL_INFO_STD(VIDIOC_S_AUDIO, vidioc_s_audio, v4l_print_audio, INFO_FL_PRIO), 1148 IOCTL_INFO_STD(VIDIOC_S_AUDIO, vidioc_s_audio, v4l_print_audio, INFO_FL_PRIO),
940 IOCTL_INFO(VIDIOC_QUERYCTRL, INFO_FL_CTRL | INFO_FL_CLEAR(v4l2_queryctrl, id)), 1149 IOCTL_INFO(VIDIOC_QUERYCTRL, INFO_FL_CTRL | INFO_FL_CLEAR(v4l2_queryctrl, id)),
@@ -946,10 +1155,10 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
946 IOCTL_INFO_FNC(VIDIOC_ENUMOUTPUT, v4l_enumoutput, v4l_print_enumoutput, INFO_FL_CLEAR(v4l2_output, index)), 1155 IOCTL_INFO_FNC(VIDIOC_ENUMOUTPUT, v4l_enumoutput, v4l_print_enumoutput, INFO_FL_CLEAR(v4l2_output, index)),
947 IOCTL_INFO_STD(VIDIOC_G_AUDOUT, vidioc_g_audout, v4l_print_audioout, 0), 1156 IOCTL_INFO_STD(VIDIOC_G_AUDOUT, vidioc_g_audout, v4l_print_audioout, 0),
948 IOCTL_INFO_STD(VIDIOC_S_AUDOUT, vidioc_s_audout, v4l_print_audioout, INFO_FL_PRIO), 1157 IOCTL_INFO_STD(VIDIOC_S_AUDOUT, vidioc_s_audout, v4l_print_audioout, INFO_FL_PRIO),
949 IOCTL_INFO(VIDIOC_G_MODULATOR, INFO_FL_CLEAR(v4l2_modulator, index)), 1158 IOCTL_INFO_STD(VIDIOC_G_MODULATOR, vidioc_g_modulator, v4l_print_modulator, INFO_FL_CLEAR(v4l2_modulator, index)),
950 IOCTL_INFO(VIDIOC_S_MODULATOR, INFO_FL_PRIO), 1159 IOCTL_INFO_STD(VIDIOC_S_MODULATOR, vidioc_s_modulator, v4l_print_modulator, INFO_FL_PRIO),
951 IOCTL_INFO(VIDIOC_G_FREQUENCY, INFO_FL_CLEAR(v4l2_frequency, tuner)), 1160 IOCTL_INFO_FNC(VIDIOC_G_FREQUENCY, v4l_g_frequency, v4l_print_frequency, INFO_FL_CLEAR(v4l2_frequency, tuner)),
952 IOCTL_INFO(VIDIOC_S_FREQUENCY, INFO_FL_PRIO), 1161 IOCTL_INFO_FNC(VIDIOC_S_FREQUENCY, v4l_s_frequency, v4l_print_frequency, INFO_FL_PRIO),
953 IOCTL_INFO(VIDIOC_CROPCAP, INFO_FL_CLEAR(v4l2_cropcap, type)), 1162 IOCTL_INFO(VIDIOC_CROPCAP, INFO_FL_CLEAR(v4l2_cropcap, type)),
954 IOCTL_INFO(VIDIOC_G_CROP, INFO_FL_CLEAR(v4l2_crop, type)), 1163 IOCTL_INFO(VIDIOC_G_CROP, INFO_FL_CLEAR(v4l2_crop, type)),
955 IOCTL_INFO(VIDIOC_S_CROP, INFO_FL_PRIO), 1164 IOCTL_INFO(VIDIOC_S_CROP, INFO_FL_PRIO),
@@ -957,7 +1166,7 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
957 IOCTL_INFO(VIDIOC_S_SELECTION, INFO_FL_PRIO), 1166 IOCTL_INFO(VIDIOC_S_SELECTION, INFO_FL_PRIO),
958 IOCTL_INFO(VIDIOC_G_JPEGCOMP, 0), 1167 IOCTL_INFO(VIDIOC_G_JPEGCOMP, 0),
959 IOCTL_INFO(VIDIOC_S_JPEGCOMP, INFO_FL_PRIO), 1168 IOCTL_INFO(VIDIOC_S_JPEGCOMP, INFO_FL_PRIO),
960 IOCTL_INFO(VIDIOC_QUERYSTD, 0), 1169 IOCTL_INFO_FNC(VIDIOC_QUERYSTD, v4l_querystd, v4l_print_std, 0),
961 IOCTL_INFO_FNC(VIDIOC_TRY_FMT, v4l_try_fmt, v4l_print_format, 0), 1170 IOCTL_INFO_FNC(VIDIOC_TRY_FMT, v4l_try_fmt, v4l_print_format, 0),
962 IOCTL_INFO_STD(VIDIOC_ENUMAUDIO, vidioc_enumaudio, v4l_print_audio, INFO_FL_CLEAR(v4l2_audio, index)), 1171 IOCTL_INFO_STD(VIDIOC_ENUMAUDIO, vidioc_enumaudio, v4l_print_audio, INFO_FL_CLEAR(v4l2_audio, index)),
963 IOCTL_INFO_STD(VIDIOC_ENUMAUDOUT, vidioc_enumaudout, v4l_print_audioout, INFO_FL_CLEAR(v4l2_audioout, index)), 1172 IOCTL_INFO_STD(VIDIOC_ENUMAUDOUT, vidioc_enumaudout, v4l_print_audioout, INFO_FL_CLEAR(v4l2_audioout, index)),
@@ -978,7 +1187,7 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
978 IOCTL_INFO(VIDIOC_DBG_S_REGISTER, 0), 1187 IOCTL_INFO(VIDIOC_DBG_S_REGISTER, 0),
979 IOCTL_INFO(VIDIOC_DBG_G_REGISTER, 0), 1188 IOCTL_INFO(VIDIOC_DBG_G_REGISTER, 0),
980 IOCTL_INFO(VIDIOC_DBG_G_CHIP_IDENT, 0), 1189 IOCTL_INFO(VIDIOC_DBG_G_CHIP_IDENT, 0),
981 IOCTL_INFO(VIDIOC_S_HW_FREQ_SEEK, INFO_FL_PRIO), 1190 IOCTL_INFO_FNC(VIDIOC_S_HW_FREQ_SEEK, v4l_s_hw_freq_seek, v4l_print_hw_freq_seek, INFO_FL_PRIO),
982 IOCTL_INFO(VIDIOC_ENUM_DV_PRESETS, 0), 1191 IOCTL_INFO(VIDIOC_ENUM_DV_PRESETS, 0),
983 IOCTL_INFO(VIDIOC_S_DV_PRESET, INFO_FL_PRIO), 1192 IOCTL_INFO(VIDIOC_S_DV_PRESET, INFO_FL_PRIO),
984 IOCTL_INFO(VIDIOC_G_DV_PRESET, 0), 1193 IOCTL_INFO(VIDIOC_G_DV_PRESET, 0),
@@ -1160,102 +1369,6 @@ static long __video_do_ioctl(struct file *file,
1160 dbgbuf(cmd, vfd, p); 1369 dbgbuf(cmd, vfd, p);
1161 break; 1370 break;
1162 } 1371 }
1163 /* ---------- tv norms ---------- */
1164 case VIDIOC_ENUMSTD:
1165 {
1166 struct v4l2_standard *p = arg;
1167 v4l2_std_id id = vfd->tvnorms, curr_id = 0;
1168 unsigned int index = p->index, i, j = 0;
1169 const char *descr = "";
1170
1171 if (id == 0)
1172 break;
1173 ret = -EINVAL;
1174
1175 /* Return norm array in a canonical way */
1176 for (i = 0; i <= index && id; i++) {
1177 /* last std value in the standards array is 0, so this
1178 while always ends there since (id & 0) == 0. */
1179 while ((id & standards[j].std) != standards[j].std)
1180 j++;
1181 curr_id = standards[j].std;
1182 descr = standards[j].descr;
1183 j++;
1184 if (curr_id == 0)
1185 break;
1186 if (curr_id != V4L2_STD_PAL &&
1187 curr_id != V4L2_STD_SECAM &&
1188 curr_id != V4L2_STD_NTSC)
1189 id &= ~curr_id;
1190 }
1191 if (i <= index)
1192 break;
1193
1194 v4l2_video_std_construct(p, curr_id, descr);
1195
1196 dbgarg(cmd, "index=%d, id=0x%Lx, name=%s, fps=%d/%d, "
1197 "framelines=%d\n", p->index,
1198 (unsigned long long)p->id, p->name,
1199 p->frameperiod.numerator,
1200 p->frameperiod.denominator,
1201 p->framelines);
1202
1203 ret = 0;
1204 break;
1205 }
1206 case VIDIOC_G_STD:
1207 {
1208 v4l2_std_id *id = arg;
1209
1210 /* Calls the specific handler */
1211 if (ops->vidioc_g_std)
1212 ret = ops->vidioc_g_std(file, fh, id);
1213 else if (vfd->current_norm) {
1214 ret = 0;
1215 *id = vfd->current_norm;
1216 }
1217
1218 if (likely(!ret))
1219 dbgarg(cmd, "std=0x%08Lx\n", (long long unsigned)*id);
1220 break;
1221 }
1222 case VIDIOC_S_STD:
1223 {
1224 v4l2_std_id *id = arg, norm;
1225
1226 dbgarg(cmd, "std=%08Lx\n", (long long unsigned)*id);
1227
1228 ret = -EINVAL;
1229 norm = (*id) & vfd->tvnorms;
1230 if (vfd->tvnorms && !norm) /* Check if std is supported */
1231 break;
1232
1233 /* Calls the specific handler */
1234 ret = ops->vidioc_s_std(file, fh, &norm);
1235
1236 /* Updates standard information */
1237 if (ret >= 0)
1238 vfd->current_norm = norm;
1239 break;
1240 }
1241 case VIDIOC_QUERYSTD:
1242 {
1243 v4l2_std_id *p = arg;
1244
1245 /*
1246 * If nothing detected, it should return all supported
1247 * Drivers just need to mask the std argument, in order
1248 * to remove the standards that don't apply from the mask.
1249 * This means that tuners, audio and video decoders can join
1250 * their efforts to improve the standards detection
1251 */
1252 *p = vfd->tvnorms;
1253 ret = ops->vidioc_querystd(file, fh, arg);
1254 if (!ret)
1255 dbgarg(cmd, "detected std=%08Lx\n",
1256 (unsigned long long)*p);
1257 break;
1258 }
1259 1372
1260 /* --- controls ---------------------------------------------- */ 1373 /* --- controls ---------------------------------------------- */
1261 case VIDIOC_QUERYCTRL: 1374 case VIDIOC_QUERYCTRL:
@@ -1426,31 +1539,6 @@ static long __video_do_ioctl(struct file *file,
1426 p->id, p->index); 1539 p->id, p->index);
1427 break; 1540 break;
1428 } 1541 }
1429 case VIDIOC_G_MODULATOR:
1430 {
1431 struct v4l2_modulator *p = arg;
1432
1433 ret = ops->vidioc_g_modulator(file, fh, p);
1434 if (!ret)
1435 dbgarg(cmd, "index=%d, name=%s, "
1436 "capability=%d, rangelow=%d,"
1437 " rangehigh=%d, txsubchans=%d\n",
1438 p->index, p->name, p->capability,
1439 p->rangelow, p->rangehigh,
1440 p->txsubchans);
1441 break;
1442 }
1443 case VIDIOC_S_MODULATOR:
1444 {
1445 struct v4l2_modulator *p = arg;
1446
1447 dbgarg(cmd, "index=%d, name=%s, capability=%d, "
1448 "rangelow=%d, rangehigh=%d, txsubchans=%d\n",
1449 p->index, p->name, p->capability, p->rangelow,
1450 p->rangehigh, p->txsubchans);
1451 ret = ops->vidioc_s_modulator(file, fh, p);
1452 break;
1453 }
1454 case VIDIOC_G_CROP: 1542 case VIDIOC_G_CROP:
1455 { 1543 {
1456 struct v4l2_crop *p = arg; 1544 struct v4l2_crop *p = arg;
@@ -1684,68 +1772,6 @@ static long __video_do_ioctl(struct file *file,
1684 ret = ops->vidioc_s_parm(file, fh, p); 1772 ret = ops->vidioc_s_parm(file, fh, p);
1685 break; 1773 break;
1686 } 1774 }
1687 case VIDIOC_G_TUNER:
1688 {
1689 struct v4l2_tuner *p = arg;
1690
1691 p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
1692 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1693 ret = ops->vidioc_g_tuner(file, fh, p);
1694 if (!ret)
1695 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1696 "capability=0x%x, rangelow=%d, "
1697 "rangehigh=%d, signal=%d, afc=%d, "
1698 "rxsubchans=0x%x, audmode=%d\n",
1699 p->index, p->name, p->type,
1700 p->capability, p->rangelow,
1701 p->rangehigh, p->signal, p->afc,
1702 p->rxsubchans, p->audmode);
1703 break;
1704 }
1705 case VIDIOC_S_TUNER:
1706 {
1707 struct v4l2_tuner *p = arg;
1708
1709 p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
1710 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1711 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1712 "capability=0x%x, rangelow=%d, "
1713 "rangehigh=%d, signal=%d, afc=%d, "
1714 "rxsubchans=0x%x, audmode=%d\n",
1715 p->index, p->name, p->type,
1716 p->capability, p->rangelow,
1717 p->rangehigh, p->signal, p->afc,
1718 p->rxsubchans, p->audmode);
1719 ret = ops->vidioc_s_tuner(file, fh, p);
1720 break;
1721 }
1722 case VIDIOC_G_FREQUENCY:
1723 {
1724 struct v4l2_frequency *p = arg;
1725
1726 p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
1727 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1728 ret = ops->vidioc_g_frequency(file, fh, p);
1729 if (!ret)
1730 dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n",
1731 p->tuner, p->type, p->frequency);
1732 break;
1733 }
1734 case VIDIOC_S_FREQUENCY:
1735 {
1736 struct v4l2_frequency *p = arg;
1737 enum v4l2_tuner_type type;
1738
1739 type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
1740 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1741 dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n",
1742 p->tuner, p->type, p->frequency);
1743 if (p->type != type)
1744 ret = -EINVAL;
1745 else
1746 ret = ops->vidioc_s_frequency(file, fh, p);
1747 break;
1748 }
1749 case VIDIOC_G_SLICED_VBI_CAP: 1775 case VIDIOC_G_SLICED_VBI_CAP:
1750 { 1776 {
1751 struct v4l2_sliced_vbi_cap *p = arg; 1777 struct v4l2_sliced_vbi_cap *p = arg;
@@ -1805,22 +1831,6 @@ static long __video_do_ioctl(struct file *file,
1805 dbgarg(cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision); 1831 dbgarg(cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision);
1806 break; 1832 break;
1807 } 1833 }
1808 case VIDIOC_S_HW_FREQ_SEEK:
1809 {
1810 struct v4l2_hw_freq_seek *p = arg;
1811 enum v4l2_tuner_type type;
1812
1813 type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
1814 V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1815 dbgarg(cmd,
1816 "tuner=%u, type=%u, seek_upward=%u, wrap_around=%u, spacing=%u\n",
1817 p->tuner, p->type, p->seek_upward, p->wrap_around, p->spacing);
1818 if (p->type != type)
1819 ret = -EINVAL;
1820 else
1821 ret = ops->vidioc_s_hw_freq_seek(file, fh, p);
1822 break;
1823 }
1824 case VIDIOC_ENUM_FRAMESIZES: 1834 case VIDIOC_ENUM_FRAMESIZES:
1825 { 1835 {
1826 struct v4l2_frmsizeenum *p = arg; 1836 struct v4l2_frmsizeenum *p = arg;