From 5549f54f46c2375761f42cd2741364316e3b2a13 Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Wed, 27 Dec 2006 23:28:54 -0300 Subject: V4L/DVB (5050): Pvrusb2: Newer frequency range checking Implement new method for doing integer range checking, so that we can more intelligently range-check radio and tv ranges at once. Signed-off-by: Mike Isely Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pvrusb2/pvrusb2-hdw.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c') diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index fe290f2f4e14..04e746932217 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -381,6 +381,15 @@ static int ctrl_vres_min_get(struct pvr2_ctrl *cptr,int *vp) return 0; } +static int ctrl_freq_check(struct pvr2_ctrl *cptr,int v) +{ + if (cptr->hdw->input_val == PVR2_CVAL_INPUT_RADIO) { + return ((v >= RADIO_MIN_FREQ) && (v <= RADIO_MAX_FREQ)); + } else { + return ((v >= TV_MIN_FREQ) && (v <= TV_MAX_FREQ)); + } +} + static int ctrl_freq_max_get(struct pvr2_ctrl *cptr, int *vp) { /* Actual maximum depends on radio/tv mode */ @@ -788,6 +797,7 @@ static const struct pvr2_ctl_info control_defs[] = { DEFINT(TV_MIN_FREQ,TV_MAX_FREQ), /* Hook in check for input value (tv/radio) and adjust max/min values accordingly */ + .check_value = ctrl_freq_check, .get_max_value = ctrl_freq_max_get, .get_min_value = ctrl_freq_min_get, },{ -- cgit v1.2.2