aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-video.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-video.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c98
1 files changed, 58 insertions, 40 deletions
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 1a5137550e7..68c26898186 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1112,10 +1112,8 @@ static struct videobuf_queue_ops video_qops = {
1112 1112
1113/* ------------------------------------------------------------------ */ 1113/* ------------------------------------------------------------------ */
1114 1114
1115int saa7134_g_ctrl(struct file *file, void *priv, struct v4l2_control *c) 1115int saa7134_g_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c)
1116{ 1116{
1117 struct saa7134_fh *fh = priv;
1118 struct saa7134_dev *dev = fh->dev;
1119 const struct v4l2_queryctrl* ctrl; 1117 const struct v4l2_queryctrl* ctrl;
1120 1118
1121 ctrl = ctrl_by_id(c->id); 1119 ctrl = ctrl_by_id(c->id);
@@ -1160,20 +1158,31 @@ int saa7134_g_ctrl(struct file *file, void *priv, struct v4l2_control *c)
1160 } 1158 }
1161 return 0; 1159 return 0;
1162} 1160}
1163EXPORT_SYMBOL_GPL(saa7134_g_ctrl); 1161EXPORT_SYMBOL_GPL(saa7134_g_ctrl_internal);
1162
1163static int saa7134_g_ctrl(struct file *file, void *priv, struct v4l2_control *c)
1164{
1165 struct saa7134_fh *fh = priv;
1166
1167 return saa7134_g_ctrl_internal(fh->dev, fh, c);
1168}
1164 1169
1165int saa7134_s_ctrl(struct file *file, void *f, struct v4l2_control *c) 1170int saa7134_s_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c)
1166{ 1171{
1167 const struct v4l2_queryctrl* ctrl; 1172 const struct v4l2_queryctrl* ctrl;
1168 struct saa7134_fh *fh = f;
1169 struct saa7134_dev *dev = fh->dev;
1170 unsigned long flags; 1173 unsigned long flags;
1171 int restart_overlay = 0; 1174 int restart_overlay = 0;
1172 int err = -EINVAL; 1175 int err;
1173 1176
1174 err = v4l2_prio_check(&dev->prio, &fh->prio); 1177 /* When called from the empress code fh == NULL.
1175 if (0 != err) 1178 That needs to be fixed somehow, but for now this is
1176 return err; 1179 good enough. */
1180 if (fh) {
1181 err = v4l2_prio_check(&dev->prio, &fh->prio);
1182 if (0 != err)
1183 return err;
1184 }
1185 err = -EINVAL;
1177 1186
1178 mutex_lock(&dev->lock); 1187 mutex_lock(&dev->lock);
1179 1188
@@ -1274,7 +1283,14 @@ error:
1274 mutex_unlock(&dev->lock); 1283 mutex_unlock(&dev->lock);
1275 return err; 1284 return err;
1276} 1285}
1277EXPORT_SYMBOL_GPL(saa7134_s_ctrl); 1286EXPORT_SYMBOL_GPL(saa7134_s_ctrl_internal);
1287
1288static int saa7134_s_ctrl(struct file *file, void *f, struct v4l2_control *c)
1289{
1290 struct saa7134_fh *fh = f;
1291
1292 return saa7134_s_ctrl_internal(fh->dev, fh, c);
1293}
1278 1294
1279/* ------------------------------------------------------------------ */ 1295/* ------------------------------------------------------------------ */
1280 1296
@@ -2353,26 +2369,7 @@ static const struct file_operations video_fops =
2353 .llseek = no_llseek, 2369 .llseek = no_llseek,
2354}; 2370};
2355 2371
2356static const struct file_operations radio_fops = 2372static const struct v4l2_ioctl_ops video_ioctl_ops = {
2357{
2358 .owner = THIS_MODULE,
2359 .open = video_open,
2360 .release = video_release,
2361 .ioctl = video_ioctl2,
2362 .compat_ioctl = v4l_compat_ioctl32,
2363 .llseek = no_llseek,
2364};
2365
2366/* ----------------------------------------------------------- */
2367/* exported stuff */
2368
2369struct video_device saa7134_video_template =
2370{
2371 .name = "saa7134-video",
2372 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER |
2373 VID_TYPE_CLIPPING|VID_TYPE_SCALES,
2374 .fops = &video_fops,
2375 .minor = -1,
2376 .vidioc_querycap = saa7134_querycap, 2373 .vidioc_querycap = saa7134_querycap,
2377 .vidioc_enum_fmt_vid_cap = saa7134_enum_fmt_vid_cap, 2374 .vidioc_enum_fmt_vid_cap = saa7134_enum_fmt_vid_cap,
2378 .vidioc_g_fmt_vid_cap = saa7134_g_fmt_vid_cap, 2375 .vidioc_g_fmt_vid_cap = saa7134_g_fmt_vid_cap,
@@ -2421,16 +2418,18 @@ struct video_device saa7134_video_template =
2421 .vidioc_g_register = vidioc_g_register, 2418 .vidioc_g_register = vidioc_g_register,
2422 .vidioc_s_register = vidioc_s_register, 2419 .vidioc_s_register = vidioc_s_register,
2423#endif 2420#endif
2424 .tvnorms = SAA7134_NORMS,
2425 .current_norm = V4L2_STD_PAL,
2426}; 2421};
2427 2422
2428struct video_device saa7134_radio_template = 2423static const struct file_operations radio_fops = {
2429{ 2424 .owner = THIS_MODULE,
2430 .name = "saa7134-radio", 2425 .open = video_open,
2431 .type = VID_TYPE_TUNER, 2426 .release = video_release,
2432 .fops = &radio_fops, 2427 .ioctl = video_ioctl2,
2433 .minor = -1, 2428 .compat_ioctl = v4l_compat_ioctl32,
2429 .llseek = no_llseek,
2430};
2431
2432static const struct v4l2_ioctl_ops radio_ioctl_ops = {
2434 .vidioc_querycap = radio_querycap, 2433 .vidioc_querycap = radio_querycap,
2435 .vidioc_g_tuner = radio_g_tuner, 2434 .vidioc_g_tuner = radio_g_tuner,
2436 .vidioc_enum_input = radio_enum_input, 2435 .vidioc_enum_input = radio_enum_input,
@@ -2447,6 +2446,25 @@ struct video_device saa7134_radio_template =
2447 .vidioc_s_frequency = saa7134_s_frequency, 2446 .vidioc_s_frequency = saa7134_s_frequency,
2448}; 2447};
2449 2448
2449/* ----------------------------------------------------------- */
2450/* exported stuff */
2451
2452struct video_device saa7134_video_template = {
2453 .name = "saa7134-video",
2454 .fops = &video_fops,
2455 .ioctl_ops = &video_ioctl_ops,
2456 .minor = -1,
2457 .tvnorms = SAA7134_NORMS,
2458 .current_norm = V4L2_STD_PAL,
2459};
2460
2461struct video_device saa7134_radio_template = {
2462 .name = "saa7134-radio",
2463 .fops = &radio_fops,
2464 .ioctl_ops = &radio_ioctl_ops,
2465 .minor = -1,
2466};
2467
2450int saa7134_video_init1(struct saa7134_dev *dev) 2468int saa7134_video_init1(struct saa7134_dev *dev)
2451{ 2469{
2452 /* sanitycheck insmod options */ 2470 /* sanitycheck insmod options */