Re: [PATCH] it913x Support it9135 Verions 2 chip.

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

 



Em 31-10-2011 14:02, Malcolm Priestley escreveu:
> Support for version 2 type chips and other LNA versions of version 1
> 
> Scripts may be compressed slightly at a later stage.
> 
> TODO
> Firmware loader
> However, things are a little confusing,  it is not clear that
> dvb-usb-it9137-01.fw does not work with version 2 chips
> as in recent files both firmwares are the same.
> 
> Should be applied to: 8133 Support for single ITE 9135 device.
> 
> Signed-off-by: Malcolm Priestley <tvboxspy@xxxxxxxxx>

Hi Malcolm,

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: it913x [VER 1.07] Support for single ITE 9135 devices
> Date: Fri, 14 Oct 2011 22:54:11 -0000
> From: tvboxspy <tvboxspy@xxxxxxxxx>

Could you please fix your From to add your name there?

Thanks!
Mauro


> ---
>  drivers/media/dvb/dvb-usb/it913x.c           |   52 +--
>  drivers/media/dvb/frontends/it913x-fe-priv.h |  718 +++++++++++++++++++++++++-
>  drivers/media/dvb/frontends/it913x-fe.c      |  110 +++-
>  drivers/media/dvb/frontends/it913x-fe.h      |   24 +-
>  4 files changed, 823 insertions(+), 81 deletions(-)
> 
> diff --git a/drivers/media/dvb/dvb-usb/it913x.c b/drivers/media/dvb/dvb-usb/it913x.c
> index c462261..a541904 100644
> --- a/drivers/media/dvb/dvb-usb/it913x.c
> +++ b/drivers/media/dvb/dvb-usb/it913x.c
> @@ -60,15 +60,6 @@ struct it913x_state {
>  	u8 id;
>  };
>  
> -struct ite_config {
> -	u8 chip_ver;
> -	u16 chip_type;
> -	u32 firmware;
> -	u8 tuner_id_0;
> -	u8 tuner_id_1;
> -	u8 dual_mode;
> -};
> -
>  struct ite_config it913x_config;
>  
>  static int it913x_bulk_write(struct usb_device *dev,
> @@ -390,8 +381,8 @@ static int it913x_identify_state(struct usb_device *udev,
>  			if (ret != 0)
>  				ret = it913x_wr_reg(udev, DEV_0,
>  					GPIOH1_O, 0x0);
> +			props->num_adapters = 2;
>  		}
> -		props->num_adapters = 2;
>  	} else
>  		props->num_adapters = 1;
>  
> @@ -474,12 +465,17 @@ static int it913x_download_firmware(struct usb_device *udev,
>  	/* Tuner function */
>  	if (it913x_config.dual_mode)
>  		ret |= it913x_wr_reg(udev, DEV_0_DMOD , 0xec4c, 0xa0);
> -
> -	ret |= it913x_wr_reg(udev, DEV_0,  PADODPU, 0x0);
> -	ret |= it913x_wr_reg(udev, DEV_0,  AGC_O_D, 0x0);
> -	if (it913x_config.dual_mode) {
> -		ret |= it913x_wr_reg(udev, DEV_1,  PADODPU, 0x0);
> -		ret |= it913x_wr_reg(udev, DEV_1,  AGC_O_D, 0x0);
> +	else
> +		ret |= it913x_wr_reg(udev, DEV_0_DMOD , 0xec4c, 0x68);
> +
> +	if ((it913x_config.chip_ver == 1) &&
> +		(it913x_config.chip_type == 0x9135)) {
> +		ret |= it913x_wr_reg(udev, DEV_0,  PADODPU, 0x0);
> +		ret |= it913x_wr_reg(udev, DEV_0,  AGC_O_D, 0x0);
> +		if (it913x_config.dual_mode) {
> +			ret |= it913x_wr_reg(udev, DEV_1,  PADODPU, 0x0);
> +			ret |= it913x_wr_reg(udev, DEV_1,  AGC_O_D, 0x0);
> +		}
>  	}
>  
>  	return (ret < 0) ? -ENODEV : 0;
> @@ -501,31 +497,13 @@ static int it913x_frontend_attach(struct dvb_usb_adapter *adap)
>  {
>  	struct usb_device *udev = adap->dev->udev;
>  	int ret = 0;
> -	u8 adf = it913x_read_reg(udev, IO_MUX_POWER_CLK);
>  	u8 adap_addr = I2C_BASE_ADDR + (adap->id << 5);
>  	u16 ep_size = adap->props.fe[0].stream.u.bulk.buffersize;
> -	u8 tuner_id, tuner_type;
>  
> -	if (adap->id == 0)
> -		tuner_id = it913x_config.tuner_id_0;
> -	else
> -		tuner_id = it913x_config.tuner_id_1;
> -
> -	/* TODO we always use IT9137 possible references here*/
> -	/* Documentation suggests don't care */
> -	switch (tuner_id) {
> -	case 0x51:
> -	case 0x52:
> -	case 0x60:
> -	case 0x61:
> -	case 0x62:
> -	default:
> -	case 0x38:
> -		tuner_type = IT9137;
> -	}
> +	it913x_config.adf = it913x_read_reg(udev, IO_MUX_POWER_CLK);
>  
>  	adap->fe_adap[0].fe = dvb_attach(it913x_fe_attach,
> -		&adap->dev->i2c_adap, adap_addr, adf, tuner_type);
> +		&adap->dev->i2c_adap, adap_addr, &it913x_config);
>  
>  	if (adap->id == 0 && adap->fe_adap[0].fe) {
>  		ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2_SW_RST, 0x1);
> @@ -698,5 +676,5 @@ module_exit(it913x_module_exit);
>  
>  MODULE_AUTHOR("Malcolm Priestley <tvboxspy@xxxxxxxxx>");
>  MODULE_DESCRIPTION("it913x USB 2 Driver");
> -MODULE_VERSION("1.07");
> +MODULE_VERSION("1.08");
>  MODULE_LICENSE("GPL");
> diff --git a/drivers/media/dvb/frontends/it913x-fe-priv.h b/drivers/media/dvb/frontends/it913x-fe-priv.h
> index 1c6fb4b..abf1395 100644
> --- a/drivers/media/dvb/frontends/it913x-fe-priv.h
> +++ b/drivers/media/dvb/frontends/it913x-fe-priv.h
> @@ -205,6 +205,10 @@ fe_modulation_t fe_con[] = {
>  
>  /* Standard demodulator functions */
>  static struct it913xset set_solo_fe[] = {
> +	{PRO_LINK, GPIOH5_EN, {0x01}, 0x01},
> +	{PRO_LINK, GPIOH5_ON, {0x01}, 0x01},
> +	{PRO_LINK, GPIOH5_O, {0x00}, 0x01},
> +	{PRO_LINK, GPIOH5_O, {0x01}, 0x01},
>  	{PRO_LINK, DVBT_INTEN, {0x04}, 0x01},
>  	{PRO_LINK, DVBT_ENABLE, {0x05}, 0x01},
>  	{PRO_DMOD, MP2IF_MPEG_PAR_MODE, {0x00}, 0x01},
> @@ -233,8 +237,121 @@ static struct it913xset init_1[] = {
>  	{0xff, 0x0000, {0x00}, 0x00} /* Terminating Entry */
>  };
>  
> -/* ---------IT9137 0x38 tuner init---------- */
> -static struct it913xset it9137_set[] = {
> +
> +/* Version 1 types */
> +static struct it913xset it9135_v1[] = {
> +	{PRO_DMOD, 0x0051, {0x01}, 0x01},
> +	{PRO_DMOD, 0x0070, {0x0a}, 0x01},
> +	{PRO_DMOD, 0x007e, {0x04}, 0x01},
> +	{PRO_DMOD, 0x0081, {0x0a}, 0x01},
> +	{PRO_DMOD, 0x008a, {0x01}, 0x01},
> +	{PRO_DMOD, 0x008e, {0x01}, 0x01},
> +	{PRO_DMOD, 0x0092, {0x06}, 0x01},
> +	{PRO_DMOD, 0x0099, {0x01}, 0x01},
> +	{PRO_DMOD, 0x009f, {0xe1}, 0x01},
> +	{PRO_DMOD, 0x00a0, {0xcf}, 0x01},
> +	{PRO_DMOD, 0x00a3, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00a5, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00a6, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00a9, {0x00}, 0x01},
> +	{PRO_DMOD, 0x00aa, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00b0, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00c2, {0x05}, 0x01},
> +	{PRO_DMOD, 0x00c6, {0x19}, 0x01},
> +	{PRO_DMOD, 0xf000, {0x0f}, 0x01},
> +	{PRO_DMOD, 0xf016, {0x10}, 0x01},
> +	{PRO_DMOD, 0xf017, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf018, {0x05}, 0x01},
> +	{PRO_DMOD, 0xf019, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf01a, {0x05}, 0x01},
> +	{PRO_DMOD, 0xf021, {0x03}, 0x01},
> +	{PRO_DMOD, 0xf022, {0x0a}, 0x01},
> +	{PRO_DMOD, 0xf023, {0x0a}, 0x01},
> +	{PRO_DMOD, 0xf02b, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf02c, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf064, {0x03}, 0x01},
> +	{PRO_DMOD, 0xf065, {0xf9}, 0x01},
> +	{PRO_DMOD, 0xf066, {0x03}, 0x01},
> +	{PRO_DMOD, 0xf067, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf06f, {0xe0}, 0x01},
> +	{PRO_DMOD, 0xf070, {0x03}, 0x01},
> +	{PRO_DMOD, 0xf072, {0x0f}, 0x01},
> +	{PRO_DMOD, 0xf073, {0x03}, 0x01},
> +	{PRO_DMOD, 0xf078, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf087, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf09b, {0x3f}, 0x01},
> +	{PRO_DMOD, 0xf09c, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf09d, {0x20}, 0x01},
> +	{PRO_DMOD, 0xf09e, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf09f, {0x0c}, 0x01},
> +	{PRO_DMOD, 0xf0a0, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf130, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf132, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf144, {0x1a}, 0x01},
> +	{PRO_DMOD, 0xf146, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf14a, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf14c, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf14d, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf14f, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf158, {0x7f}, 0x01},
> +	{PRO_DMOD, 0xf15a, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf15b, {0x08}, 0x01},
> +	{PRO_DMOD, 0xf15d, {0x03}, 0x01},
> +	{PRO_DMOD, 0xf15e, {0x05}, 0x01},
> +	{PRO_DMOD, 0xf163, {0x05}, 0x01},
> +	{PRO_DMOD, 0xf166, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf167, {0x40}, 0x01},
> +	{PRO_DMOD, 0xf168, {0x0f}, 0x01},
> +	{PRO_DMOD, 0xf17a, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf17b, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf183, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf19d, {0x40}, 0x01},
> +	{PRO_DMOD, 0xf1bc, {0x36}, 0x01},
> +	{PRO_DMOD, 0xf1bd, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf1cb, {0xa0}, 0x01},
> +	{PRO_DMOD, 0xf1cc, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf204, {0x10}, 0x01},
> +	{PRO_DMOD, 0xf214, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf40e, {0x0a}, 0x01},
> +	{PRO_DMOD, 0xf40f, {0x40}, 0x01},
> +	{PRO_DMOD, 0xf410, {0x08}, 0x01},
> +	{PRO_DMOD, 0xf55f, {0x0a}, 0x01},
> +	{PRO_DMOD, 0xf561, {0x15}, 0x01},
> +	{PRO_DMOD, 0xf562, {0x20}, 0x01},
> +	{PRO_DMOD, 0xf5df, {0xfb}, 0x01},
> +	{PRO_DMOD, 0xf5e0, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf5e3, {0x09}, 0x01},
> +	{PRO_DMOD, 0xf5e4, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf5e5, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf5f8, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf5fd, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf600, {0x05}, 0x01},
> +	{PRO_DMOD, 0xf601, {0x08}, 0x01},
> +	{PRO_DMOD, 0xf602, {0x0b}, 0x01},
> +	{PRO_DMOD, 0xf603, {0x0e}, 0x01},
> +	{PRO_DMOD, 0xf604, {0x11}, 0x01},
> +	{PRO_DMOD, 0xf605, {0x14}, 0x01},
> +	{PRO_DMOD, 0xf606, {0x17}, 0x01},
> +	{PRO_DMOD, 0xf607, {0x1f}, 0x01},
> +	{PRO_DMOD, 0xf60e, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf60f, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf610, {0x32}, 0x01},
> +	{PRO_DMOD, 0xf611, {0x10}, 0x01},
> +	{PRO_DMOD, 0xf707, {0xfc}, 0x01},
> +	{PRO_DMOD, 0xf708, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf709, {0x37}, 0x01},
> +	{PRO_DMOD, 0xf70a, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf78b, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf80f, {0x40}, 0x01},
> +	{PRO_DMOD, 0xf810, {0x54}, 0x01},
> +	{PRO_DMOD, 0xf811, {0x5a}, 0x01},
> +	{PRO_DMOD, 0xf905, {0x01}, 0x01},
> +	{PRO_DMOD, 0xfb06, {0x03}, 0x01},
> +	{PRO_DMOD, 0xfd8b, {0x00}, 0x01},
> +	{0xff, 0x0000, {0x00}, 0x00} /* Terminating Entry */
> +};
> +
> +static struct it913xset it9135_38[] = {
>  	{PRO_DMOD, 0x0043, {0x00}, 0x01},
>  	{PRO_DMOD, 0x0046, {0x38}, 0x01},
>  	{PRO_DMOD, 0x0051, {0x01}, 0x01},
> @@ -244,7 +361,7 @@ static struct it913xset it9137_set[] = {
>  	{PRO_DMOD, 0x0075, {0x8c, 0x8c, 0x8c, 0xc8, 0x01}, 0x05},
>  	{PRO_DMOD, 0x007e, {0x04, 0x00}, 0x02},
>  	{PRO_DMOD, 0x0081, {	0x0a, 0x12, 0x02, 0x0a, 0x03, 0xc8, 0xb8,
> -				0xd0, 0xc3, 0x01	}, 0x0a},
> +				0xd0, 0xc3, 0x01}, 0x0a},
>  	{PRO_DMOD, 0x008e, {0x01}, 0x01},
>  	{PRO_DMOD, 0x0092, {0x06, 0x00, 0x00, 0x00, 0x00}, 0x05},
>  	{PRO_DMOD, 0x0099, {0x01}, 0x01},
> @@ -262,15 +379,25 @@ static struct it913xset it9137_set[] = {
>  	{PRO_DMOD, 0x00f3, {0x05, 0x8c, 0x8c}, 0x03},
>  	{PRO_DMOD, 0x00f8, {0x03, 0x06, 0x06}, 0x03},
>  	{PRO_DMOD, 0x00fc, {	0x02, 0x02, 0x02, 0x09, 0x50, 0x7b, 0x77,
> -				0x00, 0x02, 0xc8, 0x05, 0x7b	}, 0x0c},
> +				0x00, 0x02, 0xc8, 0x05, 0x7b}, 0x0c},
>  	{PRO_DMOD, 0x0109, {0x02}, 0x01},
> -	{PRO_DMOD, 0x0115, {0x0a, 0x03}, 0x02},
> -	{PRO_DMOD, 0x011a, {0xc8, 0x7b, 0xbc, 0xa0}, 0x04},
> +	{PRO_DMOD, 0x0115, {0x0a, 0x03, 0x02, 0x80}, 0x04},
> +	{PRO_DMOD, 0x011a, {0xc8, 0x7b, 0x8a, 0xa0}, 0x04},
>  	{PRO_DMOD, 0x0122, {0x02, 0x18, 0xc3}, 0x03},
>  	{PRO_DMOD, 0x0127, {0x00, 0x07}, 0x02},
>  	{PRO_DMOD, 0x012a, {0x53, 0x51, 0x4e, 0x43}, 0x04},
>  	{PRO_DMOD, 0x0137, {0x01, 0x00, 0x07, 0x00, 0x06}, 0x05},
> -	{PRO_DMOD, 0x013d, {0x00, 0x01, 0x5b, 0xc8}, 0x04},
> +	{PRO_DMOD, 0x013d, {0x00, 0x01, 0x5b, 0xc8, 0x59}, 0x05},
> +	{PRO_DMOD, 0xf000, {0x0f}, 0x01},
> +	{PRO_DMOD, 0xf016, {0x10, 0x04, 0x05, 0x04, 0x05}, 0x05},
> +	{PRO_DMOD, 0xf01f, {0x8c, 0x00, 0x03, 0x0a, 0x0a}, 0x05},
> +	{PRO_DMOD, 0xf029, {0x8c, 0x00, 0x00, 0x01}, 0x04},
> +	{PRO_DMOD, 0xf064, {0x03, 0xf9, 0x03, 0x01}, 0x04},
> +	{PRO_DMOD, 0xf06f, {0xe0, 0x03}, 0x02},
> +	{PRO_DMOD, 0xf072, {0x0f, 0x03}, 0x02},
> +	{PRO_DMOD, 0xf077, {0x01, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf085, {0x00, 0x02, 0x00}, 0x03},
> +	{PRO_DMOD, 0xf09b, {0x3f, 0x00, 0x20, 0x00, 0x0c, 0x00}, 0x06},
>  	{PRO_DMOD, 0xf130, {0x04}, 0x01},
>  	{PRO_DMOD, 0xf132, {0x04}, 0x01},
>  	{PRO_DMOD, 0xf144, {0x1a}, 0x01},
> @@ -301,7 +428,7 @@ static struct it913xset it9137_set[] = {
>  	{PRO_DMOD, 0xf5f8, {0x01}, 0x01},
>  	{PRO_DMOD, 0xf5fd, {0x01}, 0x01},
>  	{PRO_DMOD, 0xf600, {	0x05, 0x08, 0x0b, 0x0e, 0x11, 0x14, 0x17,
> -				0x1f	}, 0x08},
> +				0x1f}, 0x08},
>  	{PRO_DMOD, 0xf60e, {0x00, 0x04, 0x32, 0x10}, 0x04},
>  	{PRO_DMOD, 0xf707, {0xfc, 0x00, 0x37, 0x00}, 0x04},
>  	{PRO_DMOD, 0xf78b, {0x01}, 0x01},
> @@ -309,13 +436,578 @@ static struct it913xset it9137_set[] = {
>  	{PRO_DMOD, 0xf905, {0x01}, 0x01},
>  	{PRO_DMOD, 0xfb06, {0x03}, 0x01},
>  	{PRO_DMOD, 0xfd8b, {0x00}, 0x01},
> -	{PRO_LINK, GPIOH5_EN, {0x01}, 0x01},
> -	{PRO_LINK, GPIOH5_ON, {0x01}, 0x01},
> -	{PRO_LINK, GPIOH5_O, {0x00}, 0x01},
> -	{PRO_LINK, GPIOH5_O, {0x01}, 0x01},
> -	{0xff, 0x0000, {0x00}, 0x00}, /* Terminating Entry */
> +	{0xff, 0x0000, {0x00}, 0x00} /* Terminating Entry */
> +};
> +
> +static struct it913xset it9135_51[] = {
> +	{PRO_DMOD, 0x0043, {0x00}, 0x01},
> +	{PRO_DMOD, 0x0046, {0x51}, 0x01},
> +	{PRO_DMOD, 0x0051, {0x01}, 0x01},
> +	{PRO_DMOD, 0x005f, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0x0068, {0x0a}, 0x01},
> +	{PRO_DMOD, 0x0070, {0x0a, 0x06, 0x02}, 0x03},
> +	{PRO_DMOD, 0x0075, {0x8c, 0x8c, 0x8c, 0xc8, 0x01}, 0x05},
> +	{PRO_DMOD, 0x007e, {0x04, 0x00}, 0x02},
> +	{PRO_DMOD, 0x0081, {	0x0a, 0x12, 0x02, 0x0a, 0x03, 0xc0, 0x96,
> +				0xcf, 0xc3, 0x01}, 0x0a},
> +	{PRO_DMOD, 0x008e, {0x01}, 0x01},
> +	{PRO_DMOD, 0x0092, {0x06, 0x00, 0x00, 0x00, 0x00}, 0x05},
> +	{PRO_DMOD, 0x0099, {0x01}, 0x01},
> +	{PRO_DMOD, 0x009b, {0x3c, 0x28}, 0x02},
> +	{PRO_DMOD, 0x009f, {0xe1, 0xcf}, 0x02},
> +	{PRO_DMOD, 0x00a3, {0x01, 0x5a, 0x01, 0x01}, 0x04},
> +	{PRO_DMOD, 0x00a9, {0x00, 0x01}, 0x02},
> +	{PRO_DMOD, 0x00b0, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00b3, {0x02, 0x3c}, 0x02},
> +	{PRO_DMOD, 0x00b6, {0x14}, 0x01},
> +	{PRO_DMOD, 0x00c0, {0x11, 0x00, 0x05}, 0x03},
> +	{PRO_DMOD, 0x00c4, {0x00}, 0x01},
> +	{PRO_DMOD, 0x00c6, {0x19, 0x00}, 0x02},
> +	{PRO_DMOD, 0x00cc, {0x2e, 0x51, 0x33}, 0x03},
> +	{PRO_DMOD, 0x00f3, {0x05, 0x8c, 0x8c}, 0x03},
> +	{PRO_DMOD, 0x00f8, {0x03, 0x06, 0x06}, 0x03},
> +	{PRO_DMOD, 0x00fc, {	0x03, 0x02, 0x02, 0x09, 0x50, 0x7a, 0x77,
> +				0x01, 0x02, 0xb0, 0x02, 0x7a}, 0x0c},
> +	{PRO_DMOD, 0x0109, {0x02}, 0x01},
> +	{PRO_DMOD, 0x0115, {0x0a, 0x03, 0x02, 0x80}, 0x04},
> +	{PRO_DMOD, 0x011a, {0xc0, 0x7a, 0xac, 0x8c}, 0x04},
> +	{PRO_DMOD, 0x0122, {0x02, 0x70, 0xa4}, 0x03},
> +	{PRO_DMOD, 0x0127, {0x00, 0x07}, 0x02},
> +	{PRO_DMOD, 0x012a, {0x53, 0x51, 0x4e, 0x43}, 0x04},
> +	{PRO_DMOD, 0x0137, {0x01, 0x00, 0x07, 0x00, 0x06}, 0x05},
> +	{PRO_DMOD, 0x013d, {0x00, 0x01, 0x5b, 0xc0, 0x59}, 0x05},
> +	{PRO_DMOD, 0xf000, {0x0f}, 0x01},
> +	{PRO_DMOD, 0xf016, {0x10, 0x04, 0x05, 0x04, 0x05}, 0x05},
> +	{PRO_DMOD, 0xf01f, {0x8c, 0x00, 0x03, 0x0a, 0x0a}, 0x05},
> +	{PRO_DMOD, 0xf029, {0x8c, 0x00, 0x00, 0x01}, 0x04},
> +	{PRO_DMOD, 0xf064, {0x03, 0xf9, 0x03, 0x01}, 0x04},
> +	{PRO_DMOD, 0xf06f, {0xe0, 0x03}, 0x02},
> +	{PRO_DMOD, 0xf072, {0x0f, 0x03}, 0x02},
> +	{PRO_DMOD, 0xf077, {0x01, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf085, {0xc0, 0x01, 0x00}, 0x03},
> +	{PRO_DMOD, 0xf09b, {0x3f, 0x00, 0x20, 0x00, 0x0c, 0x00}, 0x06},
> +	{PRO_DMOD, 0xf130, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf132, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf144, {0x1a}, 0x01},
> +	{PRO_DMOD, 0xf146, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf14a, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf14c, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf14f, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf158, {0x7f}, 0x01},
> +	{PRO_DMOD, 0xf15a, {0x00, 0x08}, 0x02},
> +	{PRO_DMOD, 0xf15d, {0x03, 0x05}, 0x02},
> +	{PRO_DMOD, 0xf163, {0x05}, 0x01},
> +	{PRO_DMOD, 0xf166, {0x01, 0x40, 0x0f}, 0x03},
> +	{PRO_DMOD, 0xf17a, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf183, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf19d, {0x40}, 0x01},
> +	{PRO_DMOD, 0xf1bc, {0x36, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf1cb, {0xa0, 0x01}, 0x02},
> +	{PRO_DMOD, 0xf204, {0x10}, 0x01},
> +	{PRO_DMOD, 0xf214, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf24c, {0x88, 0x95, 0x9a, 0x90}, 0x04},
> +	{PRO_DMOD, 0xf25a, {0x07, 0xe8, 0x03, 0xb0, 0x04}, 0x05},
> +	{PRO_DMOD, 0xf270, {0x01, 0x02, 0x01, 0x02}, 0x04},
> +	{PRO_DMOD, 0xf40e, {0x0a, 0x40, 0x08}, 0x03},
> +	{PRO_DMOD, 0xf55f, {0x0a}, 0x01},
> +	{PRO_DMOD, 0xf561, {0x15, 0x20}, 0x02},
> +	{PRO_DMOD, 0xf5df, {0xfb, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf5e3, {0x09, 0x01, 0x01}, 0x03},
> +	{PRO_DMOD, 0xf5f8, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf5fd, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf600, {	0x05, 0x08, 0x0b, 0x0e, 0x11, 0x14, 0x17,
> +				0x1f}, 0x08},
> +	{PRO_DMOD, 0xf60e, {0x00, 0x04, 0x32, 0x10}, 0x04},
> +	{PRO_DMOD, 0xf707, {0xfc, 0x00, 0x37, 0x00}, 0x04},
> +	{PRO_DMOD, 0xf78b, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf80f, {0x40, 0x54, 0x5a}, 0x03},
> +	{PRO_DMOD, 0xf905, {0x01}, 0x01},
> +	{PRO_DMOD, 0xfb06, {0x03}, 0x01},
> +	{PRO_DMOD, 0xfd8b, {0x00}, 0x01},
> +	{0xff, 0x0000, {0x00}, 0x00} /* Terminating Entry */
> +};
> +
> +static struct it913xset it9135_52[] = {
> +	{PRO_DMOD, 0x0043, {0x00}, 0x01},
> +	{PRO_DMOD, 0x0046, {0x52}, 0x01},
> +	{PRO_DMOD, 0x0051, {0x01}, 0x01},
> +	{PRO_DMOD, 0x005f, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0x0068, {0x10}, 0x01},
> +	{PRO_DMOD, 0x0070, {0x0a, 0x05, 0x02}, 0x03},
> +	{PRO_DMOD, 0x0075, {0x8c, 0x8c, 0x8c, 0xa0, 0x01}, 0x05},
> +	{PRO_DMOD, 0x007e, {0x04, 0x00}, 0x02},
> +	{PRO_DMOD, 0x0081, {	0x0a, 0x12, 0x03, 0x0a, 0x03, 0xb3, 0x97,
> +				0xc0, 0x9e, 0x01}, 0x0a},
> +	{PRO_DMOD, 0x008e, {0x01}, 0x01},
> +	{PRO_DMOD, 0x0092, {0x06, 0x00, 0x00, 0x00, 0x00}, 0x05},
> +	{PRO_DMOD, 0x0099, {0x01}, 0x01},
> +	{PRO_DMOD, 0x009b, {0x3c, 0x28}, 0x02},
> +	{PRO_DMOD, 0x009f, {0xe1, 0xcf}, 0x02},
> +	{PRO_DMOD, 0x00a3, {0x01, 0x5c, 0x01, 0x01}, 0x04},
> +	{PRO_DMOD, 0x00a9, {0x00, 0x01}, 0x02},
> +	{PRO_DMOD, 0x00b0, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00b3, {0x02, 0x3c}, 0x02},
> +	{PRO_DMOD, 0x00b6, {0x14}, 0x01},
> +	{PRO_DMOD, 0x00c0, {0x11, 0x00, 0x05}, 0x03},
> +	{PRO_DMOD, 0x00c4, {0x00}, 0x01},
> +	{PRO_DMOD, 0x00c6, {0x19, 0x00}, 0x02},
> +	{PRO_DMOD, 0x00cc, {0x2e, 0x51, 0x33}, 0x03},
> +	{PRO_DMOD, 0x00f3, {0x05, 0x91, 0x8c}, 0x03},
> +	{PRO_DMOD, 0x00f8, {0x03, 0x06, 0x06}, 0x03},
> +	{PRO_DMOD, 0x00fc, {	0x03, 0x02, 0x02, 0x09, 0x50, 0x74, 0x77,
> +				0x02, 0x02, 0xae, 0x02, 0x6e}, 0x0c},
> +	{PRO_DMOD, 0x0109, {0x02}, 0x01},
> +	{PRO_DMOD, 0x0115, {0x0a, 0x03, 0x02, 0x80}, 0x04},
> +	{PRO_DMOD, 0x011a, {0xcd, 0x62, 0xa4, 0x8c}, 0x04},
> +	{PRO_DMOD, 0x0122, {0x03, 0x18, 0x9e}, 0x03},
> +	{PRO_DMOD, 0x0127, {0x00, 0x07}, 0x02},
> +	{PRO_DMOD, 0x012a, {0x53, 0x51, 0x4e, 0x43}, 0x04},
> +	{PRO_DMOD, 0x0137, {0x00, 0x00, 0x07, 0x00, 0x06}, 0x05},
> +	{PRO_DMOD, 0x013d, {0x00, 0x01, 0x5b, 0xb6, 0x59}, 0x05},
> +	{PRO_DMOD, 0xf000, {0x0f}, 0x01},
> +	{PRO_DMOD, 0xf016, {0x10, 0x04, 0x05, 0x04, 0x05}, 0x05},
> +	{PRO_DMOD, 0xf01f, {0x8c, 0x00, 0x03, 0x0a, 0x0a}, 0x05},
> +	{PRO_DMOD, 0xf029, {0x8c, 0x00, 0x00, 0x01}, 0x04},
> +	{PRO_DMOD, 0xf064, {0x03, 0xf9, 0x03, 0x01}, 0x04},
> +	{PRO_DMOD, 0xf06f, {0xe0, 0x03}, 0x02},
> +	{PRO_DMOD, 0xf072, {0x0f, 0x03}, 0x02},
> +	{PRO_DMOD, 0xf077, {0x01, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf085, {0xc0, 0x01, 0x00}, 0x03},
> +	{PRO_DMOD, 0xf09b, {0x3f, 0x00, 0x20, 0x00, 0x0c, 0x00}, 0x06},
> +	{PRO_DMOD, 0xf130, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf132, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf144, {0x1a}, 0x01},
> +	{PRO_DMOD, 0xf146, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf14a, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf14c, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf14f, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf158, {0x7f}, 0x01},
> +	{PRO_DMOD, 0xf15a, {0x00, 0x08}, 0x02},
> +	{PRO_DMOD, 0xf15d, {0x03, 0x05}, 0x02},
> +	{PRO_DMOD, 0xf163, {0x05}, 0x01},
> +	{PRO_DMOD, 0xf166, {0x01, 0x40, 0x0f}, 0x03},
> +	{PRO_DMOD, 0xf17a, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf183, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf19d, {0x40}, 0x01},
> +	{PRO_DMOD, 0xf1bc, {0x36, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf1cb, {0xa0, 0x01}, 0x02},
> +	{PRO_DMOD, 0xf204, {0x10}, 0x01},
> +	{PRO_DMOD, 0xf214, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf24c, {0x88, 0x95, 0x9a, 0x90}, 0x04},
> +	{PRO_DMOD, 0xf25a, {0x07, 0xe8, 0x03, 0xb0, 0x04}, 0x05},
> +	{PRO_DMOD, 0xf270, {0x01, 0x02, 0x01, 0x02}, 0x04},
> +	{PRO_DMOD, 0xf40e, {0x0a, 0x40, 0x08}, 0x03},
> +	{PRO_DMOD, 0xf55f, {0x0a}, 0x01},
> +	{PRO_DMOD, 0xf561, {0x15, 0x20}, 0x02},
> +	{PRO_DMOD, 0xf5df, {0xfb, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf5e3, {0x09, 0x01, 0x01}, 0x03},
> +	{PRO_DMOD, 0xf5f8, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf5fd, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf600, {0x05, 0x08, 0x0b, 0x0e, 0x11, 0x14, 0x17,
> +				0x1f}, 0x08},
> +	{PRO_DMOD, 0xf60e, {0x00, 0x04, 0x32, 0x10}, 0x04},
> +	{PRO_DMOD, 0xf707, {0xfc, 0x00, 0x37, 0x00}, 0x04},
> +	{PRO_DMOD, 0xf78b, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf80f, {0x40, 0x54, 0x5a}, 0x03},
> +	{PRO_DMOD, 0xf905, {0x01}, 0x01},
> +	{PRO_DMOD, 0xfb06, {0x03}, 0x01},
> +	{PRO_DMOD, 0xfd8b, {0x00}, 0x01},
> +	{0xff, 0x0000, {0x00}, 0x00} /* Terminating Entry */
> +};
> +
> +/* Version 2 types */
> +static struct it913xset it9135_v2[] = {
> +	{PRO_DMOD, 0x0051, {0x01}, 0x01},
> +	{PRO_DMOD, 0x0070, {0x0a}, 0x01},
> +	{PRO_DMOD, 0x007e, {0x04}, 0x01},
> +	{PRO_DMOD, 0x0081, {0x0a}, 0x01},
> +	{PRO_DMOD, 0x008a, {0x01}, 0x01},
> +	{PRO_DMOD, 0x008e, {0x01}, 0x01},
> +	{PRO_DMOD, 0x0092, {0x06}, 0x01},
> +	{PRO_DMOD, 0x0099, {0x01}, 0x01},
> +	{PRO_DMOD, 0x009f, {0xe1}, 0x01},
> +	{PRO_DMOD, 0x00a0, {0xcf}, 0x01},
> +	{PRO_DMOD, 0x00a3, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00a5, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00a6, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00a9, {0x00}, 0x01},
> +	{PRO_DMOD, 0x00aa, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00b0, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00c2, {0x05}, 0x01},
> +	{PRO_DMOD, 0x00c6, {0x19}, 0x01},
> +	{PRO_DMOD, 0xf000, {0x0f}, 0x01},
> +	{PRO_DMOD, 0xf02b, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf064, {0x03}, 0x01},
> +	{PRO_DMOD, 0xf065, {0xf9}, 0x01},
> +	{PRO_DMOD, 0xf066, {0x03}, 0x01},
> +	{PRO_DMOD, 0xf067, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf06f, {0xe0}, 0x01},
> +	{PRO_DMOD, 0xf070, {0x03}, 0x01},
> +	{PRO_DMOD, 0xf072, {0x0f}, 0x01},
> +	{PRO_DMOD, 0xf073, {0x03}, 0x01},
> +	{PRO_DMOD, 0xf078, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf087, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf09b, {0x3f}, 0x01},
> +	{PRO_DMOD, 0xf09c, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf09d, {0x20}, 0x01},
> +	{PRO_DMOD, 0xf09e, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf09f, {0x0c}, 0x01},
> +	{PRO_DMOD, 0xf0a0, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf130, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf132, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf144, {0x1a}, 0x01},
> +	{PRO_DMOD, 0xf146, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf14a, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf14c, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf14d, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf14f, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf158, {0x7f}, 0x01},
> +	{PRO_DMOD, 0xf15a, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf15b, {0x08}, 0x01},
> +	{PRO_DMOD, 0xf15d, {0x03}, 0x01},
> +	{PRO_DMOD, 0xf15e, {0x05}, 0x01},
> +	{PRO_DMOD, 0xf163, {0x05}, 0x01},
> +	{PRO_DMOD, 0xf166, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf167, {0x40}, 0x01},
> +	{PRO_DMOD, 0xf168, {0x0f}, 0x01},
> +	{PRO_DMOD, 0xf17a, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf17b, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf183, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf19d, {0x40}, 0x01},
> +	{PRO_DMOD, 0xf1bc, {0x36}, 0x01},
> +	{PRO_DMOD, 0xf1bd, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf1cb, {0xa0}, 0x01},
> +	{PRO_DMOD, 0xf1cc, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf204, {0x10}, 0x01},
> +	{PRO_DMOD, 0xf214, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf40e, {0x0a}, 0x01},
> +	{PRO_DMOD, 0xf40f, {0x40}, 0x01},
> +	{PRO_DMOD, 0xf410, {0x08}, 0x01},
> +	{PRO_DMOD, 0xf55f, {0x0a}, 0x01},
> +	{PRO_DMOD, 0xf561, {0x15}, 0x01},
> +	{PRO_DMOD, 0xf562, {0x20}, 0x01},
> +	{PRO_DMOD, 0xf5e3, {0x09}, 0x01},
> +	{PRO_DMOD, 0xf5e4, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf5e5, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf600, {0x05}, 0x01},
> +	{PRO_DMOD, 0xf601, {0x08}, 0x01},
> +	{PRO_DMOD, 0xf602, {0x0b}, 0x01},
> +	{PRO_DMOD, 0xf603, {0x0e}, 0x01},
> +	{PRO_DMOD, 0xf604, {0x11}, 0x01},
> +	{PRO_DMOD, 0xf605, {0x14}, 0x01},
> +	{PRO_DMOD, 0xf606, {0x17}, 0x01},
> +	{PRO_DMOD, 0xf607, {0x1f}, 0x01},
> +	{PRO_DMOD, 0xf60e, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf60f, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf610, {0x32}, 0x01},
> +	{PRO_DMOD, 0xf611, {0x10}, 0x01},
> +	{PRO_DMOD, 0xf707, {0xfc}, 0x01},
> +	{PRO_DMOD, 0xf708, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf709, {0x37}, 0x01},
> +	{PRO_DMOD, 0xf70a, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf78b, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf80f, {0x40}, 0x01},
> +	{PRO_DMOD, 0xf810, {0x54}, 0x01},
> +	{PRO_DMOD, 0xf811, {0x5a}, 0x01},
> +	{PRO_DMOD, 0xf905, {0x01}, 0x01},
> +	{PRO_DMOD, 0xfb06, {0x03}, 0x01},
> +	{PRO_DMOD, 0xfd8b, {0x00}, 0x01},
> +	{0xff, 0x0000, {0x00}, 0x00} /* Terminating Entry */
> +};
> +
> +static struct it913xset it9135_60[] = {
> +	{PRO_DMOD, 0x0043, {0x00}, 0x01},
> +	{PRO_DMOD, 0x0046, {0x60}, 0x01},
> +	{PRO_DMOD, 0x0051, {0x01}, 0x01},
> +	{PRO_DMOD, 0x005f, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0x0068, {0x0a}, 0x01},
> +	{PRO_DMOD, 0x006a, {0x03}, 0x01},
> +	{PRO_DMOD, 0x0070, {0x0a, 0x05, 0x02}, 0x03},
> +	{PRO_DMOD, 0x0075, {0x8c, 0x8c, 0x8c, 0x8c, 0x01}, 0x05},
> +	{PRO_DMOD, 0x007e, {0x04}, 0x01},
> +	{PRO_DMOD, 0x0081, {0x0a, 0x12}, 0x02},
> +	{PRO_DMOD, 0x0084, {0x0a, 0x33, 0xbe, 0xa0, 0xc6, 0xb6, 0x01}, 0x07},
> +	{PRO_DMOD, 0x008e, {0x01}, 0x01},
> +	{PRO_DMOD, 0x0092, {0x06, 0x00, 0x00, 0x00, 0x00}, 0x05},
> +	{PRO_DMOD, 0x0099, {0x01}, 0x01},
> +	{PRO_DMOD, 0x009b, {0x3c, 0x28}, 0x02},
> +	{PRO_DMOD, 0x009f, {0xe1, 0xcf}, 0x02},
> +	{PRO_DMOD, 0x00a3, {0x01, 0x5a, 0x01, 0x01}, 0x04},
> +	{PRO_DMOD, 0x00a9, {0x00, 0x01}, 0x02},
> +	{PRO_DMOD, 0x00b0, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00b3, {0x02, 0x3a}, 0x02},
> +	{PRO_DMOD, 0x00b6, {0x14}, 0x01},
> +	{PRO_DMOD, 0x00c0, {0x11, 0x00, 0x05, 0x01, 0x00}, 0x05},
> +	{PRO_DMOD, 0x00c6, {0x19, 0x00}, 0x02},
> +	{PRO_DMOD, 0x00cb, {0x32, 0x2c, 0x4f, 0x30}, 0x04},
> +	{PRO_DMOD, 0x00f3, {0x05, 0xa0, 0x8c}, 0x03},
> +	{PRO_DMOD, 0x00f8, {0x03, 0x06, 0x06}, 0x03},
> +	{PRO_DMOD, 0x00fc, {	0x03, 0x03, 0x02, 0x0a, 0x50, 0x7b, 0x8c,
> +				0x00, 0x02, 0xbe, 0x00}, 0x0b},
> +	{PRO_DMOD, 0x0109, {0x02}, 0x01},
> +	{PRO_DMOD, 0x0115, {0x0a, 0x03}, 0x02},
> +	{PRO_DMOD, 0x011a, {0xbe}, 0x01},
> +	{PRO_DMOD, 0x0124, {0xae}, 0x01},
> +	{PRO_DMOD, 0x0127, {0x00}, 0x01},
> +	{PRO_DMOD, 0x012a, {0x56, 0x50, 0x47, 0x42}, 0x04},
> +	{PRO_DMOD, 0x0137, {0x00}, 0x01},
> +	{PRO_DMOD, 0x013b, {0x08}, 0x01},
> +	{PRO_DMOD, 0x013f, {0x5b}, 0x01},
> +	{PRO_DMOD, 0x0141, {	0x59, 0xf9, 0x19, 0x19, 0x8c, 0x8c, 0x8c,
> +				0x6e, 0x8c, 0x50, 0x8c, 0x8c, 0xac, 0xc6,
> +				0x33}, 0x0f},
> +	{PRO_DMOD, 0x0151, {0x28}, 0x01},
> +	{PRO_DMOD, 0x0153, {0xbc}, 0x01},
> +	{PRO_DMOD, 0x0178, {0x09}, 0x01},
> +	{PRO_DMOD, 0x0181, {0x94, 0x6e}, 0x02},
> +	{PRO_DMOD, 0x0185, {0x24}, 0x01},
> +	{PRO_DMOD, 0x0187, {0x00, 0x00, 0xbe, 0x02, 0x80}, 0x05},
> +	{PRO_DMOD, 0xed02, {0xff}, 0x01},
> +	{PRO_DMOD, 0xee42, {0xff}, 0x01},
> +	{PRO_DMOD, 0xee82, {0xff}, 0x01},
> +	{PRO_DMOD, 0xf000, {0x0f}, 0x01},
> +	{PRO_DMOD, 0xf01f, {0x8c, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf029, {0x8c, 0x00, 0x00}, 0x03},
> +	{PRO_DMOD, 0xf064, {0x03, 0xf9, 0x03, 0x01}, 0x04},
> +	{PRO_DMOD, 0xf06f, {0xe0, 0x03}, 0x02},
> +	{PRO_DMOD, 0xf072, {0x0f, 0x03}, 0x02},
> +	{PRO_DMOD, 0xf077, {0x01, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf087, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf09b, {0x3f, 0x00, 0x20, 0x00, 0x0c, 0x00}, 0x06},
> +	{PRO_DMOD, 0xf130, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf132, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf144, {0x1a}, 0x01},
> +	{PRO_DMOD, 0xf146, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf14a, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf14c, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf14f, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf158, {0x7f}, 0x01},
> +	{PRO_DMOD, 0xf15a, {0x00, 0x08}, 0x02},
> +	{PRO_DMOD, 0xf15d, {0x03, 0x05}, 0x02},
> +	{PRO_DMOD, 0xf163, {0x05}, 0x01},
> +	{PRO_DMOD, 0xf166, {0x01, 0x40, 0x0f}, 0x03},
> +	{PRO_DMOD, 0xf17a, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf183, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf19d, {0x40}, 0x01},
> +	{PRO_DMOD, 0xf1bc, {0x36, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf1cb, {0xa0, 0x01}, 0x02},
> +	{PRO_DMOD, 0xf204, {0x10}, 0x01},
> +	{PRO_DMOD, 0xf214, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf24c, {0x88, 0x95, 0x9a, 0x90}, 0x04},
> +	{PRO_DMOD, 0xf25a, {0x07, 0xe8, 0x03, 0xb0, 0x04}, 0x05},
> +	{PRO_DMOD, 0xf270, {0x01, 0x02, 0x01, 0x02}, 0x04},
> +	{PRO_DMOD, 0xf40e, {0x0a, 0x40, 0x08}, 0x03},
> +	{PRO_DMOD, 0xf55f, {0x0a}, 0x01},
> +	{PRO_DMOD, 0xf561, {0x15, 0x20}, 0x02},
> +	{PRO_DMOD, 0xf5e3, {0x09, 0x01, 0x01}, 0x03},
> +	{PRO_DMOD, 0xf600, {0x05, 0x08, 0x0b, 0x0e, 0x11, 0x14, 0x17
> +		, 0x1f}, 0x08},
> +	{PRO_DMOD, 0xf60e, {0x00, 0x04, 0x32, 0x10}, 0x04},
> +	{PRO_DMOD, 0xf707, {0xfc, 0x00, 0x37, 0x00}, 0x04},
> +	{PRO_DMOD, 0xf78b, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf80f, {0x40, 0x54, 0x5a}, 0x03},
> +	{PRO_DMOD, 0xf905, {0x01}, 0x01},
> +	{PRO_DMOD, 0xfb06, {0x03}, 0x01},
> +	{PRO_DMOD, 0xfd8b, {0x00}, 0x01},
> +	{0xff, 0x0000, {0x00}, 0x00} /* Terminating Entry */
> +};
> +
> +static struct it913xset it9135_61[] = {
> +	{PRO_DMOD, 0x0043, {0x00}, 0x01},
> +	{PRO_DMOD, 0x0046, {0x61}, 0x01},
> +	{PRO_DMOD, 0x0051, {0x01}, 0x01},
> +	{PRO_DMOD, 0x005f, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0x0068, {0x06}, 0x01},
> +	{PRO_DMOD, 0x006a, {0x03}, 0x01},
> +	{PRO_DMOD, 0x0070, {0x0a, 0x05, 0x02}, 0x03},
> +	{PRO_DMOD, 0x0075, {0x8c, 0x8c, 0x8c, 0x90, 0x01}, 0x05},
> +	{PRO_DMOD, 0x007e, {0x04}, 0x01},
> +	{PRO_DMOD, 0x0081, {0x0a, 0x12}, 0x02},
> +	{PRO_DMOD, 0x0084, {0x0a, 0x33, 0xbc, 0x9c, 0xcc, 0xa8, 0x01}, 0x07},
> +	{PRO_DMOD, 0x008e, {0x01}, 0x01},
> +	{PRO_DMOD, 0x0092, {0x06, 0x00, 0x00, 0x00, 0x00}, 0x05},
> +	{PRO_DMOD, 0x0099, {0x01}, 0x01},
> +	{PRO_DMOD, 0x009b, {0x3c, 0x28}, 0x02},
> +	{PRO_DMOD, 0x009f, {0xe1, 0xcf}, 0x02},
> +	{PRO_DMOD, 0x00a3, {0x01, 0x5c, 0x01, 0x01}, 0x04},
> +	{PRO_DMOD, 0x00a9, {0x00, 0x01}, 0x02},
> +	{PRO_DMOD, 0x00b0, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00b3, {0x02, 0x3a}, 0x02},
> +	{PRO_DMOD, 0x00b6, {0x14}, 0x01},
> +	{PRO_DMOD, 0x00c0, {0x11, 0x00, 0x05, 0x01, 0x00}, 0x05},
> +	{PRO_DMOD, 0x00c6, {0x19, 0x00}, 0x02},
> +	{PRO_DMOD, 0x00cb, {0x32, 0x2c, 0x4f, 0x30}, 0x04},
> +	{PRO_DMOD, 0x00f3, {0x05, 0xa0, 0x8c}, 0x03},
> +	{PRO_DMOD, 0x00f8, {0x03, 0x06, 0x06}, 0x03},
> +	{PRO_DMOD, 0x00fc, {	0x03, 0x03, 0x02, 0x08, 0x50, 0x7b, 0x8c,
> +				0x01, 0x02, 0xc8, 0x00}, 0x0b},
> +	{PRO_DMOD, 0x0109, {0x02}, 0x01},
> +	{PRO_DMOD, 0x0115, {0x0a, 0x03}, 0x02},
> +	{PRO_DMOD, 0x011a, {0xc6}, 0x01},
> +	{PRO_DMOD, 0x0124, {0xa8}, 0x01},
> +	{PRO_DMOD, 0x0127, {0x00}, 0x01},
> +	{PRO_DMOD, 0x012a, {0x59, 0x50, 0x47, 0x42}, 0x04},
> +	{PRO_DMOD, 0x0137, {0x00}, 0x01},
> +	{PRO_DMOD, 0x013b, {0x05}, 0x01},
> +	{PRO_DMOD, 0x013f, {0x5b}, 0x01},
> +	{PRO_DMOD, 0x0141, {	0x59, 0xf9, 0x59, 0x59, 0x8c, 0x8c, 0x8c,
> +				0x7b, 0x8c, 0x50, 0x8c, 0x8c, 0xa8, 0xc6,
> +				0x33}, 0x0f},
> +	{PRO_DMOD, 0x0151, {0x28}, 0x01},
> +	{PRO_DMOD, 0x0153, {0xcc}, 0x01},
> +	{PRO_DMOD, 0x0178, {0x09}, 0x01},
> +	{PRO_DMOD, 0x0181, {0x9c, 0x76}, 0x02},
> +	{PRO_DMOD, 0x0185, {0x28}, 0x01},
> +	{PRO_DMOD, 0x0187, {0x01, 0x00, 0xaa, 0x02, 0x80}, 0x05},
> +	{PRO_DMOD, 0xed02, {0xff}, 0x01},
> +	{PRO_DMOD, 0xee42, {0xff}, 0x01},
> +	{PRO_DMOD, 0xee82, {0xff}, 0x01},
> +	{PRO_DMOD, 0xf000, {0x0f}, 0x01},
> +	{PRO_DMOD, 0xf01f, {0x8c, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf029, {0x8c, 0x00, 0x00}, 0x03},
> +	{PRO_DMOD, 0xf064, {0x03, 0xf9, 0x03, 0x01}, 0x04},
> +	{PRO_DMOD, 0xf06f, {0xe0, 0x03}, 0x02},
> +	{PRO_DMOD, 0xf072, {0x0f, 0x03}, 0x02},
> +	{PRO_DMOD, 0xf077, {0x01, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf087, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf09b, {0x3f, 0x00, 0x20, 0x00, 0x0c, 0x00}, 0x06},
> +	{PRO_DMOD, 0xf130, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf132, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf144, {0x1a}, 0x01},
> +	{PRO_DMOD, 0xf146, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf14a, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf14c, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf14f, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf158, {0x7f}, 0x01},
> +	{PRO_DMOD, 0xf15a, {0x00, 0x08}, 0x02},
> +	{PRO_DMOD, 0xf15d, {0x03, 0x05}, 0x02},
> +	{PRO_DMOD, 0xf163, {0x05}, 0x01},
> +	{PRO_DMOD, 0xf166, {0x01, 0x40, 0x0f}, 0x03},
> +	{PRO_DMOD, 0xf17a, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf183, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf19d, {0x40}, 0x01},
> +	{PRO_DMOD, 0xf1bc, {0x36, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf1cb, {0xa0, 0x01}, 0x02},
> +	{PRO_DMOD, 0xf204, {0x10}, 0x01},
> +	{PRO_DMOD, 0xf214, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf24c, {0x88, 0x95, 0x9a, 0x90}, 0x04},
> +	{PRO_DMOD, 0xf25a, {0x07, 0xe8, 0x03, 0xb0, 0x04}, 0x05},
> +	{PRO_DMOD, 0xf270, {0x01, 0x02, 0x01, 0x02}, 0x04},
> +	{PRO_DMOD, 0xf40e, {0x0a, 0x40, 0x08}, 0x03},
> +	{PRO_DMOD, 0xf55f, {0x0a}, 0x01},
> +	{PRO_DMOD, 0xf561, {0x15, 0x20}, 0x02},
> +	{PRO_DMOD, 0xf5e3, {0x09, 0x01, 0x01}, 0x03},
> +	{PRO_DMOD, 0xf600, {	0x05, 0x08, 0x0b, 0x0e, 0x11, 0x14, 0x17,
> +				0x1f}, 0x08},
> +	{PRO_DMOD, 0xf60e, {0x00, 0x04, 0x32, 0x10}, 0x04},
> +	{PRO_DMOD, 0xf707, {0xfc, 0x00, 0x37, 0x00}, 0x04},
> +	{PRO_DMOD, 0xf78b, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf80f, {0x40, 0x54, 0x5a}, 0x03},
> +	{PRO_DMOD, 0xf905, {0x01}, 0x01},
> +	{PRO_DMOD, 0xfb06, {0x03}, 0x01},
> +	{PRO_DMOD, 0xfd8b, {0x00}, 0x01},
> +	{0xff, 0x0000, {0x00}, 0x00} /* Terminating Entry */
> +};
> +
> +static struct it913xset it9135_62[] = {
> +	{PRO_DMOD, 0x0043, {0x00}, 0x01},
> +	{PRO_DMOD, 0x0046, {0x62}, 0x01},
> +	{PRO_DMOD, 0x0051, {0x01}, 0x01},
> +	{PRO_DMOD, 0x005f, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0x0068, {0x0a}, 0x01},
> +	{PRO_DMOD, 0x006a, {0x03}, 0x01},
> +	{PRO_DMOD, 0x0070, {0x0a, 0x05, 0x02}, 0x03},
> +	{PRO_DMOD, 0x0075, {0x8c, 0x8c, 0x8c, 0x8c, 0x01}, 0x05},
> +	{PRO_DMOD, 0x007e, {0x04}, 0x01},
> +	{PRO_DMOD, 0x0081, {0x0a, 0x12}, 0x02},
> +	{PRO_DMOD, 0x0084, {	0x0a, 0x33, 0xb8, 0x9c, 0xb2, 0xa6, 0x01},
> +				0x07},
> +	{PRO_DMOD, 0x008e, {0x01}, 0x01},
> +	{PRO_DMOD, 0x0092, {0x06, 0x00, 0x00, 0x00, 0x00}, 0x05},
> +	{PRO_DMOD, 0x0099, {0x01}, 0x01},
> +	{PRO_DMOD, 0x009b, {0x3c, 0x28}, 0x02},
> +	{PRO_DMOD, 0x009f, {0xe1, 0xcf}, 0x02},
> +	{PRO_DMOD, 0x00a3, {0x01, 0x5a, 0x01, 0x01}, 0x04},
> +	{PRO_DMOD, 0x00a9, {0x00, 0x01}, 0x02},
> +	{PRO_DMOD, 0x00b0, {0x01}, 0x01},
> +	{PRO_DMOD, 0x00b3, {0x02, 0x3a}, 0x02},
> +	{PRO_DMOD, 0x00b6, {0x14}, 0x01},
> +	{PRO_DMOD, 0x00c0, {0x11, 0x00, 0x05, 0x01, 0x00}, 0x05},
> +	{PRO_DMOD, 0x00c6, {0x19, 0x00}, 0x02},
> +	{PRO_DMOD, 0x00cb, {0x32, 0x2c, 0x4f, 0x30}, 0x04},
> +	{PRO_DMOD, 0x00f3, {0x05, 0x8c, 0x8c}, 0x03},
> +	{PRO_DMOD, 0x00f8, {0x03, 0x06, 0x06}, 0x03},
> +	{PRO_DMOD, 0x00fc, {	0x02, 0x03, 0x02, 0x09, 0x50, 0x6e, 0x8c,
> +				0x02, 0x02, 0xc2, 0x00}, 0x0b},
> +	{PRO_DMOD, 0x0109, {0x02}, 0x01},
> +	{PRO_DMOD, 0x0115, {0x0a, 0x03}, 0x02},
> +	{PRO_DMOD, 0x011a, {0xb8}, 0x01},
> +	{PRO_DMOD, 0x0124, {0xa8}, 0x01},
> +	{PRO_DMOD, 0x0127, {0x00}, 0x01},
> +	{PRO_DMOD, 0x012a, {0x53, 0x51, 0x4e, 0x43}, 0x04},
> +	{PRO_DMOD, 0x0137, {0x00}, 0x01},
> +	{PRO_DMOD, 0x013b, {0x05}, 0x01},
> +	{PRO_DMOD, 0x013f, {0x5b}, 0x01},
> +	{PRO_DMOD, 0x0141, {	0x59, 0xf9, 0x59, 0x19, 0x8c, 0x8c, 0x8c,
> +				0x7b, 0x8c, 0x50, 0x70, 0x8c, 0x96, 0xd0,
> +				0x33}, 0x0f},
> +	{PRO_DMOD, 0x0151, {0x28}, 0x01},
> +	{PRO_DMOD, 0x0153, {0xb2}, 0x01},
> +	{PRO_DMOD, 0x0178, {0x09}, 0x01},
> +	{PRO_DMOD, 0x0181, {0x9c, 0x6e}, 0x02},
> +	{PRO_DMOD, 0x0185, {0x24}, 0x01},
> +	{PRO_DMOD, 0x0187, {0x00, 0x00, 0xb8, 0x02, 0x80}, 0x05},
> +	{PRO_DMOD, 0xed02, {0xff}, 0x01},
> +	{PRO_DMOD, 0xee42, {0xff}, 0x01},
> +	{PRO_DMOD, 0xee82, {0xff}, 0x01},
> +	{PRO_DMOD, 0xf000, {0x0f}, 0x01},
> +	{PRO_DMOD, 0xf01f, {0x8c, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf029, {0x8c, 0x00, 0x00}, 0x03},
> +	{PRO_DMOD, 0xf064, {0x03, 0xf9, 0x03, 0x01}, 0x04},
> +	{PRO_DMOD, 0xf06f, {0xe0, 0x03}, 0x02},
> +	{PRO_DMOD, 0xf072, {0x0f, 0x03}, 0x02},
> +	{PRO_DMOD, 0xf077, {0x01, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf087, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf09b, {0x3f, 0x00, 0x20, 0x00, 0x0c, 0x00}, 0x06},
> +	{PRO_DMOD, 0xf130, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf132, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf144, {0x1a}, 0x01},
> +	{PRO_DMOD, 0xf146, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf14a, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf14c, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf14f, {0x04}, 0x01},
> +	{PRO_DMOD, 0xf158, {0x7f}, 0x01},
> +	{PRO_DMOD, 0xf15a, {0x00, 0x08}, 0x02},
> +	{PRO_DMOD, 0xf15d, {0x03, 0x05}, 0x02},
> +	{PRO_DMOD, 0xf163, {0x05}, 0x01},
> +	{PRO_DMOD, 0xf166, {0x01, 0x40, 0x0f}, 0x03},
> +	{PRO_DMOD, 0xf17a, {0x00, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf183, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf19d, {0x40}, 0x01},
> +	{PRO_DMOD, 0xf1bc, {0x36, 0x00}, 0x02},
> +	{PRO_DMOD, 0xf1cb, {0xa0, 0x01}, 0x02},
> +	{PRO_DMOD, 0xf204, {0x10}, 0x01},
> +	{PRO_DMOD, 0xf214, {0x00}, 0x01},
> +	{PRO_DMOD, 0xf24c, {0x88, 0x95, 0x9a, 0x90}, 0x04},
> +	{PRO_DMOD, 0xf25a, {0x07, 0xe8, 0x03, 0xb0, 0x04}, 0x05},
> +	{PRO_DMOD, 0xf270, {0x01, 0x02, 0x01, 0x02}, 0x04},
> +	{PRO_DMOD, 0xf40e, {0x0a, 0x40, 0x08}, 0x03},
> +	{PRO_DMOD, 0xf55f, {0x0a}, 0x01},
> +	{PRO_DMOD, 0xf561, {0x15, 0x20}, 0x02},
> +	{PRO_DMOD, 0xf5e3, {0x09, 0x01, 0x01}, 0x03},
> +	{PRO_DMOD, 0xf600, {	0x05, 0x08, 0x0b, 0x0e, 0x11, 0x14, 0x17,
> +				0x1f}, 0x08},
> +	{PRO_DMOD, 0xf60e, {0x00, 0x04, 0x32, 0x10}, 0x04},
> +	{PRO_DMOD, 0xf707, {0xfc, 0x00, 0x37, 0x00}, 0x04},
> +	{PRO_DMOD, 0xf78b, {0x01}, 0x01},
> +	{PRO_DMOD, 0xf80f, {0x40, 0x54, 0x5a}, 0x03},
> +	{PRO_DMOD, 0xf905, {0x01}, 0x01},
> +	{PRO_DMOD, 0xfb06, {0x03}, 0x01},
> +	{PRO_DMOD, 0xfd8b, {0x00}, 0x01},
> +	{0xff, 0x0000, {0x00}, 0x00} /* Terminating Entry */
>  };
>  
> +/* Tuner setting scripts (still keeping it9137) */
>  static struct it913xset it9137_tuner_off[] = {
>  	{PRO_DMOD, 0xfba8, {0x01}, 0x01}, /* Tuner Clock Off  */
>  	{PRO_DMOD, 0xec40, {0x00}, 0x01}, /* Power Down Tuner */
> diff --git a/drivers/media/dvb/frontends/it913x-fe.c b/drivers/media/dvb/frontends/it913x-fe.c
> index d4bd24e..5113b89 100644
> --- a/drivers/media/dvb/frontends/it913x-fe.c
> +++ b/drivers/media/dvb/frontends/it913x-fe.c
> @@ -50,6 +50,7 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able)).");
>  struct it913x_fe_state {
>  	struct dvb_frontend frontend;
>  	struct i2c_adapter *i2c_adap;
> +	struct ite_config *config;
>  	u8 i2c_addr;
>  	u32 frequency;
>  	u8 adf;
> @@ -211,13 +212,17 @@ static int it913x_init_tuner(struct it913x_fe_state *state)
>  	state->tun_fn_min /= (state->tun_fdiv * nv_val);
>  	deb_info("Tuner fn_min %d", state->tun_fn_min);
>  
> -	for (i = 0; i < 50; i++) {
> -		reg = it913x_read_reg_u8(state, 0xec82);
> -		if (reg > 0)
> -			break;
> -		if (reg < 0)
> -			return -ENODEV;
> -		udelay(2000);
> +	if (state->config->chip_ver > 1)
> +		msleep(50);
> +	else {
> +		for (i = 0; i < 50; i++) {
> +			reg = it913x_read_reg_u8(state, 0xec82);
> +			if (reg > 0)
> +				break;
> +			if (reg < 0)
> +				return -ENODEV;
> +			udelay(2000);
> +		}
>  	}
>  
>  	return it913x_write_reg(state, PRO_DMOD, 0xed81, val);
> @@ -578,7 +583,12 @@ static int it913x_fe_set_frontend(struct dvb_frontend *fe,
>  
>  	deb_info("Frontend Set Tuner Type %02x", state->tuner_type);
>  	switch (state->tuner_type) {
> -	case IT9137: /* Tuner type 0x38 */
> +	case IT9135_38:
> +	case IT9135_51:
> +	case IT9135_52:
> +	case IT9135_60:
> +	case IT9135_61:
> +	case IT9135_62:
>  		ret = it9137_set_tuner(state,
>  			p->u.ofdm.bandwidth, p->frequency);
>  		break;
> @@ -678,14 +688,15 @@ static u32 compute_div(u32 a, u32 b, u32 x)
>  
>  static int it913x_fe_start(struct it913x_fe_state *state)
>  {
> -	struct it913xset *set_fe;
> +	struct it913xset *set_lna;
>  	struct it913xset *set_mode;
>  	int ret;
> -	u8 adf = (state->adf & 0xf);
> +	u8 adf = (state->config->adf & 0xf);
>  	u32 adc, xtal;
>  	u8 b[4];
>  
> -	ret = it913x_init_tuner(state);
> +	if (state->config->chip_ver == 1)
> +		ret = it913x_init_tuner(state);
>  
>  	if (adf < 12) {
>  		state->crystalFrequency = fe_clockTable[adf].xtal ;
> @@ -720,23 +731,57 @@ static int it913x_fe_start(struct it913x_fe_state *state)
>  	b[1] = (adc >> 8) & 0xff;
>  	b[2] = (adc >> 16) & 0xff;
>  	ret |= it913x_write(state, PRO_DMOD, ADC_FREQ, b, 3);
> +	if (ret < 0)
> +		return -ENODEV;
>  
> +	/* v1 or v2 tuner script */
> +	if (state->config->chip_ver > 1)
> +		ret = it913x_fe_script_loader(state, it9135_v2);
> +	else
> +		ret = it913x_fe_script_loader(state, it9135_v1);
> +	if (ret < 0)
> +		return ret;
> +
> +	/* LNA Scripts */
>  	switch (state->tuner_type) {
> -	case IT9137: /* Tuner type 0x38 */
> -		set_fe = it9137_set;
> +	case IT9135_51:
> +		set_lna = it9135_51;
> +		break;
> +	case IT9135_52:
> +		set_lna = it9135_52;
>  		break;
> +	case IT9135_60:
> +		set_lna = it9135_60;
> +		break;
> +	case IT9135_61:
> +		set_lna = it9135_61;
> +		break;
> +	case IT9135_62:
> +		set_lna = it9135_62;
> +		break;
> +	case IT9135_38:
>  	default:
> -		return -EINVAL;
> +		set_lna = it9135_38;
>  	}
> +	ret = it913x_fe_script_loader(state, set_lna);
> +	if (ret < 0)
> +		return ret;
> +
> +	if (state->config->chip_ver == 2) {
> +		ret = it913x_write_reg(state, PRO_DMOD, TRIGGER_OFSM, 0x1);
> +		ret |= it913x_write_reg(state, PRO_LINK, PADODPU, 0x0);
> +		ret |= it913x_write_reg(state, PRO_LINK, AGC_O_D, 0x0);
> +		ret |= it913x_init_tuner(state);
> +	}
> +	if (ret < 0)
> +		return -ENODEV;
>  
> -	/* set the demod */
> -	ret = it913x_fe_script_loader(state, set_fe);
>  	/* Always solo frontend */
>  	set_mode = set_solo_fe;
>  	ret |= it913x_fe_script_loader(state, set_mode);
>  
>  	ret |= it913x_fe_suspend(state);
> -	return 0;
> +	return (ret < 0) ? -ENODEV : 0;
>  }
>  
>  static int it913x_fe_init(struct dvb_frontend *fe)
> @@ -750,13 +795,7 @@ static int it913x_fe_init(struct dvb_frontend *fe)
>  
>  	ret |= it913x_fe_script_loader(state, init_1);
>  
> -	switch (state->tuner_type) {
> -	case IT9137:
> -		ret |= it913x_write_reg(state, PRO_DMOD, 0xfba8, 0x0);
> -		break;
> -	default:
> -		return -EINVAL;
> -	}
> +	ret |= it913x_write_reg(state, PRO_DMOD, 0xfba8, 0x0);
>  
>  	return (ret < 0) ? -ENODEV : 0;
>  }
> @@ -770,19 +809,34 @@ static void it913x_fe_release(struct dvb_frontend *fe)
>  static struct dvb_frontend_ops it913x_fe_ofdm_ops;
>  
>  struct dvb_frontend *it913x_fe_attach(struct i2c_adapter *i2c_adap,
> -		u8 i2c_addr, u8 adf, u8 type)
> +		u8 i2c_addr, struct ite_config *config)
>  {
>  	struct it913x_fe_state *state = NULL;
>  	int ret;
> +
>  	/* allocate memory for the internal state */
>  	state = kzalloc(sizeof(struct it913x_fe_state), GFP_KERNEL);
>  	if (state == NULL)
> +		return NULL;
> +	if (config == NULL)
>  		goto error;
>  
>  	state->i2c_adap = i2c_adap;
>  	state->i2c_addr = i2c_addr;
> -	state->adf = adf;
> -	state->tuner_type = type;
> +	state->config = config;
> +
> +	switch (state->config->tuner_id_0) {
> +	case IT9135_51:
> +	case IT9135_52:
> +	case IT9135_60:
> +	case IT9135_61:
> +	case IT9135_62:
> +		state->tuner_type = state->config->tuner_id_0;
> +		break;
> +	default:
> +	case IT9135_38:
> +		state->tuner_type = IT9135_38;
> +	}
>  
>  	ret = it913x_fe_start(state);
>  	if (ret < 0)
> @@ -835,5 +889,5 @@ static struct dvb_frontend_ops it913x_fe_ofdm_ops = {
>  
>  MODULE_DESCRIPTION("it913x Frontend and it9137 tuner");
>  MODULE_AUTHOR("Malcolm Priestley tvboxspy@xxxxxxxxx");
> -MODULE_VERSION("1.07");
> +MODULE_VERSION("1.08");
>  MODULE_LICENSE("GPL");
> diff --git a/drivers/media/dvb/frontends/it913x-fe.h b/drivers/media/dvb/frontends/it913x-fe.h
> index 9d97f32..43f879a 100644
> --- a/drivers/media/dvb/frontends/it913x-fe.h
> +++ b/drivers/media/dvb/frontends/it913x-fe.h
> @@ -23,13 +23,25 @@
>  
>  #include <linux/dvb/frontend.h>
>  #include "dvb_frontend.h"
> +
> +struct ite_config {
> +	u8 chip_ver;
> +	u16 chip_type;
> +	u32 firmware;
> +	u8 tuner_id_0;
> +	u8 tuner_id_1;
> +	u8 dual_mode;
> +	u8 adf;
> +};
> +
>  #if defined(CONFIG_DVB_IT913X_FE) || (defined(CONFIG_DVB_IT913X_FE_MODULE) && \
>  defined(MODULE))
>  extern struct dvb_frontend *it913x_fe_attach(struct i2c_adapter *i2c_adap,
> -			u8 i2c_addr, u8 adf, u8 type);
> +			u8 i2c_addr, struct ite_config *config);
>  #else
>  static inline struct dvb_frontend *it913x_fe_attach(
> -		struct i2c_adapter *i2c_adap,	u8 i2c_addr, u8 adf, u8 type)
> +		struct i2c_adapter *i2c_adap,
> +			u8 i2c_addr, struct ite_config *config)
>  {
>  	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
>  	return NULL;
> @@ -144,8 +156,14 @@ static inline struct dvb_frontend *it913x_fe_attach(
>  #define EST_SIGNAL_LEVEL	0x004a
>  #define FREE_BAND		0x004b
>  #define SUSPEND_FLAG		0x004c
> -/* Build in tuners */
> +/* Build in tuner types */
>  #define IT9137 0x38
> +#define IT9135_38 0x38
> +#define IT9135_51 0x50
> +#define IT9135_52 0x52
> +#define IT9135_60 0x60
> +#define IT9135_61 0x61
> +#define IT9135_62 0x62
>  
>  enum {
>  	CMD_DEMOD_READ = 0,

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux