Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c0e69315edd1d6901a021b85e0eea397444df702
Commit:     c0e69315edd1d6901a021b85e0eea397444df702
Parent:     f1382122ab49a7f01fa107608eaf664b12055b8b
Author:     Mike Isely <[EMAIL PROTECTED]>
AuthorDate: Wed Dec 27 23:25:06 2006 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Wed Feb 21 13:34:32 2007 -0200

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/video/pvrusb2/pvrusb2-v4l2.c |   26 ++++++++++++++++++++++----
 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 d5a54e8..f747279 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,
        case VIDIOC_S_FREQUENCY:
        {
                const struct v4l2_frequency *vf = (struct v4l2_frequency *)arg;
+               unsigned long fv;
+               fv = vf->frequency;
+               if (vf->type == V4L2_TUNER_RADIO) {
+                       fv = (fv * 125) / 2;
+               } else {
+                       fv = fv * 62500;
+               }
                ret = pvr2_ctrl_set_value(
-                       pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY),
-                       vf->frequency * 62500);
+                       pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY),fv);
                break;
        }
 
@@ -398,11 +404,23 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct 
file *file,
        {
                struct v4l2_frequency *vf = (struct v4l2_frequency *)arg;
                int val = 0;
+               int cur_input = PVR2_CVAL_INPUT_TV;
                ret = pvr2_ctrl_get_value(
                        pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY),
                        &val);
-               val /= 62500;
-               vf->frequency = val;
+               if (ret != 0) break;
+               pvr2_ctrl_get_value(
+                       pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_INPUT),
+                       &cur_input);
+               if (cur_input == PVR2_CVAL_INPUT_RADIO) {
+                       val = (val * 2) / 125;
+                       vf->frequency = val;
+                       vf->type = V4L2_TUNER_RADIO;
+               } else {
+                       val /= 62500;
+                       vf->frequency = val;
+                       vf->type = V4L2_TUNER_ANALOG_TV;
+               }
                break;
        }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to