Project

General

Profile

RE: August DVB-T210 » patch-cxusb.patch

Martin W, 2014-11-08 20:03

View differences:

drivers/media/usb/dvb-usb/cxusb.c
1407 1407
	return 0;
1408 1408
}
1409
static int cxusb_mygica_t230_frontend_attach(struct dvb_usb_adapter *adap)
1409 1410

  
1411
{
1412

  
1413
	struct dvb_usb_device *d = adap->dev;
1414

  
1415
	struct cxusb_state *st = d->priv;
1416

  
1417
	struct i2c_adapter *adapter;
1418

  
1419
	struct i2c_client *client_demod;
1420

  
1421
	struct i2c_client *client_tuner;
1422

  
1423
	struct i2c_board_info info;
1424

  
1425
	struct si2168_config si2168_config;
1426

  
1427
	struct si2157_config si2157_config;
1428

  
1429
	/* Select required USB configuration */
1430

  
1431
	if (usb_set_interface(d->udev, 0, 0) < 0)
1432

  
1433
		err("set interface failed");
1434

  
1435
	/* Unblock all USB pipes */
1436

  
1437
	usb_clear_halt(d->udev,
1438

  
1439
		usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1440

  
1441
	usb_clear_halt(d->udev,
1442

  
1443
		usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1444

  
1445
	usb_clear_halt(d->udev,
1446

  
1447
		usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
1448

  
1449
	/* attach frontend */
1450

  
1451
	si2168_config.i2c_adapter = &adapter;
1452

  
1453
	si2168_config.fe = &adap->fe_adap[0].fe;
1454

  
1455
	si2168_config.ts_mode = SI2168_TS_PARALLEL;
1456

  
1457
	si2168_config.ts_clock_inv = 1;
1458

  
1459
	memset(&info, 0, sizeof(struct i2c_board_info));
1460

  
1461
	strlcpy(info.type, "si2168", I2C_NAME_SIZE);
1462

  
1463
	info.addr = 0x64;
1464

  
1465
	info.platform_data = &si2168_config;
1466

  
1467
	request_module(info.type);
1468

  
1469
	client_demod = i2c_new_device(&d->i2c_adap, &info);
1470

  
1471
	if (client_demod == NULL || client_demod->dev.driver == NULL)
1472

  
1473
		return -ENODEV;
1474

  
1475
	if (!try_module_get(client_demod->dev.driver->owner)) {
1476

  
1477
		i2c_unregister_device(client_demod);
1478

  
1479
		return -ENODEV;
1480

  
1481
	}
1482

  
1483
	st->i2c_client_demod = client_demod;
1484

  
1485
	/* attach tuner */
1486

  
1487
	memset(&si2157_config, 0, sizeof(si2157_config));
1488

  
1489
	si2157_config.fe = adap->fe_adap[0].fe;
1490

  
1491
	memset(&info, 0, sizeof(struct i2c_board_info));
1492

  
1493
	strlcpy(info.type, "si2157", I2C_NAME_SIZE);
1494

  
1495
	info.addr = 0x60;
1496

  
1497
	info.platform_data = &si2157_config;
1498

  
1499
	request_module(info.type);
1500

  
1501
	client_tuner = i2c_new_device(adapter, &info);
1502

  
1503
	if (client_tuner == NULL || client_tuner->dev.driver == NULL) {
1504

  
1505
		module_put(client_demod->dev.driver->owner);
1506

  
1507
		i2c_unregister_device(client_demod);
1508

  
1509
		return -ENODEV;
1510

  
1511
	}
1512

  
1513
	if (!try_module_get(client_tuner->dev.driver->owner)) {
1514

  
1515
		i2c_unregister_device(client_tuner);
1516

  
1517
		module_put(client_demod->dev.driver->owner);
1518

  
1519
		i2c_unregister_device(client_demod);
1520

  
1521
		return -ENODEV;
1522

  
1523
	}
1524

  
1525
	st->i2c_client_tuner = client_tuner;
1526

  
1527
	return 0;
1528

  
1529
}
1410 1530
static int cxusb_tt_ct2_4400_attach(struct dvb_usb_adapter *adap)
1411 1531
{
1412 1532
	struct dvb_usb_device *d = adap->dev;
drivers/media/usb/dvb-usb/cxusb.c
1438 1558
	si2168_config.i2c_adapter = &adapter;
1439 1559
	si2168_config.fe = &adap->fe_adap[0].fe;
1440 1560
	si2168_config.ts_mode = SI2168_TS_PARALLEL;
1561
	si2168_config.ts_clock_inv = 0;
1441 1562

  
1442 1563
	/* CT2-4400v2 TS gets corrupted without this */
1443 1564
	if (d->udev->descriptor.idProduct ==
drivers/media/usb/dvb-usb/cxusb.c
1609 1730
static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
1610 1731
static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
1611 1732
static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
1733
static struct dvb_usb_device_properties cxusb_mygica_t230_properties;
1612 1734
static struct dvb_usb_device_properties cxusb_tt_ct2_4400_properties;
1613 1735

  
1614 1736
static int cxusb_probe(struct usb_interface *intf,
drivers/media/usb/dvb-usb/cxusb.c
1640 1762
				     THIS_MODULE, NULL, adapter_nr) ||
1641 1763
	    0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties,
1642 1764
				     THIS_MODULE, NULL, adapter_nr) ||
1765
	    0 == dvb_usb_device_init(intf, &cxusb_mygica_t230_properties,
1766
				     THIS_MODULE, NULL, adapter_nr) ||
1643 1767
	    0 == dvb_usb_device_init(intf, &cxusb_tt_ct2_4400_properties,
1644 1768
				     THIS_MODULE, NULL, adapter_nr) ||
1645 1769
	    0)
drivers/media/usb/dvb-usb/cxusb.c
1701 1825
	{ USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689) },
1702 1826
	{ USB_DEVICE(USB_VID_TECHNOTREND, USB_PID_TECHNOTREND_TVSTICK_CT2_4400) },
1703 1827
	{ USB_DEVICE(USB_VID_TECHNOTREND, USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI) },
1828
 	{ USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230) },
1704 1829
	{}		/* Terminating entry */
1705 1830
};
1706 1831
MODULE_DEVICE_TABLE (usb, cxusb_table);
drivers/media/usb/dvb-usb/cxusb.c
2406 2531
		},
