[linux-dvb] [patch] dvb-bt8xx cleanup

Manu Abraham manu at kromtek.com
Fri Mar 11 19:46:10 CET 2005


Kenneth Aafløy wrote:
> On Friday 11 March 2005 17:26, you wrote:
> 
>>It sounds good, but i need some time to get that going, if i tried that 
>>at the moment the people who test it out will be even more confused, 
>>considering that they are really confused at present, which patch and so 
>>on, just to avoid that, the experimental branch i just started..
>>
>>As soon as i am through with a stage of testing, i would do as you 
>>suggested..
>>
>>Too many dependencies are always a headache..
> 
> 
> Ok, fair enough.
> 
> 
>>I have created a twinhan-exp branch. Please do take a look at it. I just 
>>started on it, but you can see how it looks at the moment .. Your 
>>comments are welcome.
> 
> 
> I did, looks ok to me, now that I understand how the hardware is laid out.
> 
> I would like to suggest the attached patch for both HEAD and twinhan-exp,
> it applies to cleanly to HEAD and to twinhan-exp with offsets.
> 
> It's purpose is to make the internals of bt878, well, internal.
> 

It looks okay.. But are you sure you want to make the transition from 
dvb-bt8xx to bt878 straight away, or can can you hold back a while till 
dominique finshes testing..

If you think it does not break anything.. maybe better i will send you a 
tarball of what i am working on, maybe you will get a better idea of 
what i was working on ..

I think your patch doesn't break anything, but it would be better if you 
can hold back a while, such that things are not in a hanging state. The 
reason is that the hardware is really a mess and indentify what exactly 
is the problem is extremely difficult ..

What i woud suggest is if you can wait a while , till this state of 
uncertainty is over, that would be nice, and quite helpful for the 
people who do test it out .. I had cases where a sleep for a jiffie had 
problems.. damn. These kind of problems are visible with CI modules..


Manu


> Kenneth
> 
> 
> ------------------------------------------------------------------------
> 
> ? all.patch
> Index: bt878.c
> ===================================================================
> RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/bt8xx/bt878.c,v
> retrieving revision 1.22
> diff -u -u -r1.22 bt878.c
> --- bt878.c	12 Feb 2005 01:24:28 -0000	1.22
> +++ bt878.c	11 Mar 2005 17:07:52 -0000
> @@ -60,13 +60,23 @@
>  module_param_named(debug, bt878_debug, int, 0644);
>  MODULE_PARM_DESC(bt878_debug, "Turn on/off debugging (default:off).");
>  
> -int bt878_num;
> -struct bt878 bt878[BT878_MAX];
> +static int bt878_num;
> +static struct bt878 bt878[BT878_MAX];
>  
> -EXPORT_SYMBOL(bt878_debug);
> -EXPORT_SYMBOL(bt878_verbose);
> -EXPORT_SYMBOL(bt878_num);
> -EXPORT_SYMBOL(bt878);
> +#if defined(__powerpc__)	/* big-endian */
> +extern __inline__ void io_st_le32(volatile unsigned __iomem *addr, unsigned val)
> +{
> +	__asm__ __volatile__("stwbrx %1,0,%2":"=m"(*addr):"r"(val),
> +			     "r"(addr));
> +	__asm__ __volatile__("eieio":::"memory");
> +}
> +
> +#define bmtwrite(dat,adr)  io_st_le32((adr),(dat))
> +#define bmtread(adr)       ld_le32((adr))
> +#else
> +#define bmtwrite(dat,adr)  writel((dat), (adr))
> +#define bmtread(adr)       readl(adr)
> +#endif
>  
>  #define btwrite(dat,adr)    bmtwrite((dat), (bt->bt878_mem+(adr)))
>  #define btread(adr)         bmtread(bt->bt878_mem+(adr))
> @@ -240,6 +250,8 @@
>  	btwrite(controlreg, BT878_AGPIO_DMA_CTL);
>  }
>  
> +EXPORT_SYMBOL(bt878_start);
> +
>  void bt878_stop(struct bt878 *bt)
>  {
>  	u32 stat;
> @@ -261,9 +273,32 @@
>  		bt->nr, i, stat);
>  }
>  
> -EXPORT_SYMBOL(bt878_start);
>  EXPORT_SYMBOL(bt878_stop);
>  
> +static int is_pci_slot_eq(struct pci_dev* adev, struct pci_dev* bdev)
> +{
> +	if ((adev->subsystem_vendor == bdev->subsystem_vendor) &&
> +		(adev->subsystem_device == bdev->subsystem_device) &&
> +		(adev->bus->number == bdev->bus->number) &&
> +		(PCI_SLOT(adev->devfn) == PCI_SLOT(bdev->devfn)))
> +		return 1;
> +	return 0;
> +}
> +
> +struct bt878 * bt878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev)
> +{
> +	unsigned int card_nr;
> +
> +	/* Hmm, n squared. Hope n is small */
> +	for (card_nr = 0; card_nr < bt878_num; ++card_nr) {
> +		if (is_pci_slot_eq(bt878[card_nr].dev, bttv_pci_dev))
> +			return &bt878[card_nr];
> +	}
> +	return NULL;
> +}
> +
> +EXPORT_SYMBOL(bt878_match);
> +
>  /*****************************/
>  /* Interrupt service routine */
>  /*****************************/
> Index: bt878.h
> ===================================================================
> RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/bt8xx/bt878.h,v
> retrieving revision 1.7
> diff -u -u -r1.7 bt878.h
> --- bt878.h	2 Dec 2004 17:40:50 -0000	1.7
> +++ bt878.h	11 Mar 2005 17:07:52 -0000
> @@ -88,9 +88,6 @@
>  
>  #define BT878_RISC_SYNC_MASK	(1 << 15)
>  
> -extern int bt878_num;
> -extern struct bt878 bt878[BT878_MAX];
> -
>  struct bt878 {
>  	struct semaphore  gpio_lock;
>  	unsigned int nr;
> @@ -128,19 +125,6 @@
>  		u32 irq_err_ignore);
>  void bt878_stop(struct bt878 *bt);	     
>  
> -#if defined(__powerpc__)	/* big-endian */
> -extern __inline__ void io_st_le32(volatile unsigned __iomem *addr, unsigned val)
> -{
> -	__asm__ __volatile__("stwbrx %1,0,%2":"=m"(*addr):"r"(val),
> -			     "r"(addr));
> -	__asm__ __volatile__("eieio":::"memory");
> -}
> -
> -#define bmtwrite(dat,adr)  io_st_le32((adr),(dat))
> -#define bmtread(adr)       ld_le32((adr))
> -#else
> -#define bmtwrite(dat,adr)  writel((dat), (adr))
> -#define bmtread(adr)       readl(adr)
> -#endif
> +struct bt878 * bt878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev);
>  
>  #endif
> Index: dvb-bt8xx.c
> ===================================================================
> RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c,v
> retrieving revision 1.39
> diff -u -u -r1.39 dvb-bt8xx.c
> --- dvb-bt8xx.c	10 Mar 2005 15:19:09 -0000	1.39
> +++ dvb-bt8xx.c	11 Mar 2005 17:07:52 -0000
> @@ -104,29 +104,6 @@
>  	return 0;
>  }
>  
> -static int is_pci_slot_eq(struct pci_dev* adev, struct pci_dev* bdev)
> -{
> -	if ((adev->subsystem_vendor == bdev->subsystem_vendor) &&
> -		(adev->subsystem_device == bdev->subsystem_device) &&
> -		(adev->bus->number == bdev->bus->number) &&
> -		(PCI_SLOT(adev->devfn) == PCI_SLOT(bdev->devfn)))
> -		return 1;
> -	return 0;
> -}
> -
> -static struct bt878 __init *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev)
> -{
> -	unsigned int card_nr;
> -
> -	/* Hmm, n squared. Hope n is small */
> -	for (card_nr = 0; card_nr < bt878_num; card_nr++) {
> -		if (is_pci_slot_eq(bt878[card_nr].dev, bttv_pci_dev))
> -			return &bt878[card_nr];
> -	}
> -	return NULL;
> -}
> -
> -
>  static int thomson_dtt7579_demod_init(struct dvb_frontend* fe)
>  {
>  	static u8 mt352_clock_config [] = { 0x89, 0x38, 0x38 };
> @@ -722,7 +699,7 @@
>  		return -EFAULT;
>  	}
>  
> -	if (!(card->bt = dvb_bt8xx_878_match(card->bttv_nr, bttv_pci_dev))) {
> +	if (!(card->bt = bt878_match(card->bttv_nr, bttv_pci_dev))) {
>  		printk("dvb_bt8xx: unable to determine DMA core of card %d,\n",
>  		       card->bttv_nr);
>  		printk("dvb_bt8xx: if you have the ALSA bt87x audio driver "





More information about the linux-dvb mailing list