aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-empress.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-06-27 20:18:15 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:14:23 -0400
commit8b53b39d6228cda41b7ddfc9d094a072afca6655 (patch)
treeb6ad8f7d5708e5ef4021895342c91af378f04097 /drivers/media/video/saa7134/saa7134-empress.c
parente5e4cd8df61e602202f588dd545364dba37b4cc7 (diff)
V4L/DVB (8151): saa7134-empress: fix MPEG control support
The MPEG controls could not be enumerated and so could not be read or set through the v4l2-ctl utility or shown in control panels. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-empress.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c74
1 files changed, 69 insertions, 5 deletions
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index e11700eb3e5a..2a5ab957542d 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -294,10 +294,20 @@ static int empress_streamoff(struct file *file, void *priv,
294 return videobuf_streamoff(&dev->empress_tsq); 294 return videobuf_streamoff(&dev->empress_tsq);
295} 295}
296 296
297static int saa7134_i2c_call_saa6752(struct saa7134_dev *dev,
298 unsigned int cmd, void *arg)
299{
300 if (dev->mpeg_i2c_client == NULL)
301 return -EINVAL;
302 return dev->mpeg_i2c_client->driver->command(dev->mpeg_i2c_client,
303 cmd, arg);
304}
305
297static int empress_s_ext_ctrls(struct file *file, void *priv, 306static int empress_s_ext_ctrls(struct file *file, void *priv,
298 struct v4l2_ext_controls *ctrls) 307 struct v4l2_ext_controls *ctrls)
299{ 308{
300 struct saa7134_dev *dev = file->private_data; 309 struct saa7134_dev *dev = file->private_data;
310 int err;
301 311
302 /* count == 0 is abused in saa6752hs.c, so that special 312 /* count == 0 is abused in saa6752hs.c, so that special
303 case is handled here explicitly. */ 313 case is handled here explicitly. */
@@ -307,10 +317,10 @@ static int empress_s_ext_ctrls(struct file *file, void *priv,
307 if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) 317 if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG)
308 return -EINVAL; 318 return -EINVAL;
309 319
310 saa7134_i2c_call_clients(dev, VIDIOC_S_EXT_CTRLS, ctrls); 320 err = saa7134_i2c_call_saa6752(dev, VIDIOC_S_EXT_CTRLS, ctrls);
311 ts_init_encoder(dev); 321 ts_init_encoder(dev);
312 322
313 return 0; 323 return err;
314} 324}
315 325
316static int empress_g_ext_ctrls(struct file *file, void *priv, 326static int empress_g_ext_ctrls(struct file *file, void *priv,
@@ -320,9 +330,62 @@ static int empress_g_ext_ctrls(struct file *file, void *priv,
320 330
321 if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) 331 if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG)
322 return -EINVAL; 332 return -EINVAL;
323 saa7134_i2c_call_clients(dev, VIDIOC_G_EXT_CTRLS, ctrls); 333 return saa7134_i2c_call_saa6752(dev, VIDIOC_G_EXT_CTRLS, ctrls);
334}
324 335
325 return 0; 336static int empress_queryctrl(struct file *file, void *priv,
337 struct v4l2_queryctrl *c)
338{
339 static const u32 user_ctrls[] = {
340 V4L2_CID_USER_CLASS,
341 V4L2_CID_BRIGHTNESS,
342 V4L2_CID_CONTRAST,
343 V4L2_CID_SATURATION,
344 V4L2_CID_HUE,
345 V4L2_CID_AUDIO_VOLUME,
346 V4L2_CID_AUDIO_MUTE,
347 V4L2_CID_HFLIP,
348 0
349 };
350
351 static const u32 mpeg_ctrls[] = {
352 V4L2_CID_MPEG_CLASS,
353 V4L2_CID_MPEG_STREAM_TYPE,
354 V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ,
355 V4L2_CID_MPEG_AUDIO_ENCODING,
356 V4L2_CID_MPEG_AUDIO_L2_BITRATE,
357 V4L2_CID_MPEG_VIDEO_ENCODING,
358 V4L2_CID_MPEG_VIDEO_ASPECT,
359 V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
360 V4L2_CID_MPEG_VIDEO_BITRATE,
361 V4L2_CID_MPEG_VIDEO_BITRATE_PEAK,
362 0
363 };
364 static const u32 *ctrl_classes[] = {
365 user_ctrls,
366 mpeg_ctrls,
367 NULL
368 };
369 struct saa7134_dev *dev = file->private_data;
370
371 c->id = v4l2_ctrl_next(ctrl_classes, c->id);
372 if (c->id == 0)
373 return -EINVAL;
374 if (c->id == V4L2_CID_USER_CLASS || c->id == V4L2_CID_MPEG_CLASS)
375 return v4l2_ctrl_query_fill_std(c);
376 if (V4L2_CTRL_ID2CLASS(c->id) != V4L2_CTRL_CLASS_MPEG)
377 return saa7134_queryctrl(file, priv, c);
378 return saa7134_i2c_call_saa6752(dev, VIDIOC_QUERYCTRL, c);
379}
380
381static int empress_querymenu(struct file *file, void *priv,
382 struct v4l2_querymenu *c)
383{
384 struct saa7134_dev *dev = file->private_data;
385
386 if (V4L2_CTRL_ID2CLASS(c->id) != V4L2_CTRL_CLASS_MPEG)
387 return -EINVAL;
388 return saa7134_i2c_call_saa6752(dev, VIDIOC_QUERYMENU, c);
326} 389}
327 390
328static const struct file_operations ts_fops = 391static const struct file_operations ts_fops =
@@ -363,7 +426,8 @@ static struct video_device saa7134_empress_template =
363 .vidioc_g_input = empress_g_input, 426 .vidioc_g_input = empress_g_input,
364 .vidioc_s_input = empress_s_input, 427 .vidioc_s_input = empress_s_input,
365 428
366 .vidioc_queryctrl = saa7134_queryctrl, 429 .vidioc_queryctrl = empress_queryctrl,
430 .vidioc_querymenu = empress_querymenu,
367 .vidioc_g_ctrl = saa7134_g_ctrl, 431 .vidioc_g_ctrl = saa7134_g_ctrl,
368 .vidioc_s_ctrl = saa7134_s_ctrl, 432 .vidioc_s_ctrl = saa7134_s_ctrl,
369 433