 +				1);
 +		}
 +
-+#ifdef V4L2_REFACTORED_MFE_CODE
-+		ret = dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
-+#else
 +		ret = dvb_attach(mxl5007t_attach, adap->fe, &adap->dev->i2c_adap,
-+#endif
 +			af9035_af9033_config[adap->id].tuner_address,
 +			&af9035_mxl5007t_config[adap->id]) == NULL ? -ENODEV : 0;
 +
 +		break;
-+          case AF9033_TUNER_TDA18218:
-+                  af9035_af9033_config[adap->id].tuner_address = af9035_tua9001_config[adap->id].i2c_address;
-+                  af9035_af9033_config[adap->id].tuner_address += adap->id;
-+                  if (adap->id == 0) {
-+                  /* gpiot3 TUA9001 RESETN
-+                  gpiot2 TUA9001 RXEN */
-+                  ret = af9035_write_reg_bits(adap->dev, LINK,
-+                          p_reg_top_gpiot2_en, reg_top_gpiot2_en_pos,
-+                          reg_top_gpiot2_en_len, 1);
-+                  ret = af9035_write_reg_bits(adap->dev, LINK,
-+                          p_reg_top_gpiot2_on, reg_top_gpiot2_on_pos,
-+                          reg_top_gpiot2_on_len, 1);
-+                  ret = af9035_write_reg_bits(adap->dev, LINK,
-+                          p_reg_top_gpiot3_en, reg_top_gpiot3_en_pos,
-+                          reg_top_gpiot3_en_len, 1);
-+                  ret = af9035_write_reg_bits(adap->dev, LINK,
-+                          p_reg_top_gpiot3_on, reg_top_gpiot3_on_pos,
-+                          reg_top_gpiot3_on_len, 1);
-+
-+                  /* reset tuner */
-+                  ret = af9035_write_reg_bits(adap->dev, LINK, p_reg_top_gpiot3_o,
-+                          reg_top_gpiot3_o_pos, reg_top_gpiot3_o_len, 0);
-+                  msleep(1);
-+                  ret = af9035_write_reg_bits(adap->dev, LINK, p_reg_top_gpiot3_o,
-+                          reg_top_gpiot3_o_pos, reg_top_gpiot3_o_len, 1);
-+
-+                   /* activate tuner - TODO: do that like I2C gate control */
-+                   ret = af9035_write_reg_bits(adap->dev, LINK, p_reg_top_gpiot2_o,
-+                           reg_top_gpiot2_o_pos, reg_top_gpiot2_o_len, 1);
-+                   }
-+
-+#ifdef V4L2_REFACTORED_MFE_CODE
-+                   ret = dvb_attach(tda18218_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
-+#else
-+                   ret = dvb_attach(tda18218_attach, adap->fe, &adap->dev->i2c_adap,
-+#endif
-+                           &af9035_tda18218_config) == NULL ? -ENODEV : 0;
-+                   break;
++	case AF9033_TUNER_TDA18218:
++		af9035_af9033_config[adap->id].tuner_address = af9035_tua9001_config[adap->id].i2c_address;
++		af9035_af9033_config[adap->id].tuner_address += adap->id;
++		if (adap->id == 0) {
++			/* gpiot3 TUA9001 RESETN
++			   gpiot2 TUA9001 RXEN */
++			ret = af9035_write_reg_bits(adap->dev, LINK, p_reg_top_gpiot2_en,
++				 reg_top_gpiot2_en_pos, reg_top_gpiot2_en_len, 1);
++			ret = af9035_write_reg_bits(adap->dev, LINK, p_reg_top_gpiot2_on,
++				 reg_top_gpiot2_on_pos, reg_top_gpiot2_on_len, 1);
++			ret = af9035_write_reg_bits(adap->dev, LINK,
++				 p_reg_top_gpiot3_en, reg_top_gpiot3_en_pos,
++				 reg_top_gpiot3_en_len, 1);
++			ret = af9035_write_reg_bits(adap->dev, LINK,
++				 p_reg_top_gpiot3_on, reg_top_gpiot3_on_pos,
++				 reg_top_gpiot3_on_len, 1);
++
++			/* reset tuner */
++			ret = af9035_write_reg_bits(adap->dev, LINK, p_reg_top_gpiot3_o,
++				 reg_top_gpiot3_o_pos, reg_top_gpiot3_o_len, 0);
++			msleep(1);
++			ret = af9035_write_reg_bits(adap->dev, LINK, p_reg_top_gpiot3_o,
++				 reg_top_gpiot3_o_pos, reg_top_gpiot3_o_len, 1);
++
++			/* activate tuner - TODO: do that like I2C gate control */
++			ret = af9035_write_reg_bits(adap->dev, LINK, p_reg_top_gpiot2_o,
++				 reg_top_gpiot2_o_pos, reg_top_gpiot2_o_len, 1);
++		}
++
++		ret = dvb_attach(tda18218_attach, adap->fe, &adap->dev->i2c_adap,
++		   &af9035_tda18218_config) == NULL ? -ENODEV : 0;
++
++		break;
 +	default:
 +		ret = -ENODEV;
 +		err("unknown tuner ID:%d",

+	return ret;
+}
+
+enum af9035_usb_table_entry {
+	AFATECH_AF9035_1000,
+	AFATECH_AF9035_1001,
+	AFATECH_AF9035_1002,
+	AFATECH_AF9035_1003,
+	AFATECH_AF9035_9035,
+	TERRATEC_CINERGY_T_STICK,
+	TERRATEC_CINERGY_T_STICK_2,
+	AVERMEDIA_TWINSTAR,
+	AVERMEDIA_VOLAR_HD,
+	AVERMEDIA_VOLAR_HD_PRO,
+#ifdef ENABLE_A867_DEVICES
+	AVERMEDIA_A333,
+	AVERMEDIA_B867,
+	AVERMEDIA_1867,
+	AVERMEDIA_0337,
+	AVERMEDIA_A867,
+	AVERMEDIA_0867,
+	AVERMEDIA_F337,
+	AVERMEDIA_3867,
+#endif
+};
+
+static struct usb_device_id af9035_usb_table[] = {
+	[AFATECH_AF9035_1000] = {USB_DEVICE(USB_VID_AFATECH,
+				USB_PID_AFATECH_AF9035_1000)},
+	[AFATECH_AF9035_1001] = {USB_DEVICE(USB_VID_AFATECH,
+				USB_PID_AFATECH_AF9035_1001)},
+	[AFATECH_AF9035_1002] = {USB_DEVICE(USB_VID_AFATECH,
+				USB_PID_AFATECH_AF9035_1002)},
+	[AFATECH_AF9035_1003] = {USB_DEVICE(USB_VID_AFATECH,
+				USB_PID_AFATECH_AF9035_1003)},
+	[AFATECH_AF9035_9035] = {USB_DEVICE(USB_VID_AFATECH,
+				USB_PID_AFATECH_AF9035_9035)},
+	[TERRATEC_CINERGY_T_STICK] = {USB_DEVICE(USB_VID_TERRATEC,
+				USB_PID_TERRATEC_CINERGY_T_STICK)},
+	[TERRATEC_CINERGY_T_STICK_2] = {USB_DEVICE(USB_VID_TERRATEC,
+				USB_PID_TERRATEC_CINERGY_T_STICK_2)},
+	[AVERMEDIA_TWINSTAR] = {USB_DEVICE(USB_VID_AVERMEDIA,
+				USB_PID_AVERMEDIA_A825)},
+	[AVERMEDIA_VOLAR_HD] = {USB_DEVICE(USB_VID_AVERMEDIA,
+				USB_PID_AVERMEDIA_A835)},
+	[AVERMEDIA_VOLAR_HD_PRO] = {USB_DEVICE(USB_VID_AVERMEDIA,
+				USB_PID_AVERMEDIA_B835)},
+#ifdef ENABLE_A867_DEVICES
+	[AVERMEDIA_A333] = {USB_DEVICE(USB_VID_AVERMEDIA,
+				USB_PID_AVERMEDIA_A333)},
+	[AVERMEDIA_B867] = {USB_DEVICE(USB_VID_AVERMEDIA,
+				USB_PID_AVERMEDIA_B867)},
+	[AVERMEDIA_1867] = {USB_DEVICE(USB_VID_AVERMEDIA,
+				USB_PID_AVERMEDIA_1867)},
+	[AVERMEDIA_0337] = {USB_DEVICE(USB_VID_AVERMEDIA,
+				USB_PID_AVERMEDIA_0337)},
+	[AVERMEDIA_A867] = {USB_DEVICE(USB_VID_AVERMEDIA,
+				USB_PID_AVERMEDIA_A867)},
+	[AVERMEDIA_0867] = {USB_DEVICE(USB_VID_AVERMEDIA,
+				USB_PID_AVERMEDIA_0867)},
+	[AVERMEDIA_F337] = {USB_DEVICE(USB_VID_AVERMEDIA,
+				USB_PID_AVERMEDIA_F337)},
+	[AVERMEDIA_3867] = {USB_DEVICE(USB_VID_AVERMEDIA,
+				USB_PID_AVERMEDIA_3867)},
+#endif
+	{ },
+};
+
+MODULE_DEVICE_TABLE(usb, af9035_usb_table);
+
+static struct dvb_usb_device_properties af9035_properties[] = {
+	{
+		.caps = DVB_USB_IS_AN_I2C_ADAPTER,

+
+	return ret;
+}
+
+static int af9033_update_ber_ucblocks(struct dvb_frontend *fe)
+{
