diff options
author | Igor M Liplianin <liplianin@me.by> | 2008-07-20 07:05:50 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-23 07:09:17 -0400 |
commit | 7fd4828f6cc5bd4339ff58e372ccb5f528548b30 (patch) | |
tree | 3651534b0d7a753ca7214d9e56263fb7a4b54968 /drivers/media/dvb | |
parent | e272ae088fccf0e98ee0042392bd52a3455f28bd (diff) |
V4L/DVB (8421): Adds support for Dvbworld DVB-S 2102 USB card
Signed-off-by: Igor M Liplianin <liplianin@me.by>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/dvb-usb/Kconfig | 8 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/Makefile | 3 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 1 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dw2102.c | 425 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dw2102.h | 9 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/z0194a.h | 97 |
6 files changed, 543 insertions, 0 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index a577c0f89f67..3c663c65ef66 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -246,6 +246,14 @@ config DVB_USB_AF9005_REMOTE | |||
246 | Say Y here to support the default remote control decoding for the | 246 | Say Y here to support the default remote control decoding for the |
247 | Afatech AF9005 based receiver. | 247 | Afatech AF9005 based receiver. |
248 | 248 | ||
249 | config DVB_USB_DW2102 | ||
250 | tristate "DvbWorld 2102 DVB-S USB2.0 receiver" | ||
251 | depends on DVB_USB | ||
252 | select DVB_STV0299 if !DVB_FE_CUSTOMISE | ||
253 | select DVB_PLL if !DVB_FE_CUSTOMISE | ||
254 | help | ||
255 | Say Y here to support the DvbWorld 2102 DVB-S USB2.0 receiver. | ||
256 | |||
249 | config DVB_USB_ANYSEE | 257 | config DVB_USB_ANYSEE |
250 | tristate "Anysee DVB-T/C USB2.0 support" | 258 | tristate "Anysee DVB-T/C USB2.0 support" |
251 | depends on DVB_USB | 259 | depends on DVB_USB |
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile index 44c11e45e564..e206f1ea0027 100644 --- a/drivers/media/dvb/dvb-usb/Makefile +++ b/drivers/media/dvb/dvb-usb/Makefile | |||
@@ -64,6 +64,9 @@ obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o | |||
64 | dvb-usb-anysee-objs = anysee.o | 64 | dvb-usb-anysee-objs = anysee.o |
65 | obj-$(CONFIG_DVB_USB_ANYSEE) += dvb-usb-anysee.o | 65 | obj-$(CONFIG_DVB_USB_ANYSEE) += dvb-usb-anysee.o |
66 | 66 | ||
67 | dvb-usb-dw2102-objs = dw2102.o | ||
68 | obj-$(CONFIG_DVB_USB_DW2102) += dvb-usb-dw2102.o | ||
69 | |||
67 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | 70 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ |
68 | # due to tuner-xc3028 | 71 | # due to tuner-xc3028 |
69 | EXTRA_CFLAGS += -Idrivers/media/common/tuners | 72 | EXTRA_CFLAGS += -Idrivers/media/common/tuners |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index e5238b31e946..029b437caf9a 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h | |||
@@ -204,5 +204,6 @@ | |||
204 | #define USB_PID_ASUS_U3000 0x171f | 204 | #define USB_PID_ASUS_U3000 0x171f |
205 | #define USB_PID_ASUS_U3100 0x173f | 205 | #define USB_PID_ASUS_U3100 0x173f |
206 | #define USB_PID_YUAN_EC372S 0x1edc | 206 | #define USB_PID_YUAN_EC372S 0x1edc |
207 | #define USB_PID_DW2102 0x2102 | ||
207 | 208 | ||
208 | #endif | 209 | #endif |
diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c new file mode 100644 index 000000000000..a4d898b44e55 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dw2102.c | |||
@@ -0,0 +1,425 @@ | |||
1 | /* DVB USB framework compliant Linux driver for the DVBWorld DVB-S 2102 Card | ||
2 | * | ||
3 | * Copyright (C) 2008 Igor M. Liplianin (liplianin@me.by) | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation, version 2. | ||
8 | * | ||
9 | * see Documentation/dvb/README.dvb-usb for more information | ||
10 | */ | ||
11 | #include <linux/version.h> | ||
12 | #include "dw2102.h" | ||
13 | #include "stv0299.h" | ||
14 | #include "z0194a.h" | ||
15 | |||
16 | #ifndef USB_PID_DW2102 | ||
17 | #define USB_PID_DW2102 0x2102 | ||
18 | #endif | ||
19 | |||
20 | #define DW2102_READ_MSG 0 | ||
21 | #define DW2102_WRITE_MSG 1 | ||
22 | |||
23 | #define REG_1F_SYMBOLRATE_BYTE0 0x1f | ||
24 | #define REG_20_SYMBOLRATE_BYTE1 0x20 | ||
25 | #define REG_21_SYMBOLRATE_BYTE2 0x21 | ||
26 | |||
27 | #define DW2102_VOLTAGE_CTRL (0x1800) | ||
28 | #define DW2102_RC_QUERY (0x1a00) | ||
29 | |||
30 | struct dw2102_state { | ||
31 | u32 last_key_pressed; | ||
32 | }; | ||
33 | struct dw2102_rc_keys { | ||
34 | u32 keycode; | ||
35 | u32 event; | ||
36 | }; | ||
37 | |||
38 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
39 | |||
40 | static int dw2102_op_rw(struct usb_device *dev, u8 request, u16 value, | ||
41 | u8 *data, u16 len, int flags) | ||
42 | { | ||
43 | int ret; | ||
44 | u8 u8buf[len]; | ||
45 | |||
46 | unsigned int pipe = (flags == DW2102_READ_MSG) ? | ||
47 | usb_rcvctrlpipe(dev, 0) : usb_sndctrlpipe(dev, 0); | ||
48 | u8 request_type = (flags == DW2102_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT; | ||
49 | |||
50 | if (flags == DW2102_WRITE_MSG) | ||
51 | memcpy(u8buf, data, len); | ||
52 | ret = usb_control_msg(dev, pipe, request, | ||
53 | request_type | USB_TYPE_VENDOR, value, 0 , u8buf, len, 2000); | ||
54 | |||
55 | if (flags == DW2102_READ_MSG) | ||
56 | memcpy(data, u8buf, len); | ||
57 | return ret; | ||
58 | } | ||
59 | |||
60 | /* I2C */ | ||
61 | |||
62 | static int dw2102_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | ||
63 | int num) | ||
64 | { | ||
65 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | ||
66 | int i = 0, ret = 0; | ||
67 | u8 buf6[] = {0x2c, 0x05, 0xc0, 0, 0, 0, 0}; | ||
68 | u8 request; | ||
69 | u16 value; | ||
70 | |||
71 | if (!d) | ||
72 | return -ENODEV; | ||
73 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | ||
74 | return -EAGAIN; | ||
75 | |||
76 | switch (num) { | ||
77 | case 2: | ||
78 | /* read stv0299 register */ | ||
79 | request = 0xb5; | ||
80 | value = msg[0].buf[0];/* register */ | ||
81 | for (i = 0; i < msg[1].len; i++) { | ||
82 | value = value + i; | ||
83 | ret = dw2102_op_rw(d->udev, 0xb5, | ||
84 | value, buf6, 2, DW2102_READ_MSG); | ||
85 | msg[1].buf[i] = buf6[0]; | ||
86 | |||
87 | } | ||
88 | break; | ||
89 | case 1: | ||
90 | switch (msg[0].addr) { | ||
91 | case 0x68: | ||
92 | /* write to stv0299 register */ | ||
93 | buf6[0] = 0x2a; | ||
94 | buf6[1] = msg[0].buf[0]; | ||
95 | buf6[2] = msg[0].buf[1]; | ||
96 | ret = dw2102_op_rw(d->udev, 0xb2, | ||
97 | 0, buf6, 3, DW2102_WRITE_MSG); | ||
98 | break; | ||
99 | case 0x60: | ||
100 | if (msg[0].flags == 0) { | ||
101 | /* write to tuner pll */ | ||
102 | buf6[0] = 0x2c; | ||
103 | buf6[1] = 5; | ||
104 | buf6[2] = 0xc0; | ||
105 | buf6[3] = msg[0].buf[0]; | ||
106 | buf6[4] = msg[0].buf[1]; | ||
107 | buf6[5] = msg[0].buf[2]; | ||
108 | buf6[6] = msg[0].buf[3]; | ||
109 | ret = dw2102_op_rw(d->udev, 0xb2, | ||
110 | 0, buf6, 7, DW2102_WRITE_MSG); | ||
111 | } else { | ||
112 | /* write to tuner pll */ | ||
113 | ret = dw2102_op_rw(d->udev, 0xb5, | ||
114 | 0, buf6, 1, DW2102_READ_MSG); | ||
115 | msg[0].buf[0] = buf6[0]; | ||
116 | } | ||
117 | break; | ||
118 | case (DW2102_RC_QUERY): | ||
119 | ret = dw2102_op_rw(d->udev, 0xb8, | ||
120 | 0, buf6, 2, DW2102_READ_MSG); | ||
121 | msg[0].buf[0] = buf6[0]; | ||
122 | msg[0].buf[1] = buf6[1]; | ||
123 | break; | ||
124 | case (DW2102_VOLTAGE_CTRL): | ||
125 | buf6[0] = 0x30; | ||
126 | buf6[1] = msg[0].buf[0]; | ||
127 | ret = dw2102_op_rw(d->udev, 0xb2, | ||
128 | 0, buf6, 2, DW2102_WRITE_MSG); | ||
129 | break; | ||
130 | } | ||
131 | |||
132 | break; | ||
133 | } | ||
134 | |||
135 | mutex_unlock(&d->i2c_mutex); | ||
136 | return num; | ||
137 | } | ||
138 | |||
139 | static u32 dw2102_i2c_func(struct i2c_adapter *adapter) | ||
140 | { | ||
141 | return I2C_FUNC_I2C; | ||
142 | } | ||
143 | |||
144 | static struct i2c_algorithm dw2102_i2c_algo = { | ||
145 | .master_xfer = dw2102_i2c_transfer, | ||
146 | .functionality = dw2102_i2c_func, | ||
147 | }; | ||
148 | |||
149 | static int dw2102_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | ||
150 | { | ||
151 | static u8 command_13v[1] = {0x00}; | ||
152 | static u8 command_18v[1] = {0x01}; | ||
153 | struct i2c_msg msg[] = { | ||
154 | {.addr = DW2102_VOLTAGE_CTRL, .flags = 0, | ||
155 | .buf = command_13v, .len = 1}, | ||
156 | }; | ||
157 | |||
158 | struct dvb_usb_adapter *udev_adap = | ||
159 | (struct dvb_usb_adapter *)(fe->dvb->priv); | ||
160 | if (voltage == SEC_VOLTAGE_18) | ||
161 | msg[0].buf = command_18v; | ||
162 | i2c_transfer(&udev_adap->dev->i2c_adap, msg, 1); | ||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | static int dw2102_frontend_attach(struct dvb_usb_adapter *d) | ||
167 | { | ||
168 | d->fe = dvb_attach(stv0299_attach, &sharp_z0194a_config, | ||
169 | &d->dev->i2c_adap); | ||
170 | if (d->fe != NULL) { | ||
171 | d->fe->ops.set_voltage = dw2102_set_voltage; | ||
172 | info("Attached stv0299!\n"); | ||
173 | return 0; | ||
174 | } | ||
175 | return -EIO; | ||
176 | } | ||
177 | |||
178 | static int dw2102_tuner_attach(struct dvb_usb_adapter *adap) | ||
179 | { | ||
180 | dvb_attach(dvb_pll_attach, adap->fe, 0x60, | ||
181 | &adap->dev->i2c_adap, DVB_PLL_OPERA1); | ||
182 | return 0; | ||
183 | } | ||
184 | |||
185 | static struct dvb_usb_rc_key dw2102_rc_keys[] = { | ||
186 | { 0xf8, 0x0a, KEY_Q }, /*power*/ | ||
187 | { 0xf8, 0x0c, KEY_M }, /*mute*/ | ||
188 | { 0xf8, 0x11, KEY_1 }, | ||
189 | { 0xf8, 0x12, KEY_2 }, | ||
190 | { 0xf8, 0x13, KEY_3 }, | ||
191 | { 0xf8, 0x14, KEY_4 }, | ||
192 | { 0xf8, 0x15, KEY_5 }, | ||
193 | { 0xf8, 0x16, KEY_6 }, | ||
194 | { 0xf8, 0x17, KEY_7 }, | ||
195 | { 0xf8, 0x18, KEY_8 }, | ||
196 | { 0xf8, 0x19, KEY_9 }, | ||
197 | { 0xf8, 0x10, KEY_0 }, | ||
198 | { 0xf8, 0x1c, KEY_PAGEUP }, /*ch+*/ | ||
199 | { 0xf8, 0x0f, KEY_PAGEDOWN }, /*ch-*/ | ||
200 | { 0xf8, 0x1a, KEY_O }, /*vol+*/ | ||
201 | { 0xf8, 0x0e, KEY_Z }, /*vol-*/ | ||
202 | { 0xf8, 0x04, KEY_R }, /*rec*/ | ||
203 | { 0xf8, 0x09, KEY_D }, /*fav*/ | ||
204 | { 0xf8, 0x08, KEY_BACKSPACE }, /*rewind*/ | ||
205 | { 0xf8, 0x07, KEY_A }, /*fast*/ | ||
206 | { 0xf8, 0x0b, KEY_P }, /*pause*/ | ||
207 | { 0xf8, 0x02, KEY_ESC }, /*cancel*/ | ||
208 | { 0xf8, 0x03, KEY_G }, /*tab*/ | ||
209 | { 0xf8, 0x00, KEY_UP }, /*up*/ | ||
210 | { 0xf8, 0x1f, KEY_ENTER }, /*ok*/ | ||
211 | { 0xf8, 0x01, KEY_DOWN }, /*down*/ | ||
212 | { 0xf8, 0x05, KEY_C }, /*cap*/ | ||
213 | { 0xf8, 0x06, KEY_S }, /*stop*/ | ||
214 | { 0xf8, 0x40, KEY_F }, /*full*/ | ||
215 | { 0xf8, 0x1e, KEY_W }, /*tvmode*/ | ||
216 | { 0xf8, 0x1b, KEY_B }, /*recall*/ | ||
217 | |||
218 | }; | ||
219 | |||
220 | |||
221 | |||
222 | static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
223 | { | ||
224 | struct dw2102_state *st = d->priv; | ||
225 | u8 key[2]; | ||
226 | struct i2c_msg msg[] = { | ||
227 | {.addr = DW2102_RC_QUERY, .flags = I2C_M_RD, .buf = key, | ||
228 | .len = 2}, | ||
229 | }; | ||
230 | int i; | ||
231 | |||
232 | *state = REMOTE_NO_KEY_PRESSED; | ||
233 | if (dw2102_i2c_transfer(&d->i2c_adap, msg, 1) == 1) { | ||
234 | for (i = 0; i < ARRAY_SIZE(dw2102_rc_keys); i++) { | ||
235 | if (dw2102_rc_keys[i].data == msg[0].buf[0]) { | ||
236 | *state = REMOTE_KEY_PRESSED; | ||
237 | *event = dw2102_rc_keys[i].event; | ||
238 | st->last_key_pressed = | ||
239 | dw2102_rc_keys[i].event; | ||
240 | break; | ||
241 | } | ||
242 | st->last_key_pressed = 0; | ||
243 | } | ||
244 | } | ||
245 | /* info("key: %x %x\n",key[0],key[1]); */ | ||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | static struct usb_device_id dw2102_table[] = { | ||
250 | {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2102)}, | ||
251 | {USB_DEVICE(USB_VID_CYPRESS, 0x2101)}, | ||
252 | { } | ||
253 | }; | ||
254 | |||
255 | MODULE_DEVICE_TABLE(usb, dw2102_table); | ||
256 | |||
257 | static int dw2102_load_firmware(struct usb_device *dev, | ||
258 | const struct firmware *frmwr) | ||
259 | { | ||
260 | u8 *b, *p; | ||
261 | int ret = 0, i; | ||
262 | u8 reset; | ||
263 | u8 reset16 [] = {0, 0, 0, 0, 0, 0, 0}; | ||
264 | const struct firmware *fw; | ||
265 | const char *filename = "dvb-usb-dw2101.fw"; | ||
266 | switch (dev->descriptor.idProduct) { | ||
267 | case 0x2101: | ||
268 | ret = request_firmware(&fw, filename, &dev->dev); | ||
269 | if (ret != 0) { | ||
270 | err("did not find the firmware file. (%s) " | ||
271 | "Please see linux/Documentation/dvb/ for more details " | ||
272 | "on firmware-problems.", filename); | ||
273 | return ret; | ||
274 | } | ||
275 | break; | ||
276 | case USB_PID_DW2102: | ||
277 | fw = frmwr; | ||
278 | break; | ||
279 | } | ||
280 | info("start downloading DW2102 firmware"); | ||
281 | p = kmalloc(fw->size, GFP_KERNEL); | ||
282 | reset = 1; | ||
283 | /*stop the CPU*/ | ||
284 | dw2102_op_rw(dev, 0xa0, 0x7f92, &reset, 1, DW2102_WRITE_MSG); | ||
285 | dw2102_op_rw(dev, 0xa0, 0xe600, &reset, 1, DW2102_WRITE_MSG); | ||
286 | |||
287 | if (p != NULL) { | ||
288 | memcpy(p, fw->data, fw->size); | ||
289 | for (i = 0; i < fw->size; i += 0x40) { | ||
290 | b = (u8 *) p + i; | ||
291 | if (dw2102_op_rw | ||
292 | (dev, 0xa0, i, b , 0x40, | ||
293 | DW2102_WRITE_MSG) != 0x40 | ||
294 | ) { | ||
295 | err("error while transferring firmware"); | ||
296 | ret = -EINVAL; | ||
297 | break; | ||
298 | } | ||
299 | } | ||
300 | /* restart the CPU */ | ||
301 | reset = 0; | ||
302 | if (ret || dw2102_op_rw | ||
303 | (dev, 0xa0, 0x7f92, &reset, 1, | ||
304 | DW2102_WRITE_MSG) != 1) { | ||
305 | err("could not restart the USB controller CPU."); | ||
306 | ret = -EINVAL; | ||
307 | } | ||
308 | if (ret || dw2102_op_rw | ||
309 | (dev, 0xa0, 0xe600, &reset, 1, | ||
310 | DW2102_WRITE_MSG) != 1) { | ||
311 | err("could not restart the USB controller CPU."); | ||
312 | ret = -EINVAL; | ||
313 | } | ||
314 | /* init registers */ | ||
315 | switch (dev->descriptor.idProduct) { | ||
316 | case USB_PID_DW2102: | ||
317 | dw2102_op_rw | ||
318 | (dev, 0xbf, 0x0040, &reset, 0, | ||
319 | DW2102_WRITE_MSG); | ||
320 | dw2102_op_rw | ||
321 | (dev, 0xb9, 0x0000, &reset16[0], 2, | ||
322 | DW2102_READ_MSG); | ||
323 | break; | ||
324 | case 0x2101: | ||
325 | dw2102_op_rw | ||
326 | (dev, 0xbc, 0x0030, &reset16[0], 2, | ||
327 | DW2102_READ_MSG); | ||
328 | dw2102_op_rw | ||
329 | (dev, 0xba, 0x0000, &reset16[0], 7, | ||
330 | DW2102_READ_MSG); | ||
331 | dw2102_op_rw | ||
332 | (dev, 0xba, 0x0000, &reset16[0], 7, | ||
333 | DW2102_READ_MSG); | ||
334 | dw2102_op_rw | ||
335 | (dev, 0xb9, 0x0000, &reset16[0], 2, | ||
336 | DW2102_READ_MSG); | ||
337 | break; | ||
338 | } | ||
339 | kfree(p); | ||
340 | } | ||
341 | return ret; | ||
342 | } | ||
343 | |||
344 | static struct dvb_usb_device_properties dw2102_properties = { | ||
345 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
346 | .usb_ctrl = DEVICE_SPECIFIC, | ||
347 | .firmware = "dvb-usb-dw2102.fw", | ||
348 | .size_of_priv = sizeof(struct dw2102_state), | ||
349 | .no_reconnect = 1, | ||
350 | |||
351 | .i2c_algo = &dw2102_i2c_algo, | ||
352 | .rc_key_map = dw2102_rc_keys, | ||
353 | .rc_key_map_size = ARRAY_SIZE(dw2102_rc_keys), | ||
354 | .rc_interval = 150, | ||
355 | .rc_query = dw2102_rc_query, | ||
356 | |||
357 | .generic_bulk_ctrl_endpoint = 0x81, | ||
358 | /* parameter for the MPEG2-data transfer */ | ||
359 | .num_adapters = 1, | ||
360 | .download_firmware = dw2102_load_firmware, | ||
361 | .adapter = { | ||
362 | { | ||
363 | .frontend_attach = dw2102_frontend_attach, | ||
364 | .streaming_ctrl = NULL, | ||
365 | .tuner_attach = dw2102_tuner_attach, | ||
366 | .stream = { | ||
367 | .type = USB_BULK, | ||
368 | .count = 8, | ||
369 | .endpoint = 0x82, | ||
370 | .u = { | ||
371 | .bulk = { | ||
372 | .buffersize = 4096, | ||
373 | } | ||
374 | } | ||
375 | }, | ||
376 | } | ||
377 | }, | ||
378 | .num_device_descs = 2, | ||
379 | .devices = { | ||
380 | {"DVBWorld DVB-S 2102 USB2.0", | ||
381 | {&dw2102_table[0], NULL}, | ||
382 | {NULL}, | ||
383 | }, | ||
384 | {"DVBWorld DVB-S 2101 USB2.0", | ||
385 | {&dw2102_table[1], NULL}, | ||
386 | {NULL}, | ||
387 | }, | ||
388 | } | ||
389 | }; | ||
390 | |||
391 | static int dw2102_probe(struct usb_interface *intf, | ||
392 | const struct usb_device_id *id) | ||
393 | { | ||
394 | return dvb_usb_device_init(intf, &dw2102_properties, | ||
395 | THIS_MODULE, NULL, adapter_nr); | ||
396 | } | ||
397 | |||
398 | static struct usb_driver dw2102_driver = { | ||
399 | .name = "dw2102", | ||
400 | .probe = dw2102_probe, | ||
401 | .disconnect = dvb_usb_device_exit, | ||
402 | .id_table = dw2102_table, | ||
403 | }; | ||
404 | |||
405 | static int __init dw2102_module_init(void) | ||
406 | { | ||
407 | int ret = usb_register(&dw2102_driver); | ||
408 | if (ret) | ||
409 | err("usb_register failed. Error number %d", ret); | ||
410 | |||
411 | return ret; | ||
412 | } | ||
413 | |||
414 | static void __exit dw2102_module_exit(void) | ||
415 | { | ||
416 | usb_deregister(&dw2102_driver); | ||
417 | } | ||
418 | |||
419 | module_init(dw2102_module_init); | ||
420 | module_exit(dw2102_module_exit); | ||
421 | |||
422 | MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by"); | ||
423 | MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101 2102 USB2.0 device"); | ||
424 | MODULE_VERSION("0.1"); | ||
425 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/dw2102.h b/drivers/media/dvb/dvb-usb/dw2102.h new file mode 100644 index 000000000000..cb5873752e46 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dw2102.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _DW2102_H_ | ||
2 | #define _DW2102_H_ | ||
3 | |||
4 | #define DVB_USB_LOG_PREFIX "dw2102" | ||
5 | #include <dvb-usb.h> | ||
6 | |||
7 | extern int dvb_usb_dw2102_debug; | ||
8 | #define deb_xfer(args...) dprintk(dvb_usb_dw2102_debug, 0x02, args) | ||
9 | #endif | ||
diff --git a/drivers/media/dvb/frontends/z0194a.h b/drivers/media/dvb/frontends/z0194a.h new file mode 100644 index 000000000000..b5ca9e754218 --- /dev/null +++ b/drivers/media/dvb/frontends/z0194a.h | |||
@@ -0,0 +1,97 @@ | |||
1 | /* z0194a.h Sharp z0194a tuner support | ||
2 | * | ||
3 | * Copyright (C) 2008 Igor M. Liplianin (liplianin@me.by) | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation, version 2. | ||
8 | * | ||
9 | * see Documentation/dvb/README.dvb-usb for more information | ||
10 | */ | ||
11 | |||
12 | #ifndef Z0194A | ||
13 | #define Z0194A | ||
14 | |||
15 | static int sharp_z0194a__set_symbol_rate(struct dvb_frontend *fe, | ||
16 | u32 srate, u32 ratio) | ||
17 | { | ||
18 | u8 aclk = 0; | ||
19 | u8 bclk = 0; | ||
20 | |||
21 | if (srate < 1500000) { | ||
22 | aclk = 0xb7; bclk = 0x47; } | ||
23 | else if (srate < 3000000) { | ||
24 | aclk = 0xb7; bclk = 0x4b; } | ||
25 | else if (srate < 7000000) { | ||
26 | aclk = 0xb7; bclk = 0x4f; } | ||
27 | else if (srate < 14000000) { | ||
28 | aclk = 0xb7; bclk = 0x53; } | ||
29 | else if (srate < 30000000) { | ||
30 | aclk = 0xb6; bclk = 0x53; } | ||
31 | else if (srate < 45000000) { | ||
32 | aclk = 0xb4; bclk = 0x51; } | ||
33 | |||
34 | stv0299_writereg(fe, 0x13, aclk); | ||
35 | stv0299_writereg(fe, 0x14, bclk); | ||
36 | stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff); | ||
37 | stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff); | ||
38 | stv0299_writereg(fe, 0x21, (ratio) & 0xf0); | ||
39 | |||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | static u8 sharp_z0194a__inittab[] = { | ||
44 | 0x01, 0x15, | ||
45 | 0x02, 0x00, | ||
46 | 0x03, 0x00, | ||
47 | 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ | ||
48 | 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */ | ||
49 | 0x06, 0x40, /* DAC not used, set to high impendance mode */ | ||
50 | 0x07, 0x00, /* DAC LSB */ | ||
51 | 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */ | ||
52 | 0x09, 0x00, /* FIFO */ | ||
53 | 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */ | ||
54 | 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */ | ||
55 | 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ | ||
56 | 0x10, 0x3f, /* AGC2 0x3d */ | ||
57 | 0x11, 0x84, | ||
58 | 0x12, 0xb9, | ||
59 | 0x15, 0xc9, /* lock detector threshold */ | ||
60 | 0x16, 0x00, | ||
61 | 0x17, 0x00, | ||
62 | 0x18, 0x00, | ||
63 | 0x19, 0x00, | ||
64 | 0x1a, 0x00, | ||
65 | 0x1f, 0x50, | ||
66 | 0x20, 0x00, | ||
67 | 0x21, 0x00, | ||
68 | 0x22, 0x00, | ||
69 | 0x23, 0x00, | ||
70 | 0x28, 0x00, /* out imp: normal out type: parallel FEC mode:0 */ | ||
71 | 0x29, 0x1e, /* 1/2 threshold */ | ||
72 | 0x2a, 0x14, /* 2/3 threshold */ | ||
73 | 0x2b, 0x0f, /* 3/4 threshold */ | ||
74 | 0x2c, 0x09, /* 5/6 threshold */ | ||
75 | 0x2d, 0x05, /* 7/8 threshold */ | ||
76 | 0x2e, 0x01, | ||
77 | 0x31, 0x1f, /* test all FECs */ | ||
78 | 0x32, 0x19, /* viterbi and synchro search */ | ||
79 | 0x33, 0xfc, /* rs control */ | ||
80 | 0x34, 0x93, /* error control */ | ||
81 | 0x0f, 0x52, | ||
82 | 0xff, 0xff | ||
83 | }; | ||
84 | |||
85 | static struct stv0299_config sharp_z0194a_config = { | ||
86 | .demod_address = 0x68, | ||
87 | .inittab = sharp_z0194a__inittab, | ||
88 | .mclk = 88000000UL, | ||
89 | .invert = 1, | ||
90 | .skip_reinit = 0, | ||
91 | .lock_output = STV0229_LOCKOUTPUT_1, | ||
92 | .volt13_op0_op1 = STV0299_VOLT13_OP1, | ||
93 | .min_delay_ms = 100, | ||
94 | .set_symbol_rate = sharp_z0194a__set_symbol_rate, | ||
95 | }; | ||
96 | |||
97 | #endif | ||