diff options
author | Oliver Endriss <o.endriss@gmx.de> | 2006-02-28 08:32:25 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-08 09:36:33 -0500 |
commit | db5d91eb36e1cc9d46016d1d44874376cfabf274 (patch) | |
tree | 20e0222107bd13db18d50f3f4a4e1282410fc10b | |
parent | 8cc2e377a0f20f58606d8a68a423ed2ea348869d (diff) |
V4L/DVB (3406): Use refactored LNBP21 and BSBE1 code
Use refactored LNBP21/BSBE1 code for Technotrend/Hauppauge DVB-S rev 2.3.
As a side effect, FE_ENABLE_HIGH_LNB_VOLTAGE ioctl is supported now.
Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/dvb/ttpci/av7110.c | 114 |
1 files changed, 12 insertions, 102 deletions
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index d982a50cdd7f..914f2e34d8d3 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -66,6 +66,9 @@ | |||
66 | #include "av7110_ca.h" | 66 | #include "av7110_ca.h" |
67 | #include "av7110_ipack.h" | 67 | #include "av7110_ipack.h" |
68 | 68 | ||
69 | #include "bsbe1.h" | ||
70 | #include "lnbp21.h" | ||
71 | |||
69 | #define TS_WIDTH 376 | 72 | #define TS_WIDTH 376 |
70 | #define TS_HEIGHT 512 | 73 | #define TS_HEIGHT 512 |
71 | #define TS_BUFLEN (TS_WIDTH*TS_HEIGHT) | 74 | #define TS_BUFLEN (TS_WIDTH*TS_HEIGHT) |
@@ -1672,105 +1675,6 @@ static struct stv0299_config alps_bsru6_config = { | |||
1672 | }; | 1675 | }; |
1673 | 1676 | ||
1674 | 1677 | ||
1675 | static u8 alps_bsbe1_inittab[] = { | ||
1676 | 0x01, 0x15, | ||
1677 | 0x02, 0x30, | ||
1678 | 0x03, 0x00, | ||
1679 | 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ | ||
1680 | 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */ | ||
1681 | 0x06, 0x40, /* DAC not used, set to high impendance mode */ | ||
1682 | 0x07, 0x00, /* DAC LSB */ | ||
1683 | 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */ | ||
1684 | 0x09, 0x00, /* FIFO */ | ||
1685 | 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */ | ||
1686 | 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */ | ||
1687 | 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ | ||
1688 | 0x10, 0x3f, // AGC2 0x3d | ||
1689 | 0x11, 0x84, | ||
1690 | 0x12, 0xb9, | ||
1691 | 0x15, 0xc9, // lock detector threshold | ||
1692 | 0x16, 0x00, | ||
1693 | 0x17, 0x00, | ||
1694 | 0x18, 0x00, | ||
1695 | 0x19, 0x00, | ||
1696 | 0x1a, 0x00, | ||
1697 | 0x1f, 0x50, | ||
1698 | 0x20, 0x00, | ||
1699 | 0x21, 0x00, | ||
1700 | 0x22, 0x00, | ||
1701 | 0x23, 0x00, | ||
1702 | 0x28, 0x00, // out imp: normal out type: parallel FEC mode:0 | ||
1703 | 0x29, 0x1e, // 1/2 threshold | ||
1704 | 0x2a, 0x14, // 2/3 threshold | ||
1705 | 0x2b, 0x0f, // 3/4 threshold | ||
1706 | 0x2c, 0x09, // 5/6 threshold | ||
1707 | 0x2d, 0x05, // 7/8 threshold | ||
1708 | 0x2e, 0x01, | ||
1709 | 0x31, 0x1f, // test all FECs | ||
1710 | 0x32, 0x19, // viterbi and synchro search | ||
1711 | 0x33, 0xfc, // rs control | ||
1712 | 0x34, 0x93, // error control | ||
1713 | 0x0f, 0x92, | ||
1714 | 0xff, 0xff | ||
1715 | }; | ||
1716 | |||
1717 | static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) | ||
1718 | { | ||
1719 | int ret; | ||
1720 | u8 data[4]; | ||
1721 | u32 div; | ||
1722 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; | ||
1723 | |||
1724 | if ((params->frequency < 950000) || (params->frequency > 2150000)) | ||
1725 | return -EINVAL; | ||
1726 | |||
1727 | div = (params->frequency + (125 - 1)) / 125; // round correctly | ||
1728 | data[0] = (div >> 8) & 0x7f; | ||
1729 | data[1] = div & 0xff; | ||
1730 | data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; | ||
1731 | data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; | ||
1732 | |||
1733 | ret = i2c_transfer(i2c, &msg, 1); | ||
1734 | return (ret != 1) ? -EIO : 0; | ||
1735 | } | ||
1736 | |||
1737 | static struct stv0299_config alps_bsbe1_config = { | ||
1738 | .demod_address = 0x68, | ||
1739 | .inittab = alps_bsbe1_inittab, | ||
1740 | .mclk = 88000000UL, | ||
1741 | .invert = 1, | ||
1742 | .skip_reinit = 0, | ||
1743 | .min_delay_ms = 100, | ||
1744 | .set_symbol_rate = alps_bsru6_set_symbol_rate, | ||
1745 | .pll_set = alps_bsbe1_pll_set, | ||
1746 | }; | ||
1747 | |||
1748 | static int lnbp21_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) | ||
1749 | { | ||
1750 | struct av7110* av7110 = (struct av7110*) fe->dvb->priv; | ||
1751 | int ret; | ||
1752 | u8 data[1]; | ||
1753 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = data, .len = sizeof(data) }; | ||
1754 | |||
1755 | switch(voltage) { | ||
1756 | case SEC_VOLTAGE_OFF: | ||
1757 | data[0] = 0x00; | ||
1758 | break; | ||
1759 | case SEC_VOLTAGE_13: | ||
1760 | data[0] = 0x44; | ||
1761 | break; | ||
1762 | case SEC_VOLTAGE_18: | ||
1763 | data[0] = 0x4c; | ||
1764 | break; | ||
1765 | default: | ||
1766 | return -EINVAL; | ||
1767 | }; | ||
1768 | |||
1769 | ret = i2c_transfer(&av7110->i2c_adap, &msg, 1); | ||
1770 | return (ret != 1) ? -EIO : 0; | ||
1771 | } | ||
1772 | |||
1773 | |||
1774 | static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 1678 | static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
1775 | { | 1679 | { |
1776 | struct av7110* av7110 = fe->dvb->priv; | 1680 | struct av7110* av7110 = fe->dvb->priv; |
@@ -2373,9 +2277,15 @@ static int frontend_init(struct av7110 *av7110) | |||
2373 | /* ALPS BSBE1 */ | 2277 | /* ALPS BSBE1 */ |
2374 | av7110->fe = stv0299_attach(&alps_bsbe1_config, &av7110->i2c_adap); | 2278 | av7110->fe = stv0299_attach(&alps_bsbe1_config, &av7110->i2c_adap); |
2375 | if (av7110->fe) { | 2279 | if (av7110->fe) { |
2376 | av7110->fe->ops->set_voltage = lnbp21_set_voltage; | 2280 | if (lnbp21_init(av7110->fe, &av7110->i2c_adap, 0, 0)) { |
2377 | av7110->fe->ops->dishnetwork_send_legacy_command = NULL; | 2281 | printk("dvb-ttpci: LNBP21 not found!\n"); |
2378 | av7110->recover = dvb_s_recover; | 2282 | if (av7110->fe->ops->release) |
2283 | av7110->fe->ops->release(av7110->fe); | ||
2284 | av7110->fe = NULL; | ||
2285 | } else { | ||
2286 | av7110->fe->ops->dishnetwork_send_legacy_command = NULL; | ||
2287 | av7110->recover = dvb_s_recover; | ||
2288 | } | ||
2379 | } | 2289 | } |
2380 | break; | 2290 | break; |
2381 | } | 2291 | } |