diff mbox

[RFC,2/2] bttv: fix audio mute on device close for the radio device node

Message ID 1362915635-5431-2-git-send-email-fschaefer.oss@googlemail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Frank Schäfer March 10, 2013, 11:40 a.m. UTC
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/pci/bt8xx/bttv-driver.c |    5 ++++-
 1 Datei geändert, 4 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

Comments

Frank Schäfer March 10, 2013, 11:45 a.m. UTC | #1
Hans, in one of your previous comments you mentioned that radio devices
have to be handled differently, so I'm not sure if this is the right
thing to do...

Am 10.03.2013 12:40, schrieb Frank Schäfer:
> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
> ---
>  drivers/media/pci/bt8xx/bttv-driver.c |    5 ++++-
>  1 Datei geändert, 4 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
>
> diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
> index 2c09bc5..74977f7 100644
> --- a/drivers/media/pci/bt8xx/bttv-driver.c
> +++ b/drivers/media/pci/bt8xx/bttv-driver.c
> @@ -3227,6 +3227,7 @@ static int radio_open(struct file *file)
>  	v4l2_fh_init(&fh->fh, vdev);
>  
>  	btv->radio_user++;
> +	audio_mute(btv, btv->mute);
>  
>  	v4l2_fh_add(&fh->fh);
>  
> @@ -3248,8 +3249,10 @@ static int radio_release(struct file *file)
>  
>  	bttv_call_all(btv, core, ioctl, SAA6588_CMD_CLOSE, &cmd);
>  
> -	if (btv->radio_user == 0)
> +	if (btv->radio_user == 0) {
>  		btv->has_radio_tuner = 0;
> +		audio_mute(btv, 1);
> +	}

The same here, change to

            if (!btv->users && !btv->radio_user)        ?

Regards,
Frank

>  	return 0;
>  }
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hans Verkuil March 10, 2013, 11:59 a.m. UTC | #2
On Sun March 10 2013 12:40:35 Frank Schäfer wrote:
> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
> ---
>  drivers/media/pci/bt8xx/bttv-driver.c |    5 ++++-
>  1 Datei geändert, 4 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
> 
> diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
> index 2c09bc5..74977f7 100644
> --- a/drivers/media/pci/bt8xx/bttv-driver.c
> +++ b/drivers/media/pci/bt8xx/bttv-driver.c
> @@ -3227,6 +3227,7 @@ static int radio_open(struct file *file)
>  	v4l2_fh_init(&fh->fh, vdev);
>  
>  	btv->radio_user++;
> +	audio_mute(btv, btv->mute);
>  
>  	v4l2_fh_add(&fh->fh);
>  
> @@ -3248,8 +3249,10 @@ static int radio_release(struct file *file)
>  
>  	bttv_call_all(btv, core, ioctl, SAA6588_CMD_CLOSE, &cmd);
>  
> -	if (btv->radio_user == 0)
> +	if (btv->radio_user == 0) {
>  		btv->has_radio_tuner = 0;
> +		audio_mute(btv, 1);
> +	}
>  	return 0;
>  }
>  
> 

Sorry, but this isn't right.

You should be able to just set the radio to a frequency and then exit. Since
most cards have an audio out that loops to an audio input you don't want to
have to keep the radio device open.

Audio should be muted when the module is unloaded, though.

The relationship between TV and radio tuners was discussed last year. The
following proposal was accepted:

------- start -----------
How to handle tuner ownership if both a video and radio node share the same
tuner?

Calling S_FREQ, S_TUNER, S_MODULATOR or S_HW_FREQ_SEEK will make the filehandle
the owner if possible. EBUSY is returned if someone else owns the tuner and you
would need to switch the tuner mode.

Ditto for ioctls that expect a valid tuner configuration like QUERYSTD. This is
likely to be driver dependent, though. Just opening a device node should not
switch ownership.

G_FREQUENCY: should just return the last set frequency for radio or TV: requires
that that is remembered when switching ownership. This is what happens today, so
G_FREQUENCY does not have to switch ownership.

G_TUNER: the rxsubchans, signal and afc fields all require ownership of the tuner.
So in principle you would want to switch ownership when G_TUNER is called. On the
other hand, that would mean that calling v4l2-ctl --all -d /dev/radio0 would change
tuner ownership to radio for /dev/video0. That's rather unexpected.

So just set rxsubchans, signal and afc to 0 if the device node doesn't own the tuner.

Closing a device node should not switch ownership. E.g. if nobody has a radio device
open, should the tuner switch back to TV mode automatically? The answer is that it
shouldn't.

