diff options
author | Mike Isely <isely@pobox.com> | 2006-12-27 20:05:19 -0600 |
---|---|---|
committer | Mike Isely <isely@pobox.com> | 2006-12-27 20:05:19 -0600 |
commit | 9cb0dc1a11d13622b9bca84b946d3ce0e1aa1f9b (patch) | |
tree | 5ee74f5797712f325b68ab4fc0e4f10c16834ddf /linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c | |
parent | 3a6b5dfd2270a9ddcdf2b81e4dfa9388a343b0cd (diff) | |
download | mediapointer-dvb-s2-9cb0dc1a11d13622b9bca84b946d3ce0e1aa1f9b.tar.gz mediapointer-dvb-s2-9cb0dc1a11d13622b9bca84b946d3ce0e1aa1f9b.tar.bz2 |
pvrusb2: Enable radio mode round #1
From: Pantelis Koukousoulas <pakt223@freemail.gr>
This is the logic that supports switching modes via e.g.,
echo radio > /sys/class/pvrusb2/sn-*/ctl_input/cur_val.
To do the mode switching we need to a) broadcast AUDC_SET_RADIO and
b) issue the CX2341X_ENC_MUTE_VIDEO command to the encoder. The first is
done by adding a new pvr2_i2c_op and having it trigger on input change,
the second by adding this command in pvr2_encoder_start() and requesting
an encoder restart on input change by setting stale_subsys_mask appropriately.
The clues about AUDC_SET_RADIO and CX2341X_ENC_MUTE_VIDEO were kindly provided
by Hans Verkuil on the pvrusb2 mailing list. The idea to implement mode
switching this way (on input change) is due to Mike Isely.
Why AUDC_SET_RADIO/VIDIOC_S_STD are used for switching? I can 't be sure, but
I think this can be traced to a cornell student being the first to implement
radio support in ivtv "as a different standard". I think the rest just evolved
from there (it 's in the ivtv ML archives).
--Pantelis
Signed-off-by: Pantelis Koukousoulas <pakt223@freemail.gr>
Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c')
-rw-r--r-- | linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c index 05ea17afe..50fcceb15 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c @@ -24,7 +24,7 @@ #include "pvrusb2-hdw-internal.h" #include "pvrusb2-debug.h" #include <linux/videodev2.h> - +#include <media/v4l2-common.h> /* AUDC_SET_RADIO */ static void set_standard(struct pvr2_hdw *hdw) { @@ -50,6 +50,32 @@ const struct pvr2_i2c_op pvr2_i2c_op_v4l2_standard = { }; +static void set_radio(struct pvr2_hdw *hdw) +{ + pvr2_trace(PVR2_TRACE_CHIPS, + "i2c v4l2 set_radio()"); + + if (hdw->input_val == PVR2_CVAL_INPUT_RADIO) { + pvr2_i2c_core_cmd(hdw,AUDC_SET_RADIO,NULL); + } else { + set_standard(hdw); + } +} + + +static int check_radio(struct pvr2_hdw *hdw) +{ + return hdw->input_dirty != 0; +} + + +const struct pvr2_i2c_op pvr2_i2c_op_v4l2_radio = { + .check = check_radio, + .update = set_radio, + .name = "v4l2_radio", +}; + + static void set_bcsh(struct pvr2_hdw *hdw) { struct v4l2_control ctrl; @@ -145,7 +171,8 @@ static void set_frequency(struct pvr2_hdw *hdw) memset(&freq,0,sizeof(freq)); freq.frequency = fv / 62500; freq.tuner = 0; - freq.type = V4L2_TUNER_ANALOG_TV; + freq.type = (hdw->input_val == PVR2_CVAL_INPUT_RADIO) ? + V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; pvr2_i2c_core_cmd(hdw,VIDIOC_S_FREQUENCY,&freq); } |