Skip to contentSkip to conversation

PATCH: DVB bt8xx in 2.6.10

PATCH Arne Ahrend 3 participants 5 messages Jan 4, 2005 – Jan 6, 2005 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

This patch allows the user to select only actually desired frontend driver(s) for bt8xx based DVB cards by removing calls to frontend-specific XXX_attach() functions and returning NULL instead for unconfigured frontends.

To keep this patch small, no attempt is made to #ifdef away other static functions or data for unselected frontends. This leads to compiler warnings about defined, but unused code, unless all four frontends relevant to bt8xx based cards are selected.

I have tested this on the Avermedia 771 (the only DVB card I have access to).

drivers/media/dvb/bt8xx/Kconfig +17 -3
diff -uprN -X dontdiff linux-2.6.10-vanilla/drivers/media/dvb/bt8xx/Kconfig linux-2.6.10/drivers/media/dvb/bt8xx/Kconfig
@@ -1,8 +1,6 @@
 config DVB_BT8XX
-	tristate "Nebula/Pinnacle PCTV/Twinhan PCI cards"
+	tristate "Avermedia/Nebula/Pinnacle PCTV/Twinhan PCI cards"
 	depends on DVB_CORE && PCI && VIDEO_BT848
-	select DVB_MT352
-	select DVB_SP887X
 	help
 	  Support for PCI cards based on the Bt8xx PCI bridge. Examples are
 	  the Nebula cards, the Pinnacle PCTV cards and Twinhan DST cards.
@@ -11,8 +9,24 @@ config DVB_BT8XX
 	  only compressed MPEG data over the PCI bus, so you need
 	  an external software decoder to watch TV on your computer.
 
+	  It is safe to select more than one of the frontends.
+
+	  If you have an Avermedia (761) DVB-T card, select
+	  "Spase sp887x based" frontend.
+
+	  If you have an Avermedia 771 DVB-T card, select
+	  "Zarlink MT352 based" frontend.
+
+	  For Nebula or Pinnacle cards "NxtWave Communications NXT6000"
+	  frontend might suit you.
+
 	  If you have a Twinhan card, don't forget to select
 	  "Twinhan DST based DVB-S/-T frontend".
 
 	  Say Y if you own such a device and want to use it.
 
+config DVB_TWINHAN_DST
+	tristate "Twinhan DST based DVB-S/-T frontend"
+	depends on DVB_CORE && PCI && VIDEO_BT848
+	help
+	  The Twinham DST frontend for DVB.
drivers/media/dvb/bt8xx/Makefile +2 -1
diff -uprN -X dontdiff linux-2.6.10-vanilla/drivers/media/dvb/bt8xx/Makefile linux-2.6.10/drivers/media/dvb/bt8xx/Makefile
@@ -1,5 +1,6 @@
 
-obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o
+obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o
+obj-$(CONFIG_DVB_TWINHAN_DST) += dst.o
 
 EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video -Idrivers/media/dvb/frontends
 
drivers/media/dvb/bt8xx/dvb-bt8xx.c +102 -6

149 lines not on this page · raw message

drivers/media/dvb/bt8xx/dvb-bt8xx.h +7 -0
diff -uprN -X dontdiff linux-2.6.10-vanilla/drivers/media/dvb/bt8xx/dvb-bt8xx.h linux-2.6.10/drivers/media/dvb/bt8xx/dvb-bt8xx.h
@@ -22,6 +22,10 @@
  *
  */
 
+#ifndef DVB_BT8XX_H
+#define DVB_BT8XX_H
+
+
 #include <linux/i2c.h>
 #include "dvbdev.h"
 #include "dvb_net.h"
@@ -50,3 +54,6 @@ struct dvb_bt8xx_card {
 				
 	struct dvb_frontend* fe;
 };
+
+
+#endif /* DVB_BT8XX_H */
#1 lore raw
Quoted 226 lines · Arne Ahrend

This patch allows the user to select only actually desired frontend driver(s) for bt8xx based DVB cards by removing calls to frontend-specific XXX_attach() functions and returning NULL instead for unconfigured frontends.

To keep this patch small, no attempt is made to #ifdef away other static functions or data for unselected frontends. This leads to compiler warnings about defined, but unused code, unless all four frontends relevant to bt8xx based cards are selected.

I have tested this on the Avermedia 771 (the only DVB card I have access to).

diff -uprN -X dontdiff linux-2.6.10-vanilla/drivers/media/dvb/bt8xx/Kconfig linux-2.6.10/drivers/media/dvb/bt8xx/Kconfig ---
linux-2.6.10-vanilla/drivers/media/dvb/bt8xx/Kconfig 2005-01-04
15:36:33.000000000 +0100 +++
linux-2.6.10/drivers/media/dvb/bt8xx/Kconfig 2005-01-04 15:17:16.000000000
+0100 @@ -1,8 +1,6 @@
config DVB_BT8XX