How about hybrid tuners? The code to handle tuner ownership should be shared between
DVB and V4L2.
----------- end --------------

All very nice, but nobody had the chance to actually work on this.

But this is how it should work.

Regards,

	Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Frank Schäfer March 10, 2013, 1:47 p.m. UTC | #3
Am 10.03.2013 12:59, schrieb Hans Verkuil:
> On Sun March 10 2013 12:40:35 Frank Schäfer wrote:
>> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
>> ---
>>  drivers/media/pci/bt8xx/bttv-driver.c |    5 ++++-
>>  1 Datei geändert, 4 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
>>
>> diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
>> index 2c09bc5..74977f7 100644
>> --- a/drivers/media/pci/bt8xx/bttv-driver.c
>> +++ b/drivers/media/pci/bt8xx/bttv-driver.c
>> @@ -3227,6 +3227,7 @@ static int radio_open(struct file *file)
>>  	v4l2_fh_init(&fh->fh, vdev);
>>  
>>  	btv->radio_user++;
>> +	audio_mute(btv, btv->mute);
>>  
>>  	v4l2_fh_add(&fh->fh);
>>  
>> @@ -3248,8 +3249,10 @@ static int radio_release(struct file *file)
>>  
>>  	bttv_call_all(btv, core, ioctl, SAA6588_CMD_CLOSE, &cmd);
>>  
>> -	if (btv->radio_user == 0)
>> +	if (btv->radio_user == 0) {
>>  		btv->has_radio_tuner = 0;
>> +		audio_mute(btv, 1);
>> +	}
>>  	return 0;
>>  }
>>  
>>
> Sorry, but this isn't right.
>
> You should be able to just set the radio to a frequency and then exit. Since
> most cards have an audio out that loops to an audio input you don't want to
> have to keep the radio device open.

Ok, so I will drop this patch.

AFAICS the above said also applies to the video device part, so it's
still not clear to me why both devices should be handled differently.
Anyway, I will regard it as a kind of "tradition".

>
> Audio should be muted when the module is unloaded, though.
>
> The relationship between TV and radio tuners was discussed last year. The
> following proposal was accepted:
>
> ------- start -----------
> How to handle tuner ownership if both a video and radio node share the same
> tuner?
>
> Calling S_FREQ, S_TUNER, S_MODULATOR or S_HW_FREQ_SEEK will make the filehandle
> the owner if possible. EBUSY is returned if someone else owns the tuner and you
> would need to switch the tuner mode.
>
> Ditto for ioctls that expect a valid tuner configuration like QUERYSTD. This is
> likely to be driver dependent, though. Just opening a device node should not
> switch ownership.
>
> G_FREQUENCY: should just return the last set frequency for radio or TV: requires
> that that is remembered when switching ownership. This is what happens today, so
> G_FREQUENCY does not have to switch ownership.
>
> G_TUNER: the rxsubchans, signal and afc fields all require ownership of the tuner.
> So in principle you would want to switch ownership when G_TUNER is called. On the
> other hand, that would mean that calling v4l2-ctl --all -d /dev/radio0 would change
> tuner ownership to radio for /dev/video0. That's rather unexpected.
>
> So just set rxsubchans, signal and afc to 0 if the device node doesn't own the tuner.
>
> Closing a device node should not switch ownership. E.g. if nobody has a radio device
> open, should the tuner switch back to TV mode automatically? The answer is that it
> shouldn't.
>
> How about hybrid tuners? The code to handle tuner ownership should be shared between
> DVB and V4L2.
> ----------- end --------------
>
> All very nice, but nobody had the chance to actually work on this.
>
> But this is how it should work.

Interesting, thanks !

Regards,
Frank

