[linux-dvb] PATCH for customization of TwinHan DST modules

Markus Rechberger mrechberger at gmail.com
Fri Jun 1 21:36:50 CEST 2007


Acked-by: Markus Rechberger <mrechberger at gmail.com>

The ack comes because noone even moves here, Trent modified the
initial patch to work correctly, and Mauro tested the patch.

This project should go further now with other important things like
bugfixing, and doing more review on the overall other code.

Markus

On 6/1/07, Uwe Bugla <uwe.bugla at gmx.de> wrote:
> This patch provides a clean solution to customise the TwinHan DST modules if
> they are not needed.
> The basic theoretical work was done by Trent Piepho, the basic testing work
> was done by Mauro Chehab.
> I only adapted it for the current kernel (2.6.22-rc3) and changed the help
> section for better user understanding (i. e. card examples instead of
> expressions like ASIC f. ex.).
> I do appreciate further SOBs of the relevant Cced people.
>
> Signed-off-by: Uwe Bugla <uwe.bugla at gmx.de>
>
> --- a/drivers/media/dvb/bt8xx/dst.c Fri Apr 27 12:16:31 2007
> +++ b/drivers/media/dvb/bt8xx/dst.c Mon May 28 19:46:33 2007
> @@ -1729,12 +1729,22 @@ static void dst_release(struct dvb_front
>  static struct dvb_frontend_ops dst_dvbc_ops;
>  static struct dvb_frontend_ops dst_atsc_ops;
>
> -struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter
> *dvb_adapter)
> -{
> +struct dvb_frontend *dst_attach(struct dst_config *config, struct bt878
> *bt,
> + struct i2c_adapter *i2c)
> +{
> +struct dst_state *state = kzalloc(sizeof(*state), GFP_KERNEL);
> +
> +	if (!state) {
> +	printk(KERN_ERR "dst: No memory!\n");
> +	return NULL;;
> +	}
> +	state->i2c = i2c;
> +	state->config = config;
> +	state->bt = bt;
> +
>  	/* check if the ASIC is there */
>  	if (dst_probe(state) < 0) {
> -		kfree(state);
> -		return NULL;
> +		goto fail;
>  	}
>  	/* determine settings based on type */
>  	/* create dvb_frontend */
> @@ -1753,12 +1763,15 @@ struct dst_state *dst_attach(struct dst_
>  		break;
>  	default:
>  		dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report to the
> LinuxTV.org DVB mailinglist.");
> -		kfree(state);
> -		return NULL;
> +		goto fail;
>  	}
>  	state->frontend.demodulator_priv = state;
>
> -	return state;				/*	Manu (DST is a card not a frontend)	*/
> +	return &state->frontend; /* Manu (DST is a card not a frontend) */
> +
> +	fail:
> +	kfree(state);
> +	return NULL;
>  }
>
>  EXPORT_SYMBOL(dst_attach);
> --- a/drivers/media/dvb/bt8xx/dst_ca.c Fri Apr 27 12:16:31 2007
> +++ b/drivers/media/dvb/bt8xx/dst_ca.c Mon May 28 19:47:33 2007
> @@ -699,8 +699,9 @@ static struct dvb_device dvbdev_ca = {
>  	.fops = &dst_ca_fops
>  };
>
> -struct dvb_device *dst_ca_attach(struct dst_state *dst, struct dvb_adapter
> *dvb_adapter)
> -{
> +struct dvb_device *dst_ca_attach(struct dvb_frontend *fe, struct
> dvb_adapter *dvb_adapter)
> +{
> +	struct dst_state *dst = fe->demodulator_priv;
>  	struct dvb_device *dvbdev;
>
>  	dprintk(verbose, DST_CA_ERROR, 1, "registering DST-CA device");
> --- a/drivers/media/dvb/bt8xx/dst_common.h Fri Apr 27 12:16:31 2007
> +++ b/drivers/media/dvb/bt8xx/dst_common.h Mon May 28 19:47:33 2007
> @@ -177,11 +177,25 @@ int write_dst(struct dst_state *state, u
>  int write_dst(struct dst_state *state, u8 * data, u8 len);
>  int read_dst(struct dst_state *state, u8 * ret, u8 len);
>  u8 dst_check_sum(u8 * buf, u32 len);
> -struct dst_state* dst_attach(struct dst_state* state, struct dvb_adapter
> *dvb_adapter);
> -struct dvb_device *dst_ca_attach(struct dst_state *state, struct
> dvb_adapter *dvb_adapter);
> -int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh,
> int delay);
> -
> -int dst_command(struct dst_state* state, u8 * data, u8 len);
> -
> -
> +int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh,
> int delay);
> +int dst_command(struct dst_state* state, u8 * data, u8 len);
> +
> +#if defined(CONFIG_DVB_DST) || (defined(CONFIG_DVB_DST_MODULE) &&
> defined(MODULE))
> +struct dvb_frontend *dst_attach(struct dst_config *config, struct bt878
> *bt,
> +struct i2c_adapter *i2c);
> +struct dvb_device *dst_ca_attach(struct dvb_frontend *fe, struct
> dvb_adapter *dvb_adapter);
> +#else
> +static inline struct dvb_frontend *dst_attach(struct dst_config *config,
> + struct bt878 *bt, struct i2c_adapter *i2c)
> +{
> + printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
> + return NULL;
> +}
> +static inline struct dvb_device *dst_ca_attach(struct dvb_frontend *fe,
> + struct dvb_adapter *dvb_adapter)
> +{
> + printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
> + return NULL;
> +}
> +#endif // CONFIG_DVB_DST
>  #endif // DST_COMMON_H
> --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c Fri Apr 27 12:16:31 2007
> +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c Mon May 28 19:47:33 2007
> @@ -659,26 +659,17 @@ static void frontend_init(struct dvb_bt8
>
>  	case BTTV_BOARD_TWINHAN_DST:
>  		/*	DST is not a frontend driver !!!		*/
> -		state = kmalloc(sizeof (struct dst_state), GFP_KERNEL);
> -		if (!state) {
> -			printk("dvb_bt8xx: No memory\n");
> -			break;
> -		}
> -		/*	Setup the Card					*/
> -		state->config = &dst_config;
> -		state->i2c = card->i2c_adapter;
> -		state->bt = card->bt;
> -		state->dst_ca = NULL;
>  		/*	DST is not a frontend, attaching the ASIC	*/
> -		if (dvb_attach(dst_attach, state, &card->dvb_adapter) == NULL) {
> -			printk("%s: Could not find a Twinhan DST.\n", __FUNCTION__);
> +		card->fe = dvb_attach(dst_attach, &dst_config, card->bt,
> +		card->i2c_adapter);
> +		if (card->fe != NULL) {
> +		printk(KERN_ERR "%s: Could not find a Twinhan DST.\n", __FUNCTION__);
>  			break;
>  		}
>  		/*	Attach other DST peripherals if any		*/
>  		/*	Conditional Access device			*/
> -		card->fe = &state->frontend;
>  		if (state->dst_hw_cap & DST_TYPE_HAS_CA)
> -			dvb_attach(dst_ca_attach, state, &card->dvb_adapter);
> +			dvb_attach(dst_ca_attach, card->fe, &card->dvb_adapter);
>  		break;
>
>  	case BTTV_BOARD_PINNACLESAT:
> --- a/drivers/media/dvb/bt8xx/Makefile Mon Apr 30 12:39:33 2007
> +++ b/drivers/media/dvb/bt8xx/Makefile Thu May 28 19:47:00 2007
> @@ -1,3 +1,4 @@ obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-b
> -obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o dst_ca.o
> +obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o
> +obj-$(CONFIG_DVB_DST) += dst.o dst_ca.o
>
>  EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video/bt8xx
> -Idrivers/media/dvb/frontends
> --- a/drivers/media/dvb/bt8xx/Kconfig Mon Apr 30 12:39:33 2007
> +++ b/drivers/media/dvb/bt8xx/Kconfig Mon May 28 19:47:00 2007
> @@ -9,6 +9,7 @@ config DVB_BT8XX
>  	select DVB_LGDT330X if !DVB_FE_CUSTOMISE
>  	select DVB_PLL
>  	select DVB_ZL10353 if !DVB_FE_CUSTOMISE
> +	select DVB_DST if !DVB_FE_CUSTOMISE
>  	select FW_LOADER
>  	help
>  	  Support for PCI cards based on the Bt8xx PCI bridge. Examples are
> @@ -21,3 +22,11 @@ config DVB_BT8XX
>  	  an external software decoder to watch TV on your computer.
>
>  	  Say Y if you own such a device and want to use it.
> +
> +config DVB_DST
> +	tristate "Support for TwinHan DST boards (CA) and clones"
> +	depends on DVB_BT8XX && DVB_CORE && I2C
> +	default m if DVB_FE_CUSTOMISE
> +	help
> +	  Support for the following boards: TwinHan DST or clones, Pinnacle PCTV
> Sat CI, Chaintech DST-1000, DNTV Live !
> +	  Say Y if you own such a device and want to use it.
>
> --
> Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
> Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
>


-- 
Markus Rechberger



More information about the linux-dvb mailing list