1 /* DVB USB framework compliant Linux driver for the
2 * DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101,
3 * TeVii S600, S630, S650, S660, S480, S421, S632
5 * Geniatech SU3000, T220,
6 * TechnoTrend S2-4600 Cards
7 * Copyright (C) 2008-2012 Igor M. Liplianin (liplianin@me.by)
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation, version 2.
13 * see Documentation/dvb/README.dvb-usb for more information
31 #include "stb6100_proc.h"
32 #include "m88rs2000.h"
35 #include "m88ds3103.h"
38 /* Max transfer size done by I2C transfer functions */
39 #define MAX_XFER_SIZE 64
41 #ifndef USB_PID_DW2102
42 #define USB_PID_DW2102 0x2102
45 #ifndef USB_PID_DW2104
46 #define USB_PID_DW2104 0x2104
49 #ifndef USB_PID_DW3101
50 #define USB_PID_DW3101 0x3101
53 #ifndef USB_PID_CINERGY_S
54 #define USB_PID_CINERGY_S 0x0064
57 #ifndef USB_PID_TEVII_S630
58 #define USB_PID_TEVII_S630 0xd630
61 #ifndef USB_PID_TEVII_S650
62 #define USB_PID_TEVII_S650 0xd650
65 #ifndef USB_PID_TEVII_S660
66 #define USB_PID_TEVII_S660 0xd660
69 #ifndef USB_PID_TEVII_S480_1
70 #define USB_PID_TEVII_S480_1 0xd481
73 #ifndef USB_PID_TEVII_S480_2
74 #define USB_PID_TEVII_S480_2 0xd482
77 #ifndef USB_PID_PROF_1100
78 #define USB_PID_PROF_1100 0xb012
81 #ifndef USB_PID_TEVII_S421
82 #define USB_PID_TEVII_S421 0xd421
85 #ifndef USB_PID_TEVII_S632
86 #define USB_PID_TEVII_S632 0xd632
89 #ifndef USB_PID_GOTVIEW_SAT_HD
90 #define USB_PID_GOTVIEW_SAT_HD 0x5456
93 #define DW210X_READ_MSG 0
94 #define DW210X_WRITE_MSG 1
96 #define REG_1F_SYMBOLRATE_BYTE0 0x1f
97 #define REG_20_SYMBOLRATE_BYTE1 0x20
98 #define REG_21_SYMBOLRATE_BYTE2 0x21
100 #define DW2102_VOLTAGE_CTRL (0x1800)
101 #define SU3000_STREAM_CTRL (0x1900)
102 #define DW2102_RC_QUERY (0x1a00)
103 #define DW2102_LED_CTRL (0x1b00)
105 #define DW2101_FIRMWARE "dvb-usb-dw2101.fw"
106 #define DW2102_FIRMWARE "dvb-usb-dw2102.fw"
107 #define DW2104_FIRMWARE "dvb-usb-dw2104.fw"
108 #define DW3101_FIRMWARE "dvb-usb-dw3101.fw"
109 #define S630_FIRMWARE "dvb-usb-s630.fw"
110 #define S660_FIRMWARE "dvb-usb-s660.fw"
111 #define P1100_FIRMWARE "dvb-usb-p1100.fw"
112 #define P7500_FIRMWARE "dvb-usb-p7500.fw"
114 #define err_str "did not find the firmware file. (%s) " \
115 "Please see linux/Documentation/dvb/ for more details " \
116 "on firmware-problems."
118 struct dw2102_state
{
121 struct i2c_client
*i2c_client_tuner
;
123 /* fe hook functions*/
124 int (*old_set_voltage
)(struct dvb_frontend
*f
, enum fe_sec_voltage v
);
125 int (*fe_read_status
)(struct dvb_frontend
*fe
,
126 enum fe_status
*status
);
130 static int dvb_usb_dw2102_debug
;
131 module_param_named(debug
, dvb_usb_dw2102_debug
, int, 0644);
132 MODULE_PARM_DESC(debug
, "set debugging level (1=info 2=xfer 4=rc(or-able))."
133 DVB_USB_DEBUG_STATUS
);
136 static int demod_probe
= 1;
137 module_param_named(demod
, demod_probe
, int, 0644);
138 MODULE_PARM_DESC(demod
, "demod to probe (1=cx24116 2=stv0903+stv6110 "
139 "4=stv0903+stb6100(or-able)).");
141 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr
);
143 static int dw210x_op_rw(struct usb_device
*dev
, u8 request
, u16 value
,
144 u16 index
, u8
* data
, u16 len
, int flags
)
148 unsigned int pipe
= (flags
== DW210X_READ_MSG
) ?
149 usb_rcvctrlpipe(dev
, 0) : usb_sndctrlpipe(dev
, 0);
150 u8 request_type
= (flags
== DW210X_READ_MSG
) ? USB_DIR_IN
: USB_DIR_OUT
;
152 u8buf
= kmalloc(len
, GFP_KERNEL
);
157 if (flags
== DW210X_WRITE_MSG
)
158 memcpy(u8buf
, data
, len
);
159 ret
= usb_control_msg(dev
, pipe
, request
, request_type
| USB_TYPE_VENDOR
,
160 value
, index
, u8buf
, len
, 2000);
162 if (flags
== DW210X_READ_MSG
)
163 memcpy(data
, u8buf
, len
);
170 static int dw2102_i2c_transfer(struct i2c_adapter
*adap
, struct i2c_msg msg
[],
173 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
175 u8 buf6
[] = {0x2c, 0x05, 0xc0, 0, 0, 0, 0};
180 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
185 /* read stv0299 register */
186 value
= msg
[0].buf
[0];/* register */
187 for (i
= 0; i
< msg
[1].len
; i
++) {
188 dw210x_op_rw(d
->udev
, 0xb5, value
+ i
, 0,
189 buf6
, 2, DW210X_READ_MSG
);
190 msg
[1].buf
[i
] = buf6
[0];
194 switch (msg
[0].addr
) {
196 /* write to stv0299 register */
198 buf6
[1] = msg
[0].buf
[0];
199 buf6
[2] = msg
[0].buf
[1];
200 dw210x_op_rw(d
->udev
, 0xb2, 0, 0,
201 buf6
, 3, DW210X_WRITE_MSG
);
204 if (msg
[0].flags
== 0) {
205 /* write to tuner pll */
209 buf6
[3] = msg
[0].buf
[0];
210 buf6
[4] = msg
[0].buf
[1];
211 buf6
[5] = msg
[0].buf
[2];
212 buf6
[6] = msg
[0].buf
[3];
213 dw210x_op_rw(d
->udev
, 0xb2, 0, 0,
214 buf6
, 7, DW210X_WRITE_MSG
);
216 /* read from tuner */
217 dw210x_op_rw(d
->udev
, 0xb5, 0, 0,
218 buf6
, 1, DW210X_READ_MSG
);
219 msg
[0].buf
[0] = buf6
[0];
222 case (DW2102_RC_QUERY
):
223 dw210x_op_rw(d
->udev
, 0xb8, 0, 0,
224 buf6
, 2, DW210X_READ_MSG
);
225 msg
[0].buf
[0] = buf6
[0];
226 msg
[0].buf
[1] = buf6
[1];
228 case (DW2102_VOLTAGE_CTRL
):
230 buf6
[1] = msg
[0].buf
[0];
231 dw210x_op_rw(d
->udev
, 0xb2, 0, 0,
232 buf6
, 2, DW210X_WRITE_MSG
);
239 mutex_unlock(&d
->i2c_mutex
);
243 static int dw2102_serit_i2c_transfer(struct i2c_adapter
*adap
,
244 struct i2c_msg msg
[], int num
)
246 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
247 u8 buf6
[] = {0, 0, 0, 0, 0, 0, 0};
251 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
256 /* read si2109 register by number */
257 buf6
[0] = msg
[0].addr
<< 1;
258 buf6
[1] = msg
[0].len
;
259 buf6
[2] = msg
[0].buf
[0];
260 dw210x_op_rw(d
->udev
, 0xc2, 0, 0,
261 buf6
, msg
[0].len
+ 2, DW210X_WRITE_MSG
);
262 /* read si2109 register */
263 dw210x_op_rw(d
->udev
, 0xc3, 0xd0, 0,
264 buf6
, msg
[1].len
+ 2, DW210X_READ_MSG
);
265 memcpy(msg
[1].buf
, buf6
+ 2, msg
[1].len
);
269 switch (msg
[0].addr
) {
271 /* write to si2109 register */
272 buf6
[0] = msg
[0].addr
<< 1;
273 buf6
[1] = msg
[0].len
;
274 memcpy(buf6
+ 2, msg
[0].buf
, msg
[0].len
);
275 dw210x_op_rw(d
->udev
, 0xc2, 0, 0, buf6
,
276 msg
[0].len
+ 2, DW210X_WRITE_MSG
);
278 case(DW2102_RC_QUERY
):
279 dw210x_op_rw(d
->udev
, 0xb8, 0, 0,
280 buf6
, 2, DW210X_READ_MSG
);
281 msg
[0].buf
[0] = buf6
[0];
282 msg
[0].buf
[1] = buf6
[1];
284 case(DW2102_VOLTAGE_CTRL
):
286 buf6
[1] = msg
[0].buf
[0];
287 dw210x_op_rw(d
->udev
, 0xb2, 0, 0,
288 buf6
, 2, DW210X_WRITE_MSG
);
294 mutex_unlock(&d
->i2c_mutex
);
298 static int dw2102_earda_i2c_transfer(struct i2c_adapter
*adap
, struct i2c_msg msg
[], int num
)
300 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
305 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
311 /* first write first register number */
312 u8 ibuf
[MAX_XFER_SIZE
], obuf
[3];
314 if (2 + msg
[1].len
> sizeof(ibuf
)) {
315 warn("i2c rd: len=%d is too big!\n",
321 obuf
[0] = msg
[0].addr
<< 1;
322 obuf
[1] = msg
[0].len
;
323 obuf
[2] = msg
[0].buf
[0];
324 dw210x_op_rw(d
->udev
, 0xc2, 0, 0,
325 obuf
, msg
[0].len
+ 2, DW210X_WRITE_MSG
);
326 /* second read registers */
327 dw210x_op_rw(d
->udev
, 0xc3, 0xd1 , 0,
328 ibuf
, msg
[1].len
+ 2, DW210X_READ_MSG
);
329 memcpy(msg
[1].buf
, ibuf
+ 2, msg
[1].len
);
334 switch (msg
[0].addr
) {
336 /* write to register */
337 u8 obuf
[MAX_XFER_SIZE
];
339 if (2 + msg
[0].len
> sizeof(obuf
)) {
340 warn("i2c wr: len=%d is too big!\n",
346 obuf
[0] = msg
[0].addr
<< 1;
347 obuf
[1] = msg
[0].len
;
348 memcpy(obuf
+ 2, msg
[0].buf
, msg
[0].len
);
349 dw210x_op_rw(d
->udev
, 0xc2, 0, 0,
350 obuf
, msg
[0].len
+ 2, DW210X_WRITE_MSG
);
355 u8 obuf
[MAX_XFER_SIZE
];
357 if (2 + msg
[0].len
> sizeof(obuf
)) {
358 warn("i2c wr: len=%d is too big!\n",
364 obuf
[0] = msg
[0].addr
<< 1;
365 obuf
[1] = msg
[0].len
;
366 memcpy(obuf
+ 2, msg
[0].buf
, msg
[0].len
);
367 dw210x_op_rw(d
->udev
, 0xc2, 0, 0,
368 obuf
, msg
[0].len
+ 2, DW210X_WRITE_MSG
);
371 case(DW2102_RC_QUERY
): {
373 dw210x_op_rw(d
->udev
, 0xb8, 0, 0,
374 ibuf
, 2, DW210X_READ_MSG
);
375 memcpy(msg
[0].buf
, ibuf
, 2);
378 case(DW2102_VOLTAGE_CTRL
): {
381 obuf
[1] = msg
[0].buf
[0];
382 dw210x_op_rw(d
->udev
, 0xb2, 0, 0,
383 obuf
, 2, DW210X_WRITE_MSG
);
393 mutex_unlock(&d
->i2c_mutex
);
397 static int dw2104_i2c_transfer(struct i2c_adapter
*adap
, struct i2c_msg msg
[], int num
)
399 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
404 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
407 for (j
= 0; j
< num
; j
++) {
408 switch (msg
[j
].addr
) {
409 case(DW2102_RC_QUERY
): {
411 dw210x_op_rw(d
->udev
, 0xb8, 0, 0,
412 ibuf
, 2, DW210X_READ_MSG
);
413 memcpy(msg
[j
].buf
, ibuf
, 2);
416 case(DW2102_VOLTAGE_CTRL
): {
419 obuf
[1] = msg
[j
].buf
[0];
420 dw210x_op_rw(d
->udev
, 0xb2, 0, 0,
421 obuf
, 2, DW210X_WRITE_MSG
);
426 case 0x68: ds3000, stv0903
427 case 0x60: ts2020, stv6110, stb6100 */
429 if (msg
[j
].flags
== I2C_M_RD
) {
431 u8 ibuf
[MAX_XFER_SIZE
];
433 if (2 + msg
[j
].len
> sizeof(ibuf
)) {
434 warn("i2c rd: len=%d is too big!\n",
440 dw210x_op_rw(d
->udev
, 0xc3,
441 (msg
[j
].addr
<< 1) + 1, 0,
442 ibuf
, msg
[j
].len
+ 2,
444 memcpy(msg
[j
].buf
, ibuf
+ 2, msg
[j
].len
);
446 } else if (((msg
[j
].buf
[0] == 0xb0) &&
447 (msg
[j
].addr
== 0x68)) ||
448 ((msg
[j
].buf
[0] == 0xf7) &&
449 (msg
[j
].addr
== 0x55))) {
452 obuf
[0] = msg
[j
].addr
<< 1;
453 obuf
[1] = (msg
[j
].len
> 15 ? 17 : msg
[j
].len
);
454 obuf
[2] = msg
[j
].buf
[0];
455 len
= msg
[j
].len
- 1;
458 memcpy(obuf
+ 3, msg
[j
].buf
+ i
,
459 (len
> 16 ? 16 : len
));
460 dw210x_op_rw(d
->udev
, 0xc2, 0, 0,
461 obuf
, (len
> 16 ? 16 : len
) + 3,
467 /* write registers */
468 u8 obuf
[MAX_XFER_SIZE
];
470 if (2 + msg
[j
].len
> sizeof(obuf
)) {
471 warn("i2c wr: len=%d is too big!\n",
477 obuf
[0] = msg
[j
].addr
<< 1;
478 obuf
[1] = msg
[j
].len
;
479 memcpy(obuf
+ 2, msg
[j
].buf
, msg
[j
].len
);
480 dw210x_op_rw(d
->udev
, 0xc2, 0, 0,
481 obuf
, msg
[j
].len
+ 2,
492 mutex_unlock(&d
->i2c_mutex
);
496 static int dw3101_i2c_transfer(struct i2c_adapter
*adap
, struct i2c_msg msg
[],
499 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
505 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
511 /* first write first register number */
512 u8 ibuf
[MAX_XFER_SIZE
], obuf
[3];
514 if (2 + msg
[1].len
> sizeof(ibuf
)) {
515 warn("i2c rd: len=%d is too big!\n",
520 obuf
[0] = msg
[0].addr
<< 1;
521 obuf
[1] = msg
[0].len
;
522 obuf
[2] = msg
[0].buf
[0];
523 dw210x_op_rw(d
->udev
, 0xc2, 0, 0,
524 obuf
, msg
[0].len
+ 2, DW210X_WRITE_MSG
);
525 /* second read registers */
526 dw210x_op_rw(d
->udev
, 0xc3, 0x19 , 0,
527 ibuf
, msg
[1].len
+ 2, DW210X_READ_MSG
);
528 memcpy(msg
[1].buf
, ibuf
+ 2, msg
[1].len
);
533 switch (msg
[0].addr
) {
536 /* write to register */
537 u8 obuf
[MAX_XFER_SIZE
];
539 if (2 + msg
[0].len
> sizeof(obuf
)) {
540 warn("i2c wr: len=%d is too big!\n",
545 obuf
[0] = msg
[0].addr
<< 1;
546 obuf
[1] = msg
[0].len
;
547 memcpy(obuf
+ 2, msg
[0].buf
, msg
[0].len
);
548 dw210x_op_rw(d
->udev
, 0xc2, 0, 0,
549 obuf
, msg
[0].len
+ 2, DW210X_WRITE_MSG
);
552 case(DW2102_RC_QUERY
): {
554 dw210x_op_rw(d
->udev
, 0xb8, 0, 0,
555 ibuf
, 2, DW210X_READ_MSG
);
556 memcpy(msg
[0].buf
, ibuf
, 2);
564 for (i
= 0; i
< num
; i
++) {
565 deb_xfer("%02x:%02x: %s ", i
, msg
[i
].addr
,
566 msg
[i
].flags
== 0 ? ">>>" : "<<<");
567 debug_dump(msg
[i
].buf
, msg
[i
].len
, deb_xfer
);
572 mutex_unlock(&d
->i2c_mutex
);
576 static int s6x0_i2c_transfer(struct i2c_adapter
*adap
, struct i2c_msg msg
[],
579 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
580 struct usb_device
*udev
;
586 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
589 for (j
= 0; j
< num
; j
++) {
590 switch (msg
[j
].addr
) {
591 case (DW2102_RC_QUERY
): {
593 dw210x_op_rw(d
->udev
, 0xb8, 0, 0,
594 ibuf
, 5, DW210X_READ_MSG
);
595 memcpy(msg
[j
].buf
, ibuf
+ 3, 2);
598 case (DW2102_VOLTAGE_CTRL
): {
602 obuf
[1] = msg
[j
].buf
[1];/* off-on */
603 dw210x_op_rw(d
->udev
, 0x8a, 0, 0,
604 obuf
, 2, DW210X_WRITE_MSG
);
606 obuf
[1] = msg
[j
].buf
[0];/* 13v-18v */
607 dw210x_op_rw(d
->udev
, 0x8a, 0, 0,
608 obuf
, 2, DW210X_WRITE_MSG
);
611 case (DW2102_LED_CTRL
): {
615 obuf
[1] = msg
[j
].buf
[0];
616 dw210x_op_rw(d
->udev
, 0x8a, 0, 0,
617 obuf
, 2, DW210X_WRITE_MSG
);
622 case 0x68: ds3000, stv0903, rs2000
623 case 0x60: ts2020, stv6110, stb6100
626 if (msg
[j
].flags
== I2C_M_RD
) {
628 u8 ibuf
[MAX_XFER_SIZE
];
630 if (msg
[j
].len
> sizeof(ibuf
)) {
631 warn("i2c rd: len=%d is too big!\n",
637 dw210x_op_rw(d
->udev
, 0x91, 0, 0,
640 memcpy(msg
[j
].buf
, ibuf
, msg
[j
].len
);
642 } else if ((msg
[j
].buf
[0] == 0xb0) &&
643 (msg
[j
].addr
== 0x68)) {
646 obuf
[0] = (msg
[j
].len
> 16 ?
647 18 : msg
[j
].len
+ 1);
648 obuf
[1] = msg
[j
].addr
<< 1;
649 obuf
[2] = msg
[j
].buf
[0];
650 len
= msg
[j
].len
- 1;
653 memcpy(obuf
+ 3, msg
[j
].buf
+ i
,
654 (len
> 16 ? 16 : len
));
655 dw210x_op_rw(d
->udev
, 0x80, 0, 0,
656 obuf
, (len
> 16 ? 16 : len
) + 3,
661 } else if (j
< (num
- 1)) {
662 /* write register addr before read */
663 u8 obuf
[MAX_XFER_SIZE
];
665 if (2 + msg
[j
].len
> sizeof(obuf
)) {
666 warn("i2c wr: len=%d is too big!\n",
672 obuf
[0] = msg
[j
+ 1].len
;
673 obuf
[1] = (msg
[j
].addr
<< 1);
674 memcpy(obuf
+ 2, msg
[j
].buf
, msg
[j
].len
);
675 dw210x_op_rw(d
->udev
,
676 le16_to_cpu(udev
->descriptor
.idProduct
) ==
677 0x7500 ? 0x92 : 0x90, 0, 0,
678 obuf
, msg
[j
].len
+ 2,
682 /* write registers */
683 u8 obuf
[MAX_XFER_SIZE
];
685 if (2 + msg
[j
].len
> sizeof(obuf
)) {
686 warn("i2c wr: len=%d is too big!\n",
691 obuf
[0] = msg
[j
].len
+ 1;
692 obuf
[1] = (msg
[j
].addr
<< 1);
693 memcpy(obuf
+ 2, msg
[j
].buf
, msg
[j
].len
);
694 dw210x_op_rw(d
->udev
, 0x80, 0, 0,
695 obuf
, msg
[j
].len
+ 2,
706 mutex_unlock(&d
->i2c_mutex
);
710 static int su3000_i2c_transfer(struct i2c_adapter
*adap
, struct i2c_msg msg
[],
713 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
714 u8 obuf
[0x40], ibuf
[0x40];
718 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
723 switch (msg
[0].addr
) {
724 case SU3000_STREAM_CTRL
:
725 obuf
[0] = msg
[0].buf
[0] + 0x36;
728 if (dvb_usb_generic_rw(d
, obuf
, 3, ibuf
, 0, 0) < 0)
729 err("i2c transfer failed.");
731 case DW2102_RC_QUERY
:
733 if (dvb_usb_generic_rw(d
, obuf
, 1, ibuf
, 2, 0) < 0)
734 err("i2c transfer failed.");
735 msg
[0].buf
[1] = ibuf
[0];
736 msg
[0].buf
[0] = ibuf
[1];
739 /* always i2c write*/
741 obuf
[1] = msg
[0].addr
;
742 obuf
[2] = msg
[0].len
;
744 memcpy(&obuf
[3], msg
[0].buf
, msg
[0].len
);
746 if (dvb_usb_generic_rw(d
, obuf
, msg
[0].len
+ 3,
748 err("i2c transfer failed.");
753 /* always i2c read */
755 obuf
[1] = msg
[0].len
;
756 obuf
[2] = msg
[1].len
;
757 obuf
[3] = msg
[0].addr
;
758 memcpy(&obuf
[4], msg
[0].buf
, msg
[0].len
);
760 if (dvb_usb_generic_rw(d
, obuf
, msg
[0].len
+ 4,
761 ibuf
, msg
[1].len
+ 1, 0) < 0)
762 err("i2c transfer failed.");
764 memcpy(msg
[1].buf
, &ibuf
[1], msg
[1].len
);
767 warn("more than 2 i2c messages at a time is not handled yet.");
770 mutex_unlock(&d
->i2c_mutex
);
774 static u32
dw210x_i2c_func(struct i2c_adapter
*adapter
)
779 static struct i2c_algorithm dw2102_i2c_algo
= {
780 .master_xfer
= dw2102_i2c_transfer
,
781 .functionality
= dw210x_i2c_func
,
784 static struct i2c_algorithm dw2102_serit_i2c_algo
= {
785 .master_xfer
= dw2102_serit_i2c_transfer
,
786 .functionality
= dw210x_i2c_func
,
789 static struct i2c_algorithm dw2102_earda_i2c_algo
= {
790 .master_xfer
= dw2102_earda_i2c_transfer
,
791 .functionality
= dw210x_i2c_func
,
794 static struct i2c_algorithm dw2104_i2c_algo
= {
795 .master_xfer
= dw2104_i2c_transfer
,
796 .functionality
= dw210x_i2c_func
,
799 static struct i2c_algorithm dw3101_i2c_algo
= {
800 .master_xfer
= dw3101_i2c_transfer
,
801 .functionality
= dw210x_i2c_func
,
804 static struct i2c_algorithm s6x0_i2c_algo
= {
805 .master_xfer
= s6x0_i2c_transfer
,
806 .functionality
= dw210x_i2c_func
,
809 static struct i2c_algorithm su3000_i2c_algo
= {
810 .master_xfer
= su3000_i2c_transfer
,
811 .functionality
= dw210x_i2c_func
,
814 static int dw210x_read_mac_address(struct dvb_usb_device
*d
, u8 mac
[6])
818 u8 eeprom
[256], eepromline
[16];
820 for (i
= 0; i
< 256; i
++) {
821 if (dw210x_op_rw(d
->udev
, 0xb6, 0xa0 , i
, ibuf
, 2, DW210X_READ_MSG
) < 0) {
822 err("read eeprom failed.");
825 eepromline
[i
%16] = ibuf
[0];
828 if ((i
% 16) == 15) {
829 deb_xfer("%02x: ", i
- 15);
830 debug_dump(eepromline
, 16, deb_xfer
);
834 memcpy(mac
, eeprom
+ 8, 6);
838 static int s6x0_read_mac_address(struct dvb_usb_device
*d
, u8 mac
[6])
841 u8 ibuf
[] = { 0 }, obuf
[] = { 0 };
842 u8 eeprom
[256], eepromline
[16];
843 struct i2c_msg msg
[] = {
857 for (i
= 0; i
< 256; i
++) {
859 ret
= s6x0_i2c_transfer(&d
->i2c_adap
, msg
, 2);
861 err("read eeprom failed.");
864 eepromline
[i
% 16] = ibuf
[0];
868 if ((i
% 16) == 15) {
869 deb_xfer("%02x: ", i
- 15);
870 debug_dump(eepromline
, 16, deb_xfer
);
874 memcpy(mac
, eeprom
+ 16, 6);
878 static int su3000_streaming_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
880 static u8 command_start
[] = {0x00};
881 static u8 command_stop
[] = {0x01};
882 struct i2c_msg msg
= {
883 .addr
= SU3000_STREAM_CTRL
,
885 .buf
= onoff
? command_start
: command_stop
,
889 i2c_transfer(&adap
->dev
->i2c_adap
, &msg
, 1);
894 static int su3000_power_ctrl(struct dvb_usb_device
*d
, int i
)
896 struct dw2102_state
*state
= (struct dw2102_state
*)d
->priv
;
897 u8 obuf
[] = {0xde, 0};
899 info("%s: %d, initialized %d\n", __func__
, i
, state
->initialized
);
901 if (i
&& !state
->initialized
) {
902 state
->initialized
= 1;
904 dvb_usb_generic_rw(d
, obuf
, 2, NULL
, 0, 0);
910 static int su3000_read_mac_address(struct dvb_usb_device
*d
, u8 mac
[6])
913 u8 obuf
[] = { 0x1f, 0xf0 };
915 struct i2c_msg msg
[] = {
930 for (i
= 0; i
< 6; i
++) {
932 if (i2c_transfer(&d
->i2c_adap
, msg
, 2) != 2)
941 static int su3000_identify_state(struct usb_device
*udev
,
942 struct dvb_usb_device_properties
*props
,
943 struct dvb_usb_device_description
**desc
,
946 info("%s\n", __func__
);
952 static int dw210x_set_voltage(struct dvb_frontend
*fe
,
953 enum fe_sec_voltage voltage
)
955 static u8 command_13v
[] = {0x00, 0x01};
956 static u8 command_18v
[] = {0x01, 0x01};
957 static u8 command_off
[] = {0x00, 0x00};
958 struct i2c_msg msg
= {
959 .addr
= DW2102_VOLTAGE_CTRL
,
965 struct dvb_usb_adapter
*udev_adap
=
966 (struct dvb_usb_adapter
*)(fe
->dvb
->priv
);
967 if (voltage
== SEC_VOLTAGE_18
)
968 msg
.buf
= command_18v
;
969 else if (voltage
== SEC_VOLTAGE_13
)
970 msg
.buf
= command_13v
;
972 i2c_transfer(&udev_adap
->dev
->i2c_adap
, &msg
, 1);
977 static int s660_set_voltage(struct dvb_frontend
*fe
,
978 enum fe_sec_voltage voltage
)
980 struct dvb_usb_adapter
*d
=
981 (struct dvb_usb_adapter
*)(fe
->dvb
->priv
);
982 struct dw2102_state
*st
= (struct dw2102_state
*)d
->dev
->priv
;
984 dw210x_set_voltage(fe
, voltage
);
985 if (st
->old_set_voltage
)
986 st
->old_set_voltage(fe
, voltage
);
991 static void dw210x_led_ctrl(struct dvb_frontend
*fe
, int offon
)
993 static u8 led_off
[] = { 0 };
994 static u8 led_on
[] = { 1 };
995 struct i2c_msg msg
= {
996 .addr
= DW2102_LED_CTRL
,
1001 struct dvb_usb_adapter
*udev_adap
=
1002 (struct dvb_usb_adapter
*)(fe
->dvb
->priv
);
1006 i2c_transfer(&udev_adap
->dev
->i2c_adap
, &msg
, 1);
1009 static int tt_s2_4600_read_status(struct dvb_frontend
*fe
,
1010 enum fe_status
*status
)
1012 struct dvb_usb_adapter
*d
=
1013 (struct dvb_usb_adapter
*)(fe
->dvb
->priv
);
1014 struct dw2102_state
*st
= (struct dw2102_state
*)d
->dev
->priv
;
1017 ret
= st
->fe_read_status(fe
, status
);
1019 /* resync slave fifo when signal change from unlock to lock */
1020 if ((*status
& FE_HAS_LOCK
) && (!st
->last_lock
))
1021 su3000_streaming_ctrl(d
, 1);
1023 st
->last_lock
= (*status
& FE_HAS_LOCK
) ? 1 : 0;
1027 static struct stv0299_config sharp_z0194a_config
= {
1028 .demod_address
= 0x68,
1029 .inittab
= sharp_z0194a_inittab
,
1033 .lock_output
= STV0299_LOCKOUTPUT_1
,
1034 .volt13_op0_op1
= STV0299_VOLT13_OP1
,
1035 .min_delay_ms
= 100,
1036 .set_symbol_rate
= sharp_z0194a_set_symbol_rate
,
1039 static struct cx24116_config dw2104_config
= {
1040 .demod_address
= 0x55,
1041 .mpg_clk_pos_pol
= 0x01,
1044 static struct si21xx_config serit_sp1511lhb_config
= {
1045 .demod_address
= 0x68,
1046 .min_delay_ms
= 100,
1050 static struct tda10023_config dw3101_tda10023_config
= {
1051 .demod_address
= 0x0c,
1055 static struct mt312_config zl313_config
= {
1056 .demod_address
= 0x0e,
1059 static struct ds3000_config dw2104_ds3000_config
= {
1060 .demod_address
= 0x68,
1063 static struct ts2020_config dw2104_ts2020_config
= {
1064 .tuner_address
= 0x60,
1066 .frequency_div
= 1060000,
1069 static struct ds3000_config s660_ds3000_config
= {
1070 .demod_address
= 0x68,
1072 .set_lock_led
= dw210x_led_ctrl
,
1075 static struct ts2020_config s660_ts2020_config
= {
1076 .tuner_address
= 0x60,
1078 .frequency_div
= 1146000,
1081 static struct stv0900_config dw2104a_stv0900_config
= {
1082 .demod_address
= 0x6a,
1085 .clkmode
= 3,/* 0-CLKI, 2-XTALI, else AUTO */
1086 .diseqc_mode
= 2,/* 2/3 PWM */
1087 .tun1_maddress
= 0,/* 0x60 */
1088 .tun1_adc
= 0,/* 2 Vpp */
1092 static struct stb6100_config dw2104a_stb6100_config
= {
1093 .tuner_address
= 0x60,
1094 .refclock
= 27000000,
1097 static struct stv0900_config dw2104_stv0900_config
= {
1098 .demod_address
= 0x68,
1104 .tun1_adc
= 1,/* 1 Vpp */
1108 static struct stv6110_config dw2104_stv6110_config
= {
1109 .i2c_address
= 0x60,
1114 static struct stv0900_config prof_7500_stv0900_config
= {
1115 .demod_address
= 0x6a,
1118 .clkmode
= 3,/* 0-CLKI, 2-XTALI, else AUTO */
1119 .diseqc_mode
= 2,/* 2/3 PWM */
1120 .tun1_maddress
= 0,/* 0x60 */
1121 .tun1_adc
= 0,/* 2 Vpp */
1124 .set_lock_led
= dw210x_led_ctrl
,
1127 static struct ds3000_config su3000_ds3000_config
= {
1128 .demod_address
= 0x68,
1130 .set_lock_led
= dw210x_led_ctrl
,
1133 static struct cxd2820r_config cxd2820r_config
= {
1134 .i2c_address
= 0x6c, /* (0xd8 >> 1) */
1139 static struct tda18271_config tda18271_config
= {
1140 .output_opt
= TDA18271_OUTPUT_LT_OFF
,
1141 .gate
= TDA18271_GATE_DIGITAL
,
1144 static const struct m88ds3103_config tt_s2_4600_m88ds3103_config
= {
1148 .ts_mode
= M88DS3103_TS_CI
,
1153 .clock_out
= M88DS3103_CLOCK_OUT_ENABLED
,
1160 static u8 m88rs2000_inittab
[] = {
1161 DEMOD_WRITE
, 0x9a, 0x30,
1162 DEMOD_WRITE
, 0x00, 0x01,
1163 WRITE_DELAY
, 0x19, 0x00,
1164 DEMOD_WRITE
, 0x00, 0x00,
1165 DEMOD_WRITE
, 0x9a, 0xb0,
1166 DEMOD_WRITE
, 0x81, 0xc1,
1167 DEMOD_WRITE
, 0x81, 0x81,
1168 DEMOD_WRITE
, 0x86, 0xc6,
1169 DEMOD_WRITE
, 0x9a, 0x30,
1170 DEMOD_WRITE
, 0xf0, 0x80,
1171 DEMOD_WRITE
, 0xf1, 0xbf,
1172 DEMOD_WRITE
, 0xb0, 0x45,
1173 DEMOD_WRITE
, 0xb2, 0x01,
1174 DEMOD_WRITE
, 0x9a, 0xb0,
1178 static struct m88rs2000_config s421_m88rs2000_config
= {
1180 .inittab
= m88rs2000_inittab
,
1183 static int dw2104_frontend_attach(struct dvb_usb_adapter
*d
)
1185 struct dvb_tuner_ops
*tuner_ops
= NULL
;
1187 if (demod_probe
& 4) {
1188 d
->fe_adap
[0].fe
= dvb_attach(stv0900_attach
, &dw2104a_stv0900_config
,
1189 &d
->dev
->i2c_adap
, 0);
1190 if (d
->fe_adap
[0].fe
!= NULL
) {
1191 if (dvb_attach(stb6100_attach
, d
->fe_adap
[0].fe
,
1192 &dw2104a_stb6100_config
,
1193 &d
->dev
->i2c_adap
)) {
1194 tuner_ops
= &d
->fe_adap
[0].fe
->ops
.tuner_ops
;
1195 tuner_ops
->set_frequency
= stb6100_set_freq
;
1196 tuner_ops
->get_frequency
= stb6100_get_freq
;
1197 tuner_ops
->set_bandwidth
= stb6100_set_bandw
;
1198 tuner_ops
->get_bandwidth
= stb6100_get_bandw
;
1199 d
->fe_adap
[0].fe
->ops
.set_voltage
= dw210x_set_voltage
;
1200 info("Attached STV0900+STB6100!\n");
1206 if (demod_probe
& 2) {
1207 d
->fe_adap
[0].fe
= dvb_attach(stv0900_attach
, &dw2104_stv0900_config
,
1208 &d
->dev
->i2c_adap
, 0);
1209 if (d
->fe_adap
[0].fe
!= NULL
) {
1210 if (dvb_attach(stv6110_attach
, d
->fe_adap
[0].fe
,
1211 &dw2104_stv6110_config
,
1212 &d
->dev
->i2c_adap
)) {
1213 d
->fe_adap
[0].fe
->ops
.set_voltage
= dw210x_set_voltage
;
1214 info("Attached STV0900+STV6110A!\n");
1220 if (demod_probe
& 1) {
1221 d
->fe_adap
[0].fe
= dvb_attach(cx24116_attach
, &dw2104_config
,
1223 if (d
->fe_adap
[0].fe
!= NULL
) {
1224 d
->fe_adap
[0].fe
->ops
.set_voltage
= dw210x_set_voltage
;
1225 info("Attached cx24116!\n");
1230 d
->fe_adap
[0].fe
= dvb_attach(ds3000_attach
, &dw2104_ds3000_config
,
1232 if (d
->fe_adap
[0].fe
!= NULL
) {
1233 dvb_attach(ts2020_attach
, d
->fe_adap
[0].fe
,
1234 &dw2104_ts2020_config
, &d
->dev
->i2c_adap
);
1235 d
->fe_adap
[0].fe
->ops
.set_voltage
= dw210x_set_voltage
;
1236 info("Attached DS3000!\n");
1243 static struct dvb_usb_device_properties dw2102_properties
;
1244 static struct dvb_usb_device_properties dw2104_properties
;
1245 static struct dvb_usb_device_properties s6x0_properties
;
1247 static int dw2102_frontend_attach(struct dvb_usb_adapter
*d
)
1249 if (dw2102_properties
.i2c_algo
== &dw2102_serit_i2c_algo
) {
1250 /*dw2102_properties.adapter->tuner_attach = NULL;*/
1251 d
->fe_adap
[0].fe
= dvb_attach(si21xx_attach
, &serit_sp1511lhb_config
,
1253 if (d
->fe_adap
[0].fe
!= NULL
) {
1254 d
->fe_adap
[0].fe
->ops
.set_voltage
= dw210x_set_voltage
;
1255 info("Attached si21xx!\n");
1260 if (dw2102_properties
.i2c_algo
== &dw2102_earda_i2c_algo
) {
1261 d
->fe_adap
[0].fe
= dvb_attach(stv0288_attach
, &earda_config
,
1263 if (d
->fe_adap
[0].fe
!= NULL
) {
1264 if (dvb_attach(stb6000_attach
, d
->fe_adap
[0].fe
, 0x61,
1265 &d
->dev
->i2c_adap
)) {
1266 d
->fe_adap
[0].fe
->ops
.set_voltage
= dw210x_set_voltage
;
1267 info("Attached stv0288!\n");
1273 if (dw2102_properties
.i2c_algo
== &dw2102_i2c_algo
) {
1274 /*dw2102_properties.adapter->tuner_attach = dw2102_tuner_attach;*/
1275 d
->fe_adap
[0].fe
= dvb_attach(stv0299_attach
, &sharp_z0194a_config
,
1277 if (d
->fe_adap
[0].fe
!= NULL
) {
1278 d
->fe_adap
[0].fe
->ops
.set_voltage
= dw210x_set_voltage
;
1279 info("Attached stv0299!\n");
1286 static int dw3101_frontend_attach(struct dvb_usb_adapter
*d
)
1288 d
->fe_adap
[0].fe
= dvb_attach(tda10023_attach
, &dw3101_tda10023_config
,
1289 &d
->dev
->i2c_adap
, 0x48);
1290 if (d
->fe_adap
[0].fe
!= NULL
) {
1291 info("Attached tda10023!\n");
1297 static int zl100313_frontend_attach(struct dvb_usb_adapter
*d
)
1299 d
->fe_adap
[0].fe
= dvb_attach(mt312_attach
, &zl313_config
,
1301 if (d
->fe_adap
[0].fe
!= NULL
) {
1302 if (dvb_attach(zl10039_attach
, d
->fe_adap
[0].fe
, 0x60,
1303 &d
->dev
->i2c_adap
)) {
1304 d
->fe_adap
[0].fe
->ops
.set_voltage
= dw210x_set_voltage
;
1305 info("Attached zl100313+zl10039!\n");
1313 static int stv0288_frontend_attach(struct dvb_usb_adapter
*d
)
1317 d
->fe_adap
[0].fe
= dvb_attach(stv0288_attach
, &earda_config
,
1320 if (d
->fe_adap
[0].fe
== NULL
)
1323 if (NULL
== dvb_attach(stb6000_attach
, d
->fe_adap
[0].fe
, 0x61, &d
->dev
->i2c_adap
))
1326 d
->fe_adap
[0].fe
->ops
.set_voltage
= dw210x_set_voltage
;
1328 dw210x_op_rw(d
->dev
->udev
, 0x8a, 0, 0, obuf
, 2, DW210X_WRITE_MSG
);
1330 info("Attached stv0288+stb6000!\n");
1336 static int ds3000_frontend_attach(struct dvb_usb_adapter
*d
)
1338 struct dw2102_state
*st
= d
->dev
->priv
;
1341 d
->fe_adap
[0].fe
= dvb_attach(ds3000_attach
, &s660_ds3000_config
,
1344 if (d
->fe_adap
[0].fe
== NULL
)
1347 dvb_attach(ts2020_attach
, d
->fe_adap
[0].fe
, &s660_ts2020_config
,
1350 st
->old_set_voltage
= d
->fe_adap
[0].fe
->ops
.set_voltage
;
1351 d
->fe_adap
[0].fe
->ops
.set_voltage
= s660_set_voltage
;
1353 dw210x_op_rw(d
->dev
->udev
, 0x8a, 0, 0, obuf
, 2, DW210X_WRITE_MSG
);
1355 info("Attached ds3000+ts2020!\n");
1360 static int prof_7500_frontend_attach(struct dvb_usb_adapter
*d
)
1364 d
->fe_adap
[0].fe
= dvb_attach(stv0900_attach
, &prof_7500_stv0900_config
,
1365 &d
->dev
->i2c_adap
, 0);
1366 if (d
->fe_adap
[0].fe
== NULL
)
1369 d
->fe_adap
[0].fe
->ops
.set_voltage
= dw210x_set_voltage
;
1371 dw210x_op_rw(d
->dev
->udev
, 0x8a, 0, 0, obuf
, 2, DW210X_WRITE_MSG
);
1373 info("Attached STV0900+STB6100A!\n");
1378 static int su3000_frontend_attach(struct dvb_usb_adapter
*d
)
1380 u8 obuf
[3] = { 0xe, 0x80, 0 };
1383 if (dvb_usb_generic_rw(d
->dev
, obuf
, 3, ibuf
, 1, 0) < 0)
1384 err("command 0x0e transfer failed.");
1390 if (dvb_usb_generic_rw(d
->dev
, obuf
, 3, ibuf
, 1, 0) < 0)
1391 err("command 0x0e transfer failed.");
1398 if (dvb_usb_generic_rw(d
->dev
, obuf
, 3, ibuf
, 1, 0) < 0)
1399 err("command 0x0e transfer failed.");
1405 if (dvb_usb_generic_rw(d
->dev
, obuf
, 3, ibuf
, 1, 0) < 0)
1406 err("command 0x0e transfer failed.");
1410 if (dvb_usb_generic_rw(d
->dev
, obuf
, 1, ibuf
, 1, 0) < 0)
1411 err("command 0x51 transfer failed.");
1413 d
->fe_adap
[0].fe
= dvb_attach(ds3000_attach
, &su3000_ds3000_config
,
1415 if (d
->fe_adap
[0].fe
== NULL
)
1418 if (dvb_attach(ts2020_attach
, d
->fe_adap
[0].fe
,
1419 &dw2104_ts2020_config
,
1420 &d
->dev
->i2c_adap
)) {
1421 info("Attached DS3000/TS2020!\n");
1425 info("Failed to attach DS3000/TS2020!\n");
1429 static int t220_frontend_attach(struct dvb_usb_adapter
*d
)
1431 u8 obuf
[3] = { 0xe, 0x87, 0 };
1434 if (dvb_usb_generic_rw(d
->dev
, obuf
, 3, ibuf
, 1, 0) < 0)
1435 err("command 0x0e transfer failed.");
1441 if (dvb_usb_generic_rw(d
->dev
, obuf
, 3, ibuf
, 1, 0) < 0)
1442 err("command 0x0e transfer failed.");
1448 if (dvb_usb_generic_rw(d
->dev
, obuf
, 3, ibuf
, 1, 0) < 0)
1449 err("command 0x0e transfer failed.");
1457 if (dvb_usb_generic_rw(d
->dev
, obuf
, 3, ibuf
, 1, 0) < 0)
1458 err("command 0x0e transfer failed.");
1462 if (dvb_usb_generic_rw(d
->dev
, obuf
, 1, ibuf
, 1, 0) < 0)
1463 err("command 0x51 transfer failed.");
1465 d
->fe_adap
[0].fe
= dvb_attach(cxd2820r_attach
, &cxd2820r_config
,
1466 &d
->dev
->i2c_adap
, NULL
);
1467 if (d
->fe_adap
[0].fe
!= NULL
) {
1468 if (dvb_attach(tda18271_attach
, d
->fe_adap
[0].fe
, 0x60,
1469 &d
->dev
->i2c_adap
, &tda18271_config
)) {
1470 info("Attached TDA18271HD/CXD2820R!\n");
1475 info("Failed to attach TDA18271HD/CXD2820R!\n");
1479 static int m88rs2000_frontend_attach(struct dvb_usb_adapter
*d
)
1481 u8 obuf
[] = { 0x51 };
1484 if (dvb_usb_generic_rw(d
->dev
, obuf
, 1, ibuf
, 1, 0) < 0)
1485 err("command 0x51 transfer failed.");
1487 d
->fe_adap
[0].fe
= dvb_attach(m88rs2000_attach
, &s421_m88rs2000_config
,
1490 if (d
->fe_adap
[0].fe
== NULL
)
1493 if (dvb_attach(ts2020_attach
, d
->fe_adap
[0].fe
,
1494 &dw2104_ts2020_config
,
1495 &d
->dev
->i2c_adap
)) {
1496 info("Attached RS2000/TS2020!\n");
1500 info("Failed to attach RS2000/TS2020!\n");
1504 static int tt_s2_4600_frontend_attach(struct dvb_usb_adapter
*adap
)
1506 struct dvb_usb_device
*d
= adap
->dev
;
1507 struct dw2102_state
*state
= d
->priv
;
1508 u8 obuf
[3] = { 0xe, 0x80, 0 };
1510 struct i2c_adapter
*i2c_adapter
;
1511 struct i2c_client
*client
;
1512 struct i2c_board_info info
;
1513 struct ts2020_config ts2020_config
= {};
1515 if (dvb_usb_generic_rw(d
, obuf
, 3, ibuf
, 1, 0) < 0)
1516 err("command 0x0e transfer failed.");
1522 if (dvb_usb_generic_rw(d
, obuf
, 3, ibuf
, 1, 0) < 0)
1523 err("command 0x0e transfer failed.");
1530 if (dvb_usb_generic_rw(d
, obuf
, 3, ibuf
, 1, 0) < 0)
1531 err("command 0x0e transfer failed.");
1537 if (dvb_usb_generic_rw(d
, obuf
, 3, ibuf
, 1, 0) < 0)
1538 err("command 0x0e transfer failed.");
1542 if (dvb_usb_generic_rw(d
, obuf
, 1, ibuf
, 1, 0) < 0)
1543 err("command 0x51 transfer failed.");
1545 memset(&info
, 0, sizeof(struct i2c_board_info
));
1547 adap
->fe_adap
[0].fe
= dvb_attach(m88ds3103_attach
,
1548 &tt_s2_4600_m88ds3103_config
,
1551 if (adap
->fe_adap
[0].fe
== NULL
)
1555 ts2020_config
.fe
= adap
->fe_adap
[0].fe
;
1556 strlcpy(info
.type
, "ts2022", I2C_NAME_SIZE
);
1558 info
.platform_data
= &ts2020_config
;
1559 request_module("ts2020");
1560 client
= i2c_new_device(i2c_adapter
, &info
);
1562 if (client
== NULL
|| client
->dev
.driver
== NULL
) {
1563 dvb_frontend_detach(adap
->fe_adap
[0].fe
);
1567 if (!try_module_get(client
->dev
.driver
->owner
)) {
1568 i2c_unregister_device(client
);
1569 dvb_frontend_detach(adap
->fe_adap
[0].fe
);
1573 /* delegate signal strength measurement to tuner */
1574 adap
->fe_adap
[0].fe
->ops
.read_signal_strength
=
1575 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.get_rf_strength
;
1577 state
->i2c_client_tuner
= client
;
1579 /* hook fe: need to resync the slave fifo when signal locks */
1580 state
->fe_read_status
= adap
->fe_adap
[0].fe
->ops
.read_status
;
1581 adap
->fe_adap
[0].fe
->ops
.read_status
= tt_s2_4600_read_status
;
1583 state
->last_lock
= 0;
1588 static int dw2102_tuner_attach(struct dvb_usb_adapter
*adap
)
1590 dvb_attach(dvb_pll_attach
, adap
->fe_adap
[0].fe
, 0x60,
1591 &adap
->dev
->i2c_adap
, DVB_PLL_OPERA1
);
1595 static int dw3101_tuner_attach(struct dvb_usb_adapter
*adap
)
1597 dvb_attach(dvb_pll_attach
, adap
->fe_adap
[0].fe
, 0x60,
1598 &adap
->dev
->i2c_adap
, DVB_PLL_TUA6034
);
1603 static int dw2102_rc_query(struct dvb_usb_device
*d
)
1606 struct i2c_msg msg
= {
1607 .addr
= DW2102_RC_QUERY
,
1613 if (d
->props
.i2c_algo
->master_xfer(&d
->i2c_adap
, &msg
, 1) == 1) {
1614 if (msg
.buf
[0] != 0xff) {
1615 deb_rc("%s: rc code: %x, %x\n",
1616 __func__
, key
[0], key
[1]);
1617 rc_keydown(d
->rc_dev
, RC_TYPE_UNKNOWN
, key
[0], 0);
1624 static int prof_rc_query(struct dvb_usb_device
*d
)
1627 struct i2c_msg msg
= {
1628 .addr
= DW2102_RC_QUERY
,
1634 if (d
->props
.i2c_algo
->master_xfer(&d
->i2c_adap
, &msg
, 1) == 1) {
1635 if (msg
.buf
[0] != 0xff) {
1636 deb_rc("%s: rc code: %x, %x\n",
1637 __func__
, key
[0], key
[1]);
1638 rc_keydown(d
->rc_dev
, RC_TYPE_UNKNOWN
, key
[0]^0xff, 0);
1645 static int su3000_rc_query(struct dvb_usb_device
*d
)
1648 struct i2c_msg msg
= {
1649 .addr
= DW2102_RC_QUERY
,
1655 if (d
->props
.i2c_algo
->master_xfer(&d
->i2c_adap
, &msg
, 1) == 1) {
1656 if (msg
.buf
[0] != 0xff) {
1657 deb_rc("%s: rc code: %x, %x\n",
1658 __func__
, key
[0], key
[1]);
1659 rc_keydown(d
->rc_dev
, RC_TYPE_RC5
,
1660 RC_SCANCODE_RC5(key
[1], key
[0]), 0);
1667 enum dw2102_table_entry
{
1679 TERRATEC_CINERGY_S2
,
1685 TERRATEC_CINERGY_S2_R2
,
1688 TECHNOTREND_S2_4600
,
1693 static struct usb_device_id dw2102_table
[] = {
1694 [CYPRESS_DW2102
] = {USB_DEVICE(USB_VID_CYPRESS
, USB_PID_DW2102
)},
1695 [CYPRESS_DW2101
] = {USB_DEVICE(USB_VID_CYPRESS
, 0x2101)},
1696 [CYPRESS_DW2104
] = {USB_DEVICE(USB_VID_CYPRESS
, USB_PID_DW2104
)},
1697 [TEVII_S650
] = {USB_DEVICE(0x9022, USB_PID_TEVII_S650
)},
1698 [TERRATEC_CINERGY_S
] = {USB_DEVICE(USB_VID_TERRATEC
, USB_PID_CINERGY_S
)},
1699 [CYPRESS_DW3101
] = {USB_DEVICE(USB_VID_CYPRESS
, USB_PID_DW3101
)},
1700 [TEVII_S630
] = {USB_DEVICE(0x9022, USB_PID_TEVII_S630
)},
1701 [PROF_1100
] = {USB_DEVICE(0x3011, USB_PID_PROF_1100
)},
1702 [TEVII_S660
] = {USB_DEVICE(0x9022, USB_PID_TEVII_S660
)},
1703 [PROF_7500
] = {USB_DEVICE(0x3034, 0x7500)},
1704 [GENIATECH_SU3000
] = {USB_DEVICE(0x1f4d, 0x3000)},
1705 [TERRATEC_CINERGY_S2
] = {USB_DEVICE(USB_VID_TERRATEC
, 0x00a8)},
1706 [TEVII_S480_1
] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_1
)},
1707 [TEVII_S480_2
] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_2
)},
1708 [X3M_SPC1400HD
] = {USB_DEVICE(0x1f4d, 0x3100)},
1709 [TEVII_S421
] = {USB_DEVICE(0x9022, USB_PID_TEVII_S421
)},
1710 [TEVII_S632
] = {USB_DEVICE(0x9022, USB_PID_TEVII_S632
)},
1711 [TERRATEC_CINERGY_S2_R2
] = {USB_DEVICE(USB_VID_TERRATEC
, 0x00b0)},
1712 [GOTVIEW_SAT_HD
] = {USB_DEVICE(0x1FE1, USB_PID_GOTVIEW_SAT_HD
)},
1713 [GENIATECH_T220
] = {USB_DEVICE(0x1f4d, 0xD220)},
1714 [TECHNOTREND_S2_4600
] = {USB_DEVICE(USB_VID_TECHNOTREND
,
1715 USB_PID_TECHNOTREND_CONNECT_S2_4600
)},
1716 [TEVII_S482_1
] = {USB_DEVICE(0x9022, 0xd483)},
1717 [TEVII_S482_2
] = {USB_DEVICE(0x9022, 0xd484)},
1721 MODULE_DEVICE_TABLE(usb
, dw2102_table
);
1723 static int dw2102_load_firmware(struct usb_device
*dev
,
1724 const struct firmware
*frmwr
)
1729 u8 reset16
[] = {0, 0, 0, 0, 0, 0, 0};
1730 const struct firmware
*fw
;
1732 switch (le16_to_cpu(dev
->descriptor
.idProduct
)) {
1734 ret
= request_firmware(&fw
, DW2101_FIRMWARE
, &dev
->dev
);
1736 err(err_str
, DW2101_FIRMWARE
);
1744 info("start downloading DW210X firmware");
1745 p
= kmalloc(fw
->size
, GFP_KERNEL
);
1748 dw210x_op_rw(dev
, 0xa0, 0x7f92, 0, &reset
, 1, DW210X_WRITE_MSG
);
1749 dw210x_op_rw(dev
, 0xa0, 0xe600, 0, &reset
, 1, DW210X_WRITE_MSG
);
1752 memcpy(p
, fw
->data
, fw
->size
);
1753 for (i
= 0; i
< fw
->size
; i
+= 0x40) {
1755 if (dw210x_op_rw(dev
, 0xa0, i
, 0, b
, 0x40,
1756 DW210X_WRITE_MSG
) != 0x40) {
1757 err("error while transferring firmware");
1762 /* restart the CPU */
1764 if (ret
|| dw210x_op_rw(dev
, 0xa0, 0x7f92, 0, &reset
, 1,
1765 DW210X_WRITE_MSG
) != 1) {
1766 err("could not restart the USB controller CPU.");
1769 if (ret
|| dw210x_op_rw(dev
, 0xa0, 0xe600, 0, &reset
, 1,
1770 DW210X_WRITE_MSG
) != 1) {
1771 err("could not restart the USB controller CPU.");
1774 /* init registers */
1775 switch (le16_to_cpu(dev
->descriptor
.idProduct
)) {
1776 case USB_PID_TEVII_S650
:
1777 dw2104_properties
.rc
.core
.rc_codes
= RC_MAP_TEVII_NEC
;
1778 case USB_PID_DW2104
:
1780 dw210x_op_rw(dev
, 0xc4, 0x0000, 0, &reset
, 1,
1782 /* break omitted intentionally */
1783 case USB_PID_DW3101
:
1785 dw210x_op_rw(dev
, 0xbf, 0x0040, 0, &reset
, 0,
1788 case USB_PID_CINERGY_S
:
1789 case USB_PID_DW2102
:
1790 dw210x_op_rw(dev
, 0xbf, 0x0040, 0, &reset
, 0,
1792 dw210x_op_rw(dev
, 0xb9, 0x0000, 0, &reset16
[0], 2,
1794 /* check STV0299 frontend */
1795 dw210x_op_rw(dev
, 0xb5, 0, 0, &reset16
[0], 2,
1797 if ((reset16
[0] == 0xa1) || (reset16
[0] == 0x80)) {
1798 dw2102_properties
.i2c_algo
= &dw2102_i2c_algo
;
1799 dw2102_properties
.adapter
->fe
[0].tuner_attach
= &dw2102_tuner_attach
;
1802 /* check STV0288 frontend */
1806 dw210x_op_rw(dev
, 0xc2, 0, 0, &reset16
[0], 3,
1808 dw210x_op_rw(dev
, 0xc3, 0xd1, 0, &reset16
[0], 3,
1810 if (reset16
[2] == 0x11) {
1811 dw2102_properties
.i2c_algo
= &dw2102_earda_i2c_algo
;
1816 dw210x_op_rw(dev
, 0xbc, 0x0030, 0, &reset16
[0], 2,
1818 dw210x_op_rw(dev
, 0xba, 0x0000, 0, &reset16
[0], 7,
1820 dw210x_op_rw(dev
, 0xba, 0x0000, 0, &reset16
[0], 7,
1822 dw210x_op_rw(dev
, 0xb9, 0x0000, 0, &reset16
[0], 2,
1833 static struct dvb_usb_device_properties dw2102_properties
= {
1834 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1835 .usb_ctrl
= DEVICE_SPECIFIC
,
1836 .firmware
= DW2102_FIRMWARE
,
1839 .i2c_algo
= &dw2102_serit_i2c_algo
,
1843 .rc_codes
= RC_MAP_DM1105_NEC
,
1844 .module_name
= "dw2102",
1845 .allowed_protos
= RC_BIT_NEC
,
1846 .rc_query
= dw2102_rc_query
,
1849 .generic_bulk_ctrl_endpoint
= 0x81,
1850 /* parameter for the MPEG2-data transfer */
1852 .download_firmware
= dw2102_load_firmware
,
1853 .read_mac_address
= dw210x_read_mac_address
,
1858 .frontend_attach
= dw2102_frontend_attach
,
1872 .num_device_descs
= 3,
1874 {"DVBWorld DVB-S 2102 USB2.0",
1875 {&dw2102_table
[CYPRESS_DW2102
], NULL
},
1878 {"DVBWorld DVB-S 2101 USB2.0",
1879 {&dw2102_table
[CYPRESS_DW2101
], NULL
},
1882 {"TerraTec Cinergy S USB",
1883 {&dw2102_table
[TERRATEC_CINERGY_S
], NULL
},
1889 static struct dvb_usb_device_properties dw2104_properties
= {
1890 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1891 .usb_ctrl
= DEVICE_SPECIFIC
,
1892 .firmware
= DW2104_FIRMWARE
,
1895 .i2c_algo
= &dw2104_i2c_algo
,
1898 .rc_codes
= RC_MAP_DM1105_NEC
,
1899 .module_name
= "dw2102",
1900 .allowed_protos
= RC_BIT_NEC
,
1901 .rc_query
= dw2102_rc_query
,
1904 .generic_bulk_ctrl_endpoint
= 0x81,
1905 /* parameter for the MPEG2-data transfer */
1907 .download_firmware
= dw2102_load_firmware
,
1908 .read_mac_address
= dw210x_read_mac_address
,
1913 .frontend_attach
= dw2104_frontend_attach
,
1927 .num_device_descs
= 2,
1929 { "DVBWorld DW2104 USB2.0",
1930 {&dw2102_table
[CYPRESS_DW2104
], NULL
},
1933 { "TeVii S650 USB2.0",
1934 {&dw2102_table
[TEVII_S650
], NULL
},
1940 static struct dvb_usb_device_properties dw3101_properties
= {
1941 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1942 .usb_ctrl
= DEVICE_SPECIFIC
,
1943 .firmware
= DW3101_FIRMWARE
,
1946 .i2c_algo
= &dw3101_i2c_algo
,
1949 .rc_codes
= RC_MAP_DM1105_NEC
,
1950 .module_name
= "dw2102",
1951 .allowed_protos
= RC_BIT_NEC
,
1952 .rc_query
= dw2102_rc_query
,
1955 .generic_bulk_ctrl_endpoint
= 0x81,
1956 /* parameter for the MPEG2-data transfer */
1958 .download_firmware
= dw2102_load_firmware
,
1959 .read_mac_address
= dw210x_read_mac_address
,
1964 .frontend_attach
= dw3101_frontend_attach
,
1965 .tuner_attach
= dw3101_tuner_attach
,
1979 .num_device_descs
= 1,
1981 { "DVBWorld DVB-C 3101 USB2.0",
1982 {&dw2102_table
[CYPRESS_DW3101
], NULL
},
1988 static struct dvb_usb_device_properties s6x0_properties
= {
1989 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1990 .usb_ctrl
= DEVICE_SPECIFIC
,
1991 .size_of_priv
= sizeof(struct dw2102_state
),
1992 .firmware
= S630_FIRMWARE
,
1995 .i2c_algo
= &s6x0_i2c_algo
,
1998 .rc_codes
= RC_MAP_TEVII_NEC
,
1999 .module_name
= "dw2102",
2000 .allowed_protos
= RC_BIT_NEC
,
2001 .rc_query
= dw2102_rc_query
,
2004 .generic_bulk_ctrl_endpoint
= 0x81,
2006 .download_firmware
= dw2102_load_firmware
,
2007 .read_mac_address
= s6x0_read_mac_address
,
2012 .frontend_attach
= zl100313_frontend_attach
,
2026 .num_device_descs
= 1,
2029 {&dw2102_table
[TEVII_S630
], NULL
},
2035 static struct dvb_usb_device_properties
*p1100
;
2036 static struct dvb_usb_device_description d1100
= {
2038 {&dw2102_table
[PROF_1100
], NULL
},
2042 static struct dvb_usb_device_properties
*s660
;
2043 static struct dvb_usb_device_description d660
= {
2045 {&dw2102_table
[TEVII_S660
], NULL
},
2049 static struct dvb_usb_device_description d480_1
= {
2051 {&dw2102_table
[TEVII_S480_1
], NULL
},
2055 static struct dvb_usb_device_description d480_2
= {
2057 {&dw2102_table
[TEVII_S480_2
], NULL
},
2061 static struct dvb_usb_device_properties
*p7500
;
2062 static struct dvb_usb_device_description d7500
= {
2063 "Prof 7500 USB DVB-S2",
2064 {&dw2102_table
[PROF_7500
], NULL
},
2068 static struct dvb_usb_device_properties
*s421
;
2069 static struct dvb_usb_device_description d421
= {
2071 {&dw2102_table
[TEVII_S421
], NULL
},
2075 static struct dvb_usb_device_description d632
= {
2077 {&dw2102_table
[TEVII_S632
], NULL
},
2081 static struct dvb_usb_device_properties su3000_properties
= {
2082 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
2083 .usb_ctrl
= DEVICE_SPECIFIC
,
2084 .size_of_priv
= sizeof(struct dw2102_state
),
2085 .power_ctrl
= su3000_power_ctrl
,
2087 .identify_state
= su3000_identify_state
,
2088 .i2c_algo
= &su3000_i2c_algo
,
2092 .rc_codes
= RC_MAP_SU3000
,
2093 .module_name
= "dw2102",
2094 .allowed_protos
= RC_BIT_RC5
,
2095 .rc_query
= su3000_rc_query
,
2098 .read_mac_address
= su3000_read_mac_address
,
2100 .generic_bulk_ctrl_endpoint
= 0x01,
2106 .streaming_ctrl
= su3000_streaming_ctrl
,
2107 .frontend_attach
= su3000_frontend_attach
,
2121 .num_device_descs
= 5,
2123 { "SU3000HD DVB-S USB2.0",
2124 { &dw2102_table
[GENIATECH_SU3000
], NULL
},
2127 { "Terratec Cinergy S2 USB HD",
2128 { &dw2102_table
[TERRATEC_CINERGY_S2
], NULL
},
2131 { "X3M TV SPC1400HD PCI",
2132 { &dw2102_table
[X3M_SPC1400HD
], NULL
},
2135 { "Terratec Cinergy S2 USB HD Rev.2",
2136 { &dw2102_table
[TERRATEC_CINERGY_S2_R2
], NULL
},
2139 { "GOTVIEW Satellite HD",
2140 { &dw2102_table
[GOTVIEW_SAT_HD
], NULL
},
2146 static struct dvb_usb_device_properties t220_properties
= {
2147 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
2148 .usb_ctrl
= DEVICE_SPECIFIC
,
2149 .size_of_priv
= sizeof(struct dw2102_state
),
2150 .power_ctrl
= su3000_power_ctrl
,
2152 .identify_state
= su3000_identify_state
,
2153 .i2c_algo
= &su3000_i2c_algo
,
2157 .rc_codes
= RC_MAP_SU3000
,
2158 .module_name
= "dw2102",
2159 .allowed_protos
= RC_BIT_RC5
,
2160 .rc_query
= su3000_rc_query
,
2163 .read_mac_address
= su3000_read_mac_address
,
2165 .generic_bulk_ctrl_endpoint
= 0x01,
2171 .streaming_ctrl
= su3000_streaming_ctrl
,
2172 .frontend_attach
= t220_frontend_attach
,
2186 .num_device_descs
= 1,
2188 { "Geniatech T220 DVB-T/T2 USB2.0",
2189 { &dw2102_table
[GENIATECH_T220
], NULL
},
2195 static struct dvb_usb_device_properties tt_s2_4600_properties
= {
2196 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
2197 .usb_ctrl
= DEVICE_SPECIFIC
,
2198 .size_of_priv
= sizeof(struct dw2102_state
),
2199 .power_ctrl
= su3000_power_ctrl
,
2201 .identify_state
= su3000_identify_state
,
2202 .i2c_algo
= &su3000_i2c_algo
,
2206 .rc_codes
= RC_MAP_TT_1500
,
2207 .module_name
= "dw2102",
2208 .allowed_protos
= RC_BIT_RC5
,
2209 .rc_query
= su3000_rc_query
,
2212 .read_mac_address
= su3000_read_mac_address
,
2214 .generic_bulk_ctrl_endpoint
= 0x01,
2220 .streaming_ctrl
= su3000_streaming_ctrl
,
2221 .frontend_attach
= tt_s2_4600_frontend_attach
,
2235 .num_device_descs
= 3,
2237 { "TechnoTrend TT-connect S2-4600",
2238 { &dw2102_table
[TECHNOTREND_S2_4600
], NULL
},
2241 { "TeVii S482 (tuner 1)",
2242 { &dw2102_table
[TEVII_S482_1
], NULL
},
2245 { "TeVii S482 (tuner 2)",
2246 { &dw2102_table
[TEVII_S482_2
], NULL
},
2252 static int dw2102_probe(struct usb_interface
*intf
,
2253 const struct usb_device_id
*id
)
2255 p1100
= kmemdup(&s6x0_properties
,
2256 sizeof(struct dvb_usb_device_properties
), GFP_KERNEL
);
2259 /* copy default structure */
2260 /* fill only different fields */
2261 p1100
->firmware
= P1100_FIRMWARE
;
2262 p1100
->devices
[0] = d1100
;
2263 p1100
->rc
.core
.rc_query
= prof_rc_query
;
2264 p1100
->rc
.core
.rc_codes
= RC_MAP_TBS_NEC
;
2265 p1100
->adapter
->fe
[0].frontend_attach
= stv0288_frontend_attach
;
2267 s660
= kmemdup(&s6x0_properties
,
2268 sizeof(struct dvb_usb_device_properties
), GFP_KERNEL
);
2273 s660
->firmware
= S660_FIRMWARE
;
2274 s660
->num_device_descs
= 3;
2275 s660
->devices
[0] = d660
;
2276 s660
->devices
[1] = d480_1
;
2277 s660
->devices
[2] = d480_2
;
2278 s660
->adapter
->fe
[0].frontend_attach
= ds3000_frontend_attach
;
2280 p7500
= kmemdup(&s6x0_properties
,
2281 sizeof(struct dvb_usb_device_properties
), GFP_KERNEL
);
2287 p7500
->firmware
= P7500_FIRMWARE
;
2288 p7500
->devices
[0] = d7500
;
2289 p7500
->rc
.core
.rc_query
= prof_rc_query
;
2290 p7500
->rc
.core
.rc_codes
= RC_MAP_TBS_NEC
;
2291 p7500
->adapter
->fe
[0].frontend_attach
= prof_7500_frontend_attach
;
2294 s421
= kmemdup(&su3000_properties
,
2295 sizeof(struct dvb_usb_device_properties
), GFP_KERNEL
);
2302 s421
->num_device_descs
= 2;
2303 s421
->devices
[0] = d421
;
2304 s421
->devices
[1] = d632
;
2305 s421
->adapter
->fe
[0].frontend_attach
= m88rs2000_frontend_attach
;
2307 if (0 == dvb_usb_device_init(intf
, &dw2102_properties
,
2308 THIS_MODULE
, NULL
, adapter_nr
) ||
2309 0 == dvb_usb_device_init(intf
, &dw2104_properties
,
2310 THIS_MODULE
, NULL
, adapter_nr
) ||
2311 0 == dvb_usb_device_init(intf
, &dw3101_properties
,
2312 THIS_MODULE
, NULL
, adapter_nr
) ||
2313 0 == dvb_usb_device_init(intf
, &s6x0_properties
,
2314 THIS_MODULE
, NULL
, adapter_nr
) ||
2315 0 == dvb_usb_device_init(intf
, p1100
,
2316 THIS_MODULE
, NULL
, adapter_nr
) ||
2317 0 == dvb_usb_device_init(intf
, s660
,
2318 THIS_MODULE
, NULL
, adapter_nr
) ||
2319 0 == dvb_usb_device_init(intf
, p7500
,
2320 THIS_MODULE
, NULL
, adapter_nr
) ||
2321 0 == dvb_usb_device_init(intf
, s421
,
2322 THIS_MODULE
, NULL
, adapter_nr
) ||
2323 0 == dvb_usb_device_init(intf
, &su3000_properties
,
2324 THIS_MODULE
, NULL
, adapter_nr
) ||
2325 0 == dvb_usb_device_init(intf
, &t220_properties
,
2326 THIS_MODULE
, NULL
, adapter_nr
) ||
2327 0 == dvb_usb_device_init(intf
, &tt_s2_4600_properties
,
2328 THIS_MODULE
, NULL
, adapter_nr
))
2334 static void dw2102_disconnect(struct usb_interface
*intf
)
2336 struct dvb_usb_device
*d
= usb_get_intfdata(intf
);
2337 struct dw2102_state
*st
= (struct dw2102_state
*)d
->priv
;
2338 struct i2c_client
*client
;
2340 /* remove I2C client for tuner */
2341 client
= st
->i2c_client_tuner
;
2343 module_put(client
->dev
.driver
->owner
);
2344 i2c_unregister_device(client
);
2347 dvb_usb_device_exit(intf
);
2350 static struct usb_driver dw2102_driver
= {
2352 .probe
= dw2102_probe
,
2353 .disconnect
= dw2102_disconnect
,
2354 .id_table
= dw2102_table
,
2357 module_usb_driver(dw2102_driver
);
2359 MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by");
2360 MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104,"
2361 " DVB-C 3101 USB2.0,"
2362 " TeVii S600, S630, S650, S660, S480, S421, S632"
2363 " Prof 1100, 7500 USB2.0,"
2364 " Geniatech SU3000, T220,"
2365 " TechnoTrend S2-4600 devices");
2366 MODULE_VERSION("0.1");
2367 MODULE_LICENSE("GPL");
2368 MODULE_FIRMWARE(DW2101_FIRMWARE
);
2369 MODULE_FIRMWARE(DW2102_FIRMWARE
);
2370 MODULE_FIRMWARE(DW2104_FIRMWARE
);
2371 MODULE_FIRMWARE(DW3101_FIRMWARE
);
2372 MODULE_FIRMWARE(S630_FIRMWARE
);
2373 MODULE_FIRMWARE(S660_FIRMWARE
);
2374 MODULE_FIRMWARE(P1100_FIRMWARE
);
2375 MODULE_FIRMWARE(P7500_FIRMWARE
);