forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/media/usb/em28xx/em28xx-dvb.c
....@@ -471,13 +471,13 @@
471471 {
472472 int i;
473473
474
- struct em28xx_reg_seq hauppauge_hvr930c_init[] = {
474
+ static const struct em28xx_reg_seq hauppauge_hvr930c_init[] = {
475475 {EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 0x65},
476476 {EM2874_R80_GPIO_P0_CTRL, 0xfb, 0xff, 0x32},
477477 {EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 0xb8},
478478 { -1, -1, -1, -1},
479479 };
480
- struct em28xx_reg_seq hauppauge_hvr930c_end[] = {
480
+ static const struct em28xx_reg_seq hauppauge_hvr930c_end[] = {
481481 {EM2874_R80_GPIO_P0_CTRL, 0xef, 0xff, 0x01},
482482 {EM2874_R80_GPIO_P0_CTRL, 0xaf, 0xff, 0x65},
483483 {EM2874_R80_GPIO_P0_CTRL, 0xef, 0xff, 0x76},
....@@ -493,7 +493,7 @@
493493 { -1, -1, -1, -1},
494494 };
495495
496
- struct {
496
+ static const struct {
497497 unsigned char r[4];
498498 int len;
499499 } regs[] = {
....@@ -537,20 +537,20 @@
537537 static void terratec_h5_init(struct em28xx *dev)
538538 {
539539 int i;
540
- struct em28xx_reg_seq terratec_h5_init[] = {
540
+ static const struct em28xx_reg_seq terratec_h5_init[] = {
541541 {EM2820_R08_GPIO_CTRL, 0xff, 0xff, 10},
542542 {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100},
543543 {EM2874_R80_GPIO_P0_CTRL, 0xf2, 0xff, 50},
544544 {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100},
545545 { -1, -1, -1, -1},
546546 };
547
- struct em28xx_reg_seq terratec_h5_end[] = {
547
+ static const struct em28xx_reg_seq terratec_h5_end[] = {
548548 {EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100},
549549 {EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 50},
550550 {EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100},
551551 { -1, -1, -1, -1},
552552 };
553
- struct {
553
+ static const struct {
554554 unsigned char r[4];
555555 int len;
556556 } regs[] = {
....@@ -594,14 +594,14 @@
594594 * 0xe6: unknown (does not affect DVB-T).
595595 * 0xb6: unknown (does not affect DVB-T).
596596 */
597
- struct em28xx_reg_seq terratec_htc_stick_init[] = {
597
+ static const struct em28xx_reg_seq terratec_htc_stick_init[] = {
598598 {EM2820_R08_GPIO_CTRL, 0xff, 0xff, 10},
599599 {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100},
600600 {EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 50},
601601 {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100},
602602 { -1, -1, -1, -1},
603603 };
604
- struct em28xx_reg_seq terratec_htc_stick_end[] = {
604
+ static const struct em28xx_reg_seq terratec_htc_stick_end[] = {
605605 {EM2874_R80_GPIO_P0_CTRL, 0xb6, 0xff, 100},
606606 {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 50},
607607 { -1, -1, -1, -1},
....@@ -611,7 +611,7 @@
611611 * Init the analog decoder (not yet supported), but
612612 * it's probably still a good idea.
613613 */
614
- struct {
614
+ static const struct {
615615 unsigned char r[4];
616616 int len;
617617 } regs[] = {
....@@ -642,14 +642,14 @@
642642 {
643643 int i;
644644
645
- struct em28xx_reg_seq terratec_htc_usb_xs_init[] = {
645
+ static const struct em28xx_reg_seq terratec_htc_usb_xs_init[] = {
646646 {EM2820_R08_GPIO_CTRL, 0xff, 0xff, 10},
647647 {EM2874_R80_GPIO_P0_CTRL, 0xb2, 0xff, 100},
648648 {EM2874_R80_GPIO_P0_CTRL, 0xb2, 0xff, 50},
649649 {EM2874_R80_GPIO_P0_CTRL, 0xb6, 0xff, 100},
650650 { -1, -1, -1, -1},
651651 };
652
- struct em28xx_reg_seq terratec_htc_usb_xs_end[] = {
652
+ static const struct em28xx_reg_seq terratec_htc_usb_xs_end[] = {
653653 {EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 100},
654654 {EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 50},
655655 {EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100},
....@@ -660,7 +660,7 @@
660660 * Init the analog decoder (not yet supported), but
661661 * it's probably still a good idea.
662662 */
663
- struct {
663
+ static const struct {
664664 unsigned char r[4];
665665 int len;
666666 } regs[] = {
....@@ -704,7 +704,7 @@
704704 * digital demodulator and tuner are routed via AVF4910B.
705705 */
706706 int i;
707
- struct {
707
+ static const struct {
708708 unsigned char r[4];
709709 int len;
710710 } regs[] = {
....@@ -800,7 +800,7 @@
800800 static void px_bcud_init(struct em28xx *dev)
801801 {
802802 int i;
803
- struct {
803
+ static const struct {
804804 unsigned char r[4];
805805 int len;
806806 } regs1[] = {
....@@ -818,7 +818,7 @@
818818 {{ 0x85, 0x7a }, 2},
819819 {{ 0x87, 0x04 }, 2},
820820 };
821
- static struct em28xx_reg_seq gpio[] = {
821
+ static const struct em28xx_reg_seq gpio[] = {
822822 {EM28XX_R06_I2C_CLK, 0x40, 0xff, 300},
823823 {EM2874_R80_GPIO_P0_CTRL, 0xfd, 0xff, 60},
824824 {EM28XX_R15_RGAIN, 0x20, 0xff, 0},
....@@ -1193,6 +1193,61 @@
11931193 /* attach tuner */
11941194 ts2020_config.fe = dvb->fe[0];
11951195
1196
+ dvb->i2c_client_tuner = dvb_module_probe("ts2020", "ts2022",
1197
+ i2c_adapter,
1198
+ 0x60, &ts2020_config);
1199
+ if (!dvb->i2c_client_tuner) {
1200
+ dvb_module_release(dvb->i2c_client_demod);
1201
+ return -ENODEV;
1202
+ }
1203
+
1204
+ /* delegate signal strength measurement to tuner */
1205
+ dvb->fe[0]->ops.read_signal_strength =
1206
+ dvb->fe[0]->ops.tuner_ops.get_rf_strength;
1207
+
1208
+ /* attach SEC */
1209
+ a8293_pdata.dvb_frontend = dvb->fe[0];
1210
+ dvb->i2c_client_sec = dvb_module_probe("a8293", NULL,
1211
+ &dev->i2c_adap[dev->def_i2c_bus],
1212
+ 0x08, &a8293_pdata);
1213
+ if (!dvb->i2c_client_sec) {
1214
+ dvb_module_release(dvb->i2c_client_tuner);
1215
+ dvb_module_release(dvb->i2c_client_demod);
1216
+ return -ENODEV;
1217
+ }
1218
+
1219
+ return 0;
1220
+}
1221
+
1222
+static int em28178_dvb_init_pctv_461e_v2(struct em28xx *dev)
1223
+{
1224
+ struct em28xx_dvb *dvb = dev->dvb;
1225
+ struct i2c_adapter *i2c_adapter;
1226
+ struct m88ds3103_platform_data m88ds3103_pdata = {};
1227
+ struct ts2020_config ts2020_config = {};
1228
+ struct a8293_platform_data a8293_pdata = {};
1229
+
1230
+ /* attach demod */
1231
+ m88ds3103_pdata.clk = 27000000;
1232
+ m88ds3103_pdata.i2c_wr_max = 33;
1233
+ m88ds3103_pdata.ts_mode = M88DS3103_TS_PARALLEL;
1234
+ m88ds3103_pdata.ts_clk = 16000;
1235
+ m88ds3103_pdata.ts_clk_pol = 0;
1236
+ m88ds3103_pdata.agc = 0x99;
1237
+ m88ds3103_pdata.agc_inv = 0;
1238
+ m88ds3103_pdata.spec_inv = 0;
1239
+ dvb->i2c_client_demod = dvb_module_probe("m88ds3103", "m88ds3103b",
1240
+ &dev->i2c_adap[dev->def_i2c_bus],
1241
+ 0x6a, &m88ds3103_pdata);
1242
+
1243
+ if (!dvb->i2c_client_demod)
1244
+ return -ENODEV;
1245
+
1246
+ dvb->fe[0] = m88ds3103_pdata.get_dvb_frontend(dvb->i2c_client_demod);
1247
+ i2c_adapter = m88ds3103_pdata.get_i2c_adapter(dvb->i2c_client_demod);
1248
+
1249
+ /* attach tuner */
1250
+ ts2020_config.fe = dvb->fe[0];
11961251 dvb->i2c_client_tuner = dvb_module_probe("ts2020", "ts2022",
11971252 i2c_adapter,
11981253 0x60, &ts2020_config);
....@@ -1860,6 +1915,11 @@
18601915 if (result)
18611916 goto out_free;
18621917 break;
1918
+ case EM28178_BOARD_PCTV_461E_V2:
1919
+ result = em28178_dvb_init_pctv_461e_v2(dev);
1920
+ if (result)
1921
+ goto out_free;
1922
+ break;
18631923 case EM28178_BOARD_PCTV_292E:
18641924 result = em28178_dvb_init_pctv_292e(dev);
18651925 if (result)