Project

General

Profile

RE: August DVB-T210 » 0002-dvb-usb-cxusb-Mygica-T230-support.patch

Crazy Cat, 2014-09-23 21:05

View differences:

drivers/media/dvb-core/dvb-usb-ids.h
355 355
#define USB_PID_MSI_DIGI_VOX_MINI_III                   0x8807
356 356
#define USB_PID_SONY_PLAYTV				0x0003
357 357
#define USB_PID_MYGICA_D689				0xd811
358
#define USB_PID_MYGICA_T230				0xc688
358 359
#define USB_PID_ELGATO_EYETV_DIVERSITY			0x0011
359 360
#define USB_PID_ELGATO_EYETV_DTT			0x0021
360 361
#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
	memset(&info, 0, sizeof(struct i2c_board_info));
1439
	strlcpy(info.type, "si2168", I2C_NAME_SIZE);
1440
	info.addr = 0x64;
1441
	info.platform_data = &si2168_config;
1442
	request_module(info.type);
1443
	client_demod = i2c_new_device(&d->i2c_adap, &info);
1444
	if (client_demod == NULL || client_demod->dev.driver == NULL)
1445
		return -ENODEV;
1446

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

  
1452
	st->i2c_client_demod = client_demod;
1453

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

  
1475
	st->i2c_client_tuner = client_tuner;
1476

  
1477
	return 0;
1478
}
1479

  
1411 1480
static int cxusb_tt_ct2_4400_attach(struct dvb_usb_adapter *adap)
1412 1481
{
1413 1482
	struct dvb_usb_device *d = adap->dev;
......
1603 1672
static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
1604 1673
static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
1605 1674
static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
1675
static struct dvb_usb_device_properties cxusb_mygica_t230_properties;
1606 1676
static struct dvb_usb_device_properties cxusb_tt_ct2_4400_properties;
1607 1677

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

  
2477
static struct dvb_usb_device_properties cxusb_mygica_t230_properties = {
2478
	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
2479

  
2480
	.usb_ctrl         = CYPRESS_FX2,
2481

  
2482
	.size_of_priv     = sizeof(struct cxusb_state),
2483

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

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

  
2507
	.power_ctrl       = cxusb_d680_dmb_power_ctrl,
2508

  
2509
	.i2c_algo         = &cxusb_i2c_algo,
2510

  
2511
	.generic_bulk_ctrl_endpoint = 0x01,
2512

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

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

  
2404 2530
static struct usb_driver cxusb_driver = {
2405 2531
	.name		= "dvb_usb_cxusb",
2406 2532
	.probe		= cxusb_probe,
2407
- 
(2-2/2)