]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/linux-3.10-dvb_tevi_s482.patch
Merge branch 'hyper-v-fixes' into next
[ipfire-2.x.git] / src / patches / linux-3.10-dvb_tevi_s482.patch
1 diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c
2 index 1a3df10..82d35c6 100644
3 --- a/drivers/media/usb/dvb-usb/dw2102.c
4 +++ b/drivers/media/usb/dvb-usb/dw2102.c
5 @@ -31,6 +31,9 @@
6 #include "m88rs2000.h"
7 #include "tda18271.h"
8 #include "cxd2820r.h"
9 +#include "m88ds3103.h"
10 +#include "m88ts2022.h"
11 +
12
13 /* Max transfer size done by I2C transfer functions */
14 #define MAX_XFER_SIZE 64
15 @@ -71,6 +74,14 @@
16 #define USB_PID_TEVII_S480_2 0xd482
17 #endif
18
19 +#ifndef USB_PID_TEVII_S482_1
20 +#define USB_PID_TEVII_S482_1 0xd483
21 +#endif
22 +
23 +#ifndef USB_PID_TEVII_S482_2
24 +#define USB_PID_TEVII_S482_2 0xd484
25 +#endif
26 +
27 #ifndef USB_PID_PROF_1100
28 #define USB_PID_PROF_1100 0xb012
29 #endif
30 @@ -1117,6 +1128,19 @@ static struct tda18271_config tda18271_config = {
31 .gate = TDA18271_GATE_DIGITAL,
32 };
33
34 +static const struct m88ds3103_config s482_m88ds3103_config = {
35 + .i2c_addr = 0x68,
36 + .clock = 27000000,
37 + .i2c_wr_max = 33,
38 + .clock_out = 0,
39 + .ts_mode = M88DS3103_TS_CI,
40 + .ts_clk = 16000,
41 + .ts_clk_pol = 0,
42 + .agc = 0x99,
43 + .lnb_hv_pol = 1,
44 + .lnb_en_pol = 1,
45 + };
46 +
47 static u8 m88rs2000_inittab[] = {
48 DEMOD_WRITE, 0x9a, 0x30,
49 DEMOD_WRITE, 0x00, 0x01,
50 @@ -1386,6 +1410,83 @@ static int su3000_frontend_attach(struct dvb_usb_adapter *d)
51 return -EIO;
52 }
53
54 +static int m88ds3103_frontend_attach(struct dvb_usb_adapter *d)
55 +{
56 + u8 obuf[3] = { 0xe, 0x80, 0 };
57 + u8 ibuf[] = { 0 };
58 +
59 + /* demod I2C adapter */
60 + struct i2c_adapter *i2c_adapter;
61 + struct i2c_client *client;
62 + struct i2c_board_info info;
63 + struct m88ts2022_config m88ts2022_config = {
64 + .clock = 27000000,
65 + };
66 + memset(&info, 0, sizeof(struct i2c_board_info));
67 + if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
68 + err("command 0x0e transfer failed.");
69 +
70 + obuf[0] = 0xe;
71 + obuf[1] = 0x02;
72 + obuf[2] = 1;
73 +
74 + if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
75 + err("command 0x0e transfer failed.");
76 + msleep(300);
77 +
78 + obuf[0] = 0xe;
79 + obuf[1] = 0x83;
80 + obuf[2] = 0;
81 +
82 + if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
83 + err("command 0x0e transfer failed.");
84 +
85 + obuf[0] = 0xe;
86 + obuf[1] = 0x83;
87 + obuf[2] = 1;
88 +
89 + if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
90 + err("command 0x0e transfer failed.");
91 +
92 + obuf[0] = 0x51;
93 +
94 + if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
95 + err("command 0x51 transfer failed.");
96 + d->fe_adap[0].fe = dvb_attach(m88ds3103_attach,
97 + &s482_m88ds3103_config,
98 + &d->dev->i2c_adap,
99 + &i2c_adapter);
100 + if (d->fe_adap[0].fe == NULL)
101 + return -EIO;
102 + /* attach tuner */
103 + m88ts2022_config.fe = d->fe_adap[0].fe;
104 + strlcpy(info.type, "m88ts2022", I2C_NAME_SIZE);
105 + info.addr = 0x60;
106 + info.platform_data = &m88ts2022_config;
107 + request_module("m88ts2022");
108 + client = i2c_new_device(i2c_adapter, &info);
109 + if (client == NULL || client->dev.driver == NULL) {
110 + dvb_frontend_detach(d->fe_adap[0].fe);
111 + goto fail_attach;
112 + }
113 + if (!try_module_get(client->dev.driver->owner)) {
114 + i2c_unregister_device(client);
115 + dvb_frontend_detach(d->fe_adap[0].fe);
116 + goto fail_attach;
117 + }
118 + info("attached m88ds3103/m88ts2022!\n");
119 +
120 + /* delegate signal strength measurement to tuner */
121 +
122 + d->fe_adap[0].fe->ops.read_signal_strength =
123 + d->fe_adap[0].fe->ops.tuner_ops.get_rf_strength;
124 +
125 + return 0;
126 +fail_attach:
127 + info("Failed to attach m88ds3103/m88ts2022!\n");
128 + return -EIO;
129 +}
130 +
131 static int t220_frontend_attach(struct dvb_usb_adapter *d)
132 {
133 u8 obuf[3] = { 0xe, 0x87, 0 };
134 @@ -1557,6 +1658,8 @@ enum dw2102_table_entry {
135 TEVII_S480_2,
136 X3M_SPC1400HD,
137 TEVII_S421,
138 + TEVII_S482_1,
139 + TEVII_S482_2,
140 TEVII_S632,
141 TERRATEC_CINERGY_S2_R2,
142 GOTVIEW_SAT_HD,
143 @@ -1580,7 +1683,9 @@ static struct usb_device_id dw2102_table[] = {
144 [TEVII_S480_2] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)},
145 [X3M_SPC1400HD] = {USB_DEVICE(0x1f4d, 0x3100)},
146 [TEVII_S421] = {USB_DEVICE(0x9022, USB_PID_TEVII_S421)},
147 - [TEVII_S632] = {USB_DEVICE(0x9022, USB_PID_TEVII_S632)},
148 + [TEVII_S482_1] = { USB_DEVICE(0x9022, USB_PID_TEVII_S482_1) },
149 + [TEVII_S482_2] = { USB_DEVICE(0x9022, USB_PID_TEVII_S482_2) },
150 + [TEVII_S632] = { USB_DEVICE(0x9022, USB_PID_TEVII_S632) },
151 [TERRATEC_CINERGY_S2_R2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00b0)},
152 [GOTVIEW_SAT_HD] = {USB_DEVICE(0x1FE1, USB_PID_GOTVIEW_SAT_HD)},
153 [GENIATECH_T220] = {USB_DEVICE(0x1f4d, 0xD220)},
154 @@ -2012,6 +2117,59 @@ static struct dvb_usb_device_properties su3000_properties = {
155 }
156 };
157
158 +static struct dvb_usb_device_properties m88ds3103_properties = {
159 + .caps = DVB_USB_IS_AN_I2C_ADAPTER,
160 + .usb_ctrl = DEVICE_SPECIFIC,
161 + .size_of_priv = sizeof(struct su3000_state),
162 + .power_ctrl = su3000_power_ctrl,
163 + .num_adapters = 1,
164 + .identify_state = su3000_identify_state,
165 + .i2c_algo = &su3000_i2c_algo,
166 +
167 + .rc.core = {
168 + .rc_interval = 150,
169 + .rc_codes = RC_MAP_TEVII_NEC,
170 + .module_name = "dw2102",
171 + .allowed_protos = RC_BIT_NEC,
172 + .rc_query = dw2102_rc_query,
173 + },
174 +
175 + .read_mac_address = su3000_read_mac_address,
176 +
177 + .generic_bulk_ctrl_endpoint = 0x01,
178 +
179 + .adapter = {
180 + {
181 + .num_frontends = 1,
182 + .fe = { {
183 + .streaming_ctrl = su3000_streaming_ctrl,
184 + .frontend_attach = m88ds3103_frontend_attach,
185 + .stream = {
186 + .type = USB_BULK,
187 + .count = 8,
188 + .endpoint = 0x82,
189 + .u = {
190 + .bulk = {
191 + .buffersize = 4096,
192 + }
193 + }
194 + }
195 + } },
196 + }
197 + },
198 + .num_device_descs = 2,
199 + .devices = {
200 + { "TeVii S482.1 USB",
201 + { &dw2102_table[TEVII_S482_1], NULL },
202 + { NULL },
203 + },
204 + { "TeVii S482.2 USB",
205 + { &dw2102_table[TEVII_S482_2], NULL },
206 + { NULL },
207 + },
208 + }
209 +};
210 +
211 static struct dvb_usb_device_properties t220_properties = {
212 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
213 .usb_ctrl = DEVICE_SPECIFIC,
214 @@ -2131,11 +2289,13 @@ static int dw2102_probe(struct usb_interface *intf,
215 0 == dvb_usb_device_init(intf, p7500,
216 THIS_MODULE, NULL, adapter_nr) ||
217 0 == dvb_usb_device_init(intf, s421,
218 - THIS_MODULE, NULL, adapter_nr) ||
219 - 0 == dvb_usb_device_init(intf, &su3000_properties,
220 - THIS_MODULE, NULL, adapter_nr) ||
221 + THIS_MODULE, NULL, adapter_nr) ||
222 0 == dvb_usb_device_init(intf, &t220_properties,
223 - THIS_MODULE, NULL, adapter_nr))
224 + THIS_MODULE, NULL, adapter_nr) ||
225 + 0 == dvb_usb_device_init(intf, &m88ds3103_properties,
226 + THIS_MODULE, NULL, adapter_nr) ||
227 + 0 == dvb_usb_device_init(intf, &su3000_properties,
228 + THIS_MODULE, NULL, adapter_nr))
229 return 0;
230
231 return -ENODEV;
232 @@ -2153,7 +2313,7 @@ module_usb_driver(dw2102_driver);
233 MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by");
234 MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104,"
235 " DVB-C 3101 USB2.0,"
236 - " TeVii S600, S630, S650, S660, S480, S421, S632"
237 + " TeVii S600, S630, S650, S660, S480, S482, S421, S632"
238 " Prof 1100, 7500 USB2.0,"
239 " Geniatech SU3000, T220 devices");
240 MODULE_VERSION("0.1");