/* automute */
mute = mute || (btv->opt_automute && (!signal || !btv->users)
- && !btv->radio_user);
+ && !btv->has_radio_tuner);
if (mute)
gpio_val = bttv_tvcards[btv->c.type].gpiomute;
.buf_release = buffer_release,
};
+static void radio_enable(struct bttv *btv)
+{
+ /* Switch to the radio tuner */
+ if (!btv->has_radio_tuner) {
+ btv->has_radio_tuner = 1;
+ bttv_call_all(btv, tuner, s_radio);
+ audio_input(btv, TVAUDIO_INPUT_RADIO);
+ }
+}
+
static int bttv_s_std(struct file *file, void *priv, v4l2_std_id *id)
{
struct bttv_fh *fh = priv;
if (f->tuner)
return -EINVAL;
+ if (f->type == V4L2_TUNER_RADIO)
+ radio_enable(btv);
f->frequency = f->type == V4L2_TUNER_RADIO ?
btv->radio_freq : btv->tv_freq;
frequency before assigning radio/tv_freq. */
bttv_call_all(btv, tuner, g_frequency, f);
if (f->type == V4L2_TUNER_RADIO) {
+ radio_enable(btv);
btv->radio_freq = f->frequency;
if (btv->has_matchbox)
tea5757_set_freq(btv, btv->radio_freq);
btv->radio_user++;
- bttv_call_all(btv, tuner, s_radio);
- audio_input(btv,TVAUDIO_INPUT_RADIO);
v4l2_fh_add(&fh->fh);
return 0;
bttv_call_all(btv, core, ioctl, SAA6588_CMD_CLOSE, &cmd);
+ if (btv->radio_user == 0)
+ btv->has_radio_tuner = 0;
return 0;
}
return -EINVAL;
strcpy(t->name, "Radio");
t->type = V4L2_TUNER_RADIO;
+ radio_enable(btv);
bttv_call_all(btv, tuner, g_tuner, t);
if (0 != t->index)
return -EINVAL;
+ radio_enable(btv);
bttv_call_all(btv, tuner, s_tuner, t);
return 0;
}
cmd.buffer = data;
cmd.instance = file;
cmd.result = -ENODEV;
+ radio_enable(btv);
bttv_call_all(btv, core, ioctl, SAA6588_CMD_READ, &cmd);
res = POLLPRI;
else if (req_events & POLLPRI)
poll_wait(file, &fh->fh.wait, wait);
+ radio_enable(btv);
cmd.instance = file;
cmd.event_list = wait;
cmd.result = res;