Project

General

Profile

0002-dvb-usb-dw2102-Geniatech-T220A-support.patch

Geniatech T220A support patch - Crazy Cat, 2014-09-20 19:01

View differences:

drivers/media/usb/dvb-usb/dw2102.c
2 2
 *	DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101,
3 3
 *	TeVii S600, S630, S650, S660, S480, S421, S632
4 4
 *	Prof 1100, 7500,
5
 *	Geniatech SU3000, T220 Cards
5
 *	Geniatech SU3000, T220, T220A Cards
6 6
 * Copyright (C) 2008-2012 Igor M. Liplianin ([email protected])
7
 *           (C) 2013-2014 CrazyCat ([email protected])
7 8
 *
8 9
 *	This program is free software; you can redistribute it and/or modify it
9 10
 *	under the terms of the GNU General Public License as published by the
......
30 31
#include "stb6100_proc.h"
31 32
#include "m88rs2000.h"
32 33
#include "tda18271.h"
34
#include "tda18273.h"
33 35
#include "cxd2820r.h"
34 36

35 37
/* Max transfer size done by I2C transfer functions */
......
1436 1438
	return -EIO;
1437 1439
}
1438 1440

1441
static int t220a_frontend_attach(struct dvb_usb_adapter *d)
1442
{
1443
	u8 obuf[3] = { 0xe, 0x87, 0 };
1444
	u8 ibuf[] = { 0 };
1445

1446
	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1447
		err("command 0x0e transfer failed.");
1448

1449
	obuf[0] = 0xe;
1450
	obuf[1] = 0x86;
1451
	obuf[2] = 1;
1452

1453
	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1454
		err("command 0x0e transfer failed.");
1455

1456
	obuf[0] = 0xe;
1457
	obuf[1] = 0x80;
1458
	obuf[2] = 0;
1459

1460
	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1461
		err("command 0x0e transfer failed.");
1462

1463
	msleep(50);
1464

1465
	obuf[0] = 0xe;
1466
	obuf[1] = 0x80;
1467
	obuf[2] = 1;
1468

1469
	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1470
		err("command 0x0e transfer failed.");
1471

1472
	obuf[0] = 0x51;
1473

1474
	if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
1475
		err("command 0x51 transfer failed.");
1476

1477
	d->fe_adap[0].fe = dvb_attach(cxd2820r_attach, &cxd2820r_config,
1478
					&d->dev->i2c_adap, NULL);
1479
	if (d->fe_adap[0].fe != NULL) {
1480
		if (dvb_attach(tda18273_attach, d->fe_adap[0].fe,
1481
					&d->dev->i2c_adap, 0x60)) {
1482
			info("Attached TDA18273/CXD2820R!\n");
1483
			return 0;
1484
		}
1485
	}
1486

1487
	info("Failed to attach TDA18273/CXD2820R!\n");
1488
	return -EIO;
1489
}
1490

1439 1491
static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d)
1440 1492
{
1441 1493
	u8 obuf[] = { 0x51 };
......
1561 1613
	TERRATEC_CINERGY_S2_R2,
1562 1614
	GOTVIEW_SAT_HD,
1563 1615
	GENIATECH_T220,
1616
	GENIATECH_T220A,
1564 1617
};
1565 1618

1566 1619
static struct usb_device_id dw2102_table[] = {
......
1584 1637
	[TERRATEC_CINERGY_S2_R2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00b0)},
1585 1638
	[GOTVIEW_SAT_HD] = {USB_DEVICE(0x1FE1, USB_PID_GOTVIEW_SAT_HD)},
1586 1639
	[GENIATECH_T220] = {USB_DEVICE(0x1f4d, 0xD220)},
1640
	[GENIATECH_T220A] = {USB_DEVICE(0x0572, 0xC686)},
1587 1641
	{ }
1588 1642
};
1589 1643

......
2061 2115
	}
2062 2116
};
2063 2117

2118
static struct dvb_usb_device_properties t220a_properties = {
2119
	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
2120
	.usb_ctrl = DEVICE_SPECIFIC,
2121
	.size_of_priv = sizeof(struct su3000_state),
2122
	.power_ctrl = su3000_power_ctrl,
2123
	.num_adapters = 1,
2124
	.identify_state	= su3000_identify_state,
2125
	.i2c_algo = &su3000_i2c_algo,
2126

2127
	.rc.core = {
2128
		.rc_interval = 150,
2129
		.rc_codes = RC_MAP_SU3000,
2130
		.module_name = "dw2102",
2131
		.allowed_protos   = RC_BIT_RC5,
2132
		.rc_query = su3000_rc_query,
2133
	},
2134

2135
	.read_mac_address = su3000_read_mac_address,
2136

2137
	.generic_bulk_ctrl_endpoint = 0x01,
2138

2139
	.adapter = {
2140
		{
2141
		.num_frontends = 1,
2142
		.fe = { {
2143
			.streaming_ctrl   = su3000_streaming_ctrl,
2144
			.frontend_attach  = t220a_frontend_attach,
2145
			.stream = {
2146
				.type = USB_BULK,
2147
				.count = 8,
2148
				.endpoint = 0x82,
2149
				.u = {
2150
					.bulk = {
2151
						.buffersize = 4096,
2152
					}
2153
				}
2154
			}
2155
		} },
2156
		}
2157
	},
2158
	.num_device_descs = 1,
2159
	.devices = {
2160
		{ "Geniatech T220A DVB-T/T2 USB2.0",
2161
			{ &dw2102_table[GENIATECH_T220A], NULL },
2162
			{ NULL },
2163
		},
2164
	}
2165
};
2166

2064 2167
static int dw2102_probe(struct usb_interface *intf,
2065 2168
		const struct usb_device_id *id)
2066 2169
{
......
2135 2238
	    0 == dvb_usb_device_init(intf, &su3000_properties,
2136 2239
			 THIS_MODULE, NULL, adapter_nr) ||
2137 2240
	    0 == dvb_usb_device_init(intf, &t220_properties,
2241
			 THIS_MODULE, NULL, adapter_nr) ||
2242
	    0 == dvb_usb_device_init(intf, &t220a_properties,
2138 2243
			 THIS_MODULE, NULL, adapter_nr))
2139 2244
		return 0;
2140 2245

......
2155 2260
			" DVB-C 3101 USB2.0,"
2156 2261
			" TeVii S600, S630, S650, S660, S480, S421, S632"
2157 2262
			" Prof 1100, 7500 USB2.0,"
2158
			" Geniatech SU3000, T220 devices");
2263
			" Geniatech SU3000, T220, T220A devices");
2159 2264
MODULE_VERSION("0.1");
2160 2265
MODULE_LICENSE("GPL");
2161 2266
MODULE_FIRMWARE(DW2101_FIRMWARE);
2162
-