>
> Regards,
>
> 	Hans

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hans Verkuil March 10, 2013, 1:56 p.m. UTC | #4
On Sun March 10 2013 14:47:48 Frank Schäfer wrote:
> Am 10.03.2013 12:59, schrieb Hans Verkuil:
> > On Sun March 10 2013 12:40:35 Frank Schäfer wrote:
> >> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
> >> ---
> >>  drivers/media/pci/bt8xx/bttv-driver.c |    5 ++++-
> >>  1 Datei geändert, 4 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
> >>
> >> diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
> >> index 2c09bc5..74977f7 100644
> >> --- a/drivers/media/pci/bt8xx/bttv-driver.c
> >> +++ b/drivers/media/pci/bt8xx/bttv-driver.c
> >> @@ -3227,6 +3227,7 @@ static int radio_open(struct file *file)
> >>  	v4l2_fh_init(&fh->fh, vdev);
> >>  
> >>  	btv->radio_user++;
> >> +	audio_mute(btv, btv->mute);
> >>  
> >>  	v4l2_fh_add(&fh->fh);
> >>  
> >> @@ -3248,8 +3249,10 @@ static int radio_release(struct file *file)
> >>  
> >>  	bttv_call_all(btv, core, ioctl, SAA6588_CMD_CLOSE, &cmd);
> >>  
> >> -	if (btv->radio_user == 0)
> >> +	if (btv->radio_user == 0) {
> >>  		btv->has_radio_tuner = 0;
> >> +		audio_mute(btv, 1);
> >> +	}
> >>  	return 0;
> >>  }
> >>  
> >>
> > Sorry, but this isn't right.
> >
> > You should be able to just set the radio to a frequency and then exit. Since
> > most cards have an audio out that loops to an audio input you don't want to
> > have to keep the radio device open.
> 
> Ok, so I will drop this patch.
> 
> AFAICS the above said also applies to the video device part, so it's
> still not clear to me why both devices should be handled differently.
> Anyway, I will regard it as a kind of "tradition".

It is legacy. I doubt we would design it like that today. Also note that
there is generally little point in just listening to TV without actually
watching it (although some people do :-) ), so it makes sense to mute the
audio when you stop watching TV.

But radio has traditionally been implemented this way and we have to keep
that.

Regards,

	Hans

> 
> >
> > Audio should be muted when the module is unloaded, though.
> >
> > The relationship between TV and radio tuners was discussed last year. The
> > following proposal was accepted:
> >
> > ------- start -----------
> > How to handle tuner ownership if both a video and radio node share the same
> > tuner?
> >
> > Calling S_FREQ, S_TUNER, S_MODULATOR or S_HW_FREQ_SEEK will make the filehandle
> > the owner if possible. EBUSY is returned if someone else owns the tuner and you
> > would need to switch the tuner mode.
> >
> > Ditto for ioctls that expect a valid tuner configuration like QUERYSTD. This is
> > likely to be driver dependent, though. Just opening a device node should not
> > switch ownership.
> >
> > G_FREQUENCY: should just return the last set frequency for radio or TV: requires
> > that that is remembered when switching ownership. This is what happens today, so
> > G_FREQUENCY does not have to switch ownership.
> >
> > G_TUNER: the rxsubchans, signal and afc fields all require ownership of the tuner.
> > So in principle you would want to switch ownership when G_TUNER is called. On the
> > other hand, that would mean that calling v4l2-ctl --all -d /dev/radio0 would change
> > tuner ownership to radio for /dev/video0. That's rather unexpected.
> >
> > So just set rxsubchans, signal and afc to 0 if the device node doesn't own the tuner.
> >
> > Closing a device node should not switch ownership. E.g. if nobody has a radio device
> > open, should the tuner switch back to TV mode automatically? The answer is that it
> > shouldn't.
> >
> > How about hybrid tuners? The code to handle tuner ownership should be shared between
> > DVB and V4L2.
> > ----------- end --------------
> >
> > All very nice, but nobody had the chance to actually work on this.
> >
> > But this is how it should work.
> 
> Interesting, thanks !
> 
> Regards,
> Frank
> 
> >
> > Regards,
> >
> > 	Hans
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mauro Carvalho Chehab March 10, 2013, 1:58 p.m. UTC | #5
Em Sun, 10 Mar 2013 14:47:48 +0100
Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:

