aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci/av7110.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/ttpci/av7110.c')
-rw-r--r--drivers/media/dvb/ttpci/av7110.c201
1 files changed, 119 insertions, 82 deletions
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index e4c6e87f6c5d..22b203f8ff27 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -168,7 +168,9 @@ static void init_av7110_av(struct av7110 *av7110)
168 if (ret < 0) 168 if (ret < 0)
169 printk("dvb-ttpci:cannot switch on SCART(AD):%d\n",ret); 169 printk("dvb-ttpci:cannot switch on SCART(AD):%d\n",ret);
170 if (rgb_on && 170 if (rgb_on &&
171 (av7110->dev->pci->subsystem_vendor == 0x110a) && (av7110->dev->pci->subsystem_device == 0x0000)) { 171 ((av7110->dev->pci->subsystem_vendor == 0x110a) ||
172 (av7110->dev->pci->subsystem_vendor == 0x13c2)) &&
173 (av7110->dev->pci->subsystem_device == 0x0000)) {
172 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // RGB on, SCART pin 16 174 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // RGB on, SCART pin 16
173 //saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // SCARTpin 8 175 //saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // SCARTpin 8
174 } 176 }
@@ -177,9 +179,6 @@ static void init_av7110_av(struct av7110 *av7110)
177 ret = av7110_set_volume(av7110, av7110->mixer.volume_left, av7110->mixer.volume_right); 179 ret = av7110_set_volume(av7110, av7110->mixer.volume_left, av7110->mixer.volume_right);
178 if (ret < 0) 180 if (ret < 0)
179 printk("dvb-ttpci:cannot set volume :%d\n",ret); 181 printk("dvb-ttpci:cannot set volume :%d\n",ret);
180 ret = av7110_setup_irc_config(av7110, 0);
181 if (ret < 0)
182 printk("dvb-ttpci:cannot setup irc config :%d\n",ret);
183} 182}
184 183
185static void recover_arm(struct av7110 *av7110) 184static void recover_arm(struct av7110 *av7110)
@@ -265,60 +264,6 @@ static int arm_thread(void *data)
265} 264}
266 265
267 266
268/**
269 * Hack! we save the last av7110 ptr. This should be ok, since
270 * you rarely will use more then one IR control.
271 *
272 * If we want to support multiple controls we would have to do much more...
273 */
274int av7110_setup_irc_config(struct av7110 *av7110, u32 ir_config)
275{
276 int ret = 0;
277 static struct av7110 *last;
278
279 dprintk(4, "%p\n", av7110);
280
281 if (!av7110)
282 av7110 = last;
283 else
284 last = av7110;
285
286 if (av7110) {
287 ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, SetIR, 1, ir_config);
288 av7110->ir_config = ir_config;
289 }
290 return ret;
291}
292
293static void (*irc_handler)(u32);
294
295void av7110_register_irc_handler(void (*func)(u32))
296{
297 dprintk(4, "registering %p\n", func);
298 irc_handler = func;
299}
300
301void av7110_unregister_irc_handler(void (*func)(u32))
302{
303 dprintk(4, "unregistering %p\n", func);
304 irc_handler = NULL;
305}
306
307static void run_handlers(unsigned long ircom)
308{
309 if (irc_handler != NULL)
310 (*irc_handler)((u32) ircom);
311}
312
313static DECLARE_TASKLET(irtask, run_handlers, 0);
314
315static void IR_handle(struct av7110 *av7110, u32 ircom)
316{
317 dprintk(4, "ircommand = %08x\n", ircom);
318 irtask.data = (unsigned long) ircom;
319 tasklet_schedule(&irtask);
320}
321
322/**************************************************************************** 267/****************************************************************************
323 * IRQ handling 268 * IRQ handling
324 ****************************************************************************/ 269 ****************************************************************************/
@@ -711,8 +656,9 @@ static void gpioirq(unsigned long data)
711 return; 656 return;
712 657
713 case DATA_IRCOMMAND: 658 case DATA_IRCOMMAND:
714 IR_handle(av7110, 659 if (av7110->ir_handler)
715 swahw32(irdebi(av7110, DEBINOSWAP, Reserved, 0, 4))); 660 av7110->ir_handler(av7110,
661 swahw32(irdebi(av7110, DEBINOSWAP, Reserved, 0, 4)));
716 iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2); 662 iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2);
717 break; 663 break;
718 664
@@ -1668,9 +1614,8 @@ static int alps_bsru6_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ra
1668 return 0; 1614 return 0;
1669} 1615}
1670 1616
1671static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 1617static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params)
1672{ 1618{
1673 struct av7110* av7110 = (struct av7110*) fe->dvb->priv;
1674 int ret; 1619 int ret;
1675 u8 data[4]; 1620 u8 data[4];
1676 u32 div; 1621 u32 div;
@@ -1687,7 +1632,7 @@ static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param
1687 1632
1688 if (params->frequency > 1530000) data[3] = 0xc0; 1633 if (params->frequency > 1530000) data[3] = 0xc0;
1689 1634
1690 ret = i2c_transfer(&av7110->i2c_adap, &msg, 1); 1635 ret = i2c_transfer(i2c, &msg, 1);
1691 if (ret != 1) 1636 if (ret != 1)
1692 return -EIO; 1637 return -EIO;
1693 return 0; 1638 return 0;
@@ -1751,9 +1696,8 @@ static u8 alps_bsbe1_inittab[] = {
1751 0xff, 0xff 1696 0xff, 0xff
1752}; 1697};
1753 1698
1754static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 1699static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params)
1755{ 1700{
1756 struct av7110* av7110 = (struct av7110*) fe->dvb->priv;
1757 int ret; 1701 int ret;
1758 u8 data[4]; 1702 u8 data[4];
1759 u32 div; 1703 u32 div;
@@ -1768,7 +1712,7 @@ static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param
1768 data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; 1712 data[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
1769 data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; 1713 data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4;
1770 1714
1771 ret = i2c_transfer(&av7110->i2c_adap, &msg, 1); 1715 ret = i2c_transfer(i2c, &msg, 1);
1772 return (ret != 1) ? -EIO : 0; 1716 return (ret != 1) ? -EIO : 0;
1773} 1717}
1774 1718
@@ -1936,6 +1880,98 @@ static struct sp8870_config alps_tdlb7_config = {
1936}; 1880};
1937 1881
1938 1882
1883static u8 nexusca_stv0297_inittab[] = {
1884 0x80, 0x01,
1885 0x80, 0x00,
1886 0x81, 0x01,
1887 0x81, 0x00,
1888 0x00, 0x09,
1889 0x01, 0x69,
1890 0x03, 0x00,
1891 0x04, 0x00,
1892 0x07, 0x00,
1893 0x08, 0x00,
1894 0x20, 0x00,
1895 0x21, 0x40,
1896 0x22, 0x00,
1897 0x23, 0x00,
1898 0x24, 0x40,
1899 0x25, 0x88,
1900 0x30, 0xff,
1901 0x31, 0x00,
1902 0x32, 0xff,
1903 0x33, 0x00,
1904 0x34, 0x50,
1905 0x35, 0x7f,
1906 0x36, 0x00,
1907 0x37, 0x20,
1908 0x38, 0x00,
1909 0x40, 0x1c,
1910 0x41, 0xff,
1911 0x42, 0x29,
1912 0x43, 0x00,
1913 0x44, 0xff,
1914 0x45, 0x00,
1915 0x46, 0x00,
1916 0x49, 0x04,
1917 0x4a, 0x00,
1918 0x4b, 0x7b,
1919 0x52, 0x30,
1920 0x55, 0xae,
1921 0x56, 0x47,
1922 0x57, 0xe1,
1923 0x58, 0x3a,
1924 0x5a, 0x1e,
1925 0x5b, 0x34,
1926 0x60, 0x00,
1927 0x63, 0x00,
1928 0x64, 0x00,
1929 0x65, 0x00,
1930 0x66, 0x00,
1931 0x67, 0x00,
1932 0x68, 0x00,
1933 0x69, 0x00,
1934 0x6a, 0x02,
1935 0x6b, 0x00,
1936 0x70, 0xff,
1937 0x71, 0x00,
1938 0x72, 0x00,
1939 0x73, 0x00,
1940 0x74, 0x0c,
1941 0x80, 0x00,
1942 0x81, 0x00,
1943 0x82, 0x00,
1944 0x83, 0x00,
1945 0x84, 0x04,
1946 0x85, 0x80,
1947 0x86, 0x24,
1948 0x87, 0x78,
1949 0x88, 0x10,
1950 0x89, 0x00,
1951 0x90, 0x01,
1952 0x91, 0x01,
1953 0xa0, 0x04,
1954 0xa1, 0x00,
1955 0xa2, 0x00,
1956 0xb0, 0x91,
1957 0xb1, 0x0b,
1958 0xc0, 0x53,
1959 0xc1, 0x70,
1960 0xc2, 0x12,
1961 0xd0, 0x00,
1962 0xd1, 0x00,
1963 0xd2, 0x00,
1964 0xd3, 0x00,
1965 0xd4, 0x00,
1966 0xd5, 0x00,
1967 0xde, 0x00,
1968 0xdf, 0x00,
1969 0x61, 0x49,
1970 0x62, 0x0b,
1971 0x53, 0x08,
1972 0x59, 0x08,
1973 0xff, 0xff,
1974};
1939 1975
1940static int nexusca_stv0297_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 1976static int nexusca_stv0297_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
1941{ 1977{
@@ -1984,6 +2020,7 @@ static int nexusca_stv0297_pll_set(struct dvb_frontend* fe, struct dvb_frontend_
1984static struct stv0297_config nexusca_stv0297_config = { 2020static struct stv0297_config nexusca_stv0297_config = {
1985 2021
1986 .demod_address = 0x1C, 2022 .demod_address = 0x1C,
2023 .inittab = nexusca_stv0297_inittab,
1987 .invert = 1, 2024 .invert = 1,
1988 .pll_set = nexusca_stv0297_pll_set, 2025 .pll_set = nexusca_stv0297_pll_set,
1989}; 2026};
@@ -2261,7 +2298,7 @@ static int frontend_init(struct av7110 *av7110)
2261 2298
2262 case 0x000A: // Hauppauge/TT Nexus-CA rev1.X 2299 case 0x000A: // Hauppauge/TT Nexus-CA rev1.X
2263 2300
2264 av7110->fe = stv0297_attach(&nexusca_stv0297_config, &av7110->i2c_adap, 0x7b); 2301 av7110->fe = stv0297_attach(&nexusca_stv0297_config, &av7110->i2c_adap);
2265 if (av7110->fe) { 2302 if (av7110->fe) {
2266 /* set TDA9819 into DVB mode */ 2303 /* set TDA9819 into DVB mode */
2267 saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) 2304 saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD)
@@ -2692,7 +2729,7 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d
2692 goto err_av7110_exit_v4l_12; 2729 goto err_av7110_exit_v4l_12;
2693 2730
2694#if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE) 2731#if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE)
2695 av7110_ir_init(); 2732 av7110_ir_init(av7110);
2696#endif 2733#endif
2697 printk(KERN_INFO "dvb-ttpci: found av7110-%d.\n", av7110_num); 2734 printk(KERN_INFO "dvb-ttpci: found av7110-%d.\n", av7110_num);
2698 av7110_num++; 2735 av7110_num++;
@@ -2734,6 +2771,9 @@ static int av7110_detach(struct saa7146_dev* saa)
2734 struct av7110 *av7110 = saa->ext_priv; 2771 struct av7110 *av7110 = saa->ext_priv;
2735 dprintk(4, "%p\n", av7110); 2772 dprintk(4, "%p\n", av7110);
2736 2773
2774#if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE)
2775 av7110_ir_exit(av7110);
2776#endif
2737 if (budgetpatch) { 2777 if (budgetpatch) {
2738 /* Disable RPS1 */ 2778 /* Disable RPS1 */
2739 saa7146_write(saa, MC1, MASK_29); 2779 saa7146_write(saa, MC1, MASK_29);
@@ -2830,7 +2870,7 @@ static struct saa7146_pci_extension_data x_var = { \
2830 .ext_priv = x_name, \ 2870 .ext_priv = x_name, \
2831 .ext = &av7110_extension } 2871 .ext = &av7110_extension }
2832 2872
2833MAKE_AV7110_INFO(tts_1_X, "Technotrend/Hauppauge WinTV DVB-S rev1.X"); 2873MAKE_AV7110_INFO(tts_1_X_fsc,"Technotrend/Hauppauge WinTV DVB-S rev1.X or Fujitsu Siemens DVB-C");
2834MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X"); 2874MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X");
2835MAKE_AV7110_INFO(ttc_1_X, "Technotrend/Hauppauge WinTV Nexus-CA rev1.X"); 2875MAKE_AV7110_INFO(ttc_1_X, "Technotrend/Hauppauge WinTV Nexus-CA rev1.X");
2836MAKE_AV7110_INFO(ttc_2_X, "Technotrend/Hauppauge WinTV DVB-C rev2.X"); 2876MAKE_AV7110_INFO(ttc_2_X, "Technotrend/Hauppauge WinTV DVB-C rev2.X");
@@ -2842,16 +2882,16 @@ MAKE_AV7110_INFO(fsc, "Fujitsu Siemens DVB-C");
2842MAKE_AV7110_INFO(fss, "Fujitsu Siemens DVB-S rev1.6"); 2882MAKE_AV7110_INFO(fss, "Fujitsu Siemens DVB-S rev1.6");
2843 2883
2844static struct pci_device_id pci_tbl[] = { 2884static struct pci_device_id pci_tbl[] = {
2845 MAKE_EXTENSION_PCI(fsc, 0x110a, 0x0000), 2885 MAKE_EXTENSION_PCI(fsc, 0x110a, 0x0000),
2846 MAKE_EXTENSION_PCI(tts_1_X, 0x13c2, 0x0000), 2886 MAKE_EXTENSION_PCI(tts_1_X_fsc, 0x13c2, 0x0000),
2847 MAKE_EXTENSION_PCI(ttt_1_X, 0x13c2, 0x0001), 2887 MAKE_EXTENSION_PCI(ttt_1_X, 0x13c2, 0x0001),
2848 MAKE_EXTENSION_PCI(ttc_2_X, 0x13c2, 0x0002), 2888 MAKE_EXTENSION_PCI(ttc_2_X, 0x13c2, 0x0002),
2849 MAKE_EXTENSION_PCI(tts_2_X, 0x13c2, 0x0003), 2889 MAKE_EXTENSION_PCI(tts_2_X, 0x13c2, 0x0003),
2850 MAKE_EXTENSION_PCI(fss, 0x13c2, 0x0006), 2890 MAKE_EXTENSION_PCI(fss, 0x13c2, 0x0006),
2851 MAKE_EXTENSION_PCI(ttt, 0x13c2, 0x0008), 2891 MAKE_EXTENSION_PCI(ttt, 0x13c2, 0x0008),
2852 MAKE_EXTENSION_PCI(ttc_1_X, 0x13c2, 0x000a), 2892 MAKE_EXTENSION_PCI(ttc_1_X, 0x13c2, 0x000a),
2853 MAKE_EXTENSION_PCI(tts_2_3, 0x13c2, 0x000e), 2893 MAKE_EXTENSION_PCI(tts_2_3, 0x13c2, 0x000e),
2854 MAKE_EXTENSION_PCI(tts_1_3se, 0x13c2, 0x1002), 2894 MAKE_EXTENSION_PCI(tts_1_3se, 0x13c2, 0x1002),
2855 2895
2856/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0004), UNDEFINED CARD */ // Galaxis DVB PC-Sat-Carte 2896/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0004), UNDEFINED CARD */ // Galaxis DVB PC-Sat-Carte
2857/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0005), UNDEFINED CARD */ // Technisat SkyStar1 2897/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0005), UNDEFINED CARD */ // Technisat SkyStar1
@@ -2889,9 +2929,6 @@ static int __init av7110_init(void)
2889 2929
2890static void __exit av7110_exit(void) 2930static void __exit av7110_exit(void)
2891{ 2931{
2892#if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE)
2893 av7110_ir_exit();
2894#endif
2895 saa7146_unregister_extension(&av7110_extension); 2932 saa7146_unregister_extension(&av7110_extension);
2896} 2933}
2897 2934