Project

General

Profile

RE: August DVB-T210 » 0003-cxusb-Geniatech-T230-support.patch

Crazy Cat, 2014-11-10 23:10

View differences:

drivers/media/dvb-core/dvb-usb-ids.h
356 356
#define USB_PID_MSI_DIGI_VOX_MINI_III                   0x8807
357 357
#define USB_PID_SONY_PLAYTV				0x0003
358 358
#define USB_PID_MYGICA_D689				0xd811
359
#define USB_PID_MYGICA_T230				0xc688
359 360
#define USB_PID_ELGATO_EYETV_DIVERSITY			0x0011
360 361
#define USB_PID_ELGATO_EYETV_DTT			0x0021
361 362
#define USB_PID_ELGATO_EYETV_DTT_2			0x003f
drivers/media/usb/dvb-usb/cxusb.c
1408 1408
	return 0;
1409 1409
}
1410 1410

  
1411
static int cxusb_mygica_t230_frontend_attach(struct dvb_usb_adapter *adap)
1412
{
1413
	struct dvb_usb_device *d = adap->dev;
1414
	struct cxusb_state *st = d->priv;
1415
	struct i2c_adapter *adapter;
1416
	struct i2c_client *client_demod;
1417
	struct i2c_client *client_tuner;
1418
	struct i2c_board_info info;
1419
	struct si2168_config si2168_config;
1420
	struct si2157_config si2157_config;
1421

  
1422
	/* Select required USB configuration */
1423
	if (usb_set_interface(d->udev, 0, 0) < 0)
1424
		err("set interface failed");
1425

  
1426
	/* Unblock all USB pipes */
1427
	usb_clear_halt(d->udev,
1428
		usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1429
	usb_clear_halt(d->udev,
1430
		usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1431
	usb_clear_halt(d->udev,
1432
		usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
1433

  
1434
	/* attach frontend */
1435
	si2168_config.i2c_adapter = &adapter;
1436
	si2168_config.fe = &adap->fe_adap[0].fe;
1437
	si2168_config.ts_mode = SI2168_TS_PARALLEL;
1438
	si2168_config.ts_clock_inv = 1;
1439
	memset(&info, 0, sizeof(struct i2c_board_info));
1440
	strlcpy(info.type, "si2168", I2C_NAME_SIZE);
1441
	info.addr = 0x64;
1442
	info.platform_data = &si2168_config;
1443
	request_module(info.type);
1444
	client_demod = i2c_new_device(&d->i2c_adap, &info);
1445
	if (client_demod == NULL || client_demod->dev.driver == NULL)
1446
		return -ENODEV;
1447

  
1448
	if (!try_module_get(client_demod->dev.driver->owner)) {
1449
		i2c_unregister_device(client_demod);
1450
		return -ENODEV;
1451
	}
1452

  
1453
	st->i2c_client_demod = client_demod;
1454

  
1455
	/* attach tuner */
1456
	memset(&si2157_config, 0, sizeof(si2157_config));
1457
	si2157_config.fe = adap->fe_adap[0].fe;
1458
	memset(&info, 0, sizeof(struct i2c_board_info));
1459
	strlcpy(info.type, "si2157", I2C_NAME_SIZE);
1460
	info.addr = 0x60;
1461
	info.platform_data = &si2157_config;
1462
	request_module(info.type);
1463
	client_tuner = i2c_new_device(adapter, &info);
1464
	if (client_tuner == NULL || client_tuner->dev.driver == NULL) {
1465
		module_put(client_demod->dev.driver->owner);
1466
		i2c_unregister_device(client_demod);
1467
		return -ENODEV;
1468
	}
1469
	if (!try_module_get(client_tuner->dev.driver->owner)) {
1470
		i2c_unregister_device(client_tuner);
1471
		module_put(client_demod->dev.driver->owner);
1472
		i2c_unregister_device(client_demod);
1473
		return -ENODEV;
1474
	}
1475

  
1476
	st->i2c_client_tuner = client_tuner;
1477

  
1478
	return 0;
1479
}
1480

  
1411 1481
static int cxusb_tt_ct2_4400_attach(struct dvb_usb_adapter *adap)
1412 1482
{
1413 1483
	struct dvb_usb_device *d = adap->dev;
......
1438 1508
	si2168_config.i2c_adapter = &adapter;
1439 1509
	si2168_config.fe = &adap->fe_adap[0].fe;
1440 1510
	si2168_config.ts_mode = SI2168_TS_PARALLEL;
1511
	si2168_config.ts_clock_inv = 0;
1441 1512
	memset(&info, 0, sizeof(struct i2c_board_info));
1442 1513
	strlcpy(info.type, "si2168", I2C_NAME_SIZE);
1443 1514
	info.addr = 0x64;
......
1603 1674
static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
1604 1675
static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
1605 1676
static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
1677
static struct dvb_usb_device_properties cxusb_mygica_t230_properties;
1606 1678
static struct dvb_usb_device_properties cxusb_tt_ct2_4400_properties;
1607 1679

  
1608 1680
static int cxusb_probe(struct usb_interface *intf,
......
1634 1706
				     THIS_MODULE, NULL, adapter_nr) ||
1635 1707
	    0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties,
1636 1708
				     THIS_MODULE, NULL, adapter_nr) ||
1709
	    0 == dvb_usb_device_init(intf, &cxusb_mygica_t230_properties,
1710
				     THIS_MODULE, NULL, adapter_nr) ||
1637 1711
	    0 == dvb_usb_device_init(intf, &cxusb_tt_ct2_4400_properties,
1638 1712
				     THIS_MODULE, NULL, adapter_nr) ||
1639 1713
	    0)
......
1695 1769
	{ USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689) },
1696 1770
	{ USB_DEVICE(USB_VID_TECHNOTREND, USB_PID_TECHNOTREND_TVSTICK_CT2_4400) },
1697 1771
	{ USB_DEVICE(USB_VID_TECHNOTREND, USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI) },
1772
	{ USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230) },
