Re: [PATCHv2 3/3] dw2102: TechnoTrend TT-connect S2-4600 DVB-S/S2 tuner

2015-03-16 Thread Antti Palosaari

On 03/16/2015 07:22 PM, Olli Salonen wrote:

TechnoTrend TT-connect S2-4600 is a USB2.0 DVB-S/S2 tuner using the popular
Montage M88DS3103/M88TS2022 demod/tuner.

The demodulator needs a firmware. Antti posted a firmware when releasing
support for PCTV 461e, available here:
http://palosaari.fi/linux/v4l-dvb/firmware/M88DS3103/

Patch v2: removed one unnecessary debug printout.

Signed-off-by: Olli Salonen olli.salo...@iki.fi


Reviewed-by: Antti Palosaari cr...@iki.fi

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


[PATCHv2 3/3] dw2102: TechnoTrend TT-connect S2-4600 DVB-S/S2 tuner

2015-03-16 Thread Olli Salonen
TechnoTrend TT-connect S2-4600 is a USB2.0 DVB-S/S2 tuner using the popular 
Montage M88DS3103/M88TS2022 demod/tuner.

The demodulator needs a firmware. Antti posted a firmware when releasing 
support for PCTV 461e, available here: 
http://palosaari.fi/linux/v4l-dvb/firmware/M88DS3103/

Patch v2: removed one unnecessary debug printout.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/dvb-core/dvb-usb-ids.h |   1 +
 drivers/media/usb/dvb-usb/Kconfig|   6 +-
 drivers/media/usb/dvb-usb/dw2102.c   | 158 ++-
 3 files changed, 161 insertions(+), 4 deletions(-)

diff --git a/drivers/media/dvb-core/dvb-usb-ids.h 
b/drivers/media/dvb-core/dvb-usb-ids.h
index 80ab8d0..c6de073 100644
--- a/drivers/media/dvb-core/dvb-usb-ids.h
+++ b/drivers/media/dvb-core/dvb-usb-ids.h
@@ -245,6 +245,7 @@
 #define USB_PID_TECHNOTREND_CONNECT_S2400   0x3006
 #define USB_PID_TECHNOTREND_CONNECT_S2400_8KEEPROM 0x3009
 #define USB_PID_TECHNOTREND_CONNECT_CT3650 0x300d
+#define USB_PID_TECHNOTREND_CONNECT_S2_4600 0x3011
 #define USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI0x3012
 #define USB_PID_TECHNOTREND_TVSTICK_CT2_4400   0x3014
 #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY   0x005a
diff --git a/drivers/media/usb/dvb-usb/Kconfig 
b/drivers/media/usb/dvb-usb/Kconfig
index 3364200..def1e06 100644
--- a/drivers/media/usb/dvb-usb/Kconfig
+++ b/drivers/media/usb/dvb-usb/Kconfig
@@ -278,9 +278,11 @@ config DVB_USB_DW2102
select DVB_STV6110 if MEDIA_SUBDRV_AUTOSELECT
select DVB_STV0900 if MEDIA_SUBDRV_AUTOSELECT
select DVB_M88RS2000 if MEDIA_SUBDRV_AUTOSELECT
+   select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT
+   select MEDIA_TUNER_TS2022 if MEDIA_SUBDRV_AUTOSELECT
help
- Say Y here to support the DvbWorld, TeVii, Prof DVB-S/S2 USB2.0
- receivers.
+ Say Y here to support the DvbWorld, TeVii, Prof, TechnoTrend
+ DVB-S/S2 USB2.0 receivers.
 
 config DVB_USB_CINERGY_T2
tristate Terratec CinergyT2/qanu USB 2.0 DVB-T receiver
diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index f7dd973..9dc3619 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -2,7 +2,8 @@
  * DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101,
  * TeVii S600, S630, S650, S660, S480, S421, S632
  * Prof 1100, 7500,
- * Geniatech SU3000, T220 Cards
+ * Geniatech SU3000, T220,
+ * TechnoTrend S2-4600 Cards
  * Copyright (C) 2008-2012 Igor M. Liplianin (liplia...@me.by)
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -31,6 +32,8 @@
 #include m88rs2000.h
 #include tda18271.h
 #include cxd2820r.h
+#include m88ds3103.h
+#include m88ts2022.h
 
 /* Max transfer size done by I2C transfer functions */
 #define MAX_XFER_SIZE  64
@@ -1115,6 +1118,22 @@ static struct tda18271_config tda18271_config = {
.gate = TDA18271_GATE_DIGITAL,
 };
 
+static const struct m88ds3103_config tt_s2_4600_m88ds3103_config = {
+   .i2c_addr = 0x68,
+   .clock = 2700,
+   .i2c_wr_max = 33,
+   .ts_mode = M88DS3103_TS_CI,
+   .ts_clk = 16000,
+   .ts_clk_pol = 0,
+   .spec_inv = 0,
+   .agc_inv = 0,
+   .clock_out = M88DS3103_CLOCK_OUT_ENABLED,
+   .envelope_mode = 0,
+   .agc = 0x99,
+   .lnb_hv_pol = 1,
+   .lnb_en_pol = 0,
+};
+
 static u8 m88rs2000_inittab[] = {
DEMOD_WRITE, 0x9a, 0x30,
DEMOD_WRITE, 0x00, 0x01,
@@ -1459,6 +1478,86 @@ static int m88rs2000_frontend_attach(struct 
dvb_usb_adapter *d)
return -EIO;
 }
 
+static int tt_s2_4600_frontend_attach(struct dvb_usb_adapter *adap)
+{
+   struct dvb_usb_device *d = adap-dev;
+   struct dw2102_state *state = d-priv;
+   u8 obuf[3] = { 0xe, 0x80, 0 };
+   u8 ibuf[] = { 0 };
+   struct i2c_adapter *i2c_adapter;
+   struct i2c_client *client;
+   struct i2c_board_info info;
+   struct m88ts2022_config m88ts2022_config = {
+   .clock = 2700,
+   };
+
+   if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0)  0)
+   err(command 0x0e transfer failed.);
+
+   obuf[0] = 0xe;
+   obuf[1] = 0x02;
+   obuf[2] = 1;
+
+   if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0)  0)
+   err(command 0x0e transfer failed.);
+   msleep(300);
+
+   obuf[0] = 0xe;
+   obuf[1] = 0x83;
+   obuf[2] = 0;
+
+   if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0)  0)
+   err(command 0x0e transfer failed.);
+
+   obuf[0] = 0xe;
+   obuf[1] = 0x83;
+   obuf[2] = 1;
+
+   if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0)  0)
+   err(command 0x0e transfer failed.);
+
+   obuf[0] = 0x51;
+
+   if (dvb_usb_generic_rw(d, obuf, 1, ibuf, 1, 0)  0)
+   err(command 0x51 transfer failed.);
+
+   memset(info, 0,