aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2006-12-27 21:25:06 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-02-21 10:34:32 -0500
commitc0e69315edd1d6901a021b85e0eea397444df702 (patch)
treee32ec4ac3f8d4c0944a84e5503989c2348880c9a /drivers
parentf1382122ab49a7f01fa107608eaf664b12055b8b (diff)
V4L/DVB (5048): Pvrusb2: v4l2 API implementation frequency tweaks
Report and set correctly converted frequency to/from a V4L2 app. Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index d5a54e8b72d5..f74727983df3 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -388,9 +388,15 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
388 case VIDIOC_S_FREQUENCY: 388 case VIDIOC_S_FREQUENCY:
389 { 389 {
390 const struct v4l2_frequency *vf = (struct v4l2_frequency *)arg; 390 const struct v4l2_frequency *vf = (struct v4l2_frequency *)arg;
391 unsigned long fv;
392 fv = vf->frequency;
393 if (vf->type == V4L2_TUNER_RADIO) {
394 fv = (fv * 125) / 2;
395 } else {
396 fv = fv * 62500;
397 }
391 ret = pvr2_ctrl_set_value( 398 ret = pvr2_ctrl_set_value(
392 pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY), 399 pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY),fv);
393 vf->frequency * 62500);
394 break; 400 break;
395 } 401 }
396 402
@@ -398,11 +404,23 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
398 { 404 {
399 struct v4l2_frequency *vf = (struct v4l2_frequency *)arg; 405 struct v4l2_frequency *vf = (struct v4l2_frequency *)arg;
400 int val = 0; 406 int val = 0;
407 int cur_input = PVR2_CVAL_INPUT_TV;
401 ret = pvr2_ctrl_get_value( 408 ret = pvr2_ctrl_get_value(
402 pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY), 409 pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY),
403 &val); 410 &val);
404 val /= 62500; 411 if (ret != 0) break;
405 vf->frequency = val; 412 pvr2_ctrl_get_value(
413 pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_INPUT),
414 &cur_input);
415 if (cur_input == PVR2_CVAL_INPUT_RADIO) {
416 val = (val * 2) / 125;
417 vf->frequency = val;
418 vf->type = V4L2_TUNER_RADIO;
419 } else {
420 val /= 62500;
421 vf->frequency = val;
422 vf->type = V4L2_TUNER_ANALOG_TV;
423 }
406 break; 424 break;
407 } 425 }
408 426