Project

General

Profile

RE: August DVB-T210 ยป cxusb-t220.patch

Alternative Geniatech T220 support. - Crazy Cat, 2014-04-14 05:28

View differences:

drivers/media/usb/dvb-usb/cxusb.c
42 42
#include "dib0070.h"
43 43
#include "lgs8gxx.h"
44 44
#include "atbm8830.h"
45
#include "cxd2820r.h"
46
#include "tda18271.h"
45 47

  
46 48
/* Max transfer size done by I2C transfer functions */
47 49
#define MAX_XFER_SIZE  64
......
873 875
	return (fe == NULL) ? -EIO : 0;
874 876
}
875 877

  
878
static struct tda18271_config d220_tda18271_cfg = {
879
        .output_opt = TDA18271_OUTPUT_LT_OFF,
880
        .gate = TDA18271_GATE_DIGITAL,
881
};
882
static int cxusb_mygica_d220_tuner_attach(struct dvb_usb_adapter *adap)
883
{
884
        struct dvb_frontend *fe;
885
        fe = dvb_attach(tda18271_attach, adap->fe_adap[0].fe, 0x60,
886
                        &adap->dev->i2c_adap, &d220_tda18271_cfg);
887
        return (fe == NULL) ? -EIO : 0;
888
}
889

  
876 890
static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap)
877 891
{
878 892
	u8 b;
......
1286 1300
	return 0;
1287 1301
}
1288 1302

  
1303
static struct cxd2820r_config d220_cxd2820r_cfg = {
1304
        .i2c_address = (0xd8 >> 1),
1305
        .ts_mode = 0x38,
1306
};
1307

  
1308
static int cxusb_mygica_d220_frontend_attach(struct dvb_usb_adapter *adap)
1309
{
1310
        struct dvb_usb_device *d = adap->dev;
1311

  
1312
        /* Select required USB configuration */
1313
        if (usb_set_interface(d->udev, 0, 0) < 0)
1314
                err("set interface failed");
1315

  
1316
        /* Unblock all USB pipes */
1317
        usb_clear_halt(d->udev,
1318
                usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1319
        usb_clear_halt(d->udev,
1320
                usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1321
        usb_clear_halt(d->udev,
1322
                usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
1323

  
1324

  
1325
        /* Attach frontend */
1326
        adap->fe_adap[0].fe = dvb_attach(cxd2820r_attach, &d220_cxd2820r_cfg,
1327
                &d->i2c_adap, NULL);
1328
        if (adap->fe_adap[0].fe == NULL)
1329
                return -EIO;
1330

  
1331
        return 0;
1332
}
1333

  
1289 1334
/*
1290 1335
 * DViCO has shipped two devices with the same USB ID, but only one of them
1291 1336
 * needs a firmware download.  Check the device class details to see if they
......
1367 1412
static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
1368 1413
static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
1369 1414
static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
1415
static struct dvb_usb_device_properties cxusb_mygica_d220_properties;
1370 1416

  
1371 1417
static int cxusb_probe(struct usb_interface *intf,
1372 1418
		       const struct usb_device_id *id)
......
1397 1443
				     THIS_MODULE, NULL, adapter_nr) ||
1398 1444
	    0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties,
1399 1445
				     THIS_MODULE, NULL, adapter_nr) ||
1446
	    0 == dvb_usb_device_init(intf, &cxusb_mygica_d220_properties,
1447
                                     THIS_MODULE, NULL, adapter_nr) ||
1400 1448
	    0)
1401 1449
		return 0;
1402 1450

  
......
1424 1472
	{ USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) },
1425 1473
	{ USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) },
1426 1474
	{ USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689) },
1475
        { USB_DEVICE(USB_VID_GTEK, 0xD220) },
1427 1476
	{}		/* Terminating entry */
1428 1477
};
1429 1478
MODULE_DEVICE_TABLE (usb, cxusb_table);
......
2070 2119
	}
2071 2120
};
2072 2121

  
2122
static struct dvb_usb_device_properties cxusb_mygica_d220_properties = {
2123
	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
2124

  
2125
	.usb_ctrl         = CYPRESS_FX2,
2126

  
2127
	.size_of_priv     = sizeof(struct cxusb_state),
2128

  
2129
	.num_adapters = 1,
2130
	.adapter = {
2131
		{
2132
		.num_frontends = 1,
2133
		.fe = {{
2134
			.streaming_ctrl   = cxusb_streaming_ctrl,
2135
			.frontend_attach  = cxusb_mygica_d220_frontend_attach,
2136
			.tuner_attach     = cxusb_mygica_d220_tuner_attach,
2137

  
2138
			/* parameter for the MPEG2-data transfer */
2139
			.stream = {
2140
				.type = USB_BULK,
2141
				.count = 5,
2142
				.endpoint = 0x02,
2143
				.u = {
2144
					.bulk = {
2145
						.buffersize = 8192,
2146
					}
2147
				}
2148
			},
2149
 		}},
2150
 		},
2151
	},
2152

  
2153
	.power_ctrl       = cxusb_d680_dmb_power_ctrl,
2154

  
2155
	.i2c_algo         = &cxusb_i2c_algo,
2156

  
2157
	.generic_bulk_ctrl_endpoint = 0x01,
2158

  
2159
	.rc.legacy = {
2160
		.rc_interval      = 100,
2161
		.rc_map_table     = rc_map_d680_dmb_table,
2162
		.rc_map_size      = ARRAY_SIZE(rc_map_d680_dmb_table),
2163
		.rc_query         = cxusb_d680_dmb_rc_query,
2164
	},
2165

  
2166
	.num_device_descs = 1,
2167
	.devices = {
2168
		{
2169
			"Mygica T220 DVB-T/T2/C",
2170
			{ NULL },
2171
			{ &cxusb_table[20], NULL },
2172
		},
2173
	}
2174
};
2175

  
2073 2176
static struct usb_driver cxusb_driver = {
2074 2177
	.name		= "dvb_usb_cxusb",
2075 2178
	.probe		= cxusb_probe,
    (1-1/1)