1698 1773
	{}		/* Terminating entry */
1699 1774
};
1700 1775
MODULE_DEVICE_TABLE (usb, cxusb_table);
......
2401 2476
	}
2402 2477
};
2403 2478

  
2479
static struct dvb_usb_device_properties cxusb_mygica_t230_properties = {
2480
	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
2481

  
2482
	.usb_ctrl         = CYPRESS_FX2,
2483

  
2484
	.size_of_priv     = sizeof(struct cxusb_state),
2485

  
2486
	.num_adapters = 1,
2487
	.adapter = {
2488
		{
2489
		.num_frontends = 1,
2490
		.fe = {{
2491
			.streaming_ctrl   = cxusb_streaming_ctrl,
2492
			.frontend_attach  = cxusb_mygica_t230_frontend_attach,
2493

  
2494
			/* parameter for the MPEG2-data transfer */
2495
			.stream = {
2496
				.type = USB_BULK,
2497
				.count = 5,
2498
				.endpoint = 0x02,
2499
				.u = {
2500
					.bulk = {
2501
						.buffersize = 8192,
2502
					}
2503
				}
2504
			},
2505
		} },
2506
		},
2507
	},
2508

  
2509
	.power_ctrl       = cxusb_d680_dmb_power_ctrl,
2510

  
2511
	.i2c_algo         = &cxusb_i2c_algo,
2512

  
2513
	.generic_bulk_ctrl_endpoint = 0x01,
2514

  
2515
	.rc.legacy = {
2516
		.rc_interval      = 100,
2517
		.rc_map_table     = rc_map_d680_dmb_table,
2518
		.rc_map_size      = ARRAY_SIZE(rc_map_d680_dmb_table),
2519
		.rc_query         = cxusb_d680_dmb_rc_query,
2520
	},
2521

  
2522
	.num_device_descs = 1,
2523
	.devices = {
2524
		{
2525
			"Mygica T230 DVB-T/T2/C",
2526
			{ NULL },
2527
			{ &cxusb_table[22], NULL },
2528
		},
2529
	}
2530
};
2531

  
2404 2532
static struct usb_driver cxusb_driver = {
2405 2533
	.name		= "dvb_usb_cxusb",
2406 2534
	.probe		= cxusb_probe,
2407
- 
(3-3/3)