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.c144
1 files changed, 127 insertions, 17 deletions
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 922c205a2652..8e33a850e13e 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -130,7 +130,7 @@ static void init_av7110_av(struct av7110 *av7110)
130 av7110->current_input = 0; 130 av7110->current_input = 0;
131 if (i2c_writereg(av7110, 0x20, 0x00, 0x00) == 1) { 131 if (i2c_writereg(av7110, 0x20, 0x00, 0x00) == 1) {
132 printk ("dvb-ttpci: Crystal audio DAC @ card %d detected\n", 132 printk ("dvb-ttpci: Crystal audio DAC @ card %d detected\n",
133 av7110->dvb_adapter->num); 133 av7110->dvb_adapter.num);
134 av7110->adac_type = DVB_ADAC_CRYSTAL; 134 av7110->adac_type = DVB_ADAC_CRYSTAL;
135 i2c_writereg(av7110, 0x20, 0x01, 0xd2); 135 i2c_writereg(av7110, 0x20, 0x01, 0xd2);
136 i2c_writereg(av7110, 0x20, 0x02, 0x49); 136 i2c_writereg(av7110, 0x20, 0x02, 0x49);
@@ -145,13 +145,13 @@ static void init_av7110_av(struct av7110 *av7110)
145 } 145 }
146 else if (dev->pci->subsystem_vendor == 0x110a) { 146 else if (dev->pci->subsystem_vendor == 0x110a) {
147 printk("dvb-ttpci: DVB-C w/o analog module @ card %d detected\n", 147 printk("dvb-ttpci: DVB-C w/o analog module @ card %d detected\n",
148 av7110->dvb_adapter->num); 148 av7110->dvb_adapter.num);
149 av7110->adac_type = DVB_ADAC_NONE; 149 av7110->adac_type = DVB_ADAC_NONE;
150 } 150 }
151 else { 151 else {
152 av7110->adac_type = adac; 152 av7110->adac_type = adac;
153 printk("dvb-ttpci: adac type set to %d @ card %d\n", 153 printk("dvb-ttpci: adac type set to %d @ card %d\n",
154 av7110->dvb_adapter->num, av7110->adac_type); 154 av7110->dvb_adapter.num, av7110->adac_type);
155 } 155 }
156 156
157 if (av7110->adac_type == DVB_ADAC_NONE || av7110->adac_type == DVB_ADAC_MSP) { 157 if (av7110->adac_type == DVB_ADAC_NONE || av7110->adac_type == DVB_ADAC_MSP) {
@@ -231,7 +231,7 @@ static int arm_thread(void *data)
231 231
232 if (newloops == av7110->arm_loops) { 232 if (newloops == av7110->arm_loops) {
233 printk(KERN_ERR "dvb-ttpci: ARM crashed @ card %d\n", 233 printk(KERN_ERR "dvb-ttpci: ARM crashed @ card %d\n",
234 av7110->dvb_adapter->num); 234 av7110->dvb_adapter.num);
235 235
236 arm_error(av7110); 236 arm_error(av7110);
237 av7710_set_video_mode(av7110, vidmode); 237 av7710_set_video_mode(av7110, vidmode);
@@ -1282,7 +1282,7 @@ static int av7110_register(struct av7110 *av7110)
1282 av7110->dmxdev.demux = &dvbdemux->dmx; 1282 av7110->dmxdev.demux = &dvbdemux->dmx;
1283 av7110->dmxdev.capabilities = 0; 1283 av7110->dmxdev.capabilities = 0;
1284 1284
1285 dvb_dmxdev_init(&av7110->dmxdev, av7110->dvb_adapter); 1285 dvb_dmxdev_init(&av7110->dmxdev, &av7110->dvb_adapter);
1286 1286
1287 av7110->hw_frontend.source = DMX_FRONTEND_0; 1287 av7110->hw_frontend.source = DMX_FRONTEND_0;
1288 1288
@@ -1307,11 +1307,11 @@ static int av7110_register(struct av7110 *av7110)
1307 av7110_ca_register(av7110); 1307 av7110_ca_register(av7110);
1308 1308
1309#ifdef CONFIG_DVB_AV7110_OSD 1309#ifdef CONFIG_DVB_AV7110_OSD
1310 dvb_register_device(av7110->dvb_adapter, &av7110->osd_dev, 1310 dvb_register_device(&av7110->dvb_adapter, &av7110->osd_dev,
1311 &dvbdev_osd, av7110, DVB_DEVICE_OSD); 1311 &dvbdev_osd, av7110, DVB_DEVICE_OSD);
1312#endif 1312#endif
1313 1313
1314 dvb_net_init(av7110->dvb_adapter, &av7110->dvb_net, &dvbdemux->dmx); 1314 dvb_net_init(&av7110->dvb_adapter, &av7110->dvb_net, &dvbdemux->dmx);
1315 1315
1316 if (budgetpatch) { 1316 if (budgetpatch) {
1317 /* initialize software demux1 without its own frontend 1317 /* initialize software demux1 without its own frontend
@@ -1334,9 +1334,9 @@ static int av7110_register(struct av7110 *av7110)
1334 av7110->dmxdev1.demux = &dvbdemux1->dmx; 1334 av7110->dmxdev1.demux = &dvbdemux1->dmx;
1335 av7110->dmxdev1.capabilities = 0; 1335 av7110->dmxdev1.capabilities = 0;
1336 1336
1337 dvb_dmxdev_init(&av7110->dmxdev1, av7110->dvb_adapter); 1337 dvb_dmxdev_init(&av7110->dmxdev1, &av7110->dvb_adapter);
1338 1338
1339 dvb_net_init(av7110->dvb_adapter, &av7110->dvb_net1, &dvbdemux1->dmx); 1339 dvb_net_init(&av7110->dvb_adapter, &av7110->dvb_net1, &dvbdemux1->dmx);
1340 printk("dvb-ttpci: additional demux1 for budget-patch registered\n"); 1340 printk("dvb-ttpci: additional demux1 for budget-patch registered\n");
1341 } 1341 }
1342 return 0; 1342 return 0;
@@ -1673,6 +1673,106 @@ static struct stv0299_config alps_bsru6_config = {
1673}; 1673};
1674 1674
1675 1675
1676static u8 alps_bsbe1_inittab[] = {
1677 0x01, 0x15,
1678 0x02, 0x30,
1679 0x03, 0x00,
1680 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
1681 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
1682 0x06, 0x40, /* DAC not used, set to high impendance mode */
1683 0x07, 0x00, /* DAC LSB */
1684 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
1685 0x09, 0x00, /* FIFO */
1686 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
1687 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
1688 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
1689 0x10, 0x3f, // AGC2 0x3d
1690 0x11, 0x84,
1691 0x12, 0xb5, // Lock detect: -64 Carrier freq detect:on
1692 0x15, 0xc9, // lock detector threshold
1693 0x16, 0x00,
1694 0x17, 0x00,
1695 0x18, 0x00,
1696 0x19, 0x00,
1697 0x1a, 0x00,
1698 0x1f, 0x50,
1699 0x20, 0x00,
1700 0x21, 0x00,
1701 0x22, 0x00,
1702 0x23, 0x00,
1703 0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
1704 0x29, 0x1e, // 1/2 threshold
1705 0x2a, 0x14, // 2/3 threshold
1706 0x2b, 0x0f, // 3/4 threshold
1707 0x2c, 0x09, // 5/6 threshold
1708 0x2d, 0x05, // 7/8 threshold
1709 0x2e, 0x01,
1710 0x31, 0x1f, // test all FECs
1711 0x32, 0x19, // viterbi and synchro search
1712 0x33, 0xfc, // rs control
1713 0x34, 0x93, // error control
1714 0x0f, 0x92,
1715 0xff, 0xff
1716};
1717
1718static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
1719{
1720 struct av7110* av7110 = (struct av7110*) fe->dvb->priv;
1721 int ret;
1722 u8 data[4];
1723 u32 div;
1724 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
1725
1726 if ((params->frequency < 950000) || (params->frequency > 2150000))
1727 return -EINVAL;
1728
1729 div = (params->frequency + (125 - 1)) / 125; // round correctly
1730 data[0] = (div >> 8) & 0x7f;
1731 data[1] = div & 0xff;
1732 data[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
1733 data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4;
1734
1735 ret = i2c_transfer(&av7110->i2c_adap, &msg, 1);
1736 return (ret != 1) ? -EIO : 0;
1737}
1738
1739static struct stv0299_config alps_bsbe1_config = {
1740 .demod_address = 0x68,
1741 .inittab = alps_bsbe1_inittab,
1742 .mclk = 88000000UL,
1743 .invert = 1,
1744 .enhanced_tuning = 0,
1745 .skip_reinit = 0,
1746 .min_delay_ms = 100,
1747 .set_symbol_rate = alps_bsru6_set_symbol_rate,
1748 .pll_set = alps_bsbe1_pll_set,
1749};
1750
1751static int lnbp21_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage)
1752{
1753 struct av7110* av7110 = (struct av7110*) fe->dvb->priv;
1754 int ret;
1755 u8 data[1];
1756 struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = data, .len = sizeof(data) };
1757
1758 switch(voltage) {
1759 case SEC_VOLTAGE_OFF:
1760 data[0] = 0x00;
1761 break;
1762 case SEC_VOLTAGE_13:
1763 data[0] = 0x44;
1764 break;
1765 case SEC_VOLTAGE_18:
1766 data[0] = 0x4c;
1767 break;
1768 default:
1769 return -EINVAL;
1770 };
1771
1772 ret = i2c_transfer(&av7110->i2c_adap, &msg, 1);
1773 return (ret != 1) ? -EIO : 0;
1774}
1775
1676 1776
1677static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 1777static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
1678{ 1778{
@@ -2116,6 +2216,14 @@ static int frontend_init(struct av7110 *av7110)
2116 av7110->dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240; 2216 av7110->dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240;
2117 break; 2217 break;
2118 } 2218 }
2219 break;
2220
2221 case 0x000E: /* Hauppauge/TT Nexus-S rev 2.3 */
2222 /* ALPS BSBE1 */
2223 av7110->fe = stv0299_attach(&alps_bsbe1_config, &av7110->i2c_adap);
2224 if (av7110->fe)
2225 av7110->fe->ops->set_voltage = lnbp21_set_voltage;
2226 break;
2119 } 2227 }
2120 } 2228 }
2121 2229
@@ -2138,7 +2246,7 @@ static int frontend_init(struct av7110 *av7110)
2138 FE_FUNC_OVERRIDE(av7110->fe->ops->dishnetwork_send_legacy_command, av7110->fe_dishnetwork_send_legacy_command, av7110_fe_dishnetwork_send_legacy_command); 2246 FE_FUNC_OVERRIDE(av7110->fe->ops->dishnetwork_send_legacy_command, av7110->fe_dishnetwork_send_legacy_command, av7110_fe_dishnetwork_send_legacy_command);
2139 FE_FUNC_OVERRIDE(av7110->fe->ops->set_frontend, av7110->fe_set_frontend, av7110_fe_set_frontend); 2247 FE_FUNC_OVERRIDE(av7110->fe->ops->set_frontend, av7110->fe_set_frontend, av7110_fe_set_frontend);
2140 2248
2141 ret = dvb_register_frontend(av7110->dvb_adapter, av7110->fe); 2249 ret = dvb_register_frontend(&av7110->dvb_adapter, av7110->fe);
2142 if (ret < 0) { 2250 if (ret < 0) {
2143 printk("av7110: Frontend registration failed!\n"); 2251 printk("av7110: Frontend registration failed!\n");
2144 if (av7110->fe->ops->release) 2252 if (av7110->fe->ops->release)
@@ -2352,7 +2460,7 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d
2352 goto err_dvb_unregister_adapter_2; 2460 goto err_dvb_unregister_adapter_2;
2353 2461
2354 ttpci_eeprom_parse_mac(&av7110->i2c_adap, 2462 ttpci_eeprom_parse_mac(&av7110->i2c_adap,
2355 av7110->dvb_adapter->proposed_mac); 2463 av7110->dvb_adapter.proposed_mac);
2356 ret = -ENOMEM; 2464 ret = -ENOMEM;
2357 2465
2358 if (budgetpatch) { 2466 if (budgetpatch) {
@@ -2523,7 +2631,7 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d
2523 if (ret < 0) 2631 if (ret < 0)
2524 goto err_av7110_unregister_11; 2632 goto err_av7110_unregister_11;
2525 2633
2526 av7110->dvb_adapter->priv = av7110; 2634 av7110->dvb_adapter.priv = av7110;
2527 ret = frontend_init(av7110); 2635 ret = frontend_init(av7110);
2528 if (ret < 0) 2636 if (ret < 0)
2529 goto err_av7110_exit_v4l_12; 2637 goto err_av7110_exit_v4l_12;
@@ -2558,7 +2666,7 @@ err_saa71466_vfree_4:
2558err_i2c_del_3: 2666err_i2c_del_3:
2559 i2c_del_adapter(&av7110->i2c_adap); 2667 i2c_del_adapter(&av7110->i2c_adap);
2560err_dvb_unregister_adapter_2: 2668err_dvb_unregister_adapter_2:
2561 dvb_unregister_adapter(av7110->dvb_adapter); 2669 dvb_unregister_adapter(&av7110->dvb_adapter);
2562err_put_firmware_1: 2670err_put_firmware_1:
2563 put_firmware(av7110); 2671 put_firmware(av7110);
2564err_kfree_0: 2672err_kfree_0:
@@ -2604,7 +2712,7 @@ static int av7110_detach(struct saa7146_dev* saa)
2604 2712
2605 i2c_del_adapter(&av7110->i2c_adap); 2713 i2c_del_adapter(&av7110->i2c_adap);
2606 2714
2607 dvb_unregister_adapter (av7110->dvb_adapter); 2715 dvb_unregister_adapter (&av7110->dvb_adapter);
2608 2716
2609 av7110_num--; 2717 av7110_num--;
2610 2718
@@ -2672,21 +2780,23 @@ MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X");
2672MAKE_AV7110_INFO(ttc_1_X, "Technotrend/Hauppauge WinTV Nexus-CA rev1.X"); 2780MAKE_AV7110_INFO(ttc_1_X, "Technotrend/Hauppauge WinTV Nexus-CA rev1.X");
2673MAKE_AV7110_INFO(ttc_2_X, "Technotrend/Hauppauge WinTV DVB-C rev2.X"); 2781MAKE_AV7110_INFO(ttc_2_X, "Technotrend/Hauppauge WinTV DVB-C rev2.X");
2674MAKE_AV7110_INFO(tts_2_X, "Technotrend/Hauppauge WinTV Nexus-S rev2.X"); 2782MAKE_AV7110_INFO(tts_2_X, "Technotrend/Hauppauge WinTV Nexus-S rev2.X");
2783MAKE_AV7110_INFO(tts_2_3, "Technotrend/Hauppauge WinTV Nexus-S rev2.3");
2675MAKE_AV7110_INFO(tts_1_3se, "Technotrend/Hauppauge WinTV DVB-S rev1.3 SE"); 2784MAKE_AV7110_INFO(tts_1_3se, "Technotrend/Hauppauge WinTV DVB-S rev1.3 SE");
2676MAKE_AV7110_INFO(ttt, "Technotrend/Hauppauge DVB-T"); 2785MAKE_AV7110_INFO(ttt, "Technotrend/Hauppauge DVB-T");
2677MAKE_AV7110_INFO(fsc, "Fujitsu Siemens DVB-C"); 2786MAKE_AV7110_INFO(fsc, "Fujitsu Siemens DVB-C");
2678MAKE_AV7110_INFO(fss, "Fujitsu Siemens DVB-S rev1.6"); 2787MAKE_AV7110_INFO(fss, "Fujitsu Siemens DVB-S rev1.6");
2679 2788
2680static struct pci_device_id pci_tbl[] = { 2789static struct pci_device_id pci_tbl[] = {
2790 MAKE_EXTENSION_PCI(fsc, 0x110a, 0x0000),
2681 MAKE_EXTENSION_PCI(tts_1_X, 0x13c2, 0x0000), 2791 MAKE_EXTENSION_PCI(tts_1_X, 0x13c2, 0x0000),
2682 MAKE_EXTENSION_PCI(ttt_1_X, 0x13c2, 0x0001), 2792 MAKE_EXTENSION_PCI(ttt_1_X, 0x13c2, 0x0001),
2683 MAKE_EXTENSION_PCI(ttc_2_X, 0x13c2, 0x0002), 2793 MAKE_EXTENSION_PCI(ttc_2_X, 0x13c2, 0x0002),
2684 MAKE_EXTENSION_PCI(tts_2_X, 0x13c2, 0x0003), 2794 MAKE_EXTENSION_PCI(tts_2_X, 0x13c2, 0x0003),
2685 MAKE_EXTENSION_PCI(tts_1_3se, 0x13c2, 0x1002),
2686 MAKE_EXTENSION_PCI(fsc, 0x110a, 0x0000),
2687 MAKE_EXTENSION_PCI(ttc_1_X, 0x13c2, 0x000a),
2688 MAKE_EXTENSION_PCI(fss, 0x13c2, 0x0006), 2795 MAKE_EXTENSION_PCI(fss, 0x13c2, 0x0006),
2689 MAKE_EXTENSION_PCI(ttt, 0x13c2, 0x0008), 2796 MAKE_EXTENSION_PCI(ttt, 0x13c2, 0x0008),
2797 MAKE_EXTENSION_PCI(ttc_1_X, 0x13c2, 0x000a),
2798 MAKE_EXTENSION_PCI(tts_2_3, 0x13c2, 0x000e),
2799 MAKE_EXTENSION_PCI(tts_1_3se, 0x13c2, 0x1002),
2690 2800
2691/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0004), UNDEFINED CARD */ // Galaxis DVB PC-Sat-Carte 2801/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0004), UNDEFINED CARD */ // Galaxis DVB PC-Sat-Carte
2692/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0005), UNDEFINED CARD */ // Technisat SkyStar1 2802/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0005), UNDEFINED CARD */ // Technisat SkyStar1