| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | /* Linux driver for devices based on the DiBcom DiB0700 USB bridge
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *	This program is free software; you can redistribute it and/or modify it | 
					
						
							|  |  |  |  *	under the terms of the GNU General Public License as published by the Free | 
					
						
							|  |  |  |  *	Software Foundation, version 2. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  |  *  Copyright (C) 2005-9 DiBcom, SA et al | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  |  */ | 
					
						
							|  |  |  | #include "dib0700.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "dib3000mc.h"
 | 
					
						
							| 
									
										
										
										
											2006-12-02 21:15:51 -02:00
										 |  |  | #include "dib7000m.h"
 | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | #include "dib7000p.h"
 | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | #include "dib8000.h"
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | #include "dib9000.h"
 | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | #include "mt2060.h"
 | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | #include "mt2266.h"
 | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | #include "tuner-xc2028.h"
 | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | #include "xc5000.h"
 | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | #include "xc4000.h"
 | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | #include "s5h1411.h"
 | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | #include "dib0070.h"
 | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | #include "dib0090.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-19 01:12:55 -03:00
										 |  |  | #include "lgdt3305.h"
 | 
					
						
							|  |  |  | #include "mxl5007t.h"
 | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-20 04:37:18 -03:00
										 |  |  | static int force_lna_activation; | 
					
						
							|  |  |  | module_param(force_lna_activation, int, 0644); | 
					
						
							|  |  |  | MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), " | 
					
						
							|  |  |  | 		"if applicable for the device (default: 0=automatic/off)."); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | struct dib0700_adapter_state { | 
					
						
							| 
									
										
										
										
											2011-12-24 12:24:33 -03:00
										 |  |  | 	int (*set_param_save) (struct dvb_frontend *); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	const struct firmware *frontend_firmware; | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Hauppauge Nova-T 500 (aka Bristol)
 | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  |  *  has a LNA on GPIO0 which is enabled by setting 1 */ | 
					
						
							|  |  |  | static struct mt2060_config bristol_mt2060_config[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.i2c_address = 0x60, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:56 -03:00
										 |  |  | 		.clock_out   = 3, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 	}, { | 
					
						
							|  |  |  | 		.i2c_address = 0x61, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-15 07:13:07 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = { | 
					
						
							|  |  |  | 	.band_caps = BAND_VHF | BAND_UHF, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:53 -03:00
										 |  |  | 	.setup     = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0), | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:40 -03:00
										 |  |  | 	.agc1_max = 42598, | 
					
						
							|  |  |  | 	.agc1_min = 17694, | 
					
						
							|  |  |  | 	.agc2_max = 45875, | 
					
						
							|  |  |  | 	.agc2_min = 0, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:40 -03:00
										 |  |  | 	.agc1_pt1 = 0, | 
					
						
							|  |  |  | 	.agc1_pt2 = 59, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:40 -03:00
										 |  |  | 	.agc1_slope1 = 0, | 
					
						
							|  |  |  | 	.agc1_slope2 = 69, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	.agc2_pt1 = 0, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:40 -03:00
										 |  |  | 	.agc2_pt2 = 59, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:40 -03:00
										 |  |  | 	.agc2_slope1 = 111, | 
					
						
							|  |  |  | 	.agc2_slope2 = 28, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib3000mc_config bristol_dib3000mc_config[2] = { | 
					
						
							|  |  |  | 	{	.agc          = &bristol_dib3000p_mt2060_agc_config, | 
					
						
							|  |  |  | 		.max_time     = 0x196, | 
					
						
							|  |  |  | 		.ln_adc_level = 0x1cc7, | 
					
						
							|  |  |  | 		.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{	.agc          = &bristol_dib3000p_mt2060_agc_config, | 
					
						
							|  |  |  | 		.max_time     = 0x196, | 
					
						
							|  |  |  | 		.ln_adc_level = 0x1cc7, | 
					
						
							|  |  |  | 		.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int bristol_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:40 -03:00
										 |  |  | 	struct dib0700_state *st = adap->dev->priv; | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 	if (adap->id == 0) { | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO6,  GPIO_OUT, 0); msleep(10); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO6,  GPIO_OUT, 1); msleep(10); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-20 04:37:18 -03:00
										 |  |  | 		if (force_lna_activation) | 
					
						
							|  |  |  | 			dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0); | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:40 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 		if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) { | 
					
						
							|  |  |  | 			dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10); | 
					
						
							|  |  |  | 			return -ENODEV; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:40 -03:00
										 |  |  | 	st->mt2060_if1[adap->id] = 1220; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return (adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:40 -03:00
										 |  |  | 		(10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-01-25 07:32:58 -03:00
										 |  |  | static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval) | 
					
						
							| 
									
										
										
										
											2008-01-25 06:50:07 -03:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct i2c_msg msg[2] = { | 
					
						
							|  |  |  | 		{ .addr = 0x50, .flags = 0,        .buf = &adrs, .len = 1 }, | 
					
						
							|  |  |  | 		{ .addr = 0x50, .flags = I2C_M_RD, .buf = pval,  .len = 1 }, | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 	if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO; | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | static int bristol_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-01-25 06:50:07 -03:00
										 |  |  | 	struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe_adap[0].fe, 1); | 
					
						
							| 
									
										
										
										
											2008-01-25 06:50:07 -03:00
										 |  |  | 	s8 a; | 
					
						
							|  |  |  | 	int if1=1220; | 
					
						
							| 
									
										
										
										
											2008-05-21 00:31:21 -03:00
										 |  |  | 	if (adap->dev->udev->descriptor.idVendor  == cpu_to_le16(USB_VID_HAUPPAUGE) && | 
					
						
							|  |  |  | 		adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) { | 
					
						
							| 
									
										
										
										
											2008-01-25 06:50:07 -03:00
										 |  |  | 		if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-09-13 01:32:11 -03:00
										 |  |  | 	return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, | 
					
						
							|  |  |  | 			  &bristol_mt2060_config[adap->id], if1) == NULL ? | 
					
						
							|  |  |  | 			  -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */ | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-27 10:08:51 -03:00
										 |  |  | /* MT226x */ | 
					
						
							|  |  |  | static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 		BAND_UHF, | 
					
						
							| 
									
										
										
										
											2007-07-27 10:08:51 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=1, P_agc_inv_pwm2=1,
 | 
					
						
							|  |  |  | 		* P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */ | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 		(0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | 
					
						
							|  |  |  | 	    | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		1130, | 
					
						
							|  |  |  | 		21, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0, | 
					
						
							|  |  |  | 		118, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0, | 
					
						
							|  |  |  | 		3530, | 
					
						
							|  |  |  | 		1, | 
					
						
							|  |  |  | 		0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		65535, | 
					
						
							|  |  |  | 		33770, | 
					
						
							|  |  |  | 		65535, | 
					
						
							|  |  |  | 		23592, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0, | 
					
						
							|  |  |  | 		62, | 
					
						
							|  |  |  | 		255, | 
					
						
							|  |  |  | 		64, | 
					
						
							|  |  |  | 		64, | 
					
						
							|  |  |  | 		132, | 
					
						
							|  |  |  | 		192, | 
					
						
							|  |  |  | 		80, | 
					
						
							|  |  |  | 		80, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		17, | 
					
						
							|  |  |  | 		27, | 
					
						
							|  |  |  | 		23, | 
					
						
							|  |  |  | 		51, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		1, | 
					
						
							| 
									
										
										
										
											2007-07-27 10:08:51 -03:00
										 |  |  | 	}, { | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 		BAND_VHF | BAND_LBAND, | 
					
						
							| 
									
										
										
										
											2007-07-27 10:08:51 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=1, P_agc_inv_pwm2=1,
 | 
					
						
							|  |  |  | 		* P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */ | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 		(0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | 
					
						
							|  |  |  | 	    | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		2372, | 
					
						
							|  |  |  | 		21, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0, | 
					
						
							|  |  |  | 		118, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0, | 
					
						
							|  |  |  | 		3530, | 
					
						
							|  |  |  | 		1, | 
					
						
							|  |  |  | 		0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		65535, | 
					
						
							|  |  |  | 		0, | 
					
						
							|  |  |  | 		65535, | 
					
						
							|  |  |  | 		23592, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0, | 
					
						
							|  |  |  | 		128, | 
					
						
							|  |  |  | 		128, | 
					
						
							|  |  |  | 		128, | 
					
						
							|  |  |  | 		0, | 
					
						
							|  |  |  | 		128, | 
					
						
							|  |  |  | 		253, | 
					
						
							|  |  |  | 		81, | 
					
						
							|  |  |  | 		0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		17, | 
					
						
							|  |  |  | 		27, | 
					
						
							|  |  |  | 		23, | 
					
						
							|  |  |  | 		51, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		1, | 
					
						
							| 
									
										
										
										
											2007-07-27 10:08:51 -03:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = { | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	60000, 30000, | 
					
						
							|  |  |  | 	1, 8, 3, 1, 0, | 
					
						
							|  |  |  | 	0, 0, 1, 1, 2, | 
					
						
							|  |  |  | 	(3 << 14) | (1 << 12) | (524 << 0), | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	20452225, | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = { | 
					
						
							|  |  |  | 	{	.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 		.hostbus_diversity = 1, | 
					
						
							|  |  |  | 		.tuner_is_baseband = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-27 10:08:51 -03:00
										 |  |  | 		.agc_config_count = 2, | 
					
						
							|  |  |  | 		.agc = stk7700d_7000p_mt2266_agc_config, | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 		.bw  = &stk7700d_mt2266_pll_config, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-27 10:08:51 -03:00
										 |  |  | 		.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 		.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 		.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	{	.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 		.hostbus_diversity = 1, | 
					
						
							|  |  |  | 		.tuner_is_baseband = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-27 10:08:51 -03:00
										 |  |  | 		.agc_config_count = 2, | 
					
						
							|  |  |  | 		.agc = stk7700d_7000p_mt2266_agc_config, | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 		.bw  = &stk7700d_mt2266_pll_config, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-27 10:08:51 -03:00
										 |  |  | 		.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 		.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 		.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct mt2266_config stk7700d_mt2266_config[2] = { | 
					
						
							|  |  |  | 	{	.i2c_address = 0x60 | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{	.i2c_address = 0x60 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-01-25 06:02:42 -03:00
										 |  |  | static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (adap->id == 0) { | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							|  |  |  | 		msleep(10); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 		msleep(10); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | 		msleep(10); | 
					
						
							| 
									
										
										
										
											2009-01-21 01:55:45 -03:00
										 |  |  | 		if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, | 
					
						
							|  |  |  | 					     stk7700d_dib7000p_mt2266_config) | 
					
						
							|  |  |  | 		    != 0) { | 
					
						
							|  |  |  | 			err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n", __func__); | 
					
						
							|  |  |  | 			return -ENODEV; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2008-01-25 06:02:42 -03:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 09:26:59 -03:00
										 |  |  | 	adap->fe_adap[0].fe = | 
					
						
							|  |  |  | 		dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, | 
					
						
							|  |  |  | 			   0x80 + (adap->id << 1), | 
					
						
							|  |  |  | 			   &stk7700d_dib7000p_mt2266_config[adap->id]); | 
					
						
							| 
									
										
										
										
											2008-01-25 06:02:42 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2008-01-25 06:02:42 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (adap->id == 0) { | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							|  |  |  | 		msleep(10); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 		msleep(10); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | 		msleep(10); | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2009-01-21 01:55:45 -03:00
										 |  |  | 		if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, | 
					
						
							|  |  |  | 					     stk7700d_dib7000p_mt2266_config) | 
					
						
							|  |  |  | 		    != 0) { | 
					
						
							|  |  |  | 			err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n", __func__); | 
					
						
							|  |  |  | 			return -ENODEV; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 09:26:59 -03:00
										 |  |  | 	adap->fe_adap[0].fe = | 
					
						
							|  |  |  | 		dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, | 
					
						
							|  |  |  | 			   0x80 + (adap->id << 1), | 
					
						
							|  |  |  | 			   &stk7700d_dib7000p_mt2266_config[adap->id]); | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct i2c_adapter *tun_i2c; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); | 
					
						
							|  |  |  | 	return dvb_attach(mt2266_attach, adap->fe_adap[0].fe, tun_i2c, | 
					
						
							| 
									
										
										
										
											2009-07-02 15:57:09 -03:00
										 |  |  | 		&stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */ | 
					
						
							| 
									
										
										
										
											2008-04-25 19:03:08 -07:00
										 |  |  | static struct dibx000_agc_config xc3028_agc_config = { | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 	BAND_VHF | BAND_UHF,       /* band_caps */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
 | 
					
						
							|  |  |  | 	 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, | 
					
						
							|  |  |  | 	 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */ | 
					
						
							|  |  |  | 	(0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | | 
					
						
							|  |  |  | 	(3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	712,	/* inv_gain */ | 
					
						
							|  |  |  | 	21,	/* time_stabiliz */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0,	/* alpha_level */ | 
					
						
							|  |  |  | 	118,	/* thlock */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0,	/* wbd_inv */ | 
					
						
							|  |  |  | 	2867,	/* wbd_ref */ | 
					
						
							|  |  |  | 	0,	/* wbd_sel */ | 
					
						
							|  |  |  | 	2,	/* wbd_alpha */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0,	/* agc1_max */ | 
					
						
							|  |  |  | 	0,	/* agc1_min */ | 
					
						
							|  |  |  | 	39718,	/* agc2_max */ | 
					
						
							|  |  |  | 	9930,	/* agc2_min */ | 
					
						
							|  |  |  | 	0,	/* agc1_pt1 */ | 
					
						
							|  |  |  | 	0,	/* agc1_pt2 */ | 
					
						
							|  |  |  | 	0,	/* agc1_pt3 */ | 
					
						
							|  |  |  | 	0,	/* agc1_slope1 */ | 
					
						
							|  |  |  | 	0,	/* agc1_slope2 */ | 
					
						
							|  |  |  | 	0,	/* agc2_pt1 */ | 
					
						
							|  |  |  | 	128,	/* agc2_pt2 */ | 
					
						
							|  |  |  | 	29,	/* agc2_slope1 */ | 
					
						
							|  |  |  | 	29,	/* agc2_slope2 */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	17,	/* alpha_mant */ | 
					
						
							|  |  |  | 	27,	/* alpha_exp */ | 
					
						
							|  |  |  | 	23,	/* beta_mant */ | 
					
						
							|  |  |  | 	51,	/* beta_exp */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	1,	/* perform_agc_softsplit */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */ | 
					
						
							| 
									
										
										
										
											2008-04-25 19:03:08 -07:00
										 |  |  | static struct dibx000_bandwidth_config xc3028_bw_config = { | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 	60000, 30000, /* internal, sampling */ | 
					
						
							|  |  |  | 	1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */ | 
					
						
							|  |  |  | 	0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
 | 
					
						
							|  |  |  | 			  modulo */ | 
					
						
							|  |  |  | 	(3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */ | 
					
						
							|  |  |  | 	(1 << 25) | 5816102, /* ifreq = 5.200000 MHz */ | 
					
						
							|  |  |  | 	20452225, /* timf */ | 
					
						
							|  |  |  | 	30000000, /* xtal_hz */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib7000p_config stk7700ph_dib7700_xc3028_config = { | 
					
						
							|  |  |  | 	.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 	.tuner_is_baseband = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.agc_config_count = 1, | 
					
						
							|  |  |  | 	.agc = &xc3028_agc_config, | 
					
						
							|  |  |  | 	.bw  = &xc3028_bw_config, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 	.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 	.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-12 13:31:45 -03:00
										 |  |  | static int stk7700ph_xc3028_callback(void *ptr, int component, | 
					
						
							|  |  |  | 				     int command, int arg) | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct dvb_usb_adapter *adap = ptr; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	switch (command) { | 
					
						
							|  |  |  | 	case XC2028_TUNER_RESET: | 
					
						
							|  |  |  | 		/* Send the tuner in then out of reset */ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 0); msleep(10); | 
					
						
							|  |  |  | 		dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1); | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 		break; | 
					
						
							|  |  |  | 	case XC2028_RESET_CLK: | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	default: | 
					
						
							|  |  |  | 		err("%s: unknown command %d, arg %d\n", __func__, | 
					
						
							|  |  |  | 			command, arg); | 
					
						
							|  |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct xc2028_ctrl stk7700ph_xc3028_ctrl = { | 
					
						
							|  |  |  | 	.fname = XC2028_DEFAULT_FIRMWARE, | 
					
						
							|  |  |  | 	.max_len = 64, | 
					
						
							|  |  |  | 	.demod = XC3028_FE_DIBCOM52, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct xc2028_config stk7700ph_xc3028_config = { | 
					
						
							|  |  |  | 	.i2c_addr = 0x61, | 
					
						
							|  |  |  | 	.ctrl = &stk7700ph_xc3028_ctrl, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct usb_device_descriptor *desc = &adap->dev->udev->descriptor; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-05-21 00:31:21 -03:00
										 |  |  | 	if (desc->idVendor  == cpu_to_le16(USB_VID_PINNACLE) && | 
					
						
							|  |  |  | 	    desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX)) | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(20); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(20); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-21 01:55:45 -03:00
										 |  |  | 	if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, | 
					
						
							|  |  |  | 				     &stk7700ph_dib7700_xc3028_config) != 0) { | 
					
						
							|  |  |  | 		err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n", | 
					
						
							|  |  |  | 		    __func__); | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 		&stk7700ph_dib7700_xc3028_config); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct i2c_adapter *tun_i2c; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 		DIBX000_I2C_INTERFACE_TUNER, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	stk7700ph_xc3028_config.i2c_adap = tun_i2c; | 
					
						
							| 
									
										
										
										
											2008-09-12 13:31:45 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* FIXME: generalize & move to common area */ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe->callback = stk7700ph_xc3028_callback; | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &stk7700ph_xc3028_config) | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 		== NULL ? -ENODEV : 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-01 06:51:14 -03:00
										 |  |  | #define DEFAULT_RC_INTERVAL 50
 | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | static u8 rc_request[] = { REQUEST_POLL_RC, 0 }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-03-29 21:37:01 -03:00
										 |  |  | /* Number of keypresses to ignore before start repeating */ | 
					
						
							| 
									
										
										
										
											2008-12-01 06:51:14 -03:00
										 |  |  | #define RC_REPEAT_DELAY 6
 | 
					
						
							| 
									
										
										
										
											2008-03-29 21:37:01 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * This function is used only when firmware is < 1.20 version. Newer | 
					
						
							|  |  |  |  * firmwares use bulk mode, with functions implemented at dib0700_core, | 
					
						
							|  |  |  |  * at dib0700_rc_urb_completion() | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d) | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | { | 
					
						
							|  |  |  | 	u8 key[4]; | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 	u32 keycode; | 
					
						
							|  |  |  | 	u8 toggle; | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 	int i; | 
					
						
							|  |  |  | 	struct dib0700_state *st = d->priv; | 
					
						
							| 
									
										
										
										
											2010-01-04 02:43:19 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (st->fw_version >= 0x10200) { | 
					
						
							|  |  |  | 		/* For 1.20 firmware , We need to keep the RC polling
 | 
					
						
							|  |  |  | 		   callback so we can reuse the input device setup in | 
					
						
							|  |  |  | 		   dvb-usb-remote.c.  However, the actual work is being done | 
					
						
							|  |  |  | 		   in the bulk URB completion handler. */ | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 	i = dib0700_ctrl_rd(d, rc_request, 2, key, 4); | 
					
						
							|  |  |  | 	if (i <= 0) { | 
					
						
							| 
									
										
										
										
											2007-07-31 08:48:40 -03:00
										 |  |  | 		err("RC Query Failed"); | 
					
						
							| 
									
										
										
										
											2007-07-31 19:45:13 -03:00
										 |  |  | 		return -1; | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-03-29 21:37:01 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* losing half of KEY_0 events from Philipps rc5 remotes.. */ | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 	if (key[0] == 0 && key[1] == 0 && key[2] == 0 && key[3] == 0) | 
					
						
							|  |  |  | 		return 0; | 
					
						
							| 
									
										
										
										
											2008-03-29 21:37:01 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]);  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 	d->last_event = 0; | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 	switch (d->props.rc.core.protocol) { | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 	case RC_BIT_NEC: | 
					
						
							| 
									
										
										
										
											2008-03-29 21:37:01 -03:00
										 |  |  | 		/* NEC protocol sends repeat code as 0 0 0 FF */ | 
					
						
							|  |  |  | 		if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 		    (key[3] == 0xff)) | 
					
						
							|  |  |  | 			keycode = d->last_event; | 
					
						
							|  |  |  | 		else { | 
					
						
							|  |  |  | 			keycode = key[3-2] << 8 | key[3-3]; | 
					
						
							|  |  |  | 			d->last_event = keycode; | 
					
						
							| 
									
										
										
										
											2008-03-29 21:37:01 -03:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-17 13:53:11 -03:00
										 |  |  | 		rc_keydown(d->rc_dev, keycode, 0); | 
					
						
							| 
									
										
										
										
											2008-03-29 21:37:01 -03:00
										 |  |  | 		break; | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 	default: | 
					
						
							| 
									
										
										
										
											2008-03-29 21:37:01 -03:00
										 |  |  | 		/* RC-5 protocol changes toggle bit on new keypress */ | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 		keycode = key[3-2] << 8 | key[3-3]; | 
					
						
							|  |  |  | 		toggle = key[3-1]; | 
					
						
							| 
									
										
										
										
											2010-11-17 13:53:11 -03:00
										 |  |  | 		rc_keydown(d->rc_dev, keycode, toggle); | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-03-29 21:37:01 -03:00
										 |  |  | 		break; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */ | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = { | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	BAND_UHF | BAND_VHF, | 
					
						
							| 
									
										
										
										
											2006-10-17 18:28:14 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
 | 
					
						
							|  |  |  | 	 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */ | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	(0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | 
					
						
							|  |  |  | 	| (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	712, | 
					
						
							|  |  |  | 	41, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	118, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	4095, | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	42598, | 
					
						
							|  |  |  | 	17694, | 
					
						
							|  |  |  | 	45875, | 
					
						
							|  |  |  | 	2621, | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	76, | 
					
						
							|  |  |  | 	139, | 
					
						
							|  |  |  | 	52, | 
					
						
							|  |  |  | 	59, | 
					
						
							|  |  |  | 	107, | 
					
						
							|  |  |  | 	172, | 
					
						
							|  |  |  | 	57, | 
					
						
							|  |  |  | 	70, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	21, | 
					
						
							|  |  |  | 	25, | 
					
						
							|  |  |  | 	28, | 
					
						
							|  |  |  | 	48, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	1, | 
					
						
							|  |  |  | 	{  0, | 
					
						
							|  |  |  | 	   107, | 
					
						
							|  |  |  | 	   51800, | 
					
						
							|  |  |  | 	   24700 | 
					
						
							| 
									
										
										
										
											2006-10-17 18:28:14 -03:00
										 |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = { | 
					
						
							|  |  |  | 	BAND_UHF | BAND_VHF, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
 | 
					
						
							|  |  |  | 	 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */ | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	(0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | 
					
						
							|  |  |  | 	| (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	712, | 
					
						
							|  |  |  | 	41, | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	0, | 
					
						
							|  |  |  | 	118, | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	0, | 
					
						
							|  |  |  | 	4095, | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	0, | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	42598, | 
					
						
							|  |  |  | 	16384, | 
					
						
							|  |  |  | 	42598, | 
					
						
							|  |  |  | 	    0, | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	  0, | 
					
						
							|  |  |  | 	137, | 
					
						
							|  |  |  | 	255, | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	  0, | 
					
						
							|  |  |  | 	255, | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	0, | 
					
						
							|  |  |  | 	0, | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	 0, | 
					
						
							|  |  |  | 	41, | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	15, | 
					
						
							|  |  |  | 	25, | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	28, | 
					
						
							|  |  |  | 	48, | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	0, | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dibx000_bandwidth_config stk7700p_pll_config = { | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	60000, 30000, | 
					
						
							|  |  |  | 	1, 8, 3, 1, 0, | 
					
						
							|  |  |  | 	0, 0, 1, 1, 0, | 
					
						
							|  |  |  | 	(3 << 14) | (1 << 12) | (524 << 0), | 
					
						
							|  |  |  | 	60258167, | 
					
						
							|  |  |  | 	20452225, | 
					
						
							|  |  |  | 	30000000, | 
					
						
							| 
									
										
										
										
											2006-10-17 18:28:14 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib7000m_config stk7700p_dib7000m_config = { | 
					
						
							|  |  |  | 	.dvbt_mode = 1, | 
					
						
							|  |  |  | 	.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 	.quartz_direct = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.agc_config_count = 1, | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 	.agc = &stk7700p_7000m_mt2060_agc_config, | 
					
						
							|  |  |  | 	.bw  = &stk7700p_pll_config, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 	.gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 	.gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib7000p_config stk7700p_dib7000p_config = { | 
					
						
							|  |  |  | 	.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-27 10:08:51 -03:00
										 |  |  | 	.agc_config_count = 1, | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 	.agc = &stk7700p_7000p_mt2060_agc_config, | 
					
						
							|  |  |  | 	.bw  = &stk7700p_pll_config, | 
					
						
							| 
									
										
										
										
											2006-10-17 18:28:14 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	.gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 	.gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 	.gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2006-10-17 18:28:14 -03:00
										 |  |  | 	struct dib0700_state *st = adap->dev->priv; | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 	/* unless there is no real power management in DVB - we leave the device on GPIO6 */ | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6,  GPIO_OUT, 0); msleep(50); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-10-17 18:28:14 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO6,  GPIO_OUT, 1); msleep(10); | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO9,  GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10); | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 	dib0700_ctrl_clock(adap->dev, 72, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev,  GPIO0, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-10-17 18:28:14 -03:00
										 |  |  | 	st->mt2060_if1[0] = 1220; | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (dib7000pc_detection(&adap->dev->i2c_adap)) { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config); | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 		st->is_dib7000pc = 1; | 
					
						
							|  |  |  | 	} else | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		adap->fe_adap[0].fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config); | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-10-17 18:28:14 -03:00
										 |  |  | static struct mt2060_config stk7700p_mt2060_config = { | 
					
						
							|  |  |  | 	0x60 | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-01-25 06:50:07 -03:00
										 |  |  | 	struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap; | 
					
						
							| 
									
										
										
										
											2006-10-17 18:28:14 -03:00
										 |  |  | 	struct dib0700_state *st = adap->dev->priv; | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 	struct i2c_adapter *tun_i2c; | 
					
						
							| 
									
										
										
										
											2008-01-25 06:50:07 -03:00
										 |  |  | 	s8 a; | 
					
						
							|  |  |  | 	int if1=1220; | 
					
						
							| 
									
										
										
										
											2008-05-21 00:31:21 -03:00
										 |  |  | 	if (adap->dev->udev->descriptor.idVendor  == cpu_to_le16(USB_VID_HAUPPAUGE) && | 
					
						
							|  |  |  | 		adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) { | 
					
						
							| 
									
										
										
										
											2008-01-25 06:50:07 -03:00
										 |  |  | 		if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 	if (st->is_dib7000pc) | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 	else | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		tun_i2c = dib7000m_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); | 
					
						
							| 
									
										
										
										
											2006-10-18 08:34:16 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk7700p_mt2060_config, | 
					
						
							| 
									
										
										
										
											2008-01-25 06:50:07 -03:00
										 |  |  | 		if1) == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | /* DIB7070 generic */ | 
					
						
							|  |  |  | static struct dibx000_agc_config dib7070_agc_config = { | 
					
						
							|  |  |  | 	BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND, | 
					
						
							|  |  |  | 	/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
 | 
					
						
							|  |  |  | 	 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */ | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	(0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | 
					
						
							|  |  |  | 	| (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	600, | 
					
						
							|  |  |  | 	10, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	118, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	3530, | 
					
						
							|  |  |  | 	1, | 
					
						
							|  |  |  | 	5, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	65535, | 
					
						
							|  |  |  | 		0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	65535, | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	40, | 
					
						
							|  |  |  | 	183, | 
					
						
							|  |  |  | 	206, | 
					
						
							|  |  |  | 	255, | 
					
						
							|  |  |  | 	72, | 
					
						
							|  |  |  | 	152, | 
					
						
							|  |  |  | 	88, | 
					
						
							|  |  |  | 	90, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	17, | 
					
						
							|  |  |  | 	27, | 
					
						
							|  |  |  | 	23, | 
					
						
							|  |  |  | 	51, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-08-03 13:43:40 -03:00
										 |  |  | 	deb_info("reset: %d", onoff); | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 	return dib7000p_set_gpio(fe, 8, 0, !onoff); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-08-03 13:43:40 -03:00
										 |  |  | 	deb_info("sleep: %d", onoff); | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 	return dib7000p_set_gpio(fe, 9, 0, onoff); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib0070_config dib7070p_dib0070_config[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, | 
					
						
							|  |  |  | 		.reset = dib7070_tuner_reset, | 
					
						
							|  |  |  | 		.sleep = dib7070_tuner_sleep, | 
					
						
							|  |  |  | 		.clock_khz = 12000, | 
					
						
							| 
									
										
										
										
											2009-08-03 13:43:40 -03:00
										 |  |  | 		.clock_pad_drive = 4, | 
					
						
							|  |  |  | 		.charge_pump = 2, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 	}, { | 
					
						
							|  |  |  | 		.i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, | 
					
						
							|  |  |  | 		.reset = dib7070_tuner_reset, | 
					
						
							|  |  |  | 		.sleep = dib7070_tuner_sleep, | 
					
						
							|  |  |  | 		.clock_khz = 12000, | 
					
						
							| 
									
										
										
										
											2009-08-03 13:43:40 -03:00
										 |  |  | 		.charge_pump = 2, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | static struct dib0070_config dib7770p_dib0070_config = { | 
					
						
							|  |  |  | 	 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, | 
					
						
							|  |  |  | 	 .reset = dib7070_tuner_reset, | 
					
						
							|  |  |  | 	 .sleep = dib7070_tuner_sleep, | 
					
						
							|  |  |  | 	 .clock_khz = 12000, | 
					
						
							|  |  |  | 	 .clock_pad_drive = 0, | 
					
						
							|  |  |  | 	 .flip_chip = 1, | 
					
						
							| 
									
										
										
										
											2009-09-23 13:41:27 -03:00
										 |  |  | 	 .charge_pump = 2, | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-24 12:24:33 -03:00
										 |  |  | static int dib7070_set_param_override(struct dvb_frontend *fe) | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-12-24 10:18:24 -03:00
										 |  |  | 	struct dtv_frontend_properties *p = &fe->dtv_property_cache; | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 	struct dvb_usb_adapter *adap = fe->dvb->priv; | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *state = adap->priv; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	u16 offset; | 
					
						
							| 
									
										
										
										
											2011-12-24 10:18:24 -03:00
										 |  |  | 	u8 band = BAND_OF_FREQUENCY(p->frequency/1000); | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 	switch (band) { | 
					
						
							|  |  |  | 		case BAND_VHF: offset = 950; break; | 
					
						
							|  |  |  | 		case BAND_UHF: | 
					
						
							|  |  |  | 		default: offset = 550; break; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe)); | 
					
						
							|  |  |  | 	dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe)); | 
					
						
							| 
									
										
										
										
											2011-12-24 12:24:33 -03:00
										 |  |  | 	return state->set_param_save(fe); | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-24 12:24:33 -03:00
										 |  |  | static int dib7770_set_param_override(struct dvb_frontend *fe) | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-12-24 10:18:24 -03:00
										 |  |  | 	struct dtv_frontend_properties *p = &fe->dtv_property_cache; | 
					
						
							|  |  |  | 	struct dvb_usb_adapter *adap = fe->dvb->priv; | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *state = adap->priv; | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	 u16 offset; | 
					
						
							| 
									
										
										
										
											2011-12-24 10:18:24 -03:00
										 |  |  | 	 u8 band = BAND_OF_FREQUENCY(p->frequency/1000); | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | 	 switch (band) { | 
					
						
							|  |  |  | 	 case BAND_VHF: | 
					
						
							|  |  |  | 		  dib7000p_set_gpio(fe, 0, 0, 1); | 
					
						
							|  |  |  | 		  offset = 850; | 
					
						
							|  |  |  | 		  break; | 
					
						
							|  |  |  | 	 case BAND_UHF: | 
					
						
							|  |  |  | 	 default: | 
					
						
							|  |  |  | 		  dib7000p_set_gpio(fe, 0, 0, 0); | 
					
						
							|  |  |  | 		  offset = 250; | 
					
						
							|  |  |  | 		  break; | 
					
						
							|  |  |  | 	 } | 
					
						
							|  |  |  | 	 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe)); | 
					
						
							|  |  |  | 	 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe)); | 
					
						
							| 
									
										
										
										
											2011-12-24 12:24:33 -03:00
										 |  |  | 	 return state->set_param_save(fe); | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	 struct dib0700_adapter_state *st = adap->priv; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe, | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | 			 DIBX000_I2C_INTERFACE_TUNER, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, | 
					
						
							| 
									
										
										
										
											2011-09-13 01:08:44 -03:00
										 |  |  | 			&dib7770p_dib0070_config) == NULL) | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | 		 return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; | 
					
						
							|  |  |  | 	 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7770_set_param_override; | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | 	 return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *st = adap->priv; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (adap->id == 0) { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL) | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 			return -ENODEV; | 
					
						
							|  |  |  | 	} else { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL) | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 			return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override; | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-14 13:58:59 -03:00
										 |  |  | static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index, | 
					
						
							|  |  |  | 		u16 pid, int onoff) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_state *st = adapter->dev->priv; | 
					
						
							|  |  |  | 	if (st->is_dib7000pc) | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		return dib7000p_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff); | 
					
						
							|  |  |  | 	return dib7000m_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff); | 
					
						
							| 
									
										
										
										
											2011-01-14 13:58:59 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_state *st = adapter->dev->priv; | 
					
						
							|  |  |  | 	if (st->is_dib7000pc) | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		return dib7000p_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff); | 
					
						
							|  |  |  | 	return dib7000m_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff); | 
					
						
							| 
									
										
										
										
											2011-01-14 13:58:59 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-11 19:47:49 -03:00
										 |  |  | 	return dib7000p_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff); | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-11 19:47:49 -03:00
										 |  |  | 	return dib7000p_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff); | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = { | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	60000, 15000, | 
					
						
							|  |  |  | 	1, 20, 3, 1, 0, | 
					
						
							|  |  |  | 	0, 0, 1, 1, 2, | 
					
						
							|  |  |  | 	(3 << 14) | (1 << 12) | (524 << 0), | 
					
						
							|  |  |  | 	(0 << 25) | 0, | 
					
						
							|  |  |  | 	20452225, | 
					
						
							|  |  |  | 	12000000, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib7000p_config dib7070p_dib7000p_config = { | 
					
						
							|  |  |  | 	.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.agc_config_count = 1, | 
					
						
							|  |  |  | 	.agc = &dib7070_agc_config, | 
					
						
							|  |  |  | 	.bw  = &dib7070_bw_config_12_mhz, | 
					
						
							| 
									
										
										
										
											2008-01-25 07:25:20 -03:00
										 |  |  | 	.tuner_is_baseband = 1, | 
					
						
							|  |  |  | 	.spur_protect = 1, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 	.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 	.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.hostbus_diversity = 1, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* STK7070P */ | 
					
						
							|  |  |  | static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-05-21 00:31:21 -03:00
										 |  |  | 	struct usb_device_descriptor *p = &adap->dev->udev->descriptor; | 
					
						
							|  |  |  | 	if (p->idVendor  == cpu_to_le16(USB_VID_PINNACLE) && | 
					
						
							|  |  |  | 	    p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E)) | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 	else | 
					
						
							| 
									
										
										
										
											2008-05-21 00:31:21 -03:00
										 |  |  | 		dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_ctrl_clock(adap->dev, 72, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-21 01:55:45 -03:00
										 |  |  | 	if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, | 
					
						
							|  |  |  | 				     &dib7070p_dib7000p_config) != 0) { | 
					
						
							|  |  |  | 		err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n", | 
					
						
							|  |  |  | 		    __func__); | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 		&dib7070p_dib7000p_config); | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-07 12:50:45 -03:00
										 |  |  | /* STK7770P */ | 
					
						
							|  |  |  | static struct dib7000p_config dib7770p_dib7000p_config = { | 
					
						
							|  |  |  | 	.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.agc_config_count = 1, | 
					
						
							|  |  |  | 	.agc = &dib7070_agc_config, | 
					
						
							|  |  |  | 	.bw  = &dib7070_bw_config_12_mhz, | 
					
						
							|  |  |  | 	.tuner_is_baseband = 1, | 
					
						
							|  |  |  | 	.spur_protect = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 	.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 	.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.hostbus_diversity = 1, | 
					
						
							|  |  |  | 	.enable_current_mirror = 1, | 
					
						
							| 
									
										
										
										
											2010-09-07 12:50:46 -03:00
										 |  |  | 	.disable_sample_and_hold = 0, | 
					
						
							| 
									
										
										
										
											2010-09-07 12:50:45 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct usb_device_descriptor *p = &adap->dev->udev->descriptor; | 
					
						
							|  |  |  | 	if (p->idVendor  == cpu_to_le16(USB_VID_PINNACLE) && | 
					
						
							|  |  |  | 	    p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E)) | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_ctrl_clock(adap->dev, 72, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, | 
					
						
							|  |  |  | 				     &dib7770p_dib7000p_config) != 0) { | 
					
						
							|  |  |  | 		err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n", | 
					
						
							|  |  |  | 		    __func__); | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, | 
					
						
							| 
									
										
										
										
											2010-09-07 12:50:45 -03:00
										 |  |  | 		&dib7770p_dib7000p_config); | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2010-09-07 12:50:45 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | /* DIB807x generic */ | 
					
						
							|  |  |  | static struct dibx000_agc_config dib807x_agc_config[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		BAND_VHF, | 
					
						
							|  |  |  | 		/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
 | 
					
						
							|  |  |  | 		 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, | 
					
						
							|  |  |  | 		 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0, | 
					
						
							|  |  |  | 		 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, | 
					
						
							|  |  |  | 		 * P_agc_write=0 */ | 
					
						
							|  |  |  | 		(0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) | | 
					
						
							|  |  |  | 			(0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | | 
					
						
							|  |  |  | 			(0 << 0), /* setup*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		600, /* inv_gain*/ | 
					
						
							|  |  |  | 		10,  /* time_stabiliz*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0,  /* alpha_level*/ | 
					
						
							|  |  |  | 		118,  /* thlock*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0,     /* wbd_inv*/ | 
					
						
							|  |  |  | 		3530,  /* wbd_ref*/ | 
					
						
							|  |  |  | 		1,     /* wbd_sel*/ | 
					
						
							|  |  |  | 		5,     /* wbd_alpha*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		65535,  /* agc1_max*/ | 
					
						
							|  |  |  | 		0,  /* agc1_min*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		65535,  /* agc2_max*/ | 
					
						
							|  |  |  | 		0,      /* agc2_min*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0,      /* agc1_pt1*/ | 
					
						
							|  |  |  | 		40,     /* agc1_pt2*/ | 
					
						
							|  |  |  | 		183,    /* agc1_pt3*/ | 
					
						
							|  |  |  | 		206,    /* agc1_slope1*/ | 
					
						
							|  |  |  | 		255,    /* agc1_slope2*/ | 
					
						
							|  |  |  | 		72,     /* agc2_pt1*/ | 
					
						
							|  |  |  | 		152,    /* agc2_pt2*/ | 
					
						
							|  |  |  | 		88,     /* agc2_slope1*/ | 
					
						
							|  |  |  | 		90,     /* agc2_slope2*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		17,  /* alpha_mant*/ | 
					
						
							|  |  |  | 		27,  /* alpha_exp*/ | 
					
						
							|  |  |  | 		23,  /* beta_mant*/ | 
					
						
							|  |  |  | 		51,  /* beta_exp*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0,  /* perform_agc_softsplit*/ | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		BAND_UHF, | 
					
						
							|  |  |  | 		/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
 | 
					
						
							|  |  |  | 		 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, | 
					
						
							|  |  |  | 		 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, | 
					
						
							|  |  |  | 		 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, | 
					
						
							|  |  |  | 		 * P_agc_write=0 */ | 
					
						
							|  |  |  | 		(0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) | | 
					
						
							|  |  |  | 			(0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | | 
					
						
							|  |  |  | 			(0 << 0), /* setup */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		600, /* inv_gain*/ | 
					
						
							|  |  |  | 		10,  /* time_stabiliz*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0,  /* alpha_level*/ | 
					
						
							|  |  |  | 		118,  /* thlock*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0,     /* wbd_inv*/ | 
					
						
							|  |  |  | 		3530,  /* wbd_ref*/ | 
					
						
							|  |  |  | 		1,     /* wbd_sel*/ | 
					
						
							|  |  |  | 		5,     /* wbd_alpha*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		65535,  /* agc1_max*/ | 
					
						
							|  |  |  | 		0,  /* agc1_min*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		65535,  /* agc2_max*/ | 
					
						
							|  |  |  | 		0,      /* agc2_min*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0,      /* agc1_pt1*/ | 
					
						
							|  |  |  | 		40,     /* agc1_pt2*/ | 
					
						
							|  |  |  | 		183,    /* agc1_pt3*/ | 
					
						
							|  |  |  | 		206,    /* agc1_slope1*/ | 
					
						
							|  |  |  | 		255,    /* agc1_slope2*/ | 
					
						
							|  |  |  | 		72,     /* agc2_pt1*/ | 
					
						
							|  |  |  | 		152,    /* agc2_pt2*/ | 
					
						
							|  |  |  | 		88,     /* agc2_slope1*/ | 
					
						
							|  |  |  | 		90,     /* agc2_slope2*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		17,  /* alpha_mant*/ | 
					
						
							|  |  |  | 		27,  /* alpha_exp*/ | 
					
						
							|  |  |  | 		23,  /* beta_mant*/ | 
					
						
							|  |  |  | 		51,  /* beta_exp*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		0,  /* perform_agc_softsplit*/ | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = { | 
					
						
							|  |  |  | 	60000, 15000, /* internal, sampling*/ | 
					
						
							|  |  |  | 	1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/ | 
					
						
							|  |  |  | 	0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
 | 
					
						
							|  |  |  | 			  ADClkSrc, modulo */ | 
					
						
							|  |  |  | 	(3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/ | 
					
						
							|  |  |  | 	(0 << 25) | 0, /* ifreq = 0.000000 MHz*/ | 
					
						
							|  |  |  | 	18179755, /* timf*/ | 
					
						
							|  |  |  | 	12000000, /* xtal_hz*/ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib8000_config dib807x_dib8000_config[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.agc_config_count = 2, | 
					
						
							|  |  |  | 		.agc = dib807x_agc_config, | 
					
						
							|  |  |  | 		.pll = &dib807x_bw_config_12_mhz, | 
					
						
							|  |  |  | 		.tuner_is_baseband = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 		.gpio_val = DIB8000_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 		.gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.hostbus_diversity = 1, | 
					
						
							|  |  |  | 		.div_cfg = 1, | 
					
						
							|  |  |  | 		.agc_control = &dib0070_ctrl_agc_filter, | 
					
						
							|  |  |  | 		.output_mode = OUTMODE_MPEG2_FIFO, | 
					
						
							|  |  |  | 		.drives = 0x2d98, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.agc_config_count = 2, | 
					
						
							|  |  |  | 		.agc = dib807x_agc_config, | 
					
						
							|  |  |  | 		.pll = &dib807x_bw_config_12_mhz, | 
					
						
							|  |  |  | 		.tuner_is_baseband = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 		.gpio_val = DIB8000_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 		.gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.hostbus_diversity = 1, | 
					
						
							|  |  |  | 		.agc_control = &dib0070_ctrl_agc_filter, | 
					
						
							|  |  |  | 		.output_mode = OUTMODE_MPEG2_FIFO, | 
					
						
							|  |  |  | 		.drives = 0x2d98, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff) | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | { | 
					
						
							|  |  |  | 	return dib8000_set_gpio(fe, 5, 0, !onoff); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff) | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | { | 
					
						
							|  |  |  | 	return dib8000_set_gpio(fe, 0, 0, onoff); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = { | 
					
						
							|  |  |  |     { 240,      7}, | 
					
						
							|  |  |  |     { 0xffff,   6}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib0070_config dib807x_dib0070_config[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 		.reset = dib80xx_tuner_reset, | 
					
						
							|  |  |  | 		.sleep = dib80xx_tuner_sleep, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 		.clock_khz = 12000, | 
					
						
							|  |  |  | 		.clock_pad_drive = 4, | 
					
						
							|  |  |  | 		.vga_filter = 1, | 
					
						
							|  |  |  | 		.force_crystal_mode = 1, | 
					
						
							|  |  |  | 		.enable_third_order_filter = 1, | 
					
						
							|  |  |  | 		.charge_pump = 0, | 
					
						
							|  |  |  | 		.wbd_gain = dib8070_wbd_gain_cfg, | 
					
						
							|  |  |  | 		.osc_buffer_state = 0, | 
					
						
							|  |  |  | 		.freq_offset_khz_uhf = -100, | 
					
						
							|  |  |  | 		.freq_offset_khz_vhf = -100, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 		.reset = dib80xx_tuner_reset, | 
					
						
							|  |  |  | 		.sleep = dib80xx_tuner_sleep, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 		.clock_khz = 12000, | 
					
						
							|  |  |  | 		.clock_pad_drive = 2, | 
					
						
							|  |  |  | 		.vga_filter = 1, | 
					
						
							|  |  |  | 		.force_crystal_mode = 1, | 
					
						
							|  |  |  | 		.enable_third_order_filter = 1, | 
					
						
							|  |  |  | 		.charge_pump = 0, | 
					
						
							|  |  |  | 		.wbd_gain = dib8070_wbd_gain_cfg, | 
					
						
							|  |  |  | 		.osc_buffer_state = 0, | 
					
						
							|  |  |  | 		.freq_offset_khz_uhf = -25, | 
					
						
							|  |  |  | 		.freq_offset_khz_vhf = -25, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-24 12:24:33 -03:00
										 |  |  | static int dib807x_set_param_override(struct dvb_frontend *fe) | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-12-24 10:18:24 -03:00
										 |  |  | 	struct dtv_frontend_properties *p = &fe->dtv_property_cache; | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 	struct dvb_usb_adapter *adap = fe->dvb->priv; | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *state = adap->priv; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	u16 offset = dib0070_wbd_offset(fe); | 
					
						
							| 
									
										
										
										
											2011-12-24 10:18:24 -03:00
										 |  |  | 	u8 band = BAND_OF_FREQUENCY(p->frequency/1000); | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 	switch (band) { | 
					
						
							|  |  |  | 	case BAND_VHF: | 
					
						
							|  |  |  | 		offset += 750; | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	case BAND_UHF:  /* fall-thru wanted */ | 
					
						
							|  |  |  | 	default: | 
					
						
							|  |  |  | 		offset += 250; break; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	deb_info("WBD for DiB8000: %d\n", offset); | 
					
						
							|  |  |  | 	dib8000_set_wbd_ref(fe, offset); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-24 12:24:33 -03:00
										 |  |  | 	return state->set_param_save(fe); | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int dib807x_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *st = adap->priv; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe_adap[0].fe, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 			DIBX000_I2C_INTERFACE_TUNER, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (adap->id == 0) { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 				&dib807x_dib0070_config[0]) == NULL) | 
					
						
							|  |  |  | 			return -ENODEV; | 
					
						
							|  |  |  | 	} else { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 				&dib807x_dib0070_config[1]) == NULL) | 
					
						
							|  |  |  | 			return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib807x_set_param_override; | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index, | 
					
						
							|  |  |  | 	u16 pid, int onoff) | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return dib8000_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff); | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		int onoff) | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return dib8000_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff); | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* STK807x */ | 
					
						
							|  |  |  | static int stk807x_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_ctrl_clock(adap->dev, 72, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, | 
					
						
							| 
									
										
										
										
											2011-08-10 05:17:18 -03:00
										 |  |  | 				0x80, 0); | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 			      &dib807x_dib8000_config[0]); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ?  -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* STK807xPVR */ | 
					
						
							|  |  |  | static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); | 
					
						
							|  |  |  | 	msleep(30); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(500); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_ctrl_clock(adap->dev, 72, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* initialize IC 0 */ | 
					
						
							| 
									
										
										
										
											2011-08-10 05:17:18 -03:00
										 |  |  | 	dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80, 0); | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 			      &dib807x_dib8000_config[0]); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	/* initialize IC 1 */ | 
					
						
							| 
									
										
										
										
											2011-08-10 05:17:18 -03:00
										 |  |  | 	dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82, 0); | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 			      &dib807x_dib8000_config[1]); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | /* STK8096GP */ | 
					
						
							| 
									
										
										
										
											2011-08-05 14:10:40 -03:00
										 |  |  | static struct dibx000_agc_config dib8090_agc_config[2] = { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 	BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND, | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, | 
					
						
							|  |  |  | 	 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */ | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	(0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | 
					
						
							|  |  |  | 	| (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	787, | 
					
						
							|  |  |  | 	10, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	118, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	3530, | 
					
						
							|  |  |  | 	1, | 
					
						
							|  |  |  | 	5, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	65535, | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	65535, | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	32, | 
					
						
							|  |  |  | 	114, | 
					
						
							|  |  |  | 	143, | 
					
						
							|  |  |  | 	144, | 
					
						
							|  |  |  | 	114, | 
					
						
							|  |  |  | 	227, | 
					
						
							|  |  |  | 	116, | 
					
						
							|  |  |  | 	117, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	28, | 
					
						
							|  |  |  | 	26, | 
					
						
							|  |  |  | 	31, | 
					
						
							|  |  |  | 	51, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 	BAND_CBAND, | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, | 
					
						
							|  |  |  | 	 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */ | 
					
						
							| 
									
										
										
										
											2009-12-07 07:49:40 -03:00
										 |  |  | 	(0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | 
					
						
							|  |  |  | 	| (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	787, | 
					
						
							|  |  |  | 	10, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	118, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	3530, | 
					
						
							|  |  |  | 	1, | 
					
						
							|  |  |  | 	5, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	65535, | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							|  |  |  | 	32, | 
					
						
							|  |  |  | 	114, | 
					
						
							|  |  |  | 	143, | 
					
						
							|  |  |  | 	144, | 
					
						
							|  |  |  | 	114, | 
					
						
							|  |  |  | 	227, | 
					
						
							|  |  |  | 	116, | 
					
						
							|  |  |  | 	117, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	28, | 
					
						
							|  |  |  | 	26, | 
					
						
							|  |  |  | 	31, | 
					
						
							|  |  |  | 	51, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	0, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	54000, 13500, | 
					
						
							|  |  |  | 	1, 18, 3, 1, 0, | 
					
						
							|  |  |  | 	0, 0, 1, 1, 2, | 
					
						
							|  |  |  | 	(3 << 14) | (1 << 12) | (599 << 0), | 
					
						
							|  |  |  | 	(0 << 25) | 0, | 
					
						
							|  |  |  | 	20199727, | 
					
						
							|  |  |  | 	12000000, | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int dib8090_get_adc_power(struct dvb_frontend *fe) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	return dib8000_get_adc_power(fe, 1); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | static void dib8090_agc_control(struct dvb_frontend *fe, u8 restart) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	deb_info("AGC control callback: %i\n", restart); | 
					
						
							|  |  |  | 	dib0090_dcc_freq(fe, restart); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (restart == 0) /* before AGC startup */ | 
					
						
							|  |  |  | 		dib0090_set_dc_servo(fe, 1); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | static struct dib8000_config dib809x_dib8000_config[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 	.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.agc_config_count = 2, | 
					
						
							|  |  |  | 	.agc = dib8090_agc_config, | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 	.agc_control = dib8090_agc_control, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	.pll = &dib8090_pll_config_12mhz, | 
					
						
							|  |  |  | 	.tuner_is_baseband = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 	.gpio_val = DIB8000_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 	.gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.hostbus_diversity = 1, | 
					
						
							|  |  |  | 	.div_cfg = 0x31, | 
					
						
							|  |  |  | 	.output_mode = OUTMODE_MPEG2_FIFO, | 
					
						
							|  |  |  | 	.drives = 0x2d98, | 
					
						
							|  |  |  | 	.diversity_delay = 48, | 
					
						
							|  |  |  | 	.refclksel = 3, | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	}, { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.agc_config_count = 2, | 
					
						
							|  |  |  | 	.agc = dib8090_agc_config, | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 	.agc_control = dib8090_agc_control, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	.pll = &dib8090_pll_config_12mhz, | 
					
						
							|  |  |  | 	.tuner_is_baseband = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 	.gpio_val = DIB8000_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 	.gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.hostbus_diversity = 1, | 
					
						
							|  |  |  | 	.div_cfg = 0x31, | 
					
						
							|  |  |  | 	.output_mode = OUTMODE_DIVERSITY, | 
					
						
							|  |  |  | 	.drives = 0x2d08, | 
					
						
							|  |  |  | 	.diversity_delay = 1, | 
					
						
							|  |  |  | 	.refclksel = 3, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib0090_wbd_slope dib8090_wbd_table[] = { | 
					
						
							|  |  |  | 	/* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */ | 
					
						
							|  |  |  | 	{ 120,     0, 500,  0,   500, 4 }, /* CBAND */ | 
					
						
							|  |  |  | 	{ 170,     0, 450,  0,   450, 4 }, /* CBAND */ | 
					
						
							|  |  |  | 	{ 380,    48, 373, 28,   259, 6 }, /* VHF */ | 
					
						
							|  |  |  | 	{ 860,    34, 700, 36,   616, 6 }, /* high UHF */ | 
					
						
							|  |  |  | 	{ 0xFFFF, 34, 700, 36,   616, 6 }, /* default */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib0090_config dib809x_dib0090_config = { | 
					
						
							|  |  |  | 	.io.pll_bypass = 1, | 
					
						
							|  |  |  | 	.io.pll_range = 1, | 
					
						
							|  |  |  | 	.io.pll_prediv = 1, | 
					
						
							|  |  |  | 	.io.pll_loopdiv = 20, | 
					
						
							|  |  |  | 	.io.adc_clock_ratio = 8, | 
					
						
							|  |  |  | 	.io.pll_int_loop_filt = 0, | 
					
						
							|  |  |  | 	.io.clock_khz = 12000, | 
					
						
							|  |  |  | 	.reset = dib80xx_tuner_reset, | 
					
						
							|  |  |  | 	.sleep = dib80xx_tuner_sleep, | 
					
						
							|  |  |  | 	.clkouttobamse = 1, | 
					
						
							|  |  |  | 	.analog_output = 1, | 
					
						
							|  |  |  | 	.i2c_address = DEFAULT_DIB0090_I2C_ADDRESS, | 
					
						
							|  |  |  | 	.use_pwm_agc = 1, | 
					
						
							|  |  |  | 	.clkoutdrive = 1, | 
					
						
							|  |  |  | 	.get_adc_power = dib8090_get_adc_power, | 
					
						
							|  |  |  | 	.freq_offset_khz_uhf = -63, | 
					
						
							|  |  |  | 	.freq_offset_khz_vhf = -143, | 
					
						
							|  |  |  | 	.wbd = dib8090_wbd_table, | 
					
						
							|  |  |  | 	.fref_clock_ratio = 6, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | static u8 dib8090_compute_pll_parameters(struct dvb_frontend *fe) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	u8 optimal_pll_ratio = 20; | 
					
						
							|  |  |  | 	u32 freq_adc, ratio, rest, max = 0; | 
					
						
							|  |  |  | 	u8 pll_ratio; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for (pll_ratio = 17; pll_ratio <= 20; pll_ratio++) { | 
					
						
							|  |  |  | 		freq_adc = 12 * pll_ratio * (1 << 8) / 16; | 
					
						
							|  |  |  | 		ratio = ((fe->dtv_property_cache.frequency / 1000) * (1 << 8) / 1000) / freq_adc; | 
					
						
							|  |  |  | 		rest = ((fe->dtv_property_cache.frequency / 1000) * (1 << 8) / 1000) - ratio * freq_adc; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if (rest > freq_adc / 2) | 
					
						
							|  |  |  | 			rest = freq_adc - rest; | 
					
						
							|  |  |  | 		deb_info("PLL ratio=%i rest=%i\n", pll_ratio, rest); | 
					
						
							|  |  |  | 		if ((rest > max) && (rest > 717)) { | 
					
						
							|  |  |  | 			optimal_pll_ratio = pll_ratio; | 
					
						
							|  |  |  | 			max = rest; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	deb_info("optimal PLL ratio=%i\n", optimal_pll_ratio); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return optimal_pll_ratio; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-24 12:24:33 -03:00
										 |  |  | static int dib8096_set_param_override(struct dvb_frontend *fe) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct dvb_usb_adapter *adap = fe->dvb->priv; | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *state = adap->priv; | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 	u8 pll_ratio, band = BAND_OF_FREQUENCY(fe->dtv_property_cache.frequency / 1000); | 
					
						
							|  |  |  | 	u16 target, ltgain, rf_gain_limit; | 
					
						
							|  |  |  | 	u32 timf; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	int ret = 0; | 
					
						
							|  |  |  | 	enum frontend_tune_state tune_state = CT_SHUTDOWN; | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	switch (band) { | 
					
						
							|  |  |  | 	default: | 
					
						
							|  |  |  | 			deb_info("Warning : Rf frequency  (%iHz) is not in the supported range, using VHF switch ", fe->dtv_property_cache.frequency); | 
					
						
							|  |  |  | 	case BAND_VHF: | 
					
						
							|  |  |  | 			dib8000_set_gpio(fe, 3, 0, 1); | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 	case BAND_UHF: | 
					
						
							|  |  |  | 			dib8000_set_gpio(fe, 3, 0, 0); | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-24 12:24:33 -03:00
										 |  |  | 	ret = state->set_param_save(fe); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	if (ret < 0) | 
					
						
							|  |  |  | 		return ret; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 	if (fe->dtv_property_cache.bandwidth_hz != 6000000) { | 
					
						
							|  |  |  | 		deb_info("only 6MHz bandwidth is supported\n"); | 
					
						
							|  |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** Update PLL if needed ratio **/ | 
					
						
							|  |  |  | 	dib8000_update_pll(fe, &dib8090_pll_config_12mhz, fe->dtv_property_cache.bandwidth_hz / 1000, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/** Get optimize PLL ratio to remove spurious **/ | 
					
						
							|  |  |  | 	pll_ratio = dib8090_compute_pll_parameters(fe); | 
					
						
							|  |  |  | 	if (pll_ratio == 17) | 
					
						
							|  |  |  | 		timf = 21387946; | 
					
						
							|  |  |  | 	else if (pll_ratio == 18) | 
					
						
							|  |  |  | 		timf = 20199727; | 
					
						
							|  |  |  | 	else if (pll_ratio == 19) | 
					
						
							|  |  |  | 		timf = 19136583; | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		timf = 18179756; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 	/** Update ratio **/ | 
					
						
							|  |  |  | 	dib8000_update_pll(fe, &dib8090_pll_config_12mhz, fe->dtv_property_cache.bandwidth_hz / 1000, pll_ratio); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib8000_ctrl_timf(fe, DEMOD_TIMF_SET, timf); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (band != BAND_CBAND) { | 
					
						
							|  |  |  | 		/* dib0090_get_wbd_target is returning any possible temperature compensated wbd-target */ | 
					
						
							|  |  |  | 		target = (dib0090_get_wbd_target(fe) * 8 * 18 / 33 + 1) / 2; | 
					
						
							|  |  |  | 		dib8000_set_wbd_ref(fe, target); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (band == BAND_CBAND) { | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		deb_info("tuning in CBAND - soft-AGC startup\n"); | 
					
						
							|  |  |  | 		dib0090_set_tune_state(fe, CT_AGC_START); | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		do { | 
					
						
							|  |  |  | 			ret = dib0090_gain_control(fe); | 
					
						
							|  |  |  | 			msleep(ret); | 
					
						
							|  |  |  | 			tune_state = dib0090_get_tune_state(fe); | 
					
						
							|  |  |  | 			if (tune_state == CT_AGC_STEP_0) | 
					
						
							|  |  |  | 				dib8000_set_gpio(fe, 6, 0, 1); | 
					
						
							|  |  |  | 			else if (tune_state == CT_AGC_STEP_1) { | 
					
						
							|  |  |  | 				dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, <gain); | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 				if (rf_gain_limit < 2000) /* activate the external attenuator in case of very high input power */ | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 					dib8000_set_gpio(fe, 6, 0, 0); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} while (tune_state < CT_AGC_STOP); | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		deb_info("switching to PWM AGC\n"); | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		dib0090_pwm_gain_reset(fe); | 
					
						
							|  |  |  | 		dib8000_pwm_agc_reset(fe); | 
					
						
							|  |  |  | 		dib8000_set_tune_state(fe, CT_DEMOD_START); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	} else { | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 		/* for everything else than CBAND we are using standard AGC */ | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		deb_info("not tuning in CBAND - standard AGC startup\n"); | 
					
						
							|  |  |  | 		dib0090_pwm_gain_reset(fe); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int dib809x_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *st = adap->priv; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int stk809x_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_ctrl_clock(adap->dev, 72, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-10 05:17:18 -03:00
										 |  |  | 	dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80, 0); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ?  -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *st = adap->priv; | 
					
						
							|  |  |  | 	struct i2c_adapter *tun_i2c; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	struct dvb_frontend *fe_slave  = dib8000_get_slave_frontend(adap->fe_adap[0].fe, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (fe_slave) { | 
					
						
							|  |  |  | 		tun_i2c = dib8000_get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1); | 
					
						
							|  |  |  | 		if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL) | 
					
						
							|  |  |  | 			return -ENODEV; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		fe_slave->dvb = adap->fe_adap[0].fe->dvb; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	tun_i2c = dib8000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); | 
					
						
							|  |  |  | 	if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dvb_frontend *fe_slave; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(1000); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_ctrl_clock(adap->dev, 72, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-10 05:17:18 -03:00
										 |  |  | 	dib8000_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80, 0); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]); | 
					
						
							|  |  |  | 	if (adap->fe_adap[0].fe == NULL) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	fe_slave = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]); | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	dib8000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return fe_slave == NULL ?  -ENODEV : 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-10 05:28:38 -03:00
										 |  |  | /* TFE8096P */ | 
					
						
							|  |  |  | static struct dibx000_agc_config dib8096p_agc_config[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.band_caps		= BAND_UHF, | 
					
						
							|  |  |  | 		/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
 | 
					
						
							|  |  |  | 		   P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, | 
					
						
							|  |  |  | 		   P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, | 
					
						
							|  |  |  | 		   P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, | 
					
						
							|  |  |  | 		   P_agc_write=0 */ | 
					
						
							|  |  |  | 		.setup			= (0 << 15) | (0 << 14) | (5 << 11) | 
					
						
							|  |  |  | 			| (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | 
					
						
							|  |  |  | 			| (0 << 4) | (5 << 1) | (0 << 0), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.inv_gain		= 684, | 
					
						
							|  |  |  | 		.time_stabiliz	= 10, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.alpha_level	= 0, | 
					
						
							|  |  |  | 		.thlock			= 118, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.wbd_inv		= 0, | 
					
						
							|  |  |  | 		.wbd_ref		= 1200, | 
					
						
							|  |  |  | 		.wbd_sel		= 3, | 
					
						
							|  |  |  | 		.wbd_alpha		= 5, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.agc1_max		= 65535, | 
					
						
							|  |  |  | 		.agc1_min		= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.agc2_max		= 32767, | 
					
						
							|  |  |  | 		.agc2_min		= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.agc1_pt1		= 0, | 
					
						
							|  |  |  | 		.agc1_pt2		= 0, | 
					
						
							|  |  |  | 		.agc1_pt3		= 105, | 
					
						
							|  |  |  | 		.agc1_slope1	= 0, | 
					
						
							|  |  |  | 		.agc1_slope2	= 156, | 
					
						
							|  |  |  | 		.agc2_pt1		= 105, | 
					
						
							|  |  |  | 		.agc2_pt2		= 255, | 
					
						
							|  |  |  | 		.agc2_slope1	= 54, | 
					
						
							|  |  |  | 		.agc2_slope2	= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.alpha_mant		= 28, | 
					
						
							|  |  |  | 		.alpha_exp		= 26, | 
					
						
							|  |  |  | 		.beta_mant		= 31, | 
					
						
							|  |  |  | 		.beta_exp		= 51, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.perform_agc_softsplit = 0, | 
					
						
							|  |  |  | 	} , { | 
					
						
							|  |  |  | 		.band_caps		= BAND_FM | BAND_VHF | BAND_CBAND, | 
					
						
							|  |  |  | 		/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
 | 
					
						
							|  |  |  | 		   P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, | 
					
						
							|  |  |  | 		   P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, | 
					
						
							|  |  |  | 		   P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, | 
					
						
							|  |  |  | 		   P_agc_write=0 */ | 
					
						
							|  |  |  | 		.setup			= (0 << 15) | (0 << 14) | (5 << 11) | 
					
						
							|  |  |  | 			| (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | 
					
						
							|  |  |  | 			| (0 << 4) | (5 << 1) | (0 << 0), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.inv_gain		= 732, | 
					
						
							|  |  |  | 		.time_stabiliz  = 10, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.alpha_level	= 0, | 
					
						
							|  |  |  | 		.thlock			= 118, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.wbd_inv		= 0, | 
					
						
							|  |  |  | 		.wbd_ref		= 1200, | 
					
						
							|  |  |  | 		.wbd_sel		= 3, | 
					
						
							|  |  |  | 		.wbd_alpha		= 5, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.agc1_max		= 65535, | 
					
						
							|  |  |  | 		.agc1_min		= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.agc2_max		= 32767, | 
					
						
							|  |  |  | 		.agc2_min		= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.agc1_pt1		= 0, | 
					
						
							|  |  |  | 		.agc1_pt2		= 0, | 
					
						
							|  |  |  | 		.agc1_pt3		= 98, | 
					
						
							|  |  |  | 		.agc1_slope1	= 0, | 
					
						
							|  |  |  | 		.agc1_slope2	= 167, | 
					
						
							|  |  |  | 		.agc2_pt1		= 98, | 
					
						
							|  |  |  | 		.agc2_pt2		= 255, | 
					
						
							|  |  |  | 		.agc2_slope1	= 52, | 
					
						
							|  |  |  | 		.agc2_slope2	= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.alpha_mant		= 28, | 
					
						
							|  |  |  | 		.alpha_exp		= 26, | 
					
						
							|  |  |  | 		.beta_mant		= 31, | 
					
						
							|  |  |  | 		.beta_exp		= 51, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.perform_agc_softsplit = 0, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dibx000_bandwidth_config dib8096p_clock_config_12_mhz = { | 
					
						
							|  |  |  | 	108000, 13500, | 
					
						
							|  |  |  | 	1, 9, 1, 0, 0, | 
					
						
							|  |  |  | 	0, 0, 0, 0, 2, | 
					
						
							|  |  |  | 	(3 << 14) | (1 << 12) | (524 << 0), | 
					
						
							|  |  |  | 	(0 << 25) | 0, | 
					
						
							|  |  |  | 	20199729, | 
					
						
							|  |  |  | 	12000000, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib8000_config tfe8096p_dib8000_config = { | 
					
						
							|  |  |  | 	.output_mpeg2_in_188_bytes	= 1, | 
					
						
							|  |  |  | 	.hostbus_diversity			= 1, | 
					
						
							|  |  |  | 	.update_lna					= NULL, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.agc_config_count			= 2, | 
					
						
							|  |  |  | 	.agc						= dib8096p_agc_config, | 
					
						
							|  |  |  | 	.pll						= &dib8096p_clock_config_12_mhz, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.gpio_dir					= DIB8000_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 	.gpio_val					= DIB8000_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 	.gpio_pwm_pos				= DIB8000_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.agc_control				= NULL, | 
					
						
							|  |  |  | 	.diversity_delay			= 48, | 
					
						
							|  |  |  | 	.output_mode				= OUTMODE_MPEG2_FIFO, | 
					
						
							|  |  |  | 	.enMpegOutput				= 1, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib0090_wbd_slope dib8096p_wbd_table[] = { | 
					
						
							|  |  |  | 	{ 380, 81, 850, 64, 540, 4}, | 
					
						
							|  |  |  | 	{ 860, 51, 866, 21, 375, 4}, | 
					
						
							|  |  |  | 	{1700, 0, 250, 0, 100, 6}, | 
					
						
							|  |  |  | 	{2600, 0, 250, 0, 100, 6}, | 
					
						
							|  |  |  | 	{ 0xFFFF, 0, 0, 0, 0, 0}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static const struct dib0090_config tfe8096p_dib0090_config = { | 
					
						
							|  |  |  | 	.io.clock_khz			= 12000, | 
					
						
							|  |  |  | 	.io.pll_bypass			= 0, | 
					
						
							|  |  |  | 	.io.pll_range			= 0, | 
					
						
							|  |  |  | 	.io.pll_prediv			= 3, | 
					
						
							|  |  |  | 	.io.pll_loopdiv			= 6, | 
					
						
							|  |  |  | 	.io.adc_clock_ratio		= 0, | 
					
						
							|  |  |  | 	.io.pll_int_loop_filt	= 0, | 
					
						
							|  |  |  | 	.reset					= dib8096p_tuner_sleep, | 
					
						
							|  |  |  | 	.sleep					= dib8096p_tuner_sleep, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.freq_offset_khz_uhf	= -143, | 
					
						
							|  |  |  | 	.freq_offset_khz_vhf	= -143, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.get_adc_power			= dib8090_get_adc_power, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.clkouttobamse			= 1, | 
					
						
							|  |  |  | 	.analog_output			= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.wbd_vhf_offset			= 0, | 
					
						
							|  |  |  | 	.wbd_cband_offset		= 0, | 
					
						
							|  |  |  | 	.use_pwm_agc			= 1, | 
					
						
							|  |  |  | 	.clkoutdrive			= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.fref_clock_ratio		= 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.wbd					= dib8096p_wbd_table, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.ls_cfg_pad_drv			= 0, | 
					
						
							|  |  |  | 	.data_tx_drv			= 0, | 
					
						
							|  |  |  | 	.low_if					= NULL, | 
					
						
							|  |  |  | 	.in_soc					= 1, | 
					
						
							|  |  |  | 	.force_cband_input		= 0, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct dibx090p_adc { | 
					
						
							|  |  |  | 	u32 freq;			/* RF freq MHz */ | 
					
						
							|  |  |  | 	u32 timf;			/* New Timf */ | 
					
						
							|  |  |  | 	u32 pll_loopdiv;	/* New prediv */ | 
					
						
							|  |  |  | 	u32 pll_prediv;		/* New loopdiv */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | struct dibx090p_best_adc { | 
					
						
							|  |  |  | 	u32 timf; | 
					
						
							|  |  |  | 	u32 pll_loopdiv; | 
					
						
							|  |  |  | 	u32 pll_prediv; | 
					
						
							| 
									
										
										
										
											2011-08-10 05:28:38 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | static int dib8096p_get_best_sampling(struct dvb_frontend *fe, struct dibx090p_best_adc *adc) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1; | 
					
						
							|  |  |  | 	u16 xtal = 12000; | 
					
						
							|  |  |  | 	u16 fcp_min = 1900;  /* PLL, Minimum Frequency of phase comparator (KHz) */ | 
					
						
							|  |  |  | 	u16 fcp_max = 20000; /* PLL, Maximum Frequency of phase comparator (KHz) */ | 
					
						
							|  |  |  | 	u32 fmem_max = 140000; /* 140MHz max SDRAM freq */ | 
					
						
							|  |  |  | 	u32 fdem_min = 66000; | 
					
						
							|  |  |  | 	u32 fcp = 0, fs = 0, fdem = 0, fmem = 0; | 
					
						
							|  |  |  | 	u32 harmonic_id = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	adc->timf = 0; | 
					
						
							|  |  |  | 	adc->pll_loopdiv = loopdiv; | 
					
						
							|  |  |  | 	adc->pll_prediv = prediv; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	deb_info("bandwidth = %d", fe->dtv_property_cache.bandwidth_hz); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Find Min and Max prediv */ | 
					
						
							|  |  |  | 	while ((xtal / max_prediv) >= fcp_min) | 
					
						
							|  |  |  | 		max_prediv++; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	max_prediv--; | 
					
						
							|  |  |  | 	min_prediv = max_prediv; | 
					
						
							|  |  |  | 	while ((xtal / min_prediv) <= fcp_max) { | 
					
						
							|  |  |  | 		min_prediv--; | 
					
						
							|  |  |  | 		if (min_prediv == 1) | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	min_prediv = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for (prediv = min_prediv; prediv < max_prediv; prediv++) { | 
					
						
							|  |  |  | 		fcp = xtal / prediv; | 
					
						
							|  |  |  | 		if (fcp > fcp_min && fcp < fcp_max) { | 
					
						
							|  |  |  | 			for (loopdiv = 1; loopdiv < 64; loopdiv++) { | 
					
						
							|  |  |  | 				fmem = ((xtal/prediv) * loopdiv); | 
					
						
							|  |  |  | 				fdem = fmem / 2; | 
					
						
							|  |  |  | 				fs   = fdem / 4; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				/* test min/max system restrictions */ | 
					
						
							|  |  |  | 				if ((fdem >= fdem_min) && (fmem <= fmem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz / 1000)) { | 
					
						
							|  |  |  | 					spur = 0; | 
					
						
							|  |  |  | 					/* test fs harmonics positions */ | 
					
						
							|  |  |  | 					for (harmonic_id = (fe->dtv_property_cache.frequency / (1000 * fs));  harmonic_id <= ((fe->dtv_property_cache.frequency / (1000 * fs)) + 1); harmonic_id++) { | 
					
						
							|  |  |  | 						if (((fs * harmonic_id) >= (fe->dtv_property_cache.frequency / 1000 - (fe->dtv_property_cache.bandwidth_hz / 2000))) &&  ((fs * harmonic_id) <= (fe->dtv_property_cache.frequency / 1000 + (fe->dtv_property_cache.bandwidth_hz / 2000)))) { | 
					
						
							|  |  |  | 							spur = 1; | 
					
						
							|  |  |  | 							break; | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					if (!spur) { | 
					
						
							|  |  |  | 						adc->pll_loopdiv = loopdiv; | 
					
						
							|  |  |  | 						adc->pll_prediv = prediv; | 
					
						
							|  |  |  | 						adc->timf = (4260880253U / fdem) * (1 << 8); | 
					
						
							|  |  |  | 						adc->timf += ((4260880253U % fdem) << 8) / fdem; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 						deb_info("RF %6d; BW %6d; Xtal %6d; Fmem %6d; Fdem %6d; Fs %6d; Prediv %2d; Loopdiv %2d; Timf %8d;", fe->dtv_property_cache.frequency, fe->dtv_property_cache.bandwidth_hz, xtal, fmem, fdem, fs, prediv, loopdiv, adc->timf); | 
					
						
							|  |  |  | 						break; | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (!spur) | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0) | 
					
						
							|  |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-24 12:24:33 -03:00
										 |  |  | static int dib8096p_agc_startup(struct dvb_frontend *fe) | 
					
						
							| 
									
										
										
										
											2011-08-10 05:28:38 -03:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct dvb_usb_adapter *adap = fe->dvb->priv; | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *state = adap->priv; | 
					
						
							|  |  |  | 	struct dibx000_bandwidth_config pll; | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 	struct dibx090p_best_adc adc; | 
					
						
							| 
									
										
										
										
											2011-08-10 05:28:38 -03:00
										 |  |  | 	u16 target; | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 	int ret; | 
					
						
							| 
									
										
										
										
											2011-08-10 05:28:38 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-24 12:24:33 -03:00
										 |  |  | 	ret = state->set_param_save(fe); | 
					
						
							| 
									
										
										
										
											2011-08-10 05:28:38 -03:00
										 |  |  | 	if (ret < 0) | 
					
						
							|  |  |  | 		return ret; | 
					
						
							|  |  |  | 	memset(&pll, 0, sizeof(struct dibx000_bandwidth_config)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0090_pwm_gain_reset(fe); | 
					
						
							|  |  |  | 	/* dib0090_get_wbd_target is returning any possible
 | 
					
						
							|  |  |  | 	   temperature compensated wbd-target */ | 
					
						
							|  |  |  | 	target = (dib0090_get_wbd_target(fe) * 8  + 1) / 2; | 
					
						
							|  |  |  | 	dib8000_set_wbd_ref(fe, target); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 	if (dib8096p_get_best_sampling(fe, &adc) == 0) { | 
					
						
							|  |  |  | 		pll.pll_ratio  = adc.pll_loopdiv; | 
					
						
							|  |  |  | 		pll.pll_prediv = adc.pll_prediv; | 
					
						
							| 
									
										
										
										
											2011-08-10 05:28:38 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 		dib0700_set_i2c_speed(adap->dev, 200); | 
					
						
							| 
									
										
										
										
											2013-04-22 12:45:52 -03:00
										 |  |  | 		dib8000_update_pll(fe, &pll, fe->dtv_property_cache.bandwidth_hz / 1000, 0); | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 		dib8000_ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf); | 
					
						
							|  |  |  | 		dib0700_set_i2c_speed(adap->dev, 1000); | 
					
						
							| 
									
										
										
										
											2011-08-10 05:28:38 -03:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int tfe8096p_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 	struct dib0700_state *st = adap->dev->priv; | 
					
						
							|  |  |  | 	u32 fw_version; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL); | 
					
						
							|  |  |  | 	if (fw_version >= 0x10200) | 
					
						
							|  |  |  | 		st->fw_use_new_i2c_api = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-10 05:28:38 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(20); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_ctrl_clock(adap->dev, 72, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	msleep(20); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(20); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib8000_attach, | 
					
						
							|  |  |  | 			&adap->dev->i2c_adap, 0x80, &tfe8096p_dib8000_config); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return adap->fe_adap[0].fe == NULL ?  -ENODEV : 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int tfe8096p_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *st = adap->priv; | 
					
						
							|  |  |  | 	struct i2c_adapter *tun_i2c = dib8096p_get_i2c_tuner(adap->fe_adap[0].fe); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, | 
					
						
							|  |  |  | 				&tfe8096p_dib0090_config) == NULL) | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib8000_set_gpio(adap->fe_adap[0].fe, 8, 0, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096p_agc_startup; | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | /* STK9090M */ | 
					
						
							|  |  |  | static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return dib9000_fw_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return dib9000_fw_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return dib9000_set_gpio(fe, 5, 0, !onoff); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return dib9000_set_gpio(fe, 0, 0, onoff); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 }; | 
					
						
							|  |  |  | 	u8 rb[2]; | 
					
						
							|  |  |  | 	struct i2c_msg msg[2] = { | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		{.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2}, | 
					
						
							|  |  |  | 		{.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2}, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 	u8 index_data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dibx000_i2c_set_speed(i2c, 250); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (i2c_transfer(i2c, msg, 2) != 2) | 
					
						
							|  |  |  | 		return -EIO; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	switch (rb[0] << 8 | rb[1]) { | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	case 0: | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 			deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n"); | 
					
						
							|  |  |  | 			return -EIO; | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	case 1: | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 			deb_info("Found DiB0170 rev2"); | 
					
						
							|  |  |  | 			break; | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	case 2: | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 			deb_info("Found DiB0190 rev2"); | 
					
						
							|  |  |  | 			break; | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	default: | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 			deb_info("DiB01x0 not found"); | 
					
						
							|  |  |  | 			return -EIO; | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	for (index_data = 0; index_data < len; index_data += 2) { | 
					
						
							|  |  |  | 		wb[2] = (data[index_data + 1] >> 8) & 0xff; | 
					
						
							|  |  |  | 		wb[3] = (data[index_data + 1]) & 0xff; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if (data[index_data] == 0) { | 
					
						
							|  |  |  | 			wb[0] = (data[index_data] >> 8) & 0xff; | 
					
						
							|  |  |  | 			wb[1] = (data[index_data]) & 0xff; | 
					
						
							|  |  |  | 			msg[0].len = 2; | 
					
						
							|  |  |  | 			if (i2c_transfer(i2c, msg, 2) != 2) | 
					
						
							|  |  |  | 				return -EIO; | 
					
						
							|  |  |  | 			wb[2] |= rb[0]; | 
					
						
							|  |  |  | 			wb[3] |= rb[1] & ~(3 << 4); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		wb[0] = (data[index_data] >> 8)&0xff; | 
					
						
							|  |  |  | 		wb[1] = (data[index_data])&0xff; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		msg[0].len = 4; | 
					
						
							|  |  |  | 		if (i2c_transfer(i2c, &msg[0], 1) != 1) | 
					
						
							|  |  |  | 			return -EIO; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib9000_config stk9090m_config = { | 
					
						
							|  |  |  | 	.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 	.output_mode = OUTMODE_MPEG2_FIFO, | 
					
						
							|  |  |  | 	.vcxo_timer = 279620, | 
					
						
							|  |  |  | 	.timing_frequency = 20452225, | 
					
						
							|  |  |  | 	.demod_clock_khz = 60000, | 
					
						
							|  |  |  | 	.xtal_clock_khz = 30000, | 
					
						
							|  |  |  | 	.if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0), | 
					
						
							|  |  |  | 	.subband = { | 
					
						
							|  |  |  | 		2, | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 			{ 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */ | 
					
						
							|  |  |  | 			{ 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */ | 
					
						
							|  |  |  | 			{ 0 }, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	.gpio_function = { | 
					
						
							|  |  |  | 		{ .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 }, | 
					
						
							|  |  |  | 		{ .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 }, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib9000_config nim9090md_config[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 		.output_mode = OUTMODE_MPEG2_FIFO, | 
					
						
							|  |  |  | 		.vcxo_timer = 279620, | 
					
						
							|  |  |  | 		.timing_frequency = 20452225, | 
					
						
							|  |  |  | 		.demod_clock_khz = 60000, | 
					
						
							|  |  |  | 		.xtal_clock_khz = 30000, | 
					
						
							|  |  |  | 		.if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0), | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 		.output_mode = OUTMODE_DIVERSITY, | 
					
						
							|  |  |  | 		.vcxo_timer = 279620, | 
					
						
							|  |  |  | 		.timing_frequency = 20452225, | 
					
						
							|  |  |  | 		.demod_clock_khz = 60000, | 
					
						
							|  |  |  | 		.xtal_clock_khz = 30000, | 
					
						
							|  |  |  | 		.if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0), | 
					
						
							|  |  |  | 		.subband = { | 
					
						
							|  |  |  | 			2, | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 				{ 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */ | 
					
						
							|  |  |  | 				{ 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */ | 
					
						
							|  |  |  | 				{ 0 }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		.gpio_function = { | 
					
						
							|  |  |  | 			{ .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 }, | 
					
						
							|  |  |  | 			{ .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 }, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib0090_config dib9090_dib0090_config = { | 
					
						
							|  |  |  | 	.io.pll_bypass = 0, | 
					
						
							|  |  |  | 	.io.pll_range = 1, | 
					
						
							|  |  |  | 	.io.pll_prediv = 1, | 
					
						
							|  |  |  | 	.io.pll_loopdiv = 8, | 
					
						
							|  |  |  | 	.io.adc_clock_ratio = 8, | 
					
						
							|  |  |  | 	.io.pll_int_loop_filt = 0, | 
					
						
							|  |  |  | 	.io.clock_khz = 30000, | 
					
						
							|  |  |  | 	.reset = dib90x0_tuner_reset, | 
					
						
							|  |  |  | 	.sleep = dib90x0_tuner_sleep, | 
					
						
							|  |  |  | 	.clkouttobamse = 0, | 
					
						
							|  |  |  | 	.analog_output = 0, | 
					
						
							|  |  |  | 	.use_pwm_agc = 0, | 
					
						
							|  |  |  | 	.clkoutdrive = 0, | 
					
						
							|  |  |  | 	.freq_offset_khz_uhf = 0, | 
					
						
							|  |  |  | 	.freq_offset_khz_vhf = 0, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib0090_config nim9090md_dib0090_config[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.io.pll_bypass = 0, | 
					
						
							|  |  |  | 		.io.pll_range = 1, | 
					
						
							|  |  |  | 		.io.pll_prediv = 1, | 
					
						
							|  |  |  | 		.io.pll_loopdiv = 8, | 
					
						
							|  |  |  | 		.io.adc_clock_ratio = 8, | 
					
						
							|  |  |  | 		.io.pll_int_loop_filt = 0, | 
					
						
							|  |  |  | 		.io.clock_khz = 30000, | 
					
						
							|  |  |  | 		.reset = dib90x0_tuner_reset, | 
					
						
							|  |  |  | 		.sleep = dib90x0_tuner_sleep, | 
					
						
							|  |  |  | 		.clkouttobamse = 1, | 
					
						
							|  |  |  | 		.analog_output = 0, | 
					
						
							|  |  |  | 		.use_pwm_agc = 0, | 
					
						
							|  |  |  | 		.clkoutdrive = 0, | 
					
						
							|  |  |  | 		.freq_offset_khz_uhf = 0, | 
					
						
							|  |  |  | 		.freq_offset_khz_vhf = 0, | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	}, { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		.io.pll_bypass = 0, | 
					
						
							|  |  |  | 		.io.pll_range = 1, | 
					
						
							|  |  |  | 		.io.pll_prediv = 1, | 
					
						
							|  |  |  | 		.io.pll_loopdiv = 8, | 
					
						
							|  |  |  | 		.io.adc_clock_ratio = 8, | 
					
						
							|  |  |  | 		.io.pll_int_loop_filt = 0, | 
					
						
							|  |  |  | 		.io.clock_khz = 30000, | 
					
						
							|  |  |  | 		.reset = dib90x0_tuner_reset, | 
					
						
							|  |  |  | 		.sleep = dib90x0_tuner_sleep, | 
					
						
							|  |  |  | 		.clkouttobamse = 0, | 
					
						
							|  |  |  | 		.analog_output = 0, | 
					
						
							|  |  |  | 		.use_pwm_agc = 0, | 
					
						
							|  |  |  | 		.clkoutdrive = 0, | 
					
						
							|  |  |  | 		.freq_offset_khz_uhf = 0, | 
					
						
							|  |  |  | 		.freq_offset_khz_vhf = 0, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *state = adap->priv; | 
					
						
							|  |  |  | 	struct dib0700_state *st = adap->dev->priv; | 
					
						
							|  |  |  | 	u32 fw_version; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Make use of the new i2c functions from FW 1.20 */ | 
					
						
							|  |  |  | 	dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL); | 
					
						
							|  |  |  | 	if (fw_version >= 0x10200) | 
					
						
							|  |  |  | 		st->fw_use_new_i2c_api = 1; | 
					
						
							|  |  |  | 	dib0700_set_i2c_speed(adap->dev, 340); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_ctrl_clock(adap->dev, 72, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) { | 
					
						
							|  |  |  | 		deb_info("%s: Upload failed. (file not found?)\n", __func__); | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size; | 
					
						
							|  |  |  | 	stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ?  -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int dib9090_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *state = adap->priv; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	u16 data_dib190[10] = { | 
					
						
							|  |  |  | 		1, 0x1374, | 
					
						
							|  |  |  | 		2, 0x01a2, | 
					
						
							|  |  |  | 		7, 0x0020, | 
					
						
							|  |  |  | 		0, 0x00ef, | 
					
						
							|  |  |  | 		8, 0x0486, | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return -ENODEV; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0) | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							| 
									
										
										
										
											2011-08-29 10:58:47 -03:00
										 |  |  | 	dib0700_set_i2c_speed(adap->dev, 1500); | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return -ENODEV; | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	release_firmware(state->frontend_firmware); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *state = adap->priv; | 
					
						
							|  |  |  | 	struct dib0700_state *st = adap->dev->priv; | 
					
						
							|  |  |  | 	struct i2c_adapter *i2c; | 
					
						
							|  |  |  | 	struct dvb_frontend *fe_slave; | 
					
						
							|  |  |  | 	u32 fw_version; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Make use of the new i2c functions from FW 1.20 */ | 
					
						
							|  |  |  | 	dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL); | 
					
						
							|  |  |  | 	if (fw_version >= 0x10200) | 
					
						
							|  |  |  | 		st->fw_use_new_i2c_api = 1; | 
					
						
							|  |  |  | 	dib0700_set_i2c_speed(adap->dev, 340); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_ctrl_clock(adap->dev, 72, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) { | 
					
						
							|  |  |  | 		deb_info("%s: Upload failed. (file not found?)\n", __func__); | 
					
						
							|  |  |  | 		return -EIO; | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size; | 
					
						
							|  |  |  | 	nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data; | 
					
						
							|  |  |  | 	nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size; | 
					
						
							|  |  |  | 	nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80); | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	if (adap->fe_adap[0].fe == NULL) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]); | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	dib9000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return fe_slave == NULL ?  -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *state = adap->priv; | 
					
						
							|  |  |  | 	struct i2c_adapter *i2c; | 
					
						
							|  |  |  | 	struct dvb_frontend *fe_slave; | 
					
						
							|  |  |  | 	u16 data_dib190[10] = { | 
					
						
							|  |  |  | 		1, 0x5374, | 
					
						
							|  |  |  | 		2, 0x01ae, | 
					
						
							|  |  |  | 		7, 0x0020, | 
					
						
							|  |  |  | 		0, 0x00ef, | 
					
						
							|  |  |  | 		8, 0x0406, | 
					
						
							|  |  |  | 	}; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe); | 
					
						
							|  |  |  | 	if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return -ENODEV; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0) | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							| 
									
										
										
										
											2011-08-29 10:58:47 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_set_i2c_speed(adap->dev, 1500); | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	fe_slave = dib9000_get_slave_frontend(adap->fe_adap[0].fe, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	if (fe_slave != NULL) { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		i2c = dib9000_get_component_bus_interface(adap->fe_adap[0].fe); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		dib9000_set_i2c_adapter(fe_slave, i2c); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		i2c = dib9000_get_tuner_interface(fe_slave); | 
					
						
							|  |  |  | 		if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL) | 
					
						
							|  |  |  | 			return -ENODEV; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		fe_slave->dvb = adap->fe_adap[0].fe->dvb; | 
					
						
							| 
									
										
										
										
											2011-08-29 10:58:47 -03:00
										 |  |  | 		dib9000_fw_set_component_bus_speed(adap->fe_adap[0].fe, 1500); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		if (dib9000_firmware_post_pll_init(fe_slave) < 0) | 
					
						
							|  |  |  | 			return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	release_firmware(state->frontend_firmware); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* NIM7090 */ | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dibx090p_best_adc *adc) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | { | 
					
						
							|  |  |  | 	u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	u16 xtal = 12000; | 
					
						
							|  |  |  | 	u32 fcp_min = 1900;  /* PLL Minimum Frequency comparator KHz */ | 
					
						
							|  |  |  | 	u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */ | 
					
						
							|  |  |  | 	u32 fdem_max = 76000; | 
					
						
							|  |  |  | 	u32 fdem_min = 69500; | 
					
						
							|  |  |  | 	u32 fcp = 0, fs = 0, fdem = 0; | 
					
						
							|  |  |  | 	u32 harmonic_id = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	adc->pll_loopdiv = loopdiv; | 
					
						
							|  |  |  | 	adc->pll_prediv = prediv; | 
					
						
							|  |  |  | 	adc->timf = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Find Min and Max prediv */ | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	while ((xtal/max_prediv) >= fcp_min) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		max_prediv++; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	max_prediv--; | 
					
						
							|  |  |  | 	min_prediv = max_prediv; | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	while ((xtal/min_prediv) <= fcp_max) { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		min_prediv--; | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		if (min_prediv == 1) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 			break; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	min_prediv = 2; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	for (prediv = min_prediv ; prediv < max_prediv; prediv++) { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		fcp = xtal / prediv; | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		if (fcp > fcp_min && fcp < fcp_max) { | 
					
						
							|  |  |  | 			for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 				fdem = ((xtal/prediv) * loopdiv); | 
					
						
							|  |  |  | 				fs   = fdem / 4; | 
					
						
							|  |  |  | 				/* test min/max system restrictions */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 				if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 					spur = 0; | 
					
						
							|  |  |  | 					/* test fs harmonics positions */ | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 					for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ;  harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) { | 
					
						
							|  |  |  | 						if (((fs*harmonic_id) >= ((fe->dtv_property_cache.frequency/1000) - (fe->dtv_property_cache.bandwidth_hz/2000))) &&  ((fs*harmonic_id) <= ((fe->dtv_property_cache.frequency/1000) + (fe->dtv_property_cache.bandwidth_hz/2000)))) { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 							spur = 1; | 
					
						
							|  |  |  | 							break; | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 					if (!spur) { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 						adc->pll_loopdiv = loopdiv; | 
					
						
							|  |  |  | 						adc->pll_prediv = prediv; | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 						adc->timf = 2396745143UL/fdem*(1 << 9); | 
					
						
							|  |  |  | 						adc->timf += ((2396745143UL%fdem) << 9)/fdem; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 						deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf); | 
					
						
							|  |  |  | 						break; | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (!spur) | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return -EINVAL; | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	else | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-24 12:24:33 -03:00
										 |  |  | static int dib7090_agc_startup(struct dvb_frontend *fe) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct dvb_usb_adapter *adap = fe->dvb->priv; | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *state = adap->priv; | 
					
						
							|  |  |  | 	struct dibx000_bandwidth_config pll; | 
					
						
							|  |  |  | 	u16 target; | 
					
						
							| 
									
										
										
										
											2012-12-31 10:17:44 -03:00
										 |  |  | 	struct dibx090p_best_adc adc; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	int ret; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-24 12:24:33 -03:00
										 |  |  | 	ret = state->set_param_save(fe); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	if (ret < 0) | 
					
						
							|  |  |  | 		return ret; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	memset(&pll, 0, sizeof(struct dibx000_bandwidth_config)); | 
					
						
							|  |  |  | 	dib0090_pwm_gain_reset(fe); | 
					
						
							| 
									
										
										
										
											2011-08-05 13:49:33 -03:00
										 |  |  | 	target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib7000p_set_wbd_ref(fe, target); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	if (dib7090p_get_best_sampling(fe, &adc) == 0) { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		pll.pll_ratio  = adc.pll_loopdiv; | 
					
						
							|  |  |  | 		pll.pll_prediv = adc.pll_prediv; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		dib7000p_update_pll(fe, &pll); | 
					
						
							|  |  |  | 		dib7000p_ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-05 10:39:15 -03:00
										 |  |  | static int dib7090_agc_restart(struct dvb_frontend *fe, u8 restart) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	deb_info("AGC restart callback: %d", restart); | 
					
						
							|  |  |  | 	if (restart == 0) /* before AGC startup */ | 
					
						
							|  |  |  | 		dib0090_set_dc_servo(fe, 1); | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | static int tfe7790p_update_lna(struct dvb_frontend *fe, u16 agc_global) | 
					
						
							| 
									
										
										
										
											2011-08-05 13:49:33 -03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 	deb_info("update LNA: agc global=%i", agc_global); | 
					
						
							| 
									
										
										
										
											2011-08-05 13:49:33 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 	if (agc_global < 25000) { | 
					
						
							|  |  |  | 		dib7000p_set_gpio(fe, 8, 0, 0); | 
					
						
							|  |  |  | 		dib7000p_set_agc1_min(fe, 0); | 
					
						
							| 
									
										
										
										
											2011-08-05 13:49:33 -03:00
										 |  |  | 	} else { | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 		dib7000p_set_gpio(fe, 8, 0, 1); | 
					
						
							|  |  |  | 		dib7000p_set_agc1_min(fe, 32768); | 
					
						
							| 
									
										
										
										
											2011-08-05 13:49:33 -03:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | static struct dib0090_wbd_slope dib7090_wbd_table[] = { | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	{ 380,   81, 850, 64, 540,  4}, | 
					
						
							|  |  |  | 	{ 860,   51, 866, 21,  375, 4}, | 
					
						
							|  |  |  | 	{1700,    0, 250, 0,   100, 6}, | 
					
						
							|  |  |  | 	{2600,    0, 250, 0,   100, 6}, | 
					
						
							|  |  |  | 	{ 0xFFFF, 0,   0, 0,   0,   0}, | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-05 14:10:40 -03:00
										 |  |  | static struct dibx000_agc_config dib7090_agc_config[2] = { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 		.band_caps      = BAND_UHF, | 
					
						
							|  |  |  | 		/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
 | 
					
						
							|  |  |  | 		* P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */ | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.setup          = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.inv_gain       = 687, | 
					
						
							|  |  |  | 		.time_stabiliz  = 10, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.alpha_level    = 0, | 
					
						
							|  |  |  | 		.thlock         = 118, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.wbd_inv        = 0, | 
					
						
							|  |  |  | 		.wbd_ref        = 1200, | 
					
						
							|  |  |  | 		.wbd_sel        = 3, | 
					
						
							|  |  |  | 		.wbd_alpha      = 5, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.agc1_max       = 65535, | 
					
						
							| 
									
										
										
										
											2012-12-31 09:51:17 -03:00
										 |  |  | 		.agc1_min       = 32768, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.agc2_max       = 65535, | 
					
						
							|  |  |  | 		.agc2_min       = 0, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.agc1_pt1       = 0, | 
					
						
							|  |  |  | 		.agc1_pt2       = 32, | 
					
						
							|  |  |  | 		.agc1_pt3       = 114, | 
					
						
							|  |  |  | 		.agc1_slope1    = 143, | 
					
						
							|  |  |  | 		.agc1_slope2    = 144, | 
					
						
							|  |  |  | 		.agc2_pt1       = 114, | 
					
						
							|  |  |  | 		.agc2_pt2       = 227, | 
					
						
							|  |  |  | 		.agc2_slope1    = 116, | 
					
						
							|  |  |  | 		.agc2_slope2    = 117, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.alpha_mant     = 18, | 
					
						
							|  |  |  | 		.alpha_exp      = 0, | 
					
						
							|  |  |  | 		.beta_mant      = 20, | 
					
						
							|  |  |  | 		.beta_exp       = 59, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.perform_agc_softsplit = 0, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	} , { | 
					
						
							|  |  |  | 		.band_caps      = BAND_FM | BAND_VHF | BAND_CBAND, | 
					
						
							|  |  |  | 		/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
 | 
					
						
							|  |  |  | 		* P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */ | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.setup          = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.inv_gain       = 732, | 
					
						
							|  |  |  | 		.time_stabiliz  = 10, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.alpha_level    = 0, | 
					
						
							|  |  |  | 		.thlock         = 118, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.wbd_inv        = 0, | 
					
						
							|  |  |  | 		.wbd_ref        = 1200, | 
					
						
							|  |  |  | 		.wbd_sel        = 3, | 
					
						
							|  |  |  | 		.wbd_alpha      = 5, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.agc1_max       = 65535, | 
					
						
							|  |  |  | 		.agc1_min       = 0, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.agc2_max       = 65535, | 
					
						
							|  |  |  | 		.agc2_min       = 0, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.agc1_pt1       = 0, | 
					
						
							|  |  |  | 		.agc1_pt2       = 0, | 
					
						
							|  |  |  | 		.agc1_pt3       = 98, | 
					
						
							|  |  |  | 		.agc1_slope1    = 0, | 
					
						
							|  |  |  | 		.agc1_slope2    = 167, | 
					
						
							| 
									
										
										
										
											2011-04-03 12:28:08 -03:00
										 |  |  | 		.agc2_pt1       = 98, | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.agc2_pt2       = 255, | 
					
						
							|  |  |  | 		.agc2_slope1    = 104, | 
					
						
							|  |  |  | 		.agc2_slope2    = 0, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.alpha_mant     = 18, | 
					
						
							|  |  |  | 		.alpha_exp      = 0, | 
					
						
							|  |  |  | 		.beta_mant      = 20, | 
					
						
							|  |  |  | 		.beta_exp       = 59, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 		.perform_agc_softsplit = 0, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = { | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	60000, 15000, | 
					
						
							|  |  |  | 	1, 5, 0, 0, 0, | 
					
						
							|  |  |  | 	0, 0, 1, 1, 2, | 
					
						
							|  |  |  | 	(3 << 14) | (1 << 12) | (524 << 0), | 
					
						
							|  |  |  | 	(0 << 25) | 0, | 
					
						
							|  |  |  | 	20452225, | 
					
						
							|  |  |  | 	15000000, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct dib7000p_config nim7090_dib7000p_config = { | 
					
						
							|  |  |  | 	.output_mpeg2_in_188_bytes  = 1, | 
					
						
							|  |  |  | 	.hostbus_diversity			= 1, | 
					
						
							|  |  |  | 	.tuner_is_baseband			= 1, | 
					
						
							| 
									
										
										
										
											2012-12-31 09:51:17 -03:00
										 |  |  | 	.update_lna					= tfe7790p_update_lna, /* GPIO used is the same as TFE7790 */ | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	.agc_config_count			= 2, | 
					
						
							|  |  |  | 	.agc						= dib7090_agc_config, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.bw							= &dib7090_clock_config_12_mhz, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.gpio_dir					= DIB7000P_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 	.gpio_val					= DIB7000P_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 	.gpio_pwm_pos				= DIB7000P_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.pwm_freq_div				= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.agc_control				= dib7090_agc_restart, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.spur_protect				= 0, | 
					
						
							|  |  |  | 	.disable_sample_and_hold	= 0, | 
					
						
							|  |  |  | 	.enable_current_mirror		= 0, | 
					
						
							|  |  |  | 	.diversity_delay			= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.output_mode				= OUTMODE_MPEG2_FIFO, | 
					
						
							|  |  |  | 	.enMpegOutput				= 1, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 09:51:17 -03:00
										 |  |  | static int tfe7090p_pvr_update_lna(struct dvb_frontend *fe, u16 agc_global) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	deb_info("TFE7090P-PVR update LNA: agc global=%i", agc_global); | 
					
						
							|  |  |  | 	if (agc_global < 25000) { | 
					
						
							|  |  |  | 		dib7000p_set_gpio(fe, 5, 0, 0); | 
					
						
							|  |  |  | 		dib7000p_set_agc1_min(fe, 0); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		dib7000p_set_gpio(fe, 5, 0, 1); | 
					
						
							|  |  |  | 		dib7000p_set_agc1_min(fe, 32768); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.output_mpeg2_in_188_bytes  = 1, | 
					
						
							|  |  |  | 		.hostbus_diversity			= 1, | 
					
						
							|  |  |  | 		.tuner_is_baseband			= 1, | 
					
						
							| 
									
										
										
										
											2012-12-31 09:51:17 -03:00
										 |  |  | 		.update_lna					= tfe7090p_pvr_update_lna, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		.agc_config_count			= 2, | 
					
						
							|  |  |  | 		.agc						= dib7090_agc_config, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.bw							= &dib7090_clock_config_12_mhz, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.gpio_dir					= DIB7000P_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 		.gpio_val					= DIB7000P_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 		.gpio_pwm_pos				= DIB7000P_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.pwm_freq_div				= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.agc_control				= dib7090_agc_restart, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.spur_protect				= 0, | 
					
						
							|  |  |  | 		.disable_sample_and_hold	= 0, | 
					
						
							|  |  |  | 		.enable_current_mirror		= 0, | 
					
						
							|  |  |  | 		.diversity_delay			= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.output_mode				= OUTMODE_MPEG2_PAR_GATED_CLK, | 
					
						
							|  |  |  | 		.default_i2c_addr			= 0x90, | 
					
						
							|  |  |  | 		.enMpegOutput				= 1, | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	}, { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		.output_mpeg2_in_188_bytes  = 1, | 
					
						
							|  |  |  | 		.hostbus_diversity			= 1, | 
					
						
							|  |  |  | 		.tuner_is_baseband			= 1, | 
					
						
							| 
									
										
										
										
											2012-12-31 09:51:17 -03:00
										 |  |  | 		.update_lna					= tfe7090p_pvr_update_lna, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		.agc_config_count			= 2, | 
					
						
							|  |  |  | 		.agc						= dib7090_agc_config, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.bw							= &dib7090_clock_config_12_mhz, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.gpio_dir					= DIB7000P_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 		.gpio_val					= DIB7000P_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 		.gpio_pwm_pos				= DIB7000P_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.pwm_freq_div				= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.agc_control				= dib7090_agc_restart, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.spur_protect				= 0, | 
					
						
							|  |  |  | 		.disable_sample_and_hold	= 0, | 
					
						
							|  |  |  | 		.enable_current_mirror		= 0, | 
					
						
							|  |  |  | 		.diversity_delay			= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.output_mode				= OUTMODE_MPEG2_PAR_GATED_CLK, | 
					
						
							|  |  |  | 		.default_i2c_addr			= 0x92, | 
					
						
							|  |  |  | 		.enMpegOutput				= 0, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static const struct dib0090_config nim7090_dib0090_config = { | 
					
						
							|  |  |  | 	.io.clock_khz = 12000, | 
					
						
							|  |  |  | 	.io.pll_bypass = 0, | 
					
						
							|  |  |  | 	.io.pll_range = 0, | 
					
						
							|  |  |  | 	.io.pll_prediv = 3, | 
					
						
							|  |  |  | 	.io.pll_loopdiv = 6, | 
					
						
							|  |  |  | 	.io.adc_clock_ratio = 0, | 
					
						
							|  |  |  | 	.io.pll_int_loop_filt = 0, | 
					
						
							|  |  |  | 	.reset = dib7090_tuner_sleep, | 
					
						
							|  |  |  | 	.sleep = dib7090_tuner_sleep, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.freq_offset_khz_uhf = 0, | 
					
						
							|  |  |  | 	.freq_offset_khz_vhf = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.get_adc_power = dib7090_get_adc_power, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.clkouttobamse = 1, | 
					
						
							|  |  |  | 	.analog_output = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.wbd_vhf_offset = 0, | 
					
						
							|  |  |  | 	.wbd_cband_offset = 0, | 
					
						
							|  |  |  | 	.use_pwm_agc = 1, | 
					
						
							|  |  |  | 	.clkoutdrive = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.fref_clock_ratio = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.wbd = dib7090_wbd_table, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.ls_cfg_pad_drv = 0, | 
					
						
							|  |  |  | 	.data_tx_drv = 0, | 
					
						
							|  |  |  | 	.low_if = NULL, | 
					
						
							|  |  |  | 	.in_soc = 1, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | static struct dib7000p_config tfe7790p_dib7000p_config = { | 
					
						
							| 
									
										
										
										
											2011-08-09 04:48:25 -03:00
										 |  |  | 	.output_mpeg2_in_188_bytes  = 1, | 
					
						
							|  |  |  | 	.hostbus_diversity			= 1, | 
					
						
							|  |  |  | 	.tuner_is_baseband			= 1, | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 	.update_lna					= tfe7790p_update_lna, | 
					
						
							| 
									
										
										
										
											2011-08-09 04:48:25 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	.agc_config_count			= 2, | 
					
						
							|  |  |  | 	.agc						= dib7090_agc_config, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.bw							= &dib7090_clock_config_12_mhz, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.gpio_dir					= DIB7000P_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 	.gpio_val					= DIB7000P_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 	.gpio_pwm_pos				= DIB7000P_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.pwm_freq_div				= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.agc_control				= dib7090_agc_restart, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.spur_protect				= 0, | 
					
						
							|  |  |  | 	.disable_sample_and_hold	= 0, | 
					
						
							|  |  |  | 	.enable_current_mirror		= 0, | 
					
						
							|  |  |  | 	.diversity_delay			= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.output_mode				= OUTMODE_MPEG2_PAR_GATED_CLK, | 
					
						
							|  |  |  | 	.enMpegOutput				= 1, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | static const struct dib0090_config tfe7790p_dib0090_config = { | 
					
						
							| 
									
										
										
										
											2011-08-09 04:48:25 -03:00
										 |  |  | 	.io.clock_khz = 12000, | 
					
						
							|  |  |  | 	.io.pll_bypass = 0, | 
					
						
							|  |  |  | 	.io.pll_range = 0, | 
					
						
							|  |  |  | 	.io.pll_prediv = 3, | 
					
						
							|  |  |  | 	.io.pll_loopdiv = 6, | 
					
						
							|  |  |  | 	.io.adc_clock_ratio = 0, | 
					
						
							|  |  |  | 	.io.pll_int_loop_filt = 0, | 
					
						
							|  |  |  | 	.reset = dib7090_tuner_sleep, | 
					
						
							|  |  |  | 	.sleep = dib7090_tuner_sleep, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.freq_offset_khz_uhf = 0, | 
					
						
							|  |  |  | 	.freq_offset_khz_vhf = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.get_adc_power = dib7090_get_adc_power, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.clkouttobamse = 1, | 
					
						
							|  |  |  | 	.analog_output = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.wbd_vhf_offset = 0, | 
					
						
							|  |  |  | 	.wbd_cband_offset = 0, | 
					
						
							|  |  |  | 	.use_pwm_agc = 1, | 
					
						
							|  |  |  | 	.clkoutdrive = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.fref_clock_ratio = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 	.wbd = dib7090_wbd_table, | 
					
						
							| 
									
										
										
										
											2011-08-09 04:48:25 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	.ls_cfg_pad_drv = 0, | 
					
						
							|  |  |  | 	.data_tx_drv = 0, | 
					
						
							|  |  |  | 	.low_if = NULL, | 
					
						
							|  |  |  | 	.in_soc = 1, | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 	.force_cband_input = 0, | 
					
						
							|  |  |  | 	.is_dib7090e = 0, | 
					
						
							| 
									
										
										
										
											2011-08-09 04:48:25 -03:00
										 |  |  | 	.force_crystal_mode = 1, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | static const struct dib0090_config tfe7090pvr_dib0090_config[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.io.clock_khz = 12000, | 
					
						
							|  |  |  | 		.io.pll_bypass = 0, | 
					
						
							|  |  |  | 		.io.pll_range = 0, | 
					
						
							|  |  |  | 		.io.pll_prediv = 3, | 
					
						
							|  |  |  | 		.io.pll_loopdiv = 6, | 
					
						
							|  |  |  | 		.io.adc_clock_ratio = 0, | 
					
						
							|  |  |  | 		.io.pll_int_loop_filt = 0, | 
					
						
							|  |  |  | 		.reset = dib7090_tuner_sleep, | 
					
						
							|  |  |  | 		.sleep = dib7090_tuner_sleep, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.freq_offset_khz_uhf = 50, | 
					
						
							|  |  |  | 		.freq_offset_khz_vhf = 70, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.get_adc_power = dib7090_get_adc_power, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.clkouttobamse = 1, | 
					
						
							|  |  |  | 		.analog_output = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.wbd_vhf_offset = 0, | 
					
						
							|  |  |  | 		.wbd_cband_offset = 0, | 
					
						
							|  |  |  | 		.use_pwm_agc = 1, | 
					
						
							|  |  |  | 		.clkoutdrive = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.fref_clock_ratio = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.wbd = dib7090_wbd_table, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.ls_cfg_pad_drv = 0, | 
					
						
							|  |  |  | 		.data_tx_drv = 0, | 
					
						
							|  |  |  | 		.low_if = NULL, | 
					
						
							|  |  |  | 		.in_soc = 1, | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	}, { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		.io.clock_khz = 12000, | 
					
						
							|  |  |  | 		.io.pll_bypass = 0, | 
					
						
							|  |  |  | 		.io.pll_range = 0, | 
					
						
							|  |  |  | 		.io.pll_prediv = 3, | 
					
						
							|  |  |  | 		.io.pll_loopdiv = 6, | 
					
						
							|  |  |  | 		.io.adc_clock_ratio = 0, | 
					
						
							|  |  |  | 		.io.pll_int_loop_filt = 0, | 
					
						
							|  |  |  | 		.reset = dib7090_tuner_sleep, | 
					
						
							|  |  |  | 		.sleep = dib7090_tuner_sleep, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.freq_offset_khz_uhf = -50, | 
					
						
							|  |  |  | 		.freq_offset_khz_vhf = -70, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.get_adc_power = dib7090_get_adc_power, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.clkouttobamse = 1, | 
					
						
							|  |  |  | 		.analog_output = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.wbd_vhf_offset = 0, | 
					
						
							|  |  |  | 		.wbd_cband_offset = 0, | 
					
						
							|  |  |  | 		.use_pwm_agc = 1, | 
					
						
							|  |  |  | 		.clkoutdrive = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.fref_clock_ratio = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.wbd = dib7090_wbd_table, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.ls_cfg_pad_drv = 0, | 
					
						
							|  |  |  | 		.data_tx_drv = 0, | 
					
						
							|  |  |  | 		.low_if = NULL, | 
					
						
							|  |  |  | 		.in_soc = 1, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int nim7090_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) { | 
					
						
							|  |  |  | 		err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n", __func__); | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config); | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ?  -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | static int nim7090_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	struct dib0700_adapter_state *st = adap->priv; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe_adap[0].fe); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &nim7090_dib0090_config) == NULL) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return -ENODEV; | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1); | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	return 0; | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap) | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	struct dib0700_state *st = adap->dev->priv; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* The TFE7090 requires the dib0700 to not be in master mode */ | 
					
						
							|  |  |  | 	st->disable_streaming_master_mode = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 13:08:14 -03:00
										 |  |  | 	msleep(20); | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	/* initialize IC 0 */ | 
					
						
							|  |  |  | 	if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) { | 
					
						
							|  |  |  | 		err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n", __func__); | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_i2c_speed(adap->dev, 340); | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]); | 
					
						
							|  |  |  | 	if (adap->fe_adap[0].fe == NULL) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	dib7090_slave_reset(adap->fe_adap[0].fe); | 
					
						
							| 
									
										
										
										
											2011-04-03 12:44:25 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct i2c_adapter *i2c; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	if (adap->dev->adapter[0].fe_adap[0].fe == NULL) { | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		err("the master dib7090 has to be initialized first"); | 
					
						
							|  |  |  | 		return -ENODEV; /* the master device has not been initialized */ | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	i2c = dib7000p_get_i2c_master(adap->dev->adapter[0].fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	if (dib7000p_i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) { | 
					
						
							|  |  |  | 		err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n", __func__); | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, i2c, 0x92, &tfe7090pvr_dib7000p_config[1]); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	dib0700_set_i2c_speed(adap->dev, 200); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *st = adap->priv; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe_adap[0].fe); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *st = adap->priv; | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe_adap[0].fe); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL) | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1); | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup; | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	return 0; | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | static int tfe7790p_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							| 
									
										
										
										
											2011-08-09 04:48:25 -03:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_state *st = adap->dev->priv; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 	/* The TFE7790P requires the dib0700 to not be in master mode */ | 
					
						
							| 
									
										
										
										
											2011-08-09 04:48:25 -03:00
										 |  |  | 	st->disable_streaming_master_mode = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(20); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 	msleep(20); | 
					
						
							|  |  |  | 	dib0700_ctrl_clock(adap->dev, 72, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(20); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 				1, 0x10, &tfe7790p_dib7000p_config) != 0) { | 
					
						
							| 
									
										
										
										
											2011-08-09 04:48:25 -03:00
										 |  |  | 		err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n", | 
					
						
							|  |  |  | 				__func__); | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 			0x80, &tfe7790p_dib7000p_config); | 
					
						
							| 
									
										
										
										
											2011-08-09 04:48:25 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return adap->fe_adap[0].fe == NULL ?  -ENODEV : 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | static int tfe7790p_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							| 
									
										
										
										
											2011-08-05 13:49:33 -03:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_adapter_state *st = adap->priv; | 
					
						
							|  |  |  | 	struct i2c_adapter *tun_i2c = | 
					
						
							|  |  |  | 		dib7090_get_i2c_tuner(adap->fe_adap[0].fe); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 				&tfe7790p_dib0090_config) == NULL) | 
					
						
							| 
									
										
										
										
											2011-08-05 13:49:33 -03:00
										 |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup; | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | /* STK7070PD */ | 
					
						
							|  |  |  | static struct dib7000p_config stk7070pd_dib7000p_config[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.agc_config_count = 1, | 
					
						
							|  |  |  | 		.agc = &dib7070_agc_config, | 
					
						
							|  |  |  | 		.bw  = &dib7070_bw_config_12_mhz, | 
					
						
							| 
									
										
										
										
											2008-01-25 07:25:20 -03:00
										 |  |  | 		.tuner_is_baseband = 1, | 
					
						
							|  |  |  | 		.spur_protect = 1, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 		.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 		.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.hostbus_diversity = 1, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.output_mpeg2_in_188_bytes = 1, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.agc_config_count = 1, | 
					
						
							|  |  |  | 		.agc = &dib7070_agc_config, | 
					
						
							|  |  |  | 		.bw  = &dib7070_bw_config_12_mhz, | 
					
						
							| 
									
										
										
										
											2008-01-25 07:25:20 -03:00
										 |  |  | 		.tuner_is_baseband = 1, | 
					
						
							|  |  |  | 		.spur_protect = 1, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 		.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 		.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.hostbus_diversity = 1, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:23 -03:00
										 |  |  | static void stk7070pd_init(struct dvb_usb_device *dev) | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:23 -03:00
										 |  |  | 	dib0700_set_gpio(dev, GPIO6, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 	msleep(10); | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:23 -03:00
										 |  |  | 	dib0700_set_gpio(dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 0); | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:23 -03:00
										 |  |  | 	dib0700_ctrl_clock(dev, 72, 1); | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	msleep(10); | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:23 -03:00
										 |  |  | 	dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	stk7070pd_init(adap->dev); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 	msleep(10); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-21 01:55:45 -03:00
										 |  |  | 	if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, | 
					
						
							|  |  |  | 				     stk7070pd_dib7000p_config) != 0) { | 
					
						
							|  |  |  | 		err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n", | 
					
						
							|  |  |  | 		    __func__); | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]); | 
					
						
							|  |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]); | 
					
						
							|  |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:25 -03:00
										 |  |  | static int novatd_read_status_override(struct dvb_frontend *fe, | 
					
						
							|  |  |  | 		fe_status_t *stat) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dvb_usb_adapter *adap = fe->dvb->priv; | 
					
						
							|  |  |  | 	struct dvb_usb_device *dev = adap->dev; | 
					
						
							|  |  |  | 	struct dib0700_state *state = dev->priv; | 
					
						
							|  |  |  | 	int ret; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ret = state->read_status(fe, stat); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (!ret) | 
					
						
							|  |  |  | 		dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, | 
					
						
							|  |  |  | 				!!(*stat & FE_HAS_LOCK)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return ret; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int novatd_sleep_override(struct dvb_frontend* fe) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dvb_usb_adapter *adap = fe->dvb->priv; | 
					
						
							|  |  |  | 	struct dvb_usb_device *dev = adap->dev; | 
					
						
							|  |  |  | 	struct dib0700_state *state = dev->priv; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* turn off LED */ | 
					
						
							|  |  |  | 	dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return state->sleep(fe); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:24 -03:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * novatd_frontend_attach - Nova-TD specific attach | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Nova-TD has GPIO0, 1 and 2 for LEDs. So do not fiddle with them except for | 
					
						
							|  |  |  |  * information purposes. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static int novatd_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dvb_usb_device *dev = adap->dev; | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:25 -03:00
										 |  |  | 	struct dib0700_state *st = dev->priv; | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:24 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (adap->id == 0) { | 
					
						
							|  |  |  | 		stk7070pd_init(dev); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		/* turn the power LED on, the other two off (just in case) */ | 
					
						
							|  |  |  | 		dib0700_set_gpio(dev, GPIO0, GPIO_OUT, 0); | 
					
						
							|  |  |  | 		dib0700_set_gpio(dev, GPIO1, GPIO_OUT, 0); | 
					
						
							|  |  |  | 		dib0700_set_gpio(dev, GPIO2, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if (dib7000p_i2c_enumeration(&dev->i2c_adap, 2, 18, | 
					
						
							|  |  |  | 					     stk7070pd_dib7000p_config) != 0) { | 
					
						
							|  |  |  | 			err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n", | 
					
						
							|  |  |  | 			    __func__); | 
					
						
							|  |  |  | 			return -ENODEV; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &dev->i2c_adap, | 
					
						
							|  |  |  | 			adap->id == 0 ? 0x80 : 0x82, | 
					
						
							|  |  |  | 			&stk7070pd_dib7000p_config[adap->id]); | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:25 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (adap->fe_adap[0].fe == NULL) | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	st->read_status = adap->fe_adap[0].fe->ops.read_status; | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe->ops.read_status = novatd_read_status_override; | 
					
						
							|  |  |  | 	st->sleep = adap->fe_adap[0].fe->ops.sleep; | 
					
						
							|  |  |  | 	adap->fe_adap[0].fe->ops.sleep = novatd_sleep_override; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:24 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | /* S5H1411 */ | 
					
						
							|  |  |  | static struct s5h1411_config pinnacle_801e_config = { | 
					
						
							|  |  |  | 	.output_mode   = S5H1411_PARALLEL_OUTPUT, | 
					
						
							|  |  |  | 	.gpio          = S5H1411_GPIO_OFF, | 
					
						
							|  |  |  | 	.mpeg_timing   = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK, | 
					
						
							|  |  |  | 	.qam_if        = S5H1411_IF_44000, | 
					
						
							|  |  |  | 	.vsb_if        = S5H1411_IF_44000, | 
					
						
							|  |  |  | 	.inversion     = S5H1411_INVERSION_OFF, | 
					
						
							|  |  |  | 	.status_mode   = S5H1411_DEMODLOCKING | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Pinnacle PCTV HD Pro 801e GPIOs map:
 | 
					
						
							|  |  |  |    GPIO0  - currently unknown | 
					
						
							|  |  |  |    GPIO1  - xc5000 tuner reset | 
					
						
							|  |  |  |    GPIO2  - CX25843 sleep | 
					
						
							|  |  |  |    GPIO3  - currently unknown | 
					
						
							|  |  |  |    GPIO4  - currently unknown | 
					
						
							|  |  |  |    GPIO6  - currently unknown | 
					
						
							|  |  |  |    GPIO7  - currently unknown | 
					
						
							|  |  |  |    GPIO9  - currently unknown | 
					
						
							|  |  |  |    GPIO10 - CX25843 reset | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_state *st = adap->dev->priv; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Make use of the new i2c functions from FW 1.20 */ | 
					
						
							|  |  |  | 	st->fw_use_new_i2c_api = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* The s5h1411 requires the dib0700 to not be in master mode */ | 
					
						
							|  |  |  | 	st->disable_streaming_master_mode = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* All msleep values taken from Windows USB trace */ | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(400); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 	msleep(60); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(30); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0); | 
					
						
							|  |  |  | 	msleep(30); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Put the CX25843 to sleep for now since we're in digital mode */ | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* GPIOs are initialized, do the attach */ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config, | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | 			      &adap->dev->i2c_adap); | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-25 09:47:07 -03:00
										 |  |  | static int dib0700_xc5000_tuner_callback(void *priv, int component, | 
					
						
							|  |  |  | 					 int command, int arg) | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | { | 
					
						
							|  |  |  | 	struct dvb_usb_adapter *adap = priv; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-10-06 12:07:48 -03:00
										 |  |  | 	if (command == XC5000_TUNER_RESET) { | 
					
						
							|  |  |  | 		/* Reset the tuner */ | 
					
						
							|  |  |  | 		dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0); | 
					
						
							| 
									
										
										
										
											2009-05-04 21:57:41 -03:00
										 |  |  | 		msleep(10); | 
					
						
							| 
									
										
										
										
											2008-10-06 12:07:48 -03:00
										 |  |  | 		dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1); | 
					
						
							| 
									
										
										
										
											2009-05-04 21:57:41 -03:00
										 |  |  | 		msleep(10); | 
					
						
							| 
									
										
										
										
											2008-10-06 12:07:48 -03:00
										 |  |  | 	} else { | 
					
						
							|  |  |  | 		err("xc5000: unknown tuner callback command: %d\n", command); | 
					
						
							|  |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct xc5000_config s5h1411_xc5000_tunerconfig = { | 
					
						
							|  |  |  | 	.i2c_address      = 0x64, | 
					
						
							|  |  |  | 	.if_khz           = 5380, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int xc5000_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-10-06 12:07:48 -03:00
										 |  |  | 	/* FIXME: generalize & move to common area */ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe->callback = dib0700_xc5000_tuner_callback; | 
					
						
							| 
									
										
										
										
											2008-10-06 12:07:48 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return dvb_attach(xc5000_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, | 
					
						
							| 
									
										
										
										
											2008-09-25 09:47:07 -03:00
										 |  |  | 			  &s5h1411_xc5000_tunerconfig) | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | 		== NULL ? -ENODEV : 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | static int dib0700_xc4000_tuner_callback(void *priv, int component, | 
					
						
							|  |  |  | 					 int command, int arg) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dvb_usb_adapter *adap = priv; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (command == XC4000_TUNER_RESET) { | 
					
						
							|  |  |  | 		/* Reset the tuner */ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 0); | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | 		msleep(10); | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 		dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1); | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | 	} else { | 
					
						
							|  |  |  | 		err("xc4000: unknown tuner callback command: %d\n", command); | 
					
						
							|  |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-28 01:16:05 -03:00
										 |  |  | static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = { | 
					
						
							|  |  |  | 	.band_caps = BAND_UHF | BAND_VHF, | 
					
						
							|  |  |  | 	.setup = 0x64, | 
					
						
							|  |  |  | 	.inv_gain = 0x02c8, | 
					
						
							|  |  |  | 	.time_stabiliz = 0x15, | 
					
						
							|  |  |  | 	.alpha_level = 0x00, | 
					
						
							|  |  |  | 	.thlock = 0x76, | 
					
						
							|  |  |  | 	.wbd_inv = 0x01, | 
					
						
							|  |  |  | 	.wbd_ref = 0x0b33, | 
					
						
							|  |  |  | 	.wbd_sel = 0x00, | 
					
						
							|  |  |  | 	.wbd_alpha = 0x02, | 
					
						
							|  |  |  | 	.agc1_max = 0x00, | 
					
						
							|  |  |  | 	.agc1_min = 0x00, | 
					
						
							|  |  |  | 	.agc2_max = 0x9b26, | 
					
						
							|  |  |  | 	.agc2_min = 0x26ca, | 
					
						
							|  |  |  | 	.agc1_pt1 = 0x00, | 
					
						
							|  |  |  | 	.agc1_pt2 = 0x00, | 
					
						
							|  |  |  | 	.agc1_pt3 = 0x00, | 
					
						
							|  |  |  | 	.agc1_slope1 = 0x00, | 
					
						
							|  |  |  | 	.agc1_slope2 = 0x00, | 
					
						
							|  |  |  | 	.agc2_pt1 = 0x00, | 
					
						
							|  |  |  | 	.agc2_pt2 = 0x80, | 
					
						
							|  |  |  | 	.agc2_slope1 = 0x1d, | 
					
						
							|  |  |  | 	.agc2_slope2 = 0x1d, | 
					
						
							| 
									
										
										
										
											2009-12-27 17:44:31 -03:00
										 |  |  | 	.alpha_mant = 0x11, | 
					
						
							| 
									
										
										
										
											2009-07-28 01:16:05 -03:00
										 |  |  | 	.alpha_exp = 0x1b, | 
					
						
							|  |  |  | 	.beta_mant = 0x17, | 
					
						
							|  |  |  | 	.beta_exp = 0x33, | 
					
						
							|  |  |  | 	.perform_agc_softsplit = 0x00, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-05 00:34:04 -03:00
										 |  |  | static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = { | 
					
						
							| 
									
										
										
										
											2011-06-06 12:54:54 -03:00
										 |  |  | 	60000, 30000,	/* internal, sampling */ | 
					
						
							|  |  |  | 	1, 8, 3, 1, 0,	/* pll_cfg: prediv, ratio, range, reset, bypass */ | 
					
						
							|  |  |  | 	0, 0, 1, 1, 0,	/* misc: refdiv, bypclk_div, IO_CLK_en_core, */ | 
					
						
							|  |  |  | 			/* ADClkSrc, modulo */ | 
					
						
							|  |  |  | 	(3 << 14) | (1 << 12) | 524,	/* sad_cfg: refsel, sel, freq_15k */ | 
					
						
							|  |  |  | 	39370534,	/* ifreq */ | 
					
						
							|  |  |  | 	20452225,	/* timf */ | 
					
						
							|  |  |  | 	30000000	/* xtal */ | 
					
						
							| 
									
										
										
										
											2009-10-05 00:34:04 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-24 00:07:01 -03:00
										 |  |  | /* FIXME: none of these inputs are validated yet */ | 
					
						
							|  |  |  | static struct dib7000p_config pctv_340e_config = { | 
					
						
							| 
									
										
										
										
											2009-12-27 18:58:11 -03:00
										 |  |  | 	.output_mpeg2_in_188_bytes = 1, | 
					
						
							| 
									
										
										
										
											2009-06-24 00:07:01 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	.agc_config_count = 1, | 
					
						
							| 
									
										
										
										
											2009-07-28 01:16:05 -03:00
										 |  |  | 	.agc = &stk7700p_7000p_xc4000_agc_config, | 
					
						
							| 
									
										
										
										
											2009-10-05 00:34:04 -03:00
										 |  |  | 	.bw  = &stk7700p_xc4000_pll_config, | 
					
						
							| 
									
										
										
										
											2009-06-24 00:07:01 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	.gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, | 
					
						
							|  |  |  | 	.gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, | 
					
						
							|  |  |  | 	.gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* PCTV 340e GPIOs map:
 | 
					
						
							|  |  |  |    dib0700: | 
					
						
							|  |  |  |    GPIO2  - CX25843 sleep | 
					
						
							|  |  |  |    GPIO3  - CS5340 reset | 
					
						
							|  |  |  |    GPIO5  - IRD | 
					
						
							|  |  |  |    GPIO6  - Power Supply | 
					
						
							|  |  |  |    GPIO8  - LNA (1=off 0=on) | 
					
						
							|  |  |  |    GPIO10 - CX25843 reset | 
					
						
							|  |  |  |    dib7000: | 
					
						
							|  |  |  |    GPIO8  - xc4000 reset | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_state *st = adap->dev->priv; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Power Supply on */ | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6,  GPIO_OUT, 0); | 
					
						
							|  |  |  | 	msleep(50); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6,  GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(100); /* Allow power supply to settle before probing */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* cx25843 reset */ | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10,  GPIO_OUT, 0); | 
					
						
							|  |  |  | 	msleep(1); /* cx25843 datasheet say 350us required */ | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10,  GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* LNA off for now */ | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO8,  GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Put the CX25843 to sleep for now since we're in digital mode */ | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* FIXME: not verified yet */ | 
					
						
							|  |  |  | 	dib0700_ctrl_clock(adap->dev, 72, 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-20 00:42:33 -03:00
										 |  |  | 	msleep(500); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-24 00:07:01 -03:00
										 |  |  | 	if (dib7000pc_detection(&adap->dev->i2c_adap) == 0) { | 
					
						
							|  |  |  | 		/* Demodulator not found for some reason? */ | 
					
						
							|  |  |  | 		return -ENODEV; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x12, | 
					
						
							| 
									
										
										
										
											2009-06-24 00:07:01 -03:00
										 |  |  | 			      &pctv_340e_config); | 
					
						
							|  |  |  | 	st->is_dib7000pc = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2009-06-24 00:07:01 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-28 01:16:05 -03:00
										 |  |  | static struct xc4000_config dib7000p_xc4000_tunerconfig = { | 
					
						
							| 
									
										
										
										
											2011-06-06 13:03:44 -03:00
										 |  |  | 	.i2c_address	  = 0x61, | 
					
						
							|  |  |  | 	.default_pm	  = 1, | 
					
						
							|  |  |  | 	.dvb_amplitude	  = 0, | 
					
						
							|  |  |  | 	.set_smoothedcvbs = 0, | 
					
						
							|  |  |  | 	.if_khz		  = 5400 | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int xc4000_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-06-29 21:11:02 -03:00
										 |  |  | 	struct i2c_adapter *tun_i2c; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* The xc4000 is not on the main i2c bus */ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe, | 
					
						
							| 
									
										
										
										
											2009-06-29 21:11:02 -03:00
										 |  |  | 					  DIBX000_I2C_INTERFACE_TUNER, 1); | 
					
						
							|  |  |  | 	if (tun_i2c == NULL) { | 
					
						
							| 
									
										
										
										
											2011-06-06 16:51:11 -03:00
										 |  |  | 		printk(KERN_ERR "Could not reach tuner i2c bus\n"); | 
					
						
							| 
									
										
										
										
											2009-06-29 21:11:02 -03:00
										 |  |  | 		return 0; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Setup the reset callback */ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe->callback = dib0700_xc4000_tuner_callback; | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return dvb_attach(xc4000_attach, adap->fe_adap[0].fe, tun_i2c, | 
					
						
							| 
									
										
										
										
											2009-07-28 01:16:05 -03:00
										 |  |  | 			  &dib7000p_xc4000_tunerconfig) | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | 		== NULL ? -ENODEV : 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-19 01:12:55 -03:00
										 |  |  | static struct lgdt3305_config hcw_lgdt3305_config = { | 
					
						
							|  |  |  | 	.i2c_addr           = 0x0e, | 
					
						
							|  |  |  | 	.mpeg_mode          = LGDT3305_MPEG_PARALLEL, | 
					
						
							|  |  |  | 	.tpclk_edge         = LGDT3305_TPCLK_FALLING_EDGE, | 
					
						
							|  |  |  | 	.tpvalid_polarity   = LGDT3305_TP_VALID_LOW, | 
					
						
							|  |  |  | 	.deny_i2c_rptr      = 0, | 
					
						
							|  |  |  | 	.spectral_inversion = 1, | 
					
						
							|  |  |  | 	.qam_if_khz         = 6000, | 
					
						
							|  |  |  | 	.vsb_if_khz         = 6000, | 
					
						
							|  |  |  | 	.usref_8vsb         = 0x0500, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct mxl5007t_config hcw_mxl5007t_config = { | 
					
						
							|  |  |  | 	.xtal_freq_hz = MxL_XTAL_25_MHZ, | 
					
						
							|  |  |  | 	.if_freq_hz = MxL_IF_6_MHZ, | 
					
						
							|  |  |  | 	.invert_if = 1, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* TIGER-ATSC map:
 | 
					
						
							|  |  |  |    GPIO0  - LNA_CTR  (H: LNA power enabled, L: LNA power disabled) | 
					
						
							|  |  |  |    GPIO1  - ANT_SEL  (H: VPA, L: MCX) | 
					
						
							|  |  |  |    GPIO4  - SCL2 | 
					
						
							|  |  |  |    GPIO6  - EN_TUNER | 
					
						
							|  |  |  |    GPIO7  - SDA2 | 
					
						
							|  |  |  |    GPIO10 - DEM_RST | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    MXL is behind LG's i2c repeater.  LG is on SCL2/SDA2 gpios on the DIB | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct dib0700_state *st = adap->dev->priv; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Make use of the new i2c functions from FW 1.20 */ | 
					
						
							|  |  |  | 	st->fw_use_new_i2c_api = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	st->disable_streaming_master_mode = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* fe power enable */ | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); | 
					
						
							|  |  |  | 	msleep(30); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(30); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* demod reset */ | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(30); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | 
					
						
							|  |  |  | 	msleep(30); | 
					
						
							|  |  |  | 	dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | 
					
						
							|  |  |  | 	msleep(30); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	adap->fe_adap[0].fe = dvb_attach(lgdt3305_attach, | 
					
						
							| 
									
										
										
										
											2009-01-19 01:12:55 -03:00
										 |  |  | 			      &hcw_lgdt3305_config, | 
					
						
							|  |  |  | 			      &adap->dev->i2c_adap); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; | 
					
						
							| 
									
										
										
										
											2009-01-19 01:12:55 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 	return dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe, | 
					
						
							| 
									
										
										
										
											2009-01-19 01:12:55 -03:00
										 |  |  | 			  &adap->dev->i2c_adap, 0x60, | 
					
						
							|  |  |  | 			  &hcw_mxl5007t_config) == NULL ? -ENODEV : 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | /* DVB-USB and USB stuff follows */ | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | struct usb_device_id dib0700_usb_id_table[] = { | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | /* 0 */	{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_STK7700P) }, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_STK7700P_PC) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) }, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | /* 5 */	{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) }, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_COMPRO,    USB_PID_COMPRO_VIDEOMATE_U500) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_UNIWILL,   USB_PID_UNIWILL_STK7700P) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_LEADTEK,   USB_PID_WINFAST_DTV_DONGLE_STK7700P) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) }, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) }, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_PINNACLE,  USB_PID_PINNACLE_PCTV2000E) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_TERRATEC, | 
					
						
							|  |  |  | 			USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_STK7700D) }, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | /* 15 */{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_STK7070P) }, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_PINNACLE,  USB_PID_PINNACLE_PCTV_DVB_T_FLASH) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_STK7070PD) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_PINNACLE, | 
					
						
							|  |  |  | 			USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_COMPRO,    USB_PID_COMPRO_VIDEOMATE_U500_PC) }, | 
					
						
							| 
									
										
										
										
											2007-10-08 20:08:46 -03:00
										 |  |  | /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) }, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_GIGABYTE,  USB_PID_GIGABYTE_U7000) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_ASUS,      USB_PID_ASUS_U3000) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_ASUS,      USB_PID_ASUS_U3100) }, | 
					
						
							|  |  |  | /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_TERRATEC,  USB_PID_TERRATEC_CINERGY_HT_USB_XE) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_PINNACLE,	USB_PID_PINNACLE_EXPRESSCARD_320CX) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_PINNACLE,	USB_PID_PINNACLE_PCTV72E) }, | 
					
						
							|  |  |  | /* 30 */{ USB_DEVICE(USB_VID_PINNACLE,	USB_PID_PINNACLE_PCTV73E) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_YUAN,	USB_PID_YUAN_EC372S) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_TERRATEC,	USB_PID_TERRATEC_CINERGY_HT_EXPRESS) }, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:37:54 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_TERRATEC,	USB_PID_TERRATEC_CINERGY_T_XXS) }, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:47:43 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_LEADTEK,   USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) }, | 
					
						
							| 
									
										
										
										
											2008-09-03 17:12:24 -03:00
										 |  |  | /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) }, | 
					
						
							| 
									
										
										
										
											2008-09-03 17:12:24 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) }, | 
					
						
							| 
									
										
										
										
											2008-09-06 13:42:47 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_GIGABYTE,  USB_PID_GIGABYTE_U8000) }, | 
					
						
							| 
									
										
										
										
											2008-09-07 12:39:44 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_YUAN,      USB_PID_YUAN_STK7700PH) }, | 
					
						
							| 
									
										
										
										
											2008-09-07 12:43:33 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_ASUS,	USB_PID_ASUS_U3000H) }, | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | /* 40 */{ USB_DEVICE(USB_VID_PINNACLE,  USB_PID_PINNACLE_PCTV801E) }, | 
					
						
							| 
									
										
										
										
											2008-09-25 06:22:23 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_PINNACLE,  USB_PID_PINNACLE_PCTV801E_SE) }, | 
					
						
							| 
									
										
										
										
											2009-01-08 07:58:45 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_TERRATEC,	USB_PID_TERRATEC_CINERGY_T_EXPRESS) }, | 
					
						
							| 
									
										
										
										
											2009-01-13 07:15:25 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_TERRATEC, | 
					
						
							|  |  |  | 			USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) }, | 
					
						
							| 
									
										
										
										
											2009-02-24 14:51:43 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_SONY,	USB_PID_SONY_PLAYTV) }, | 
					
						
							| 
									
										
										
										
											2009-02-26 10:31:41 -03:00
										 |  |  | /* 45 */{ USB_DEVICE(USB_VID_YUAN,      USB_PID_YUAN_PD378S) }, | 
					
						
							| 
									
										
										
										
											2009-01-19 01:12:55 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) }, | 
					
						
							| 
									
										
										
										
											2009-03-29 08:43:36 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_YUAN,	USB_PID_YUAN_MC770) }, | 
					
						
							| 
									
										
										
										
											2009-03-29 09:12:06 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_ELGATO,	USB_PID_ELGATO_EYETV_DTT) }, | 
					
						
							| 
									
										
										
										
											2009-04-20 11:57:49 -03:00
										 |  |  | /* 50 */{ USB_DEVICE(USB_VID_ELGATO,	USB_PID_ELGATO_EYETV_DTT_Dlx) }, | 
					
						
							| 
									
										
										
										
											2009-05-20 05:28:05 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_LEADTEK,   USB_PID_WINFAST_DTV_DONGLE_H) }, | 
					
						
							| 
									
										
										
										
											2009-05-20 05:35:02 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_TERRATEC,	USB_PID_TERRATEC_T3) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_TERRATEC,	USB_PID_TERRATEC_T5) }, | 
					
						
							| 
									
										
										
										
											2009-08-05 11:46:38 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_YUAN,      USB_PID_YUAN_STK7700D) }, | 
					
						
							| 
									
										
										
										
											2009-09-02 08:19:19 -03:00
										 |  |  | /* 55 */{ USB_DEVICE(USB_VID_YUAN,	USB_PID_YUAN_STK7700D_2) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_PINNACLE,	USB_PID_PINNACLE_PCTV73A) }, | 
					
						
							| 
									
										
										
										
											2009-11-30 13:52:57 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_PCTV,	USB_PID_PINNACLE_PCTV73ESE) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_PCTV,	USB_PID_PINNACLE_PCTV282E) }, | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_DIBCOM,	USB_PID_DIBCOM_STK7770P) }, | 
					
						
							| 
									
										
										
										
											2009-09-15 07:16:51 -03:00
										 |  |  | /* 60 */{ USB_DEVICE(USB_VID_TERRATEC,	USB_PID_TERRATEC_CINERGY_T_XXS_2) }, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_STK807XPVR) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_STK807XP) }, | 
					
						
							| 
									
										
										
										
											2010-09-03 10:50:24 -03:00
										 |  |  | 	{ USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) }, | 
					
						
							| 
									
										
										
										
											2009-09-28 04:19:21 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) }, | 
					
						
							| 
									
										
										
										
											2009-12-01 12:08:56 -03:00
										 |  |  | /* 65 */{ USB_DEVICE(USB_VID_PINNACLE,	USB_PID_PINNACLE_PCTV73ESE) }, | 
					
						
							| 
									
										
										
										
											2009-11-30 13:52:57 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_PINNACLE,	USB_PID_PINNACLE_PCTV282E) }, | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_STK8096GP) }, | 
					
						
							| 
									
										
										
										
											2010-04-26 22:18:57 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_ELGATO,    USB_PID_ELGATO_EYETV_DIVERSITY) }, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_NIM9090M) }, | 
					
						
							|  |  |  | /* 70 */{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_NIM8096MD) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_NIM9090MD) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_NIM7090) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_TFE7090PVR) }, | 
					
						
							| 
									
										
										
										
											2011-02-08 16:51:45 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) }, | 
					
						
							| 
									
										
										
										
											2011-05-21 07:33:38 -03:00
										 |  |  | /* 75 */{ USB_DEVICE(USB_VID_MEDION,    USB_PID_CREATIX_CTX1921) }, | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_PINNACLE,  USB_PID_PINNACLE_PCTV340E) }, | 
					
						
							| 
									
										
										
										
											2009-06-23 22:48:02 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_PINNACLE,  USB_PID_PINNACLE_PCTV340E_SE) }, | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_TFE7790P) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_DIBCOM,    USB_PID_DIBCOM_TFE8096P) }, | 
					
						
							|  |  |  | /* 80 */{ USB_DEVICE(USB_VID_ELGATO,	USB_PID_ELGATO_EYETV_DTT_2) }, | 
					
						
							| 
									
										
										
										
											2013-06-30 12:43:58 -03:00
										 |  |  | 	{ USB_DEVICE(USB_VID_PCTV,      USB_PID_PCTV_2002E) }, | 
					
						
							|  |  |  | 	{ USB_DEVICE(USB_VID_PCTV,      USB_PID_PCTV_2002E_SE) }, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 	{ 0 }		/* Terminating entry */ | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
 | 
					
						
							|  |  |  | 	.caps              = DVB_USB_IS_AN_I2C_ADAPTER, \ | 
					
						
							|  |  |  | 	.usb_ctrl          = DEVICE_SPECIFIC, \ | 
					
						
							| 
									
										
										
										
											2008-09-06 13:45:27 -03:00
										 |  |  | 	.firmware          = "dvb-usb-dib0700-1.20.fw", \ | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 	.download_firmware = dib0700_download_firmware, \ | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:40 -03:00
										 |  |  | 	.no_reconnect      = 1, \ | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 	.size_of_priv      = sizeof(struct dib0700_state), \ | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:40 -03:00
										 |  |  | 	.i2c_algo          = &dib0700_i2c_algo, \ | 
					
						
							|  |  |  | 	.identify_state    = dib0700_identify_state | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
 | 
					
						
							|  |  |  | 	.streaming_ctrl   = dib0700_streaming_ctrl, \ | 
					
						
							|  |  |  | 	.stream = { \ | 
					
						
							|  |  |  | 		.type = USB_BULK, \ | 
					
						
							|  |  |  | 		.count = 4, \ | 
					
						
							|  |  |  | 		.endpoint = ep, \ | 
					
						
							|  |  |  | 		.u = { \ | 
					
						
							|  |  |  | 			.bulk = { \ | 
					
						
							|  |  |  | 				.buffersize = 39480, \ | 
					
						
							|  |  |  | 			} \ | 
					
						
							|  |  |  | 		} \ | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct dvb_usb_device_properties dib0700_devices[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							| 
									
										
										
										
											2011-01-14 13:58:59 -03:00
										 |  |  | 				.pid_filter       = stk7700p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk7700p_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 				.frontend_attach  = stk7700p_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = stk7700p_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-10 19:23:31 -03:00
										 |  |  | 		.num_device_descs = 8, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "DiBcom STK7700P reference design", | 
					
						
							| 
									
										
										
										
											2006-10-19 07:27:19 -03:00
										 |  |  | 				{ &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] }, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Hauppauge Nova-T Stick", | 
					
						
							| 
									
										
										
										
											2006-11-12 13:02:51 -03:00
										 |  |  | 				{ &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL }, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{   "AVerMedia AVerTV DVB-T Volar", | 
					
						
							| 
									
										
										
										
											2006-11-14 05:01:47 -03:00
										 |  |  | 				{ &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] }, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2006-10-19 07:27:19 -03:00
										 |  |  | 			{   "Compro Videomate U500", | 
					
						
							| 
									
										
										
										
											2007-07-30 14:24:37 -03:00
										 |  |  | 				{ &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] }, | 
					
						
							| 
									
										
										
										
											2006-10-19 07:27:19 -03:00
										 |  |  | 				{ NULL }, | 
					
						
							| 
									
										
										
										
											2006-10-19 07:58:22 -03:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Uniwill STK7700P based (Hama and others)", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[7], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							| 
									
										
										
										
											2006-11-08 16:47:32 -03:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Leadtek Winfast DTV Dongle (STK7700P based)", | 
					
						
							| 
									
										
										
										
											2009-09-19 05:24:40 -03:00
										 |  |  | 				{ &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] }, | 
					
						
							| 
									
										
										
										
											2006-11-08 16:47:32 -03:00
										 |  |  | 				{ NULL }, | 
					
						
							| 
									
										
										
										
											2007-10-08 20:08:46 -03:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			{   "AVerMedia AVerTV DVB-T Express", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[20] }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							| 
									
										
										
										
											2007-11-10 19:23:31 -03:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Gigabyte U7000", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[21], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							| 
									
										
										
										
											2006-10-19 07:27:19 -03:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2007-08-18 18:05:31 -03:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_adapters = 2, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 				.frontend_attach  = bristol_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = bristol_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 			}, { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 				.frontend_attach  = bristol_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = bristol_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x03), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_device_descs = 1, | 
					
						
							|  |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "Hauppauge Nova-T 500 Dual DVB-T", | 
					
						
							| 
									
										
										
										
											2006-10-19 07:27:19 -03:00
										 |  |  | 				{ &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL }, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2007-07-30 13:50:28 -03:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_adapters = 2, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter       = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk70x0p_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 				.frontend_attach  = stk7700d_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = stk7700d_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 			}, { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter       = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk70x0p_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 				.frontend_attach  = stk7700d_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = stk7700d_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x03), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-04 02:38:05 -03:00
										 |  |  | 		.num_device_descs = 5, | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "Pinnacle PCTV 2000e", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[11], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Terratec Cinergy DT XS Diversity", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[12], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2007-08-18 18:04:00 -03:00
										 |  |  | 			{   "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity", | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 				{ &dib0700_usb_id_table[13], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 			{   "DiBcom STK7700D reference design", | 
					
						
							| 
									
										
										
										
											2007-07-27 10:08:51 -03:00
										 |  |  | 				{ &dib0700_usb_id_table[14], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							| 
									
										
										
										
											2009-01-08 07:58:45 -03:00
										 |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-08-04 02:38:05 -03:00
										 |  |  | 			{   "YUAN High-Tech DiBcom STK7700D", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[55], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-01-08 07:58:45 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-25 14:42:54 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2007-07-30 13:50:28 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2008-01-25 06:02:42 -03:00
										 |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter       = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk70x0p_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2008-01-25 06:02:42 -03:00
										 |  |  | 				.frontend_attach  = stk7700P2_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = stk7700d_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2008-01-25 06:02:42 -03:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-08 07:58:45 -03:00
										 |  |  | 		.num_device_descs = 3, | 
					
						
							| 
									
										
										
										
											2008-01-25 06:02:42 -03:00
										 |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "ASUS My Cinema U3000 Mini DVBT Tuner", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[23], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 			{   "Yuan EC372S", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[31], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							| 
									
										
										
										
											2009-01-08 07:58:45 -03:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Terratec Cinergy T Express", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[42], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2008-09-25 06:52:24 -03:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 			.module_name	  = "dib0700", | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter       = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk70x0p_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 				.frontend_attach  = stk7070p_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = dib7070p_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 				.size_of_priv     = sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-14 09:14:07 -03:00
										 |  |  | 		.num_device_descs = 12, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "DiBcom STK7070P reference design", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[15], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Pinnacle PCTV DVB-T Flash Stick", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[16], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2008-01-25 05:51:48 -03:00
										 |  |  | 			{   "Artec T14BR DVB-T", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[22], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							| 
									
										
										
										
											2008-01-25 06:02:42 -03:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			{   "ASUS My Cinema U3100 Mini DVBT Tuner", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[24], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2008-01-25 06:16:36 -03:00
										 |  |  | 			{   "Hauppauge Nova-T Stick", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[25], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2008-01-25 06:20:02 -03:00
										 |  |  | 			{   "Hauppauge Nova-T MyTV.t", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[26], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 			{   "Pinnacle PCTV 72e", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[29], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Pinnacle PCTV 73e", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[30], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-03-29 09:12:06 -03:00
										 |  |  | 			{   "Elgato EyeTV DTT", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[49], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-02-26 10:31:41 -03:00
										 |  |  | 			{   "Yuan PD378S", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[45], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-04-20 11:57:49 -03:00
										 |  |  | 			{   "Elgato EyeTV Dtt Dlx PD378S", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[50], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2012-04-14 09:14:07 -03:00
										 |  |  | 			{   "Elgato EyeTV DTT rev. 2", | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 				{ &dib0700_usb_id_table[80], NULL }, | 
					
						
							| 
									
										
										
										
											2012-04-14 09:14:07 -03:00
										 |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2008-01-25 06:16:36 -03:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 			.module_name	  = "dib0700", | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2009-09-02 08:19:19 -03:00
										 |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-11-04 12:11:43 -02:00
										 |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter       = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk70x0p_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2009-09-02 08:19:19 -03:00
										 |  |  | 				.frontend_attach  = stk7070p_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = dib7070p_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2009-09-02 08:19:19 -03:00
										 |  |  | 				.size_of_priv     = sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-01 12:08:56 -03:00
										 |  |  | 		.num_device_descs = 3, | 
					
						
							| 
									
										
										
										
											2009-09-02 08:19:19 -03:00
										 |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "Pinnacle PCTV 73A", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[56], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Pinnacle PCTV 73e SE", | 
					
						
							| 
									
										
										
										
											2009-12-01 12:08:56 -03:00
										 |  |  | 				{ &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL }, | 
					
						
							| 
									
										
										
										
											2009-09-02 08:19:19 -03:00
										 |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Pinnacle PCTV 282e", | 
					
						
							| 
									
										
										
										
											2009-12-01 12:08:56 -03:00
										 |  |  | 				{ &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL }, | 
					
						
							| 
									
										
										
										
											2009-09-02 08:19:19 -03:00
										 |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 			.module_name	  = "dib0700", | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_adapters = 2, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter       = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk70x0p_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:24 -03:00
										 |  |  | 				.frontend_attach  = novatd_frontend_attach, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 				.tuner_attach     = dib7070p_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 				.size_of_priv     = sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter       = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk70x0p_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:24 -03:00
										 |  |  | 				.frontend_attach  = novatd_frontend_attach, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 				.tuner_attach     = dib7070p_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x03), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 				.size_of_priv     = sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-30 12:43:58 -03:00
										 |  |  | 		.num_device_descs = 3, | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:22 -03:00
										 |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "Hauppauge Nova-TD Stick (52009)", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[35], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2013-06-30 12:43:58 -03:00
										 |  |  | 			{   "PCTV 2002e", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[81], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{   "PCTV 2002e SE", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[82], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:22 -03:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.rc.core = { | 
					
						
							|  |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							|  |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							|  |  |  | 			.module_name	  = "dib0700", | 
					
						
							|  |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2012-01-10 14:11:22 -03:00
										 |  |  | 			.change_protocol = dib0700_change_protocol, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_adapters = 2, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							|  |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter       = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk70x0p_pid_filter_ctrl, | 
					
						
							|  |  |  | 				.frontend_attach  = stk7070pd_frontend_attach0, | 
					
						
							|  |  |  | 				.tuner_attach     = dib7070p_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							|  |  |  | 			}}, | 
					
						
							|  |  |  | 				.size_of_priv     = sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, { | 
					
						
							|  |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							|  |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter       = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk70x0p_pid_filter_ctrl, | 
					
						
							|  |  |  | 				.frontend_attach  = stk7070pd_frontend_attach1, | 
					
						
							|  |  |  | 				.tuner_attach     = dib7070p_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x03), | 
					
						
							|  |  |  | 			}}, | 
					
						
							|  |  |  | 				.size_of_priv     = sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_device_descs = 5, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "DiBcom STK7070PD reference design", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[17], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Pinnacle PCTV Dual DVB-T Diversity Stick", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[18], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							| 
									
										
										
										
											2008-07-03 23:43:36 -03:00
										 |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2008-09-03 17:12:24 -03:00
										 |  |  | 			{   "Hauppauge Nova-TD-500 (84xxx)", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[36], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							| 
									
										
										
										
											2009-01-13 07:15:25 -03:00
										 |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-05-20 05:35:02 -03:00
										 |  |  | 			{  "Terratec Cinergy DT USB XS Diversity/ T5", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[43], | 
					
						
							|  |  |  | 					&dib0700_usb_id_table[53], NULL}, | 
					
						
							| 
									
										
										
										
											2009-01-13 07:15:25 -03:00
										 |  |  | 				{ NULL }, | 
					
						
							| 
									
										
										
										
											2009-02-24 14:51:43 -03:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			{  "Sony PlayTV", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[44], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							| 
									
										
										
										
											2010-04-26 22:18:57 -03:00
										 |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.rc.core = { | 
					
						
							|  |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							|  |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							|  |  |  | 			.module_name	  = "dib0700", | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_adapters = 2, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter       = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk70x0p_pid_filter_ctrl, | 
					
						
							|  |  |  | 				.frontend_attach  = stk7070pd_frontend_attach0, | 
					
						
							|  |  |  | 				.tuner_attach     = dib7070p_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 				.size_of_priv     = sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, { | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter       = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk70x0p_pid_filter_ctrl, | 
					
						
							|  |  |  | 				.frontend_attach  = stk7070pd_frontend_attach1, | 
					
						
							|  |  |  | 				.tuner_attach     = dib7070p_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x03), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 				.size_of_priv     = sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_device_descs = 1, | 
					
						
							|  |  |  | 		.devices = { | 
					
						
							| 
									
										
										
										
											2010-04-26 22:18:57 -03:00
										 |  |  | 			{   "Elgato EyeTV Diversity", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[68], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-01-21 01:37:20 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 			.rc_codes         = RC_MAP_DIB0700_NEC_TABLE, | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 			.module_name	  = "dib0700", | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter       = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk70x0p_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 				.frontend_attach  = stk7700ph_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = stk7700ph_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 				.size_of_priv = sizeof(struct | 
					
						
							|  |  |  | 						dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-05 11:46:38 -03:00
										 |  |  | 		.num_device_descs = 9, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "Terratec Cinergy HT USB XE", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[27], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Pinnacle Expresscard 320cx", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[28], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Terratec Cinergy HT Express", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[32], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2008-09-06 13:42:47 -03:00
										 |  |  | 			{   "Gigabyte U8000-RH", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[37], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2008-09-07 12:39:44 -03:00
										 |  |  | 			{   "YUAN High-Tech STK7700PH", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[38], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2008-09-07 12:43:33 -03:00
										 |  |  | 			{   "Asus My Cinema-U3000Hybrid", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[39], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-03-29 08:43:36 -03:00
										 |  |  | 			{   "YUAN High-Tech MC770", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[48], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-05-20 05:28:05 -03:00
										 |  |  | 			{   "Leadtek WinFast DTV Dongle H", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[51], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-08-05 11:46:38 -03:00
										 |  |  | 			{   "YUAN High-Tech STK7700D", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[54], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2008-03-29 21:35:57 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 			.module_name	  = "dib0700", | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | 				.frontend_attach  = s5h1411_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = xc5000_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | 				.size_of_priv = sizeof(struct | 
					
						
							|  |  |  | 						dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-25 06:22:23 -03:00
										 |  |  | 		.num_device_descs = 2, | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "Pinnacle PCTV HD Pro USB Stick", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[40], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2008-09-25 06:22:23 -03:00
										 |  |  | 			{   "Pinnacle PCTV HD USB Stick", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[41], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2008-09-08 05:42:42 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		.rc.core = { | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 			.module_name	  = "dib0700", | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2009-01-19 01:12:55 -03:00
										 |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-01-19 01:12:55 -03:00
										 |  |  | 				.frontend_attach  = lgdt3305_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = mxl5007t_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2009-01-19 01:12:55 -03:00
										 |  |  | 				.size_of_priv = sizeof(struct | 
					
						
							|  |  |  | 						dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_device_descs = 2, | 
					
						
							|  |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "Hauppauge ATSC MiniCard (B200)", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[46], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{   "Hauppauge ATSC MiniCard (B210)", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[47], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | 				.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter       = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl  = stk70x0p_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2010-09-07 12:50:45 -03:00
										 |  |  | 				.frontend_attach  = stk7770p_frontend_attach, | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | 				.tuner_attach     = dib7770p_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | 				.size_of_priv = | 
					
						
							| 
									
										
										
										
											2009-09-15 07:16:51 -03:00
										 |  |  | 					sizeof(struct dib0700_adapter_state), | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-21 07:33:38 -03:00
										 |  |  | 		.num_device_descs = 4, | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "DiBcom STK7770P reference design", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[59], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-09-19 05:24:40 -03:00
										 |  |  | 			{   "Terratec Cinergy T USB XXS (HD)/ T3", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[33], | 
					
						
							|  |  |  | 					&dib0700_usb_id_table[52], | 
					
						
							|  |  |  | 					&dib0700_usb_id_table[60], NULL}, | 
					
						
							| 
									
										
										
										
											2009-09-15 07:16:51 -03:00
										 |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2011-02-08 16:51:45 -03:00
										 |  |  | 			{   "TechniSat AirStar TeleStick 2", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[74], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2011-05-21 07:33:38 -03:00
										 |  |  | 			{   "Medion CTX1921 DVB-T USB", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[75], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-09-15 06:55:35 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		.rc.core = { | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 			.module_name	  = "dib0700", | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | 				.caps  = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 				.pid_filter = stk80xx_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl = stk80xx_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 				.frontend_attach  = stk807x_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = dib807x_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 				.size_of_priv = | 
					
						
							|  |  |  | 					sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-28 04:19:21 -03:00
										 |  |  | 		.num_device_descs = 3, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "DiBcom STK807xP reference design", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[62], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:18:26 -03:00
										 |  |  | 			{   "Prolink Pixelview SBTVD", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[63], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-09-28 04:19:21 -03:00
										 |  |  | 			{   "EvolutePC TVWay+", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[64], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 			.rc_codes         = RC_MAP_DIB0700_NEC_TABLE, | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 			.module_name	  = "dib0700", | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 		.num_adapters = 2, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | 				.caps  = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 				.pid_filter = stk80xx_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl = stk80xx_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 				.frontend_attach  = stk807xpvr_frontend_attach0, | 
					
						
							|  |  |  | 				.tuner_attach     = dib807x_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 				.size_of_priv = | 
					
						
							|  |  |  | 					sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-09-18 04:08:43 -03:00
										 |  |  | 				.caps  = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 				.pid_filter = stk80xx_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl = stk80xx_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 				.frontend_attach  = stk807xpvr_frontend_attach1, | 
					
						
							|  |  |  | 				.tuner_attach     = dib807x_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x03), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2009-09-16 09:51:30 -03:00
										 |  |  | 				.size_of_priv = | 
					
						
							|  |  |  | 					sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_device_descs = 1, | 
					
						
							|  |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "DiBcom STK807xPVR reference design", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[61], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 			.module_name	  = "dib0700", | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 				.caps  = DVB_USB_ADAP_HAS_PID_FILTER | | 
					
						
							|  |  |  | 					DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter = stk80xx_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl = stk80xx_pid_filter_ctrl, | 
					
						
							|  |  |  | 				.frontend_attach  = stk809x_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = dib809x_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2009-12-04 13:27:57 -03:00
										 |  |  | 				.size_of_priv = | 
					
						
							|  |  |  | 					sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_device_descs = 1, | 
					
						
							|  |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "DiBcom STK8096GP reference design", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[67], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							|  |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							|  |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							|  |  |  | 			.module_name	  = "dib0700", | 
					
						
							|  |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 				.caps  = DVB_USB_ADAP_HAS_PID_FILTER | | 
					
						
							|  |  |  | 					DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter = dib90x0_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl = dib90x0_pid_filter_ctrl, | 
					
						
							|  |  |  | 				.frontend_attach  = stk9090m_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = dib9090_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 				.size_of_priv = | 
					
						
							|  |  |  | 					sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_device_descs = 1, | 
					
						
							|  |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "DiBcom STK9090M reference design", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[69], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.rc.core = { | 
					
						
							|  |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							|  |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							|  |  |  | 			.module_name	  = "dib0700", | 
					
						
							|  |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 				.caps  = DVB_USB_ADAP_HAS_PID_FILTER | | 
					
						
							|  |  |  | 					DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter = stk80xx_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl = stk80xx_pid_filter_ctrl, | 
					
						
							|  |  |  | 				.frontend_attach  = nim8096md_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = nim8096md_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 				.size_of_priv = | 
					
						
							|  |  |  | 					sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_device_descs = 1, | 
					
						
							|  |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "DiBcom NIM8096MD reference design", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[70], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.rc.core = { | 
					
						
							|  |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							|  |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							|  |  |  | 			.module_name	  = "dib0700", | 
					
						
							|  |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 				.caps  = DVB_USB_ADAP_HAS_PID_FILTER | | 
					
						
							|  |  |  | 					DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter = dib90x0_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl = dib90x0_pid_filter_ctrl, | 
					
						
							|  |  |  | 				.frontend_attach  = nim9090md_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = nim9090md_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 				.size_of_priv = | 
					
						
							|  |  |  | 					sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_device_descs = 1, | 
					
						
							|  |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "DiBcom NIM9090MD reference design", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[71], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.rc.core = { | 
					
						
							|  |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							|  |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							|  |  |  | 			.module_name	  = "dib0700", | 
					
						
							|  |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 				.caps  = DVB_USB_ADAP_HAS_PID_FILTER | | 
					
						
							|  |  |  | 					DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | 
					
						
							|  |  |  | 				.frontend_attach  = nim7090_frontend_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = nim7090_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 				.size_of_priv = | 
					
						
							|  |  |  | 					sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_device_descs = 1, | 
					
						
							|  |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "DiBcom NIM7090 reference design", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[72], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.rc.core = { | 
					
						
							|  |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							|  |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							|  |  |  | 			.module_name	  = "dib0700", | 
					
						
							|  |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 		.num_adapters = 2, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 				.caps  = DVB_USB_ADAP_HAS_PID_FILTER | | 
					
						
							|  |  |  | 					DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | 
					
						
							|  |  |  | 				.frontend_attach  = tfe7090pvr_frontend0_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = tfe7090pvr_tuner0_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x03), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 				.size_of_priv = | 
					
						
							|  |  |  | 					sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 				.caps  = DVB_USB_ADAP_HAS_PID_FILTER | | 
					
						
							|  |  |  | 					DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 				.pid_filter_count = 32, | 
					
						
							|  |  |  | 				.pid_filter = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 				.pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | 
					
						
							|  |  |  | 				.frontend_attach  = tfe7090pvr_frontend1_attach, | 
					
						
							|  |  |  | 				.tuner_attach     = tfe7090pvr_tuner1_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2011-01-04 05:42:19 -03:00
										 |  |  | 				.size_of_priv = | 
					
						
							|  |  |  | 					sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_device_descs = 1, | 
					
						
							|  |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "DiBcom TFE7090PVR reference design", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[73], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							|  |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							|  |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							|  |  |  | 			.module_name	  = "dib0700", | 
					
						
							|  |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			.num_frontends = 1, | 
					
						
							|  |  |  | 			.fe = {{ | 
					
						
							| 
									
										
										
										
											2009-06-24 00:07:01 -03:00
										 |  |  | 				.frontend_attach  = pctv340e_frontend_attach, | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | 				.tuner_attach     = xc4000_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							| 
									
										
										
										
											2011-09-06 09:31:57 -03:00
										 |  |  | 			}}, | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | 				.size_of_priv = sizeof(struct | 
					
						
							|  |  |  | 						dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-23 22:48:02 -03:00
										 |  |  | 		.num_device_descs = 2, | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "Pinnacle PCTV 340e HD Pro USB Stick", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[76], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-06-23 22:48:02 -03:00
										 |  |  | 			{   "Pinnacle PCTV Hybrid Stick Solo", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[77], NULL }, | 
					
						
							|  |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2009-06-23 22:34:06 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2011-08-05 13:49:33 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							|  |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							|  |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							|  |  |  | 			.module_name	  = "dib0700", | 
					
						
							|  |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2011-08-05 13:49:33 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 				.num_frontends = 1, | 
					
						
							|  |  |  | 				.fe = {{ | 
					
						
							|  |  |  | 					.caps  = DVB_USB_ADAP_HAS_PID_FILTER | | 
					
						
							|  |  |  | 						DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 					.pid_filter_count = 32, | 
					
						
							|  |  |  | 					.pid_filter = stk70x0p_pid_filter, | 
					
						
							|  |  |  | 					.pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 					.frontend_attach  = tfe7790p_frontend_attach, | 
					
						
							|  |  |  | 					.tuner_attach     = tfe7790p_tuner_attach, | 
					
						
							| 
									
										
										
										
											2011-08-09 04:48:25 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 					DIB0700_DEFAULT_STREAMING_CONFIG(0x03), | 
					
						
							|  |  |  | 				} }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				.size_of_priv = | 
					
						
							|  |  |  | 					sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_device_descs = 1, | 
					
						
							|  |  |  | 		.devices = { | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 			{   "DiBcom TFE7790P reference design", | 
					
						
							|  |  |  | 				{ &dib0700_usb_id_table[78], NULL }, | 
					
						
							| 
									
										
										
										
											2011-08-09 04:48:25 -03:00
										 |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-10 05:28:38 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							|  |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							|  |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							|  |  |  | 			.module_name	  = "dib0700", | 
					
						
							|  |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2011-08-10 05:28:38 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 
					
						
							|  |  |  | 		.num_adapters = 1, | 
					
						
							|  |  |  | 		.adapter = { | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 				.num_frontends = 1, | 
					
						
							|  |  |  | 				.fe = {{ | 
					
						
							|  |  |  | 					.caps  = DVB_USB_ADAP_HAS_PID_FILTER | | 
					
						
							|  |  |  | 						DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 
					
						
							|  |  |  | 					.pid_filter_count = 32, | 
					
						
							|  |  |  | 					.pid_filter = stk80xx_pid_filter, | 
					
						
							|  |  |  | 					.pid_filter_ctrl = stk80xx_pid_filter_ctrl, | 
					
						
							|  |  |  | 					.frontend_attach  = tfe8096p_frontend_attach, | 
					
						
							|  |  |  | 					.tuner_attach     = tfe8096p_tuner_attach, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				} }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				.size_of_priv = | 
					
						
							|  |  |  | 					sizeof(struct dib0700_adapter_state), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.num_device_descs = 1, | 
					
						
							|  |  |  | 		.devices = { | 
					
						
							|  |  |  | 			{   "DiBcom TFE8096P reference design", | 
					
						
							| 
									
										
										
										
											2012-12-31 09:47:10 -03:00
										 |  |  | 				{ &dib0700_usb_id_table[79], NULL }, | 
					
						
							| 
									
										
										
										
											2011-08-10 05:28:38 -03:00
										 |  |  | 				{ NULL }, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 		.rc.core = { | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 			.rc_interval      = DEFAULT_RC_INTERVAL, | 
					
						
							| 
									
										
										
										
											2010-08-01 08:02:35 -03:00
										 |  |  | 			.rc_codes         = RC_MAP_DIB0700_RC5_TABLE, | 
					
						
							| 
									
										
										
										
											2010-07-31 22:56:00 -03:00
										 |  |  | 			.module_name	  = "dib0700", | 
					
						
							| 
									
										
										
										
											2010-08-01 09:37:23 -03:00
										 |  |  | 			.rc_query         = dib0700_rc_query_old_firmware, | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 			.allowed_protos   = RC_BIT_RC5 | | 
					
						
							|  |  |  | 					    RC_BIT_RC6_MCE | | 
					
						
							|  |  |  | 					    RC_BIT_NEC, | 
					
						
							| 
									
										
										
										
											2010-10-29 16:08:23 -03:00
										 |  |  | 			.change_protocol  = dib0700_change_protocol, | 
					
						
							| 
									
										
										
										
											2010-07-31 18:04:09 -03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2007-07-30 12:49:04 -03:00
										 |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2006-09-19 12:51:37 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int dib0700_device_count = ARRAY_SIZE(dib0700_devices); |