diff options
author | Yeasah Pell <yeasah@schwide.com> | 2006-08-08 14:48:08 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-09-26 10:53:38 -0400 |
commit | 18c053b3c5414c385f4a67134fd963b98881aa0d (patch) | |
tree | 007fbce6362062683a0b041903e3bc345f89b97f /drivers/media | |
parent | d12a9b911c793ab5b6b02379880efd6fa3499575 (diff) |
V4L/DVB (4434): Change BER config
Change the bit error counter configuration to be the actual BER.
Originally it was reporting UCB.
Signed-off-by: Yeasah Pell <yeasah@schwide.com>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/frontends/cx24123.c | 50 |
1 files changed, 11 insertions, 39 deletions
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c index 3acd0d7f0b2c..815f0aaf1d4f 100644 --- a/drivers/media/dvb/frontends/cx24123.c +++ b/drivers/media/dvb/frontends/cx24123.c | |||
@@ -45,9 +45,6 @@ struct cx24123_state | |||
45 | 45 | ||
46 | struct dvb_frontend frontend; | 46 | struct dvb_frontend frontend; |
47 | 47 | ||
48 | u32 lastber; | ||
49 | u16 snr; | ||
50 | |||
51 | /* Some PLL specifics for tuning */ | 48 | /* Some PLL specifics for tuning */ |
52 | u32 VCAarg; | 49 | u32 VCAarg; |
53 | u32 VGAarg; | 50 | u32 VGAarg; |
@@ -223,7 +220,7 @@ static struct { | |||
223 | {0x44, 0x00}, /* Constellation (default) */ | 220 | {0x44, 0x00}, /* Constellation (default) */ |
224 | {0x45, 0x00}, /* Symbol count (default) */ | 221 | {0x45, 0x00}, /* Symbol count (default) */ |
225 | {0x46, 0x0d}, /* Symbol rate estimator on (default) */ | 222 | {0x46, 0x0d}, /* Symbol rate estimator on (default) */ |
226 | {0x56, 0x41}, /* Various (default) */ | 223 | {0x56, 0xc1}, /* Error Counter = Viterbi BER */ |
227 | {0x57, 0xff}, /* Error Counter Window (default) */ | 224 | {0x57, 0xff}, /* Error Counter Window (default) */ |
228 | {0x67, 0x83}, /* Non-DCII symbol clock */ | 225 | {0x67, 0x83}, /* Non-DCII symbol clock */ |
229 | }; | 226 | }; |
@@ -801,29 +798,13 @@ static int cx24123_read_ber(struct dvb_frontend* fe, u32* ber) | |||
801 | { | 798 | { |
802 | struct cx24123_state *state = fe->demodulator_priv; | 799 | struct cx24123_state *state = fe->demodulator_priv; |
803 | 800 | ||
804 | state->lastber = | 801 | /* The true bit error rate is this value divided by |
805 | ((cx24123_readreg(state, 0x1c) & 0x3f) << 16) | | 802 | the window size (set as 256 * 255) */ |
803 | *ber = ((cx24123_readreg(state, 0x1c) & 0x3f) << 16) | | ||
806 | (cx24123_readreg(state, 0x1d) << 8 | | 804 | (cx24123_readreg(state, 0x1d) << 8 | |
807 | cx24123_readreg(state, 0x1e)); | 805 | cx24123_readreg(state, 0x1e)); |
808 | |||
809 | /* Do the signal quality processing here, it's derived from the BER. */ | ||
810 | /* Scale the BER from a 24bit to a SNR 16 bit where higher = better */ | ||
811 | if (state->lastber < 5000) | ||
812 | state->snr = 655*100; | ||
813 | else if ( (state->lastber >= 5000) && (state->lastber < 55000) ) | ||
814 | state->snr = 655*90; | ||
815 | else if ( (state->lastber >= 55000) && (state->lastber < 150000) ) | ||
816 | state->snr = 655*80; | ||
817 | else if ( (state->lastber >= 150000) && (state->lastber < 250000) ) | ||
818 | state->snr = 655*70; | ||
819 | else if ( (state->lastber >= 250000) && (state->lastber < 450000) ) | ||
820 | state->snr = 655*65; | ||
821 | else | ||
822 | state->snr = 0; | ||
823 | |||
824 | dprintk("%s: BER = %d, S/N index = %d\n",__FUNCTION__,state->lastber, state->snr); | ||
825 | 806 | ||
826 | *ber = state->lastber; | 807 | dprintk("%s: BER = %d\n",__FUNCTION__,*ber); |
827 | 808 | ||
828 | return 0; | 809 | return 0; |
829 | } | 810 | } |
@@ -841,19 +822,13 @@ static int cx24123_read_signal_strength(struct dvb_frontend* fe, u16* signal_str | |||
841 | static int cx24123_read_snr(struct dvb_frontend* fe, u16* snr) | 822 | static int cx24123_read_snr(struct dvb_frontend* fe, u16* snr) |
842 | { | 823 | { |
843 | struct cx24123_state *state = fe->demodulator_priv; | 824 | struct cx24123_state *state = fe->demodulator_priv; |
844 | *snr = state->snr; | ||
845 | 825 | ||
846 | dprintk("%s: read S/N index = %d\n",__FUNCTION__,*snr); | 826 | /* Inverted raw Es/N0 count, totally bogus but better than the |
827 | BER threshold. */ | ||
828 | *snr = 65535 - (((u16)cx24123_readreg(state, 0x18) << 8) | | ||
829 | (u16)cx24123_readreg(state, 0x19)); | ||
847 | 830 | ||
848 | return 0; | 831 | dprintk("%s: read S/N index = %d\n",__FUNCTION__,*snr); |
849 | } | ||
850 | |||
851 | static int cx24123_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | ||
852 | { | ||
853 | struct cx24123_state *state = fe->demodulator_priv; | ||
854 | *ucblocks = state->lastber; | ||
855 | |||
856 | dprintk("%s: ucblocks (ber) = %d\n",__FUNCTION__,*ucblocks); | ||
857 | 832 | ||
858 | return 0; | 833 | return 0; |
859 | } | 834 | } |
@@ -955,8 +930,6 @@ struct dvb_frontend* cx24123_attach(const struct cx24123_config* config, | |||
955 | /* setup the state */ | 930 | /* setup the state */ |
956 | state->config = config; | 931 | state->config = config; |
957 | state->i2c = i2c; | 932 | state->i2c = i2c; |
958 | state->lastber = 0; | ||
959 | state->snr = 0; | ||
960 | state->VCAarg = 0; | 933 | state->VCAarg = 0; |
961 | state->VGAarg = 0; | 934 | state->VGAarg = 0; |
962 | state->bandselectarg = 0; | 935 | state->bandselectarg = 0; |
@@ -1009,7 +982,6 @@ static struct dvb_frontend_ops cx24123_ops = { | |||
1009 | .read_ber = cx24123_read_ber, | 982 | .read_ber = cx24123_read_ber, |
1010 | .read_signal_strength = cx24123_read_signal_strength, | 983 | .read_signal_strength = cx24123_read_signal_strength, |
1011 | .read_snr = cx24123_read_snr, | 984 | .read_snr = cx24123_read_snr, |
1012 | .read_ucblocks = cx24123_read_ucblocks, | ||
1013 | .diseqc_send_master_cmd = cx24123_send_diseqc_msg, | 985 | .diseqc_send_master_cmd = cx24123_send_diseqc_msg, |
1014 | .diseqc_send_burst = cx24123_diseqc_send_burst, | 986 | .diseqc_send_burst = cx24123_diseqc_send_burst, |
1015 | .set_tone = cx24123_set_tone, | 987 | .set_tone = cx24123_set_tone, |