drivers/media/dvb/bt8xx/Kconfig +17 -3
-	tristate "Nebula/Pinnacle PCTV/Twinhan PCI cards"
+	tristate "Avermedia/Nebula/Pinnacle PCTV/Twinhan PCI cards"
 	depends on DVB_CORE && PCI && VIDEO_BT848
-	select DVB_MT352
-	select DVB_SP887X
 	help
 	  Support for PCI cards based on the Bt8xx PCI bridge. Examples are
 	  the Nebula cards, the Pinnacle PCTV cards and Twinhan DST cards.
@@ -11,8 +9,24 @@ config DVB_BT8XX
 	  only compressed MPEG data over the PCI bus, so you need
 	  an external software decoder to watch TV on your computer.
 
+	  It is safe to select more than one of the frontends.
+
+	  If you have an Avermedia (761) DVB-T card, select
+	  "Spase sp887x based" frontend.
+
+	  If you have an Avermedia 771 DVB-T card, select
+	  "Zarlink MT352 based" frontend.
+
+	  For Nebula or Pinnacle cards "NxtWave Communications NXT6000"
+	  frontend might suit you.
+
 	  If you have a Twinhan card, don't forget to select
 	  "Twinhan DST based DVB-S/-T frontend".
 
 	  Say Y if you own such a device and want to use it.
 
+config DVB_TWINHAN_DST
+	tristate "Twinhan DST based DVB-S/-T frontend"
+	depends on DVB_CORE && PCI && VIDEO_BT848
+	help
+	  The Twinham DST frontend for DVB.

diff -uprN -X dontdiff linux-2.6.10-vanilla/drivers/media/dvb/bt8xx/Makefile linux-2.6.10/drivers/media/dvb/bt8xx/Makefile ---
linux-2.6.10-vanilla/drivers/media/dvb/bt8xx/Makefile 2005-01-04
15:36:33.000000000 +0100 +++
linux-2.6.10/drivers/media/dvb/bt8xx/Makefile 2005-01-03 22:49:06.000000000
+0100 @@ -1,5 +1,6 @@

drivers/media/dvb/bt8xx/Makefile +2 -2
-obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o
+obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o
+obj-$(CONFIG_DVB_TWINHAN_DST) += dst.o
 
 EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video
-Idrivers/media/dvb/frontends

diff -uprN -X dontdiff linux-2.6.10-vanilla/drivers/media/dvb/bt8xx/dvb-bt8xx.c linux-2.6.10/drivers/media/dvb/bt8xx/dvb-bt8xx.c ---
linux-2.6.10-vanilla/drivers/media/dvb/bt8xx/dvb-bt8xx.c 2005-01-04
15:36:33.000000000 +0100 +++
linux-2.6.10/drivers/media/dvb/bt8xx/dvb-bt8xx.c 2005-01-04
17:01:59.000000000 +0100 @@ -220,7 +220,7 @@ static int microtune_mt7202dtf_request_f

drivers/media/dvb/bt8xx/dvb-bt8xx.c +60 -1
 	return request_firmware(fw, name, &bt->bt->dev->dev);
 }
 
-struct sp887x_config microtune_mt7202dtf_config = {
+static struct sp887x_config microtune_mt7202dtf_config = {
 
 	.demod_address = 0x70,
 	.pll_set = microtune_mt7202dtf_pll_set,
@@ -340,12 +340,108 @@ static struct nxt6000_config vp3021_alps
 };
 
 
+
+#if(defined(CONFIG_DVB_MT352) || defined(CONFIG_DVB_MT352_MODULE))
+static inline struct dvb_frontend*
+thomson_dtt7579_frontend(struct i2c_adapter* i2c)
+{
+  return mt352_attach(&thomson_dtt7579_config, i2c);
+}
+
+#else
+
+static inline struct dvb_frontend*
+thomson_dtt7579_frontend(struct i2c_adapter* i2c)
+{
+  return NULL;
+}
+#endif /* CONFIG_DVB_MT352 || CONFIG_DVB_MT352_MODULE */
+
+
+
+
+#if(defined(CONFIG_DVB_SP887X) || defined(CONFIG_DVB_SP887X_MODULE))
+static inline struct dvb_frontend*
+microtune_mt7202dtf_frontend(struct i2c_adapter* i2c)
+{
+  return sp887x_attach(&microtune_mt7202dtf_config, i2c);
+}
+
+#else
+
+static inline struct dvb_frontend*
+microtune_mt7202dtf_frontend(struct i2c_adapter* i2c)
+{
+  return NULL;
+}
+#endif /* CONFIG_DVB_SP887X || CONFIG_DVB_SP887X_MODULE */
+
+
+
+
+#if(defined(CONFIG_DVB_MT352) || defined(CONFIG_DVB_MT352_MODULE))
+static inline struct dvb_frontend*
+advbt771_samsung_tdtc9251dh0_frontend(struct i2c_adapter* i2c)
+{
+  return mt352_attach(&advbt771_samsung_tdtc9251dh0_config, i2c);
+}
+
+#else
+
+static inline struct dvb_frontend*
+advbt771_samsung_tdtc9251dh0_frontend(struct i2c_adapter* i2c)
+{
+  return NULL;
+}
+#endif /* CONFIG_DVB_MT352 || CONFIG_DVB_MT352_MODULE */
+
+
+
+
+#if(defined(CONFIG_DVB_TWINHAN_DST) ||

defined(CONFIG_DVB_TWINHAN_DST_MODULE)) +static inline struct dvb_frontend*

