Skip to contentSkip to conversation

bttv: Convert to generic TEA575x interface

PATCH New Ondrej Zary 1 participant 1 message Nov 22, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bttv: Convert to generic TEA575x interface

Remove tea575x-specific code from bttv and use the common driver instead. Only set_frequency is implemented (signal/stereo detection or seek would require more changes to bttv).

Tested on Video Highway Xtreme.
I don't have the Miro/Pinnacle or Terratec Active Radio Upgrade to test.

Miro/Pinnacle seems to be simple and should work.

However, I don't understand the Terratec Active Radio Upgrade code. The HW seems to need IOR, IOW and CSEL signals that were taken from ISA bus on older cards (IOR and IOW directly and CSEL from some address decoder) and are emulated here using GPIOs. But the code manipulating these signals in bttv seems to be broken - it never asserts the IOR signal. If anyone has this HW, please test if I got that right.

---
 drivers/media/pci/bt8xx/Kconfig       |    1 +
 drivers/media/pci/bt8xx/bttv-cards.c  |  317 ++++++++++++---------------------
 drivers/media/pci/bt8xx/bttv-driver.c |    6 +-
 drivers/media/pci/bt8xx/bttvp.h       |   14 +-
 drivers/media/radio/Kconfig           |    4 +-
 5 files changed, 125 insertions(+), 217 deletions(-)
drivers/media/pci/bt8xx/Kconfig +1 -0
index 61d09e0..4936dcb1 100644
@@ -11,6 +11,7 @@ config VIDEO_BT848
 	select VIDEO_TVAUDIO if MEDIA_SUBDRV_AUTOSELECT
 	select VIDEO_TDA7432 if MEDIA_SUBDRV_AUTOSELECT
 	select VIDEO_SAA6588 if MEDIA_SUBDRV_AUTOSELECT
+	select RADIO_TEA575X
 	---help---
 	  Support for BT848 based frame grabber/overlay boards. This includes
 	  the Miro, Hauppauge and STB boards. Please read the material in
drivers/media/pci/bt8xx/bttv-cards.c +110 -207

363 lines not on this page · raw message

drivers/media/pci/bt8xx/bttv-driver.c +4 -2
index a3b1ee9..51ffbc1 100644
@@ -1875,8 +1875,10 @@ static void bttv_set_frequency(struct bttv *btv, const struct v4l2_frequency *f)
 	if (new_freq.type == V4L2_TUNER_RADIO) {
 		radio_enable(btv);
 		btv->radio_freq = new_freq.frequency;
-		if (btv->has_matchbox)
-			tea5757_set_freq(btv, btv->radio_freq);
+		if (btv->has_tea575x) {
+			btv->tea.freq = btv->radio_freq;
+			snd_tea575x_set_freq(&btv->tea);
+		}
 	} else {
 		btv->tv_freq = new_freq.frequency;
 	}
drivers/media/pci/bt8xx/bttvp.h +8 -6
index 6eefb59..157af4e 100644
@@ -42,6 +42,7 @@
 #include <media/tveeprom.h>
 #include <media/rc-core.h>
 #include <media/ir-kbd-i2c.h>
+#include <media/tea575x.h>
 
 #include "bt848.h"
 #include "bttv.h"
@@ -361,6 +362,10 @@ struct bttv_suspend_state {
 	struct bttv_buffer     *vbi;
 };
 
+struct bttv_tea575x_gpio {
+	u8 data, clk, wren, most;
+};
+
 struct bttv {
 	struct bttv_core c;
 
@@ -447,12 +452,9 @@ struct bttv {
 
 	/* miro/pinnacle + Aimslab VHX
 	   philips matchbox (tea5757 radio tuner) support */
-	int has_matchbox;
-	int mbox_we;
-	int mbox_data;
-	int mbox_clk;
-	int mbox_most;
-	int mbox_mask;
+	int has_tea575x;
+	struct bttv_tea575x_gpio tea_gpio;
+	struct snd_tea575x tea;
 
 	/* ISA stuff (Terratec Active Radio Upgrade) */
 	int mbox_ior;
drivers/media/radio/Kconfig +2 -2
index 6ecdc39..992ebe3 100644
@@ -10,11 +10,11 @@ menuconfig RADIO_ADAPTERS
 	---help---
 	  Say Y here to enable selecting AM/FM radio adapters.
 
-if RADIO_ADAPTERS && VIDEO_V4L2
-
 config RADIO_TEA575X
 	tristate
 
+if RADIO_ADAPTERS && VIDEO_V4L2
+
 config RADIO_SI470X
 	bool "Silicon Labs Si470x FM Radio Receiver support"
 	depends on VIDEO_V4L2
Signature · 1 line
Ondrej Zary