> Am 10.03.2013 12:59, schrieb Hans Verkuil:
> > On Sun March 10 2013 12:40:35 Frank Schäfer wrote:
> >> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
> >> ---
> >>  drivers/media/pci/bt8xx/bttv-driver.c |    5 ++++-
> >>  1 Datei geändert, 4 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
> >>
> >> diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
> >> index 2c09bc5..74977f7 100644
> >> --- a/drivers/media/pci/bt8xx/bttv-driver.c
> >> +++ b/drivers/media/pci/bt8xx/bttv-driver.c
> >> @@ -3227,6 +3227,7 @@ static int radio_open(struct file *file)
> >>  	v4l2_fh_init(&fh->fh, vdev);
> >>  
> >>  	btv->radio_user++;
> >> +	audio_mute(btv, btv->mute);
> >>  
> >>  	v4l2_fh_add(&fh->fh);
> >>  
> >> @@ -3248,8 +3249,10 @@ static int radio_release(struct file *file)
> >>  
> >>  	bttv_call_all(btv, core, ioctl, SAA6588_CMD_CLOSE, &cmd);
> >>  
> >> -	if (btv->radio_user == 0)
> >> +	if (btv->radio_user == 0) {
> >>  		btv->has_radio_tuner = 0;
> >> +		audio_mute(btv, 1);
> >> +	}
> >>  	return 0;
> >>  }
> >>  
> >>
> > Sorry, but this isn't right.
> >
> > You should be able to just set the radio to a frequency and then exit. Since
> > most cards have an audio out that loops to an audio input you don't want to
> > have to keep the radio device open.
> 
> Ok, so I will drop this patch.
> 
> AFAICS the above said also applies to the video device part, so it's
> still not clear to me why both devices should be handled differently.
> Anyway, I will regard it as a kind of "tradition".

It is not tradition. Changing it would break userspace. For example, xawtv's
"radio" program expects this behavior (see the "-q" and "-m" parameters).

A typical radio usage is to do:

	$ radio -f 93.7 -q

And when user is done listening to radio:

	$ radio -m

Of course, for the above to work, the user needs to have a board wired into
the audio device, or with an speaker directly connected into it.

Regards,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Frank Schäfer March 10, 2013, 9:49 p.m. UTC | #6
Am 10.03.2013 14:56, schrieb Hans Verkuil:
> On Sun March 10 2013 14:47:48 Frank Schäfer wrote:
>> Am 10.03.2013 12:59, schrieb Hans Verkuil:
>>> On Sun March 10 2013 12:40:35 Frank Schäfer wrote:
>>>> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
>>>> ---
>>>>  drivers/media/pci/bt8xx/bttv-driver.c |    5 ++++-
>>>>  1 Datei geändert, 4 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
>>>>
>>>> diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
>>>> index 2c09bc5..74977f7 100644
>>>> --- a/drivers/media/pci/bt8xx/bttv-driver.c
>>>> +++ b/drivers/media/pci/bt8xx/bttv-driver.c
>>>> @@ -3227,6 +3227,7 @@ static int radio_open(struct file *file)
>>>>  	v4l2_fh_init(&fh->fh, vdev);
>>>>  
>>>>  	btv->radio_user++;
>>>> +	audio_mute(btv, btv->mute);
>>>>  
>>>>  	v4l2_fh_add(&fh->fh);
>>>>  
>>>> @@ -3248,8 +3249,10 @@ static int radio_release(struct file *file)
>>>>  
>>>>  	bttv_call_all(btv, core, ioctl, SAA6588_CMD_CLOSE, &cmd);
>>>>  
>>>> -	if (btv->radio_user == 0)
>>>> +	if (btv->radio_user == 0) {
>>>>  		btv->has_radio_tuner = 0;
>>>> +		audio_mute(btv, 1);
>>>> +	}
>>>>  	return 0;
>>>>  }
>>>>  
>>>>
>>> Sorry, but this isn't right.
>>>
>>> You should be able to just set the radio to a frequency and then exit. Since
>>> most cards have an audio out that loops to an audio input you don't want to
>>> have to keep the radio device open.
>> Ok, so I will drop this patch.
>>
>> AFAICS the above said also applies to the video device part, so it's
>> still not clear to me why both devices should be handled differently.
>> Anyway, I will regard it as a kind of "tradition".
> It is legacy. I doubt we would design it like that today. Also note that
> there is generally little point in just listening to TV without actually
> watching it (although some people do :-) ), so it makes sense to mute the
> audio when you stop watching TV.
>
> But radio has traditionally been implemented this way and we have to keep
> that.
>
> Regards,
>
> 	Hans
>

[...]

Am 10.03.2013 14:58, schrieb Mauro Carvalho Chehab:
...
> It is not tradition. Changing it would break userspace. For example, xawtv's
> "radio" program expects this behavior (see the "-q" and "-m" parameters).
>
> A typical radio usage is to do:
>
> 	$ radio -f 93.7 -q
>
> And when user is done listening to radio:
>
> 	$ radio -m
>
> Of course, for the above to work, the user needs to have a board wired into
> the audio device, or with an speaker directly connected into it.
>
> Regards,
> Mauro

Fair enough, thanks for your explanations.
Please excuse my questions about issues like this.
Without knowing the history and the reasons for the initial design
decisions it's sometimes difficult to understand why things are working
as they are and if they need to be fixed.

