aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/cx23885
diff options
context:
space:
mode:
authorLuis Alves <ljalvs@gmail.com>2013-10-01 21:11:35 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-10-03 06:39:22 -0400
commite6001482d49ffe1554f55c47a4ed903e86fe69a5 (patch)
treebbd74471dabe84cb8bea45bdfbac7f0bf6e82bcd /drivers/media/pci/cx23885
parent0d78868094c482367692cf40f6c364e06815ad05 (diff)
[media] cx23885: add support for cx24117 with tbs6980 or tbs6981
Signed-off-by: Luis Alves <ljalvs@gmail.com> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/pci/cx23885')
-rw-r--r--drivers/media/pci/cx23885/Kconfig1
-rw-r--r--drivers/media/pci/cx23885/cx23885-cards.c67
-rw-r--r--drivers/media/pci/cx23885/cx23885-dvb.c31
-rw-r--r--drivers/media/pci/cx23885/cx23885-input.c12
-rw-r--r--drivers/media/pci/cx23885/cx23885.h2
5 files changed, 113 insertions, 0 deletions
diff --git a/drivers/media/pci/cx23885/Kconfig b/drivers/media/pci/cx23885/Kconfig
index 5104c802f72f..d1dcb1d2e087 100644
--- a/drivers/media/pci/cx23885/Kconfig
+++ b/drivers/media/pci/cx23885/Kconfig
@@ -23,6 +23,7 @@ config VIDEO_CX23885
23 select DVB_STB6100 if MEDIA_SUBDRV_AUTOSELECT 23 select DVB_STB6100 if MEDIA_SUBDRV_AUTOSELECT
24 select DVB_STV6110 if MEDIA_SUBDRV_AUTOSELECT 24 select DVB_STV6110 if MEDIA_SUBDRV_AUTOSELECT
25 select DVB_CX24116 if MEDIA_SUBDRV_AUTOSELECT 25 select DVB_CX24116 if MEDIA_SUBDRV_AUTOSELECT
26 select DVB_CX24117 if MEDIA_SUBDRV_AUTOSELECT
26 select DVB_STV0900 if MEDIA_SUBDRV_AUTOSELECT 27 select DVB_STV0900 if MEDIA_SUBDRV_AUTOSELECT
27 select DVB_DS3000 if MEDIA_SUBDRV_AUTOSELECT 28 select DVB_DS3000 if MEDIA_SUBDRV_AUTOSELECT
28 select DVB_TS2020 if MEDIA_SUBDRV_AUTOSELECT 29 select DVB_TS2020 if MEDIA_SUBDRV_AUTOSELECT
diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c
index 6a71a965e757..b3ae43da2598 100644
--- a/drivers/media/pci/cx23885/cx23885-cards.c
+++ b/drivers/media/pci/cx23885/cx23885-cards.c
@@ -259,6 +259,16 @@ struct cx23885_board cx23885_boards[] = {
259 .name = "TurboSight TBS 6920", 259 .name = "TurboSight TBS 6920",
260 .portb = CX23885_MPEG_DVB, 260 .portb = CX23885_MPEG_DVB,
261 }, 261 },
262 [CX23885_BOARD_TBS_6980] = {
263 .name = "TurboSight TBS 6980",
264 .portb = CX23885_MPEG_DVB,
265 .portc = CX23885_MPEG_DVB,
266 },
267 [CX23885_BOARD_TBS_6981] = {
268 .name = "TurboSight TBS 6981",
269 .portb = CX23885_MPEG_DVB,
270 .portc = CX23885_MPEG_DVB,
271 },
262 [CX23885_BOARD_TEVII_S470] = { 272 [CX23885_BOARD_TEVII_S470] = {
263 .name = "TeVii S470", 273 .name = "TeVii S470",
264 .portb = CX23885_MPEG_DVB, 274 .portb = CX23885_MPEG_DVB,
@@ -699,6 +709,14 @@ struct cx23885_subid cx23885_subids[] = {
699 .subdevice = 0x8888, 709 .subdevice = 0x8888,
700 .card = CX23885_BOARD_TBS_6920, 710 .card = CX23885_BOARD_TBS_6920,
701 }, { 711 }, {
712 .subvendor = 0x6980,
713 .subdevice = 0x8888,
714 .card = CX23885_BOARD_TBS_6980,
715 }, {
716 .subvendor = 0x6981,
717 .subdevice = 0x8888,
718 .card = CX23885_BOARD_TBS_6981,
719 }, {
702 .subvendor = 0xd470, 720 .subvendor = 0xd470,
703 .subdevice = 0x9022, 721 .subdevice = 0x9022,
704 .card = CX23885_BOARD_TEVII_S470, 722 .card = CX23885_BOARD_TEVII_S470,
@@ -1023,6 +1041,35 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
1023 dev->name, tv.model); 1041 dev->name, tv.model);
1024} 1042}
1025 1043
1044/* Some TBS cards require initing a chip using a bitbanged SPI attached
1045 to the cx23885 gpio's. If this chip doesn't get init'ed the demod
1046 doesn't respond to any command. */
1047static void tbs_card_init(struct cx23885_dev *dev)
1048{
1049 int i;
1050 const u8 buf[] = {
1051 0xe0, 0x06, 0x66, 0x33, 0x65,
1052 0x01, 0x17, 0x06, 0xde};
1053
1054 switch (dev->board) {
1055 case CX23885_BOARD_TBS_6980:
1056 case CX23885_BOARD_TBS_6981:
1057 cx_set(GP0_IO, 0x00070007);
1058 usleep_range(1000, 10000);
1059 cx_clear(GP0_IO, 2);
1060 usleep_range(1000, 10000);
1061 for (i = 0; i < 9 * 8; i++) {
1062 cx_clear(GP0_IO, 7);
1063 usleep_range(1000, 10000);
1064 cx_set(GP0_IO,
1065 ((buf[i >> 3] >> (7 - (i & 7))) & 1) | 4);
1066 usleep_range(1000, 10000);
1067 }
1068 cx_set(GP0_IO, 7);
1069 break;
1070 }
1071}
1072
1026int cx23885_tuner_callback(void *priv, int component, int command, int arg) 1073int cx23885_tuner_callback(void *priv, int component, int command, int arg)
1027{ 1074{
1028 struct cx23885_tsport *port = priv; 1075 struct cx23885_tsport *port = priv;
@@ -1225,6 +1272,8 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
1225 cx_set(GP0_IO, 0x00040004); 1272 cx_set(GP0_IO, 0x00040004);
1226 break; 1273 break;
1227 case CX23885_BOARD_TBS_6920: 1274 case CX23885_BOARD_TBS_6920:
1275 case CX23885_BOARD_TBS_6980:
1276 case CX23885_BOARD_TBS_6981:
1228 case CX23885_BOARD_PROF_8000: 1277 case CX23885_BOARD_PROF_8000:
1229 cx_write(MC417_CTL, 0x00000036); 1278 cx_write(MC417_CTL, 0x00000036);
1230 cx_write(MC417_OEN, 0x00001000); 1279 cx_write(MC417_OEN, 0x00001000);
@@ -1473,6 +1522,8 @@ int cx23885_ir_init(struct cx23885_dev *dev)
1473 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: 1522 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
1474 case CX23885_BOARD_TEVII_S470: 1523 case CX23885_BOARD_TEVII_S470:
1475 case CX23885_BOARD_MYGICA_X8507: 1524 case CX23885_BOARD_MYGICA_X8507:
1525 case CX23885_BOARD_TBS_6980:
1526 case CX23885_BOARD_TBS_6981:
1476 if (!enable_885_ir) 1527 if (!enable_885_ir)
1477 break; 1528 break;
1478 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); 1529 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE);
@@ -1516,6 +1567,8 @@ void cx23885_ir_fini(struct cx23885_dev *dev)
1516 case CX23885_BOARD_TEVII_S470: 1567 case CX23885_BOARD_TEVII_S470:
1517 case CX23885_BOARD_HAUPPAUGE_HVR1250: 1568 case CX23885_BOARD_HAUPPAUGE_HVR1250:
1518 case CX23885_BOARD_MYGICA_X8507: 1569 case CX23885_BOARD_MYGICA_X8507:
1570 case CX23885_BOARD_TBS_6980:
1571 case CX23885_BOARD_TBS_6981:
1519 cx23885_irq_remove(dev, PCI_MSK_AV_CORE); 1572 cx23885_irq_remove(dev, PCI_MSK_AV_CORE);
1520 /* sd_ir is a duplicate pointer to the AV Core, just clear it */ 1573 /* sd_ir is a duplicate pointer to the AV Core, just clear it */
1521 dev->sd_ir = NULL; 1574 dev->sd_ir = NULL;
@@ -1561,6 +1614,8 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev)
1561 case CX23885_BOARD_TEVII_S470: 1614 case CX23885_BOARD_TEVII_S470:
1562 case CX23885_BOARD_HAUPPAUGE_HVR1250: 1615 case CX23885_BOARD_HAUPPAUGE_HVR1250:
1563 case CX23885_BOARD_MYGICA_X8507: 1616 case CX23885_BOARD_MYGICA_X8507:
1617 case CX23885_BOARD_TBS_6980:
1618 case CX23885_BOARD_TBS_6981:
1564 if (dev->sd_ir) 1619 if (dev->sd_ir)
1565 cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE); 1620 cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE);
1566 break; 1621 break;
@@ -1676,6 +1731,16 @@ void cx23885_card_setup(struct cx23885_dev *dev)
1676 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ 1731 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1677 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; 1732 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1678 break; 1733 break;
1734 case CX23885_BOARD_TBS_6980:
1735 case CX23885_BOARD_TBS_6981:
1736 ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1737 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1738 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1739 ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */
1740 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1741 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1742 tbs_card_init(dev);
1743 break;
1679 case CX23885_BOARD_MYGICA_X8506: 1744 case CX23885_BOARD_MYGICA_X8506:
1680 case CX23885_BOARD_MAGICPRO_PROHDTVE2: 1745 case CX23885_BOARD_MAGICPRO_PROHDTVE2:
1681 case CX23885_BOARD_MYGICA_X8507: 1746 case CX23885_BOARD_MYGICA_X8507:
@@ -1752,6 +1817,8 @@ void cx23885_card_setup(struct cx23885_dev *dev)
1752 case CX23885_BOARD_MYGICA_X8507: 1817 case CX23885_BOARD_MYGICA_X8507:
1753 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: 1818 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
1754 case CX23885_BOARD_AVERMEDIA_HC81R: 1819 case CX23885_BOARD_AVERMEDIA_HC81R:
1820 case CX23885_BOARD_TBS_6980:
1821 case CX23885_BOARD_TBS_6981:
1755 dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, 1822 dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev,
1756 &dev->i2c_bus[2].i2c_adap, 1823 &dev->i2c_bus[2].i2c_adap,
1757 "cx25840", 0x88 >> 1, NULL); 1824 "cx25840", 0x88 >> 1, NULL);
diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c
index 971e4ff1b87f..34120db1f51f 100644
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -51,6 +51,7 @@
51#include "stv6110.h" 51#include "stv6110.h"
52#include "lnbh24.h" 52#include "lnbh24.h"
53#include "cx24116.h" 53#include "cx24116.h"
54#include "cx24117.h"
54#include "cimax2.h" 55#include "cimax2.h"
55#include "lgs8gxx.h" 56#include "lgs8gxx.h"
56#include "netup-eeprom.h" 57#include "netup-eeprom.h"
@@ -461,6 +462,10 @@ static struct cx24116_config tbs_cx24116_config = {
461 .demod_address = 0x55, 462 .demod_address = 0x55,
462}; 463};
463 464
465static struct cx24117_config tbs_cx24117_config = {
466 .demod_address = 0x55,
467};
468
464static struct ds3000_config tevii_ds3000_config = { 469static struct ds3000_config tevii_ds3000_config = {
465 .demod_address = 0x68, 470 .demod_address = 0x68,
466}; 471};
@@ -1044,6 +1049,32 @@ static int dvb_register(struct cx23885_tsport *port)
1044 fe0->dvb.frontend->ops.set_voltage = f300_set_voltage; 1049 fe0->dvb.frontend->ops.set_voltage = f300_set_voltage;
1045 1050
1046 break; 1051 break;
1052 case CX23885_BOARD_TBS_6980:
1053 case CX23885_BOARD_TBS_6981:
1054 i2c_bus = &dev->i2c_bus[1];
1055
1056 switch (port->nr) {
1057 /* PORT B */
1058 case 1:
1059 fe0->dvb.frontend = dvb_attach(cx24117_attach,
1060 &tbs_cx24117_config,
1061 &i2c_bus->i2c_adap, NULL);
1062 break;
1063 /* PORT C */
1064 case 2:
1065 /* use fe1 pointer as temporary holder */
1066 /* for the first frontend */
1067 fe1 = videobuf_dvb_get_frontend(
1068 &port->dev->ts1.frontends, 1);
1069
1070 fe0->dvb.frontend = dvb_attach(cx24117_attach,
1071 &tbs_cx24117_config,
1072 &i2c_bus->i2c_adap, fe1->dvb.frontend);
1073 /* we're done, so clear fe1 pointer */
1074 fe1 = NULL;
1075 break;
1076 }
1077 break;
1047 case CX23885_BOARD_TEVII_S470: 1078 case CX23885_BOARD_TEVII_S470:
1048 i2c_bus = &dev->i2c_bus[1]; 1079 i2c_bus = &dev->i2c_bus[1];
1049 1080
diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c
index 7875dfbe09ff..8a49e7c9eddd 100644
--- a/drivers/media/pci/cx23885/cx23885-input.c
+++ b/drivers/media/pci/cx23885/cx23885-input.c
@@ -90,6 +90,8 @@ void cx23885_input_rx_work_handler(struct cx23885_dev *dev, u32 events)
90 case CX23885_BOARD_TEVII_S470: 90 case CX23885_BOARD_TEVII_S470:
91 case CX23885_BOARD_HAUPPAUGE_HVR1250: 91 case CX23885_BOARD_HAUPPAUGE_HVR1250:
92 case CX23885_BOARD_MYGICA_X8507: 92 case CX23885_BOARD_MYGICA_X8507:
93 case CX23885_BOARD_TBS_6980:
94 case CX23885_BOARD_TBS_6981:
93 /* 95 /*
94 * The only boards we handle right now. However other boards 96 * The only boards we handle right now. However other boards
95 * using the CX2388x integrated IR controller should be similar 97 * using the CX2388x integrated IR controller should be similar
@@ -168,6 +170,8 @@ static int cx23885_input_ir_start(struct cx23885_dev *dev)
168 break; 170 break;
169 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: 171 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
170 case CX23885_BOARD_TEVII_S470: 172 case CX23885_BOARD_TEVII_S470:
173 case CX23885_BOARD_TBS_6980:
174 case CX23885_BOARD_TBS_6981:
171 /* 175 /*
172 * The IR controller on this board only returns pulse widths. 176 * The IR controller on this board only returns pulse widths.
173 * Any other mode setting will fail to set up the device. 177 * Any other mode setting will fail to set up the device.
@@ -298,6 +302,14 @@ int cx23885_input_init(struct cx23885_dev *dev)
298 /* A guess at the remote */ 302 /* A guess at the remote */
299 rc_map = RC_MAP_TOTAL_MEDIA_IN_HAND_02; 303 rc_map = RC_MAP_TOTAL_MEDIA_IN_HAND_02;
300 break; 304 break;
305 case CX23885_BOARD_TBS_6980:
306 case CX23885_BOARD_TBS_6981:
307 /* Integrated CX23885 IR controller */
308 driver_type = RC_DRIVER_IR_RAW;
309 allowed_protos = RC_BIT_ALL;
310 /* A guess at the remote */
311 rc_map = RC_MAP_TBS_NEC;
312 break;
301 default: 313 default:
302 return -ENODEV; 314 return -ENODEV;
303 } 315 }
diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h
index 038caf53908b..2eb23d87c752 100644
--- a/drivers/media/pci/cx23885/cx23885.h
+++ b/drivers/media/pci/cx23885/cx23885.h
@@ -93,6 +93,8 @@
93#define CX23885_BOARD_PROF_8000 37 93#define CX23885_BOARD_PROF_8000 37
94#define CX23885_BOARD_HAUPPAUGE_HVR4400 38 94#define CX23885_BOARD_HAUPPAUGE_HVR4400 38
95#define CX23885_BOARD_AVERMEDIA_HC81R 39 95#define CX23885_BOARD_AVERMEDIA_HC81R 39
96#define CX23885_BOARD_TBS_6981 40
97#define CX23885_BOARD_TBS_6980 41
96 98
97#define GPIO_0 0x00000001 99#define GPIO_0 0x00000001
98#define GPIO_1 0x00000002 100#define GPIO_1 0x00000002