aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornibble.max <nibble.max@gmail.com>2014-11-05 09:58:38 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-11 06:19:43 -0500
commitc29d6a83b3c14cf81a4c90a941eb923625192398 (patch)
treef618540e116a5ee7bcd5f56b4c5bc9ebce678bd3
parentcba5480c1e01542a1eaf74b27b56e7d0a37c5b7b (diff)
[media] cx23885: add DVBSky S952 support
DVBSky S952 dvb-s/s2 dual PCIe card: 1>dvb frontend: M88TS2022(tuner),M88DS3103(demod) 2>PCIe bridge: CX23885(port b: parallel mode, port c: serial mode) 3>rc: cx23885 integrated. Signed-off-by: Nibble Max <nibble.max@gmail.com> Reviewed-by: Antti Palosaari <crope@iki.fi> Reviewed-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/pci/cx23885/cx23885-cards.c22
-rw-r--r--drivers/media/pci/cx23885/cx23885-dvb.c99
-rw-r--r--drivers/media/pci/cx23885/cx23885-input.c3
-rw-r--r--drivers/media/pci/cx23885/cx23885.h1
4 files changed, 124 insertions, 1 deletions
diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c
index 4b9cb0795e7e..4bad27d1caa2 100644
--- a/drivers/media/pci/cx23885/cx23885-cards.c
+++ b/drivers/media/pci/cx23885/cx23885-cards.c
@@ -696,6 +696,11 @@ struct cx23885_board cx23885_boards[] = {
696 .name = "DVBSky S950", 696 .name = "DVBSky S950",
697 .portb = CX23885_MPEG_DVB, 697 .portb = CX23885_MPEG_DVB,
698 }, 698 },
699 [CX23885_BOARD_DVBSKY_S952] = {
700 .name = "DVBSky S952",
701 .portb = CX23885_MPEG_DVB,
702 .portc = CX23885_MPEG_DVB,
703 },
699}; 704};
700const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); 705const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
701 706
@@ -971,6 +976,10 @@ struct cx23885_subid cx23885_subids[] = {
971 .subvendor = 0x4254, 976 .subvendor = 0x4254,
972 .subdevice = 0x0950, 977 .subdevice = 0x0950,
973 .card = CX23885_BOARD_DVBSKY_S950, 978 .card = CX23885_BOARD_DVBSKY_S950,
979 }, {
980 .subvendor = 0x4254,
981 .subdevice = 0x0952,
982 .card = CX23885_BOARD_DVBSKY_S952,
974 }, 983 },
975}; 984};
976const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); 985const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -1566,6 +1575,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
1566 mdelay(60); 1575 mdelay(60);
1567 break; 1576 break;
1568 case CX23885_BOARD_DVBSKY_T9580: 1577 case CX23885_BOARD_DVBSKY_T9580:
1578 case CX23885_BOARD_DVBSKY_S952:
1569 /* enable GPIO3-18 pins */ 1579 /* enable GPIO3-18 pins */
1570 cx_write(MC417_CTL, 0x00000037); 1580 cx_write(MC417_CTL, 0x00000037);
1571 cx23885_gpio_enable(dev, GPIO_2 | GPIO_11, 1); 1581 cx23885_gpio_enable(dev, GPIO_2 | GPIO_11, 1);
@@ -1697,6 +1707,7 @@ int cx23885_ir_init(struct cx23885_dev *dev)
1697 case CX23885_BOARD_DVBSKY_S950C: 1707 case CX23885_BOARD_DVBSKY_S950C:
1698 case CX23885_BOARD_TT_CT2_4500_CI: 1708 case CX23885_BOARD_TT_CT2_4500_CI:
1699 case CX23885_BOARD_DVBSKY_S950: 1709 case CX23885_BOARD_DVBSKY_S950:
1710 case CX23885_BOARD_DVBSKY_S952:
1700 if (!enable_885_ir) 1711 if (!enable_885_ir)
1701 break; 1712 break;
1702 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); 1713 dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE);
@@ -1748,6 +1759,7 @@ void cx23885_ir_fini(struct cx23885_dev *dev)
1748 case CX23885_BOARD_DVBSKY_S950C: 1759 case CX23885_BOARD_DVBSKY_S950C:
1749 case CX23885_BOARD_TT_CT2_4500_CI: 1760 case CX23885_BOARD_TT_CT2_4500_CI:
1750 case CX23885_BOARD_DVBSKY_S950: 1761 case CX23885_BOARD_DVBSKY_S950:
1762 case CX23885_BOARD_DVBSKY_S952:
1751 cx23885_irq_remove(dev, PCI_MSK_AV_CORE); 1763 cx23885_irq_remove(dev, PCI_MSK_AV_CORE);
1752 /* sd_ir is a duplicate pointer to the AV Core, just clear it */ 1764 /* sd_ir is a duplicate pointer to the AV Core, just clear it */
1753 dev->sd_ir = NULL; 1765 dev->sd_ir = NULL;
@@ -1800,6 +1812,7 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev)
1800 case CX23885_BOARD_DVBSKY_S950C: 1812 case CX23885_BOARD_DVBSKY_S950C:
1801 case CX23885_BOARD_TT_CT2_4500_CI: 1813 case CX23885_BOARD_TT_CT2_4500_CI:
1802 case CX23885_BOARD_DVBSKY_S950: 1814 case CX23885_BOARD_DVBSKY_S950:
1815 case CX23885_BOARD_DVBSKY_S952:
1803 if (dev->sd_ir) 1816 if (dev->sd_ir)
1804 cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE); 1817 cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE);
1805 break; 1818 break;
@@ -1962,6 +1975,14 @@ void cx23885_card_setup(struct cx23885_dev *dev)
1962 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ 1975 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1963 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; 1976 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1964 break; 1977 break;
1978 case CX23885_BOARD_DVBSKY_S952:
1979 ts1->gen_ctrl_val = 0x5; /* Parallel */
1980 ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1981 ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1982 ts2->gen_ctrl_val = 0xe; /* Serial bus */
1983 ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
1984 ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
1985 break;
1965 case CX23885_BOARD_HAUPPAUGE_HVR1250: 1986 case CX23885_BOARD_HAUPPAUGE_HVR1250:
1966 case CX23885_BOARD_HAUPPAUGE_HVR1500: 1987 case CX23885_BOARD_HAUPPAUGE_HVR1500:
1967 case CX23885_BOARD_HAUPPAUGE_HVR1500Q: 1988 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
@@ -2029,6 +2050,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
2029 case CX23885_BOARD_DVBSKY_S950C: 2050 case CX23885_BOARD_DVBSKY_S950C:
2030 case CX23885_BOARD_TT_CT2_4500_CI: 2051 case CX23885_BOARD_TT_CT2_4500_CI:
2031 case CX23885_BOARD_DVBSKY_S950: 2052 case CX23885_BOARD_DVBSKY_S950:
2053 case CX23885_BOARD_DVBSKY_S952:
2032 dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, 2054 dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev,
2033 &dev->i2c_bus[2].i2c_adap, 2055 &dev->i2c_bus[2].i2c_adap,
2034 "cx25840", 0x88 >> 1, NULL); 2056 "cx25840", 0x88 >> 1, NULL);
diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c
index 3410ab86bcf7..2457b6483a40 100644
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -617,6 +617,32 @@ static int dvbsky_t9580_set_voltage(struct dvb_frontend *fe,
617 return 0; 617 return 0;
618} 618}
619 619
620static int dvbsky_s952_portc_set_voltage(struct dvb_frontend *fe,
621 fe_sec_voltage_t voltage)
622{
623 struct cx23885_tsport *port = fe->dvb->priv;
624 struct cx23885_dev *dev = port->dev;
625
626 cx23885_gpio_enable(dev, GPIO_12 | GPIO_13, 1);
627
628 switch (voltage) {
629 case SEC_VOLTAGE_13:
630 cx23885_gpio_set(dev, GPIO_13);
631 cx23885_gpio_clear(dev, GPIO_12);
632 break;
633 case SEC_VOLTAGE_18:
634 cx23885_gpio_set(dev, GPIO_13);
635 cx23885_gpio_set(dev, GPIO_12);
636 break;
637 case SEC_VOLTAGE_OFF:
638 cx23885_gpio_clear(dev, GPIO_13);
639 cx23885_gpio_clear(dev, GPIO_12);
640 break;
641 }
642 /* call the frontend set_voltage function */
643 return port->fe_set_voltage(fe, voltage);
644}
645
620static int cx23885_sp2_ci_ctrl(void *priv, u8 read, int addr, 646static int cx23885_sp2_ci_ctrl(void *priv, u8 read, int addr,
621 u8 data, int *mem) 647 u8 data, int *mem)
622{ 648{
@@ -878,6 +904,19 @@ static const struct m88ds3103_config dvbsky_s950c_m88ds3103_config = {
878 .agc = 0x99, 904 .agc = 0x99,
879}; 905};
880 906
907static const struct m88ds3103_config dvbsky_s952_portc_m88ds3103_config = {
908 .i2c_addr = 0x68,
909 .clock = 27000000,
910 .i2c_wr_max = 33,
911 .clock_out = 0,
912 .ts_mode = M88DS3103_TS_SERIAL,
913 .ts_clk = 96000,
914 .ts_clk_pol = 0,
915 .lnb_en_pol = 1,
916 .lnb_hv_pol = 0,
917 .agc = 0x99,
918};
919
881static int netup_altera_fpga_rw(void *device, int flag, int data, int read) 920static int netup_altera_fpga_rw(void *device, int flag, int data, int read)
882{ 921{
883 struct cx23885_dev *dev = (struct cx23885_dev *)device; 922 struct cx23885_dev *dev = (struct cx23885_dev *)device;
@@ -1034,6 +1073,8 @@ static int dvb_register(struct cx23885_tsport *port)
1034 struct i2c_board_info info; 1073 struct i2c_board_info info;
1035 struct i2c_adapter *adapter; 1074 struct i2c_adapter *adapter;
1036 struct i2c_client *client_demod = NULL, *client_tuner = NULL, *client_ci = NULL; 1075 struct i2c_client *client_demod = NULL, *client_tuner = NULL, *client_ci = NULL;
1076 const struct m88ds3103_config *p_m88ds3103_config = NULL;
1077 int (*p_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage) = NULL;
1037 int mfe_shared = 0; /* bus not shared by default */ 1078 int mfe_shared = 0; /* bus not shared by default */
1038 int ret; 1079 int ret;
1039 1080
@@ -1849,6 +1890,61 @@ static int dvb_register(struct cx23885_tsport *port)
1849 1890
1850 port->i2c_client_tuner = client_tuner; 1891 port->i2c_client_tuner = client_tuner;
1851 break; 1892 break;
1893 case CX23885_BOARD_DVBSKY_S952:
1894 switch (port->nr) {
1895 /* port b */
1896 case 1:
1897 i2c_bus = &dev->i2c_bus[1];
1898 p_m88ds3103_config = &dvbsky_t9580_m88ds3103_config;
1899 p_set_voltage = dvbsky_t9580_set_voltage;
1900 break;
1901 /* port c */
1902 case 2:
1903 i2c_bus = &dev->i2c_bus[0];
1904 p_m88ds3103_config = &dvbsky_s952_portc_m88ds3103_config;
1905 p_set_voltage = dvbsky_s952_portc_set_voltage;
1906 break;
1907 }
1908
1909 /* attach frontend */
1910 fe0->dvb.frontend = dvb_attach(m88ds3103_attach,
1911 p_m88ds3103_config,
1912 &i2c_bus->i2c_adap, &adapter);
1913 if (fe0->dvb.frontend == NULL)
1914 break;
1915
1916 /* attach tuner */
1917 memset(&m88ts2022_config, 0, sizeof(m88ts2022_config));
1918 m88ts2022_config.fe = fe0->dvb.frontend;
1919 m88ts2022_config.clock = 27000000;
1920 memset(&info, 0, sizeof(struct i2c_board_info));
1921 strlcpy(info.type, "m88ts2022", I2C_NAME_SIZE);
1922 info.addr = 0x60;
1923 info.platform_data = &m88ts2022_config;
1924 request_module(info.type);
1925 client_tuner = i2c_new_device(adapter, &info);
1926 if (client_tuner == NULL ||
1927 client_tuner->dev.driver == NULL)
1928 goto frontend_detach;
1929 if (!try_module_get(client_tuner->dev.driver->owner)) {
1930 i2c_unregister_device(client_tuner);
1931 goto frontend_detach;
1932 }
1933
1934 /* delegate signal strength measurement to tuner */
1935 fe0->dvb.frontend->ops.read_signal_strength =
1936 fe0->dvb.frontend->ops.tuner_ops.get_rf_strength;
1937
1938 /*
1939 * for setting the voltage we need to set GPIOs on
1940 * the card.
1941 */
1942 port->fe_set_voltage =
1943 fe0->dvb.frontend->ops.set_voltage;
1944 fe0->dvb.frontend->ops.set_voltage = p_set_voltage;
1945
1946 port->i2c_client_tuner = client_tuner;
1947 break;
1852 default: 1948 default:
1853 printk(KERN_INFO "%s: The frontend of your DVB/ATSC card " 1949 printk(KERN_INFO "%s: The frontend of your DVB/ATSC card "
1854 " isn't supported yet\n", 1950 " isn't supported yet\n",
@@ -1924,7 +2020,8 @@ static int dvb_register(struct cx23885_tsport *port)
1924 break; 2020 break;
1925 } 2021 }
1926 case CX23885_BOARD_DVBSKY_T9580: 2022 case CX23885_BOARD_DVBSKY_T9580:
1927 case CX23885_BOARD_DVBSKY_S950: { 2023 case CX23885_BOARD_DVBSKY_S950:
2024 case CX23885_BOARD_DVBSKY_S952: {
1928 u8 eeprom[256]; /* 24C02 i2c eeprom */ 2025 u8 eeprom[256]; /* 24C02 i2c eeprom */
1929 2026
1930 if (port->nr > 2) 2027 if (port->nr > 2)
diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c
index 7523d0a8ae1d..a1f489444355 100644
--- a/drivers/media/pci/cx23885/cx23885-input.c
+++ b/drivers/media/pci/cx23885/cx23885-input.c
@@ -92,6 +92,7 @@ void cx23885_input_rx_work_handler(struct cx23885_dev *dev, u32 events)
92 case CX23885_BOARD_DVBSKY_S950C: 92 case CX23885_BOARD_DVBSKY_S950C:
93 case CX23885_BOARD_TT_CT2_4500_CI: 93 case CX23885_BOARD_TT_CT2_4500_CI:
94 case CX23885_BOARD_DVBSKY_S950: 94 case CX23885_BOARD_DVBSKY_S950:
95 case CX23885_BOARD_DVBSKY_S952:
95 /* 96 /*
96 * The only boards we handle right now. However other boards 97 * The only boards we handle right now. However other boards
97 * using the CX2388x integrated IR controller should be similar 98 * using the CX2388x integrated IR controller should be similar
@@ -149,6 +150,7 @@ static int cx23885_input_ir_start(struct cx23885_dev *dev)
149 case CX23885_BOARD_DVBSKY_S950C: 150 case CX23885_BOARD_DVBSKY_S950C:
150 case CX23885_BOARD_TT_CT2_4500_CI: 151 case CX23885_BOARD_TT_CT2_4500_CI:
151 case CX23885_BOARD_DVBSKY_S950: 152 case CX23885_BOARD_DVBSKY_S950:
153 case CX23885_BOARD_DVBSKY_S952:
152 /* 154 /*
153 * The IR controller on this board only returns pulse widths. 155 * The IR controller on this board only returns pulse widths.
154 * Any other mode setting will fail to set up the device. 156 * Any other mode setting will fail to set up the device.
@@ -319,6 +321,7 @@ int cx23885_input_init(struct cx23885_dev *dev)
319 case CX23885_BOARD_DVBSKY_T980C: 321 case CX23885_BOARD_DVBSKY_T980C:
320 case CX23885_BOARD_DVBSKY_S950C: 322 case CX23885_BOARD_DVBSKY_S950C:
321 case CX23885_BOARD_DVBSKY_S950: 323 case CX23885_BOARD_DVBSKY_S950:
324 case CX23885_BOARD_DVBSKY_S952:
322 /* Integrated CX23885 IR controller */ 325 /* Integrated CX23885 IR controller */
323 driver_type = RC_DRIVER_IR_RAW; 326 driver_type = RC_DRIVER_IR_RAW;
324 allowed_protos = RC_BIT_ALL; 327 allowed_protos = RC_BIT_ALL;
diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h
index f9cd0da72d02..58c5038c816b 100644
--- a/drivers/media/pci/cx23885/cx23885.h
+++ b/drivers/media/pci/cx23885/cx23885.h
@@ -97,6 +97,7 @@
97#define CX23885_BOARD_DVBSKY_S950C 47 97#define CX23885_BOARD_DVBSKY_S950C 47
98#define CX23885_BOARD_TT_CT2_4500_CI 48 98#define CX23885_BOARD_TT_CT2_4500_CI 48
99#define CX23885_BOARD_DVBSKY_S950 49 99#define CX23885_BOARD_DVBSKY_S950 49
100#define CX23885_BOARD_DVBSKY_S952 50
100 101
101#define GPIO_0 0x00000001 102#define GPIO_0 0x00000001
102#define GPIO_1 0x00000002 103#define GPIO_1 0x00000002