Regards,
Frank

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hans Verkuil March 10, 2013, 10:45 p.m. UTC | #7
On Sun March 10 2013 22:49:33 Frank Schäfer wrote:
> Am 10.03.2013 14:56, schrieb Hans Verkuil:
> > On Sun March 10 2013 14:47:48 Frank Schäfer wrote:
> >> Am 10.03.2013 12:59, schrieb Hans Verkuil:
> >>> On Sun March 10 2013 12:40:35 Frank Schäfer wrote:
> >>>> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
> >>>> ---
> >>>>  drivers/media/pci/bt8xx/bttv-driver.c |    5 ++++-
> >>>>  1 Datei geändert, 4 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
> >>>>
> >>>> diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
> >>>> index 2c09bc5..74977f7 100644
> >>>> --- a/drivers/media/pci/bt8xx/bttv-driver.c
> >>>> +++ b/drivers/media/pci/bt8xx/bttv-driver.c
> >>>> @@ -3227,6 +3227,7 @@ static int radio_open(struct file *file)
> >>>>  	v4l2_fh_init(&fh->fh, vdev);
> >>>>  
> >>>>  	btv->radio_user++;
> >>>> +	audio_mute(btv, btv->mute);
> >>>>  
> >>>>  	v4l2_fh_add(&fh->fh);
> >>>>  
> >>>> @@ -3248,8 +3249,10 @@ static int radio_release(struct file *file)
> >>>>  
> >>>>  	bttv_call_all(btv, core, ioctl, SAA6588_CMD_CLOSE, &cmd);
> >>>>  
> >>>> -	if (btv->radio_user == 0)
> >>>> +	if (btv->radio_user == 0) {
> >>>>  		btv->has_radio_tuner = 0;
> >>>> +		audio_mute(btv, 1);
> >>>> +	}
> >>>>  	return 0;
> >>>>  }
> >>>>  
> >>>>
> >>> Sorry, but this isn't right.
> >>>
> >>> You should be able to just set the radio to a frequency and then exit. Since
> >>> most cards have an audio out that loops to an audio input you don't want to
> >>> have to keep the radio device open.
> >> Ok, so I will drop this patch.
> >>
> >> AFAICS the above said also applies to the video device part, so it's
> >> still not clear to me why both devices should be handled differently.
> >> Anyway, I will regard it as a kind of "tradition".
> > It is legacy. I doubt we would design it like that today. Also note that
> > there is generally little point in just listening to TV without actually
> > watching it (although some people do :-) ), so it makes sense to mute the
> > audio when you stop watching TV.
> >
> > But radio has traditionally been implemented this way and we have to keep
> > that.
> >
> > Regards,
> >
> > 	Hans
> >
> 
> [...]
> 
> Am 10.03.2013 14:58, schrieb Mauro Carvalho Chehab:
> ...
> > It is not tradition. Changing it would break userspace. For example, xawtv's
> > "radio" program expects this behavior (see the "-q" and "-m" parameters).
> >
> > A typical radio usage is to do:
> >
> > 	$ radio -f 93.7 -q
> >
> > And when user is done listening to radio:
> >
> > 	$ radio -m
> >
> > Of course, for the above to work, the user needs to have a board wired into
> > the audio device, or with an speaker directly connected into it.
> >
> > Regards,
> > Mauro
> 
> Fair enough, thanks for your explanations.
> Please excuse my questions about issues like this.

No problem, just ask!

> Without knowing the history and the reasons for the initial design
> decisions it's sometimes difficult to understand why things are working
> as they are and if they need to be fixed.

It's not helped in the case of bttv by particularly obscure and convoluted
code with regards to audio muting and volume handling, as you have discovered
by now :-)

I'll see if I can review your patch series this week. If possible I'd like
to do some testing as well.

Regards,

	Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
index 2c09bc5..74977f7 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -3227,6 +3227,7 @@  static int radio_open(struct file *file)
 	v4l2_fh_init(&fh->fh, vdev);
 
 	btv->radio_user++;
+	audio_mute(btv, btv->mute);
 
 	v4l2_fh_add(&fh->fh);
 
@@ -3248,8 +3249,10 @@  static int radio_release(struct file *file)
 
 	bttv_call_all(btv, core, ioctl, SAA6588_CMD_CLOSE, &cmd);
 
-	if (btv->radio_user == 0)
+	if (btv->radio_user == 0) {
 		btv->has_radio_tuner = 0;
+		audio_mute(btv, 1);
+	}
 	return 0;
 }