drivers/media/dvb/bt8xx/dvb-bt8xx.c +38 -3
+dst_frontend(struct i2c_adapter* i2c, struct bt878* bt)
+{
+  return dst_attach(&dst_config, i2c, bt);
+}
+
+#else
+
+static inline struct dvb_frontend*
+dst_frontend(struct i2c_adapter* i2c, struct bt878* bt)
+{
+  return NULL;
+}
+#endif /* CONFIG_DVB_TWINHAN_DST || CONFIG_DVB_TWINHAN_DST_MODULE */
+
+
+
+
+#if(defined(CONFIG_DVB_NXT6000) || defined(CONFIG_DVB_NXT6000_MODULE))
+static inline struct dvb_frontend*
+vp3021_alps_tded4_frontend(struct i2c_adapter* i2c)
+{
+  return nxt6000_attach(&vp3021_alps_tded4_config, i2c);
+}
+
+#else
+
+static inline struct dvb_frontend*
+vp3021_alps_tded4_frontend(struct i2c_adapter* i2c)
+{
+  return NULL;
+}
+#endif /* CONFIG_DVB_NXT6000 || CONFIG_DVB_NXT6000_MODULE */
+
+
+
+
 static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
 {
 	switch(type) {
 #ifdef BTTV_DVICO_DVBT_LITE
 	case BTTV_DVICO_DVBT_LITE:
-		card->fe = mt352_attach(&thomson_dtt7579_config, card->i2c_adapter);
+		card->fe = thomson_dtt7579_frontend(card->i2c_adapter);
 		if (card->fe != NULL) {
 			card->fe->ops->info.frequency_min = 174000000;
 			card->fe->ops->info.frequency_max = 862000000;
@@ -359,21 +455,21 @@ static void frontend_init(struct dvb_bt8
 #else
 	case BTTV_NEBULA_DIGITV:
 #endif
-		card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter);
+		card->fe = vp3021_alps_tded4_frontend(card->i2c_adapter);
 		if (card->fe != NULL) {
 			break;
 		}
 		break;
 
 	case BTTV_AVDVBT_761:
-		card->fe = sp887x_attach(&microtune_mt7202dtf_config,

card->i2c_adapter); + card->fe =
microtune_mt7202dtf_frontend(card->i2c_adapter);

drivers/media/dvb/bt8xx/dvb-bt8xx.c +0 -1
 		if (card->fe != NULL) {
 			break;
 		}
 		break;
 
 	case BTTV_AVDVBT_771:
-		card->fe = mt352_attach(&advbt771_samsung_tdtc9251dh0_config,

card->i2c_adapter); + card->fe =
advbt771_samsung_tdtc9251dh0_frontend(card->i2c_adapter); if (card->fe != NULL) {

drivers/media/dvb/bt8xx/dvb-bt8xx.c +0 -0
 			card->fe->ops->info.frequency_min = 174000000;
 			card->fe->ops->info.frequency_max = 862000000;

drivers/media/dvb/bt8xx/dvb-bt8xx.c static void frontend_init(struct dvb_bt8 · line 385

Quoted 4 lines
drivers/media/dvb/bt8xx/dvb-bt8xx.c +0 -1
@@ -382,7 +478,7 @@ static void frontend_init(struct dvb_bt8
 		break;
 
 	case BTTV_TWINHAN_DST:
-		card->fe = dst_attach(&dst_config, card->i2c_adapter, card->bt);

Here dst is not a frontend, but a generic card driver. If you remove it the other devices of the DST hardware, which is under development also would fail to function, like the CA and the NET modules...

drivers/media/dvb/bt8xx/dvb-bt8xx.c static void frontend_init(struct dvb_bt8 · line 481

Quoted 1 line
drivers/media/dvb/bt8xx/dvb-bt8xx.c +1 -0
+		card->fe = dst_frontend(card->i2c_adapter, card->bt);

This is wrong since dst is not a frontend driver, but a card driver, has to be used in this manner due to the architecture of the card... Considering it like this would be as good as throwing away all the work that has undergone into the CA and the DVBNET modules..

The reason is that the architecture of the card is totally different to that of any DVB card S/C/T.

Manu

Quoted 32 lines
drivers/media/dvb/bt8xx/dvb-bt8xx.c +0 -0
 		if (card->fe != NULL) {
 			break;
 		}

diff -uprN -X dontdiff linux-2.6.10-vanilla/drivers/media/dvb/bt8xx/dvb-bt8xx.h linux-2.6.10/drivers/media/dvb/bt8xx/dvb-bt8xx.h ---
linux-2.6.10-vanilla/drivers/media/dvb/bt8xx/dvb-bt8xx.h 2005-01-04
15:36:33.000000000 +0100 +++
linux-2.6.10/drivers/media/dvb/bt8xx/dvb-bt8xx.h 2005-01-04
17:01:36.000000000 +0100 @@ -22,6 +22,10 @@
*
*/

drivers/media/dvb/bt8xx/dvb-bt8xx.h +7 -1
+#ifndef DVB_BT8XX_H
+#define DVB_BT8XX_H
+
+
 #include <linux/i2c.h>
 #include "dvbdev.h"
 #include "dvb_net.h"
@@ -50,3 +54,6 @@ struct dvb_bt8xx_card {
 
 	struct dvb_frontend* fe;
 };
+
+
+#endif /* DVB_BT8XX_H */
-

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
In reply to Arne Ahrend
Quoted 9 lines · Arne Ahrend

This patch allows the user to select only actually desired frontend driver(s) for bt8xx based DVB cards by removing calls to frontend-specific XXX_attach() functions and returning NULL instead for unconfigured frontends.

To keep this patch small, no attempt is made to #ifdef away other static functions or data for unselected frontends. This leads to compiler warnings about defined, but unused code, unless all four frontends relevant to bt8xx based cards are selected.

I have tested this on the Avermedia 771 (the only DVB card I have access to).

This approach has been discussed on the linux-dvb list and was rejected because of the huge #ifdef mess it creates (you just touched bt8xx, it's even worse for saa7146 based cards). The frontend drivers are tiny so I think you can afford to load some that aren't actually used by your hardware.

Johannes

#3 lore raw
Quoted 5 lines · On Tue, 4 Jan 2005 19:11:53 +0100 Johannes Stezenbach <[email protected]> wrote:

This approach has been discussed on the linux-dvb list and was rejected because of the huge #ifdef mess it creates (you just touched bt8xx, it's even worse for saa7146 based cards). The frontend drivers are tiny so I think you can afford to load some that aren't actually used by your hardware.

Ok, point acknowledged. The following tiny bit of cosmetic might be of interest anyway.

Arne

drivers/media/dvb/bt8xx/dvb-bt8xx.c +1 -1
diff -upr -X dontdiff linux-2.6.10-vanilla/drivers/media/dvb/bt8xx/dvb-bt8xx.c linux-2.6.10/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -220,7 +220,7 @@ static int microtune_mt7202dtf_request_f
 	return request_firmware(fw, name, &bt->bt->dev->dev);
 }
 
-struct sp887x_config microtune_mt7202dtf_config = {
+static struct sp887x_config microtune_mt7202dtf_config = {
 
 	.demod_address = 0x70,
 	.pll_set = microtune_mt7202dtf_pll_set,
drivers/media/dvb/bt8xx/dvb-bt8xx.h +5 -0
diff -upr -X dontdiff linux-2.6.10-vanilla/drivers/media/dvb/bt8xx/dvb-bt8xx.h linux-2.6.10/drivers/media/dvb/bt8xx/dvb-bt8xx.h
@@ -22,6 +22,9 @@
  *
  */
 
+#ifndef DVB_BT8XX_H
+#define DVB_BT8XX_H
+
 #include <linux/i2c.h>
 #include "dvbdev.h"
 #include "dvb_net.h"
@@ -50,3 +53,5 @@ struct dvb_bt8xx_card {
 				
 	struct dvb_frontend* fe;
 };
+
+#endif /* DVB_BT8XX_H */
#4 lore raw
Quoted 9 lines · Arne Ahrend
Quoted 5 lines · Johannes Stezenbach

This approach has been discussed on the linux-dvb list and was rejected because of the huge #ifdef mess it creates (you just touched bt8xx, it's even worse for saa7146 based cards). The frontend drivers are tiny so I think you can afford to load some that aren't actually used by your hardware.

Ok, point acknowledged. The following tiny bit of cosmetic might be of interest anyway.

Yeah. Patch comitted to linuxtv.org CVS.

Thanks,
Johannes