Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Patches: Disable DVB-T frequency bending and allow reload ofgrundig 401 module



Two patches: 

One disables frequency bending on DVB-T cards. This is fine on Grundig
29504-401 tuners as there doesn't appear to be any problems with tuning
multiples of these cards to the same frequency (Tested with three
identical cards). Needs to be tested with multiple cards with other
DVB-T tuners (specifically alps_tdlb7, and alps_tdmb7 tuners)

The other patch fixes the grundig 29504-401 frontend code so that the
module can be reloaded.

-- 
Andrew de Quincey <adq_dvb@lidskialf.net>
Index: linux/drivers/media/dvb/frontends/grundig_29504-401.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/frontends/grundig_29504-401.c,v
retrieving revision 1.5
diff -r1.5 grundig_29504-401.c
26a27
> #include <linux/delay.h>
269c270
< void reset_and_configure (struct dvb_i2c_bus *i2c)
---
> int reset_and_configure (struct dvb_i2c_bus *i2c)
271,272c272,273
< 	u8 buf [] = { 0x06 };
< 	struct i2c_msg msg = { addr: 0x00, flags: 0, buf: buf, len: 1 };
---
> 	u8 b1 [] = { 0x06 };
> 	struct i2c_msg msg = { addr: 0x00, flags: 0, buf: b1, len: 1 };
274c275,279
< 	i2c->xfer (i2c, &msg, 1);
---
> 	if (i2c->xfer(i2c, &msg, 1) != 1) {
> 	  return -1;
> 	}
> 
> 	return 0;
404c409
< 		return l64781_writereg (i2c, 0x3e, 0x5a);
---
>    	        return l64781_writereg (i2c, 0x3e, 0x5a);
421c426
< 	u8 b0 [] = { 0x1a };
---
> 	u8 b0 [] = { 0x1a, 0 };
423,429c428,468
< 	struct i2c_msg msg [] = { { addr: 0x55, flags: 0, buf: b0, len: 1 },
< 			   { addr: 0x55, flags: I2C_M_RD, buf: b1, len: 1 } };
< 
< 	if (i2c->xfer (i2c, msg, 2) == 2)   /*  probably an EEPROM... */
< 		return -ENODEV;
< 
< 	reset_and_configure (i2c);
---
> 	struct i2c_msg read_msg [] = { { addr: 0x55, flags: 0, buf: b0, len: 1 },
> 				       { addr: 0x55, flags: I2C_M_RD, buf: b1, len: 1 } };
> 	struct i2c_msg write_msg [] = { { addr: 0x55, flags: 0, buf: b0, len: 2 } };
> 	int tmp;
> 	int i;
> 
> 	// OK, try and read byte 0x1a from the device. If this fails, this means
> 	// either (a) the device is not present, or (b) the device is present, but
> 	// not configured yet. In either case, we can skip the more in-depth tests
> 	b0[0] = 0x1a;
> 	if (i2c->xfer(i2c, read_msg, 2) == 2) {
> 	        // if nothing responds, device is not present
> 	        if (reset_and_configure(i2c))
> 		        return -ENODEV;
> 
> 	        // read in 0x3e bytes from the device and OR their values together. 
> 	        // If any read fails, a grundig device is not present
> 	        tmp = 0;
> 		for(i = 0; i< 0x3e; i++) {
> 		        b0[0] = i;
> 			if (i2c->xfer(i2c, read_msg, 2) != 2) {
> 			        return -ENODEV;
> 			}
> 			tmp |= b1[0];
> 		}
> 
> 		// if the result was 0 (i.e. all memory locations were 0), it is likely 
> 		// we have a powered-down grundig chip. Power it up
> 		if (tmp == 0) {
> 		        dprintk("Found potential powered-down grundig.\n");
> 			b0[0] = 0x3e; 
> 			b0[1] = 0xa5;
> 			if (i2c->xfer(i2c, write_msg, 1) != 1) {
> 			        return -ENODEV;
> 			}
> 		} else {
> 		        dprintk("Found potential powered-up grundig or eeprom.\n");
> 		}
> 	} else {
> 	        dprintk("Found unconfigured grundig or no device.\n");
> 	}
431c470,473
< 	if (i2c->xfer (i2c, msg, 2) != 2)   /*  nothing... */
---
>         reset_and_configure(i2c);
>    
> 	b0[0] = 0x1a;
> 	if (i2c->xfer (i2c, read_msg, 2) != 2)
433d474
< 
436a478,489
> 	b0[0] = 0x24;
> 	if (i2c->xfer (i2c, read_msg, 2) != 2)
> 		return -ENODEV;
> 	if ((b1[0] & 0x3f) != 0x25)
> 		return -ENODEV;
>    
> 	b0[0] = 0x25;
> 	if (i2c->xfer (i2c, read_msg, 2) != 2)
> 		return -ENODEV;
> 	if ((b1[0] & 0x3f) != 0x2c)
> 		return -ENODEV;
>    
438a492
> 
Index: linux/drivers/media/dvb/dvb-core/dvb_frontend.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/dvb-core/dvb_frontend.c,v
retrieving revision 1.32
diff -r1.32 dvb_frontend.c
314c314,315
< 	dvb_bend_frequency (fe, 0);
---
>         if (fe->info->type != FE_OFDM) 
>                 dvb_bend_frequency (fe, 0);

Home | Main Index | Thread Index