2407 2532
	}
2408 2533
};
2534
static struct dvb_usb_device_properties cxusb_mygica_t230_properties = {
2535

  
2536
	
2537

  
2538
	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
2539

  
2540
	
2541

  
2542
	
2543

  
2544
	.usb_ctrl         = CYPRESS_FX2,
2545

  
2546
	
2547

  
2548
	
2549

  
2550
	.size_of_priv     = sizeof(struct cxusb_state),
2551

  
2552
	
2553

  
2554
	
2555

  
2556
	.num_adapters = 1,
2557

  
2558
	
2559

  
2560
	.adapter = {
2561

  
2562
	
2563

  
2564
		{
2565

  
2566
	
2567

  
2568
		.num_frontends = 1,
2569

  
2570
	
2571

  
2572
		.fe = {{
2573

  
2574
	
2575

  
2576
			.streaming_ctrl   = cxusb_streaming_ctrl,
2577

  
2578
	
2579

  
2580
			.frontend_attach  = cxusb_mygica_t230_frontend_attach,
2581

  
2582
	
2583

  
2584
	
2585

  
2586
			/* parameter for the MPEG2-data transfer */
2587

  
2588
	
2589

  
2590
			.stream = {
2591

  
2592
	
2593

  
2594
				.type = USB_BULK,
2595

  
2596
	
2597

  
2598
				.count = 5,
2599

  
2600
	
2601

  
2602
				.endpoint = 0x02,
2603

  
2604
	
2605

  
2606
				.u = {
2607

  
2608
	
2609

  
2610
					.bulk = {
2611

  
2612
	
2613

  
2614
						.buffersize = 8192,
2615

  
2616
	
2617

  
2618
					}
2619

  
2620
	
2621

  
2622
				}
2623

  
2624
	
2625

  
2626
			},
2627

  
2628
	
2629

  
2630
		} },
2631

  
2632
	
2633

  
2634
		},
2635

  
2636
	
2637

  
2638
	},
2639

  
2640
	
2641

  
2642
	
2643

  
2644
	.power_ctrl       = cxusb_d680_dmb_power_ctrl,
2645

  
2646
	
2647

  
2648
	
2649

  
2650
	.i2c_algo         = &cxusb_i2c_algo,
2651

  
2652
	
2653

  
2654
	
2655

  
2656
	.generic_bulk_ctrl_endpoint = 0x01,
2657

  
2658
	
2659

  
2660
	
2661

  
2662
	.rc.legacy = {
2663

  
2664
	
2665

  
2666
		.rc_interval      = 100,
2667

  
2668
	
2669

  
2670
		.rc_map_table     = rc_map_d680_dmb_table,
2671

  
2672
	
2673

  
2674
		.rc_map_size      = ARRAY_SIZE(rc_map_d680_dmb_table),
2675

  
2676
	
2677

  
2678
		.rc_query         = cxusb_d680_dmb_rc_query,
2679

  
2680
	
2681

  
2682
	},
2683

  
2684
	
2685

  
2686
	
2687

  
2688
	.num_device_descs = 1,
2689

  
2690
	
2691

  
2692
	.devices = {
2693

  
2694
	
2695

  
2696
		{
2697

  
2698
	
2699

  
2700
			"Mygica T230 DVB-T/T2/C",
2701

  
2702
	
2703

  
2704
			{ NULL },
2705

  
2706
	
2707

  
2708
			{ &cxusb_table[22], NULL },
2709

  
2710
	
2711

  
2712
		},
2713

  
2714
	
2715

  
2716
	}
2717

  
2718
	
2719

  
2720
};
2409 2721

  
2410 2722
static struct usb_driver cxusb_driver = {
2411 2723
	.name		= "dvb_usb_cxusb",
(1-1/2)