Message ID | 1362915635-5431-2-git-send-email-fschaefer.oss@googlemail.com (mailing list archive) |
---|---|
State | RFC, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from <linux-media-owner@vger.kernel.org>) id 1UEebh-0002NT-WE; Sun, 10 Mar 2013 12:40:02 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-3) with esmtp id 1UEebh-0005CU-Dw; Sun, 10 Mar 2013 12:40:01 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752056Ab3CJLj6 (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Sun, 10 Mar 2013 07:39:58 -0400 Received: from mail-ea0-f175.google.com ([209.85.215.175]:39206 "EHLO mail-ea0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751800Ab3CJLj5 (ORCPT <rfc822;linux-media@vger.kernel.org>); Sun, 10 Mar 2013 07:39:57 -0400 Received: by mail-ea0-f175.google.com with SMTP id o10so751245eaj.6 for <linux-media@vger.kernel.org>; Sun, 10 Mar 2013 04:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=MYqkB9f+RzZxEkSRAUFGWpfN8/whyyVLCTX+1VgLM/s=; b=04zMRI3w5q3wXxNe9EKSRmx574MoYgtHX6YU6IeBQS2iMs2SGsZcghVyM0CtjXQKgd 1i1bVQfBA71cgJ4M5tco53OACGYpyvMW4RyUpKmpPdwOOt3KKanaRFp1kr2UULMNlOY3 QT8RpnWSsEaTnTXturDvTFJkdlwMy8c38/UPpLyb9quLDYeIFGNuUXwOnDEN/7Ait2yI vX+KBldjtJJb2c0MROg7Pnl/qIJJukUzMVkdfDOCoUybwTYyZCBrng6SpCbb9WKsBa4b 1123ZkAjoiGxJ6fbXIVhxDEsL+qHqGqlRYtT/c9lwWmW6c4hQhwADa1pmU+Pq2mBppr1 b86g== X-Received: by 10.14.3.70 with SMTP id 46mr25629122eeg.2.1362915596067; Sun, 10 Mar 2013 04:39:56 -0700 (PDT) Received: from Athlon64X2-5000.site (ip-178-200-115-25.unitymediagroup.de. [178.200.115.25]) by mx.google.com with ESMTPS id q5sm17850013eeo.17.2013.03.10.04.39.54 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 10 Mar 2013 04:39:55 -0700 (PDT) From: =?UTF-8?q?Frank=20Sch=C3=A4fer?= <fschaefer.oss@googlemail.com> To: mchehab@redhat.com Cc: hverkuil@xs4all.nl, linux-media@vger.kernel.org, =?UTF-8?q?Frank=20Sch=C3=A4fer?= <fschaefer.oss@googlemail.com> Subject: [RFC PATCH 2/2] bttv: fix audio mute on device close for the radio device node Date: Sun, 10 Mar 2013 12:40:35 +0100 Message-Id: <1362915635-5431-2-git-send-email-fschaefer.oss@googlemail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1362915635-5431-1-git-send-email-fschaefer.oss@googlemail.com> References: <1362915635-5431-1-git-send-email-fschaefer.oss@googlemail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2013.3.10.113318 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_1099 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, CT_TEXT_PLAIN_UTF8_CAPS 0, DKIM_SIGNATURE 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' |
Commit Message
Frank Schaefer
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
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
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
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
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
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
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
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 --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; }