aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorManu Abraham <abraham.manu@gmail.com>2008-10-23 17:32:50 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:16 -0500
commita55bc848559d229025f5b2468fbed1070ae377e7 (patch)
treecc9c50c49b834ae57d8ced9eed656df0ba4e3496 /drivers
parent9e0dc6606a4f26a70cede6bf181cbff21f4c5477 (diff)
V4L/DVB (9399): some cleanups at budget-ci
Still messing up: * Cleanup * Use KNC1's default settings to startup with * Add in tuner wrapper calls Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/ttpci/budget-ci.c146
1 files changed, 135 insertions, 11 deletions
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c
index d179095bc27d..005c4596343d 100644
--- a/drivers/media/dvb/ttpci/budget-ci.c
+++ b/drivers/media/dvb/ttpci/budget-ci.c
@@ -1074,7 +1074,7 @@ static struct tda10023_config tda10023_config = {
1074 .deltaf = 0xa511, 1074 .deltaf = 0xa511,
1075}; 1075};
1076 1076
1077/* TT S2-3200 DVB-S (STB0899) Inittab */ 1077/* TT S2-3200 DVB-S (STB0899) Inittab */
1078static const struct stb0899_s1_reg tt3200_stb0899_s1_init_1[] = { 1078static const struct stb0899_s1_reg tt3200_stb0899_s1_init_1[] = {
1079 1079
1080// 0x0000000b , /* SYSREG */ 1080// 0x0000000b , /* SYSREG */
@@ -1136,9 +1136,9 @@ static const struct stb0899_s1_reg tt3200_stb0899_s1_init_1[] = {
1136 { STB0899_GPIO20CFG , 0x82 }, 1136 { STB0899_GPIO20CFG , 0x82 },
1137 { STB0899_SDATCFG , 0xb8 }, 1137 { STB0899_SDATCFG , 0xb8 },
1138 { STB0899_SCLTCFG , 0xba }, 1138 { STB0899_SCLTCFG , 0xba },
1139 { STB0899_AGCRFCFG , 0x1c }, // 0x11 1139 { STB0899_AGCRFCFG , 0x1c }, /* 0x11 */
1140 { STB0899_GPIO22 , 0x82 }, // AGCBB2CFG 1140 { STB0899_GPIO22 , 0x82 }, /* AGCBB2CFG */
1141 { STB0899_GPIO21 , 0x91 }, // AGCBB1CFG 1141 { STB0899_GPIO21 , 0x91 }, /* AGCBB1CFG */
1142 { STB0899_DIRCLKCFG , 0x82 }, 1142 { STB0899_DIRCLKCFG , 0x82 },
1143 { STB0899_CLKOUT27CFG , 0x7e }, 1143 { STB0899_CLKOUT27CFG , 0x7e },
1144 { STB0899_STDBYCFG , 0x82 }, 1144 { STB0899_STDBYCFG , 0x82 },
@@ -1153,8 +1153,8 @@ static const struct stb0899_s1_reg tt3200_stb0899_s1_init_1[] = {
1153 { STB0899_GPIO37CFG , 0x82 }, 1153 { STB0899_GPIO37CFG , 0x82 },
1154 { STB0899_GPIO38CFG , 0x82 }, 1154 { STB0899_GPIO38CFG , 0x82 },
1155 { STB0899_GPIO39CFG , 0x82 }, 1155 { STB0899_GPIO39CFG , 0x82 },
1156 { STB0899_NCOARSE , 0x15 }, // 0x15 = 27 Mhz Clock, F/3 = 198MHz, F/6 = 99MHz 1156 { STB0899_NCOARSE , 0x15 }, /* 0x15 = 27 Mhz Clock, F/3 = 198MHz, F/6 = 99MHz */
1157 { STB0899_SYNTCTRL , 0x02 }, // 0x00 = CLK from CLKI, 0x02 = CLK from XTALI 1157 { STB0899_SYNTCTRL , 0x02 }, /* 0x00 = CLK from CLKI, 0x02 = CLK from XTALI */
1158 { STB0899_FILTCTRL , 0x00 }, 1158 { STB0899_FILTCTRL , 0x00 },
1159 { STB0899_SYSCTRL , 0x00 }, 1159 { STB0899_SYSCTRL , 0x00 },
1160 { STB0899_STOPCLK1 , 0x20 }, 1160 { STB0899_STOPCLK1 , 0x20 },
@@ -1419,7 +1419,7 @@ static const struct stb0899_s1_reg tt3200_stb0899_s1_init_3[] = {
1419 { STB0899_VTH78 , 0x38 }, 1419 { STB0899_VTH78 , 0x38 },
1420 { STB0899_PRVIT , 0xff }, 1420 { STB0899_PRVIT , 0xff },
1421 { STB0899_VITSYNC , 0x19 }, 1421 { STB0899_VITSYNC , 0x19 },
1422 { STB0899_RSULC , 0xb1 }, // DVB = 0xb1, DSS = 0xa1 1422 { STB0899_RSULC , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */
1423 { STB0899_TSULC , 0x42 }, 1423 { STB0899_TSULC , 0x42 },
1424 { STB0899_RSLLC , 0x40 }, 1424 { STB0899_RSLLC , 0x40 },
1425 { STB0899_TSLPL , 0x12 }, 1425 { STB0899_TSLPL , 0x12 },
@@ -1545,17 +1545,141 @@ static const struct stb0899_s1_reg tt3200_stb0899_s1_init_5[] = {
1545 { 0xffff , 0xff }, 1545 { 0xffff , 0xff },
1546}; 1546};
1547 1547
1548#define TT3200_DVBS2_ESNO_AVE 3
1549#define TT3200_DVBS2_ESNO_QUANT 32
1550#define TT3200_DVBS2_AVFRAMES_COARSE 10
1551#define TT3200_DVBS2_AVFRAMES_FINE 20
1552#define TT3200_DVBS2_MISS_THRESHOLD 6
1553#define TT3200_DVBS2_UWP_THRESHOLD_ACQ 1125
1554#define TT3200_DVBS2_UWP_THRESHOLD_TRACK 758
1555#define TT3200_DVBS2_UWP_THRESHOLD_SOF 1350
1556#define TT3200_DVBS2_SOF_SEARCH_TIMEOUT 1664100
1557
1558#define TT3200_DVBS2_BTR_NCO_BITS 28
1559#define TT3200_DVBS2_BTR_GAIN_SHIFT_OFFSET 15
1560#define TT3200_DVBS2_CRL_NCO_BITS 30
1561#define TT3200_DVBS2_LDPC_MAX_ITER 70
1562
1563static int stb6100_get_frequency(struct dvb_frontend *fe, u32 *frequency)
1564{
1565 struct dvb_frontend_ops *frontend_ops = NULL;
1566 struct dvb_tuner_ops *tuner_ops = NULL;
1567 struct tuner_state t_state;
1568 int err = 0;
1569
1570 if (&fe->ops)
1571 frontend_ops = &fe->ops;
1572 if (&frontend_ops->tuner_ops)
1573 tuner_ops = &frontend_ops->tuner_ops;
1574 if (tuner_ops->get_state) {
1575 if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
1576 printk("%s: Invalid parameter\n", __func__);
1577 return err;
1578 }
1579 *frequency = t_state.frequency;
1580 printk("%s: Frequency=%d\n", __func__, t_state.frequency);
1581 }
1582 return 0;
1583}
1584
1585static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency)
1586{
1587 struct dvb_frontend_ops *frontend_ops = NULL;
1588 struct dvb_tuner_ops *tuner_ops = NULL;
1589 struct tuner_state t_state;
1590 int err = 0;
1591
1592 t_state.frequency = frequency;
1593 if (&fe->ops)
1594 frontend_ops = &fe->ops;
1595 if (&frontend_ops->tuner_ops)
1596 tuner_ops = &frontend_ops->tuner_ops;
1597 if (tuner_ops->set_state) {
1598 if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
1599 printk("%s: Invalid parameter\n", __func__);
1600 return err;
1601 }
1602 }
1603 printk("%s: Frequency=%d\n", __func__, t_state.frequency);
1604 return 0;
1605}
1606
1607static int stb6100_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
1608{
1609 struct dvb_frontend_ops *frontend_ops = &fe->ops;
1610 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
1611 struct tuner_state t_state;
1612 int err = 0;
1613
1614 if (&fe->ops)
1615 frontend_ops = &fe->ops;
1616 if (&frontend_ops->tuner_ops)
1617 tuner_ops = &frontend_ops->tuner_ops;
1618 if (tuner_ops->get_state) {
1619 if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) {
1620 printk("%s: Invalid parameter\n", __func__);
1621 return err;
1622 }
1623 *bandwidth = t_state.bandwidth;
1624 }
1625 printk("%s: Bandwidth=%d\n", __func__, t_state.bandwidth);
1626 return 0;
1627}
1628
1629static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
1630{
1631 struct dvb_frontend_ops *frontend_ops = NULL;
1632 struct dvb_tuner_ops *tuner_ops = NULL;
1633 struct tuner_state t_state;
1634 int err = 0;
1635
1636 t_state.frequency = bandwidth;
1637 if (&fe->ops)
1638 frontend_ops = &fe->ops;
1639 if (&frontend_ops->tuner_ops)
1640 tuner_ops = &frontend_ops->tuner_ops;
1641 if (tuner_ops->set_state) {
1642 if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) {
1643 printk("%s: Invalid parameter\n", __func__);
1644 return err;
1645 }
1646 }
1647 printk("%s: Bandwidth=%d\n", __func__, t_state.frequency);
1648 return 0;
1649}
1650
1548static struct stb0899_config tt3200_config = { 1651static struct stb0899_config tt3200_config = {
1549 .init_dev = tt3200_stb0899_s1_init_1, 1652 .init_dev = tt3200_stb0899_s1_init_1,
1550 .init_s2_demod = tt3200_stb0899_s2_init_2, 1653 .init_s2_demod = tt3200_stb0899_s2_init_2,
1551 .init_s1_demod = tt3200_stb0899_s1_init_3, 1654 .init_s1_demod = tt3200_stb0899_s1_init_3,
1552 .init_s2_fec = tt3200_stb0899_s2_init_4, 1655 .init_s2_fec = tt3200_stb0899_s2_init_4,
1553 .init_tst = tt3200_stb0899_s1_init_5, 1656 .init_tst = tt3200_stb0899_s1_init_5,
1554 1657
1555 .demod_address = 0x68, 1658 .demod_address = 0x68,
1556 1659
1557 .xtal_freq = 27000000, 1660 .xtal_freq = 27000000,
1558 .inversion = 1, 1661 .inversion = 1,
1662
1663 .esno_ave = TT3200_DVBS2_ESNO_AVE,
1664 .esno_quant = TT3200_DVBS2_ESNO_QUANT,
1665 .avframes_coarse = TT3200_DVBS2_AVFRAMES_COARSE,
1666 .avframes_fine = TT3200_DVBS2_AVFRAMES_FINE,
1667 .miss_threshold = TT3200_DVBS2_MISS_THRESHOLD,
1668 .uwp_threshold_acq = TT3200_DVBS2_UWP_THRESHOLD_ACQ,
1669 .uwp_threshold_track = TT3200_DVBS2_UWP_THRESHOLD_TRACK,
1670 .uwp_threshold_sof = TT3200_DVBS2_UWP_THRESHOLD_SOF,
1671 .sof_search_timeout = TT3200_DVBS2_SOF_SEARCH_TIMEOUT,
1672
1673 .btr_nco_bits = TT3200_DVBS2_BTR_NCO_BITS,
1674 .btr_gain_shift_offset = TT3200_DVBS2_BTR_GAIN_SHIFT_OFFSET,
1675 .crl_nco_bits = TT3200_DVBS2_CRL_NCO_BITS,
1676 .ldpc_max_iter = TT3200_DVBS2_LDPC_MAX_ITER,
1677
1678 .tuner_get_frequency = stb6100_get_frequency,
1679 .tuner_set_frequency = stb6100_set_frequency,
1680 .tuner_set_bandwidth = stb6100_set_bandwidth,
1681 .tuner_get_bandwidth = stb6100_get_bandwidth,
1682 .tuner_set_rfsiggain = NULL,
1559}; 1683};
1560 1684
1561struct stb6100_config tt3200_stb6100_config = { 1685struct stb6100_config tt3200_stb6100_config = {