X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmedia%2Fvideo%2Ftuner-core.c;h=b6101bf446d4897e62d85e215ae27e290140087c;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=1013b4de89a278c21ebf017a452e7cf73716b226;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 1013b4de8..b6101bf44 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -21,6 +21,7 @@ #include #include +#include #define UNSET (-1U) @@ -172,6 +173,7 @@ static void set_type(struct i2c_client *c, unsigned int type, } t->type = type; + switch (t->type) { case TUNER_MT2032: microtune_init(c); @@ -401,17 +403,16 @@ static void tuner_status(struct i2c_client *client) } tuner_info("Tuner mode: %s\n", p); tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction); - tuner_info("Standard: 0x%08lx\n", (unsigned long)t->std); - if (t->mode != V4L2_TUNER_RADIO) - return; - if (t->has_signal) { - tuner_info("Signal strength: %d\n", t->has_signal(client)); - } - if (t->is_stereo) { - tuner_info("Stereo: %s\n", t->is_stereo(client) ? "yes" : "no"); + tuner_info("Standard: 0x%08llx\n", t->std); + if (t->mode == V4L2_TUNER_RADIO) { + if (t->has_signal) { + tuner_info("Signal strength: %d\n", t->has_signal(client)); + } + if (t->is_stereo) { + tuner_info("Stereo: %s\n", t->is_stereo(client) ? "yes" : "no"); + } } } - /* ---------------------------------------------------------------------- */ /* static var Used only in tuner_attach and tuner_probe */ @@ -558,10 +559,10 @@ static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, static inline int check_v4l2(struct tuner *t) { - /* bttv still uses both v4l1 and v4l2 calls to the tuner (v4l2 for - TV, v4l1 for radio), until that is fixed this code is disabled. - Otherwise the radio (v4l1) wouldn't tune after using the TV (v4l2) - first. */ + if (t->using_v4l2) { + tuner_dbg ("ignore v4l1 call\n"); + return EINVAL; + } return 0; } @@ -743,31 +744,33 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) return 0; switch_v4l2(); - tuner->type = t->mode; - if (t->mode == V4L2_TUNER_ANALOG_TV) - tuner->capability |= V4L2_TUNER_CAP_NORM; - if (t->mode != V4L2_TUNER_RADIO) { - tuner->rangelow = tv_range[0] * 16; - tuner->rangehigh = tv_range[1] * 16; - break; - } + if (V4L2_TUNER_RADIO == t->mode) { - /* radio mode */ - if (t->has_signal) - tuner->signal = t->has_signal(client); + if (t->has_signal) + tuner->signal = t->has_signal(client); - tuner->rxsubchans = - V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; - if (t->is_stereo) { - tuner->rxsubchans = t->is_stereo(client) ? - V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; - } + if (t->is_stereo) { + if (t->is_stereo(client)) { + tuner->rxsubchans = + V4L2_TUNER_SUB_STEREO | + V4L2_TUNER_SUB_MONO; + } else { + tuner->rxsubchans = + V4L2_TUNER_SUB_MONO; + } + } + + tuner->capability |= + V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; + + tuner->audmode = t->audmode; - tuner->capability |= - V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; - tuner->audmode = t->audmode; - tuner->rangelow = radio_range[0] * 16000; - tuner->rangehigh = radio_range[1] * 16000; + tuner->rangelow = radio_range[0] * 16000; + tuner->rangehigh = radio_range[1] * 16000; + } else { + tuner->rangelow = tv_range[0] * 16; + tuner->rangehigh = tv_range[1] * 16; + } break; } case VIDIOC_S_TUNER: @@ -779,11 +782,10 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) switch_v4l2(); - /* do nothing unless we're a radio tuner */ - if (t->mode != V4L2_TUNER_RADIO) - break; - t->audmode = tuner->audmode; - set_radio_freq(client, t->radio_freq); + if (V4L2_TUNER_RADIO == t->mode) { + t->audmode = tuner->audmode; + set_radio_freq(client, t->radio_freq); + } break; } case VIDIOC_LOG_STATUS: