* [PATCH] bttv: Use btv->has_radio rather then the card info when registering the tuner
2012-05-20 11:28 [PATCH] bttv: Use btv->has_radio rather then the card info Hans de Goede
@ 2012-05-20 11:28 ` Hans de Goede
2012-05-24 9:58 ` Andrew Benham
2012-05-20 14:21 ` [PATCH] bttv: Use btv->has_radio rather then the card info Hans Verkuil
1 sibling, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2012-05-20 11:28 UTC (permalink / raw)
To: hverkuil; +Cc: Linux Media Mailing List, Hans de Goede
bttv_init_card2() sets btv->has_audio to a *default* value from the tvcards
array and then may update it by reading a card specific eeprom or gpio
detection.
After bttv_init_card2(), bttv_init_tuner(), and it should clearly use
the updated, dynamic has_radio value from btv->has_radio, rather then
the const value in the tvcards array.
This fixes the radio not working on my Hauppauge WinTV.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/media/video/bt8xx/bttv-cards.c | 4 ++--
drivers/media/video/bt8xx/bttv-driver.c | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index ff2933a..1c030fe 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -3649,7 +3649,7 @@ void __devinit bttv_init_tuner(struct bttv *btv)
struct tuner_setup tun_setup;
/* Load tuner module before issuing tuner config call! */
- if (bttv_tvcards[btv->c.type].has_radio)
+ if (btv->has_radio)
v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
&btv->c.i2c_adap, "tuner",
0, v4l2_i2c_tuner_addrs(ADDRS_RADIO));
@@ -3664,7 +3664,7 @@ void __devinit bttv_init_tuner(struct bttv *btv)
tun_setup.type = btv->tuner_type;
tun_setup.addr = addr;
- if (bttv_tvcards[btv->c.type].has_radio)
+ if (btv->has_radio)
tun_setup.mode_mask |= T_RADIO;
bttv_call_all(btv, tuner, s_type_addr, &tun_setup);
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index a9cfb0f..7ce3aac 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -1181,6 +1181,8 @@ audio_mux(struct bttv *btv, int input, int mute)
btv->mute = mute;
btv->audio = input;
+
+ printk("input: %d, mute: %d\n", input, mute);
/* automute */
mute = mute || (btv->opt_automute && !signal && !btv->radio_user);
@@ -1220,6 +1222,9 @@ audio_mux(struct bttv *btv, int input, int mute)
case TVAUDIO_INPUT_RADIO:
in = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1,
MSP_DSP_IN_SCART, MSP_DSP_IN_SCART);
+ in = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER2, \
+ MSP_DSP_IN_TUNER, MSP_DSP_IN_TUNER);
+ in = MSP_INPUT_DEFAULT;
break;
case TVAUDIO_INPUT_EXTERN:
in = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
--
1.7.10
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] bttv: Use btv->has_radio rather then the card info
2012-05-20 11:28 [PATCH] bttv: Use btv->has_radio rather then the card info Hans de Goede
2012-05-20 11:28 ` [PATCH] bttv: Use btv->has_radio rather then the card info when registering the tuner Hans de Goede
@ 2012-05-20 14:21 ` Hans Verkuil
1 sibling, 0 replies; 4+ messages in thread
From: Hans Verkuil @ 2012-05-20 14:21 UTC (permalink / raw)
To: Hans de Goede; +Cc: Linux Media Mailing List
On Sun May 20 2012 13:28:11 Hans de Goede wrote:
> I've been spending some time playing with radio receivers under Linux, and
> I noticed that my bttv's radio reception was not working. The patch in the
> next message fixes the 1st of 3 problems related to this, can you review this
> patch please and also let me know if it is ok to send patch though my tree?
>
> As said there are 3 problems with the radio on my bttv:
> 1) The problem fixed by the attached patch
>
> 2) The audio_mux function in bttv-driver.c does the wrong thing for my
> Haupage WinTV + radio + stereo (msp3400) card. Since the radio receiving
> is part of the same tuner, and not in a separate chip, the same (default
> ) msp3400 input should be selected when trying to listen to radio, as when
> watching TV.
>
> I could special case my card in audio_mux, but in general it seems
> to me that if their is a combined radio/tv tuner, rather then a separate
> radio chip (ie the tea5757), the msp3400 input should stay connected
> to the default / tuner1 input.
>
> I guess we should go with special casing for now, to avoid regressions,
> although I wonder how many people try to use the radio part of any tvcards
> they may have.
>
> 3) The automatic selection of radio versus tv-mode goes astray pretty quickly,
> if I start the radio program from xawtv, which I've patched in git to do
> digital loopback of the audio through alsa, so as that I can actual hear
> what the radio is doing :) And with a quick hack to fix 2), and then after
> that start gtk-v4l to look at the radio controls (only the mute one actually),
> then bttv automatically switches from radio to tv mode, not good (tm).
This was the behavior for a long time: opening the radio node was sufficient
to switch to radio mode, and opening a video node would switch to video.
That behavior has been marked obsolete and in the feature-removal document it
is slated for removal. Unfortunately I haven't had time to do any of that work.
The only time you should switch between radio and tv tuner is with S_TUNER,
S_FREQUENCY or S_HW_FREQ_SEEK, issued from the corresponding radio or video node.
Trying to switch to radio mode if streaming is in progress should obviously
result in EBUSY.
> IMHO it would be better to defer the switching to tv mode until something
> relevant is actually done to the /dev/video# node (set operations or start
> streaming), likewise it would probably be best to defer switching to radio
> mode until something relevant (any set operations) is actually done on
> /dev/radio#. If you agree I can try to write a patch for this.
It would be nice if bttv was fixed. There are loads more issues with bttv,
that's going to be a big project at one time.
Regards,
Hans
^ permalink raw reply [flat|nested] 4+ messages in thread