mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
f1382122ab
commit
c0e69315ed
|
@ -388,9 +388,15 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
|
||||||
case VIDIOC_S_FREQUENCY:
|
case VIDIOC_S_FREQUENCY:
|
||||||
{
|
{
|
||||||
const struct v4l2_frequency *vf = (struct v4l2_frequency *)arg;
|
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(
|
ret = pvr2_ctrl_set_value(
|
||||||
pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY),
|
pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY),fv);
|
||||||
vf->frequency * 62500);
|
|
||||||
break;
|
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;
|
struct v4l2_frequency *vf = (struct v4l2_frequency *)arg;
|
||||||
int val = 0;
|
int val = 0;
|
||||||
|
int cur_input = PVR2_CVAL_INPUT_TV;
|
||||||
ret = pvr2_ctrl_get_value(
|
ret = pvr2_ctrl_get_value(
|
||||||
pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY),
|
pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY),
|
||||||
&val);
|
&val);
|
||||||
val /= 62500;
|
if (ret != 0) break;
|
||||||
vf->frequency = val;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue