diff options
author | Patrick Boettcher <pb@linuxtv.org> | 2005-07-07 20:58:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-07 21:24:03 -0400 |
commit | d590f9c20e15620ba708e5bd71d345bf1b7b0d73 (patch) | |
tree | 938e37de3c945d3fb035f487a802ae574aa599a8 /drivers/media/dvb/dvb-usb/dtt200u-fe.c | |
parent | 4b2bd30eb79c292a83b1dfd3cca6d435c02fd5c0 (diff) |
[PATCH] dvb: usb: add supprt for WideView WT-220U
Add support and rewrote some parts with the help of vendor information
(Thanks to Steve Chang from WideView, Inc.):
o added support for the WT-220U (Pensize DVB-T receiver)
o corrected byte order for unc,ber and the pid filter
o corrected number of pids that can be fetched at the same time.
o added some comments in Kconfig-file
o added USB IDs for the WT-220U
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dtt200u-fe.c')
-rw-r--r-- | drivers/media/dvb/dvb-usb/dtt200u-fe.c | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/drivers/media/dvb/dvb-usb/dtt200u-fe.c b/drivers/media/dvb/dvb-usb/dtt200u-fe.c index 7807f33573b8..b032523b07bc 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u-fe.c +++ b/drivers/media/dvb/dvb-usb/dtt200u-fe.c | |||
@@ -14,61 +14,58 @@ | |||
14 | struct dtt200u_fe_state { | 14 | struct dtt200u_fe_state { |
15 | struct dvb_usb_device *d; | 15 | struct dvb_usb_device *d; |
16 | 16 | ||
17 | fe_status_t stat; | ||
18 | |||
17 | struct dvb_frontend_parameters fep; | 19 | struct dvb_frontend_parameters fep; |
18 | struct dvb_frontend frontend; | 20 | struct dvb_frontend frontend; |
19 | }; | 21 | }; |
20 | 22 | ||
21 | #define moan(which,what) info("unexpected value in '%s' for cmd '%02x' - please report to linux-dvb@linuxtv.org",which,what) | ||
22 | |||
23 | static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) | 23 | static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) |
24 | { | 24 | { |
25 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 25 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
26 | u8 bw = GET_TUNE_STAT; | 26 | u8 st = GET_TUNE_STATUS, b[3]; |
27 | u8 br[3] = { 0 }; | 27 | |
28 | // u8 bdeb[5] = { 0 }; | 28 | dvb_usb_generic_rw(state->d,&st,1,b,3,0); |
29 | 29 | ||
30 | dvb_usb_generic_rw(state->d,&bw,1,br,3,0); | 30 | switch (b[0]) { |
31 | switch (br[0]) { | ||
32 | case 0x01: | 31 | case 0x01: |
33 | *stat = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; | 32 | *stat = FE_HAS_SIGNAL | FE_HAS_CARRIER | |
33 | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; | ||
34 | break; | 34 | break; |
35 | case 0x00: | 35 | case 0x00: /* pending */ |
36 | *stat = 0; | 36 | *stat = FE_TIMEDOUT; /* during set_frontend */ |
37 | break; | 37 | break; |
38 | default: | 38 | default: |
39 | moan("br[0]",GET_TUNE_STAT); | 39 | case 0x02: /* failed */ |
40 | *stat = 0; | ||
40 | break; | 41 | break; |
41 | } | 42 | } |
42 | |||
43 | // bw[0] = 0x88; | ||
44 | // dvb_usb_generic_rw(state->d,bw,1,bdeb,5,0); | ||
45 | |||
46 | // deb_info("%02x: %02x %02x %02x %02x %02x\n",bw[0],bdeb[0],bdeb[1],bdeb[2],bdeb[3],bdeb[4]); | ||
47 | |||
48 | return 0; | 43 | return 0; |
49 | } | 44 | } |
45 | |||
50 | static int dtt200u_fe_read_ber(struct dvb_frontend* fe, u32 *ber) | 46 | static int dtt200u_fe_read_ber(struct dvb_frontend* fe, u32 *ber) |
51 | { | 47 | { |
52 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 48 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
53 | u8 bw = GET_BER; | 49 | u8 bw = GET_VIT_ERR_CNT,b[3]; |
54 | *ber = 0; | 50 | dvb_usb_generic_rw(state->d,&bw,1,b,3,0); |
55 | dvb_usb_generic_rw(state->d,&bw,1,(u8*) ber,3,0); | 51 | *ber = (b[0] << 16) | (b[1] << 8) | b[2]; |
56 | return 0; | 52 | return 0; |
57 | } | 53 | } |
58 | 54 | ||
59 | static int dtt200u_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | 55 | static int dtt200u_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) |
60 | { | 56 | { |
61 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 57 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
62 | u8 bw = GET_UNK; | 58 | u8 bw = GET_RS_UNCOR_BLK_CNT,b[2]; |
63 | *unc = 0; | 59 | |
64 | dvb_usb_generic_rw(state->d,&bw,1,(u8*) unc,3,0); | 60 | dvb_usb_generic_rw(state->d,&bw,1,b,2,0); |
61 | *unc = (b[0] << 8) | b[1]; | ||
65 | return 0; | 62 | return 0; |
66 | } | 63 | } |
67 | 64 | ||
68 | static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength) | 65 | static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength) |
69 | { | 66 | { |
70 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 67 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
71 | u8 bw = GET_SIG_STRENGTH, b; | 68 | u8 bw = GET_AGC, b; |
72 | dvb_usb_generic_rw(state->d,&bw,1,&b,1,0); | 69 | dvb_usb_generic_rw(state->d,&bw,1,&b,1,0); |
73 | *strength = (b << 8) | b; | 70 | *strength = (b << 8) | b; |
74 | return 0; | 71 | return 0; |
@@ -86,7 +83,7 @@ static int dtt200u_fe_read_snr(struct dvb_frontend* fe, u16 *snr) | |||
86 | static int dtt200u_fe_init(struct dvb_frontend* fe) | 83 | static int dtt200u_fe_init(struct dvb_frontend* fe) |
87 | { | 84 | { |
88 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 85 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
89 | u8 b = RESET_DEMOD; | 86 | u8 b = SET_INIT; |
90 | return dvb_usb_generic_write(state->d,&b,1); | 87 | return dvb_usb_generic_write(state->d,&b,1); |
91 | } | 88 | } |
92 | 89 | ||
@@ -98,8 +95,8 @@ static int dtt200u_fe_sleep(struct dvb_frontend* fe) | |||
98 | static int dtt200u_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) | 95 | static int dtt200u_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) |
99 | { | 96 | { |
100 | tune->min_delay_ms = 1500; | 97 | tune->min_delay_ms = 1500; |
101 | tune->step_size = 166667; | 98 | tune->step_size = 0; |
102 | tune->max_drift = 166667 * 2; | 99 | tune->max_drift = 0; |
103 | return 0; | 100 | return 0; |
104 | } | 101 | } |
105 | 102 | ||
@@ -107,27 +104,32 @@ static int dtt200u_fe_set_frontend(struct dvb_frontend* fe, | |||
107 | struct dvb_frontend_parameters *fep) | 104 | struct dvb_frontend_parameters *fep) |
108 | { | 105 | { |
109 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 106 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
107 | int i; | ||
108 | fe_status_t st; | ||
110 | u16 freq = fep->frequency / 250000; | 109 | u16 freq = fep->frequency / 250000; |
111 | u8 bw,bwbuf[2] = { SET_BANDWIDTH, 0 }, freqbuf[3] = { SET_FREQUENCY, 0, 0 }; | 110 | u8 bwbuf[2] = { SET_BANDWIDTH, 0 },freqbuf[3] = { SET_RF_FREQ, 0, 0 }; |
112 | 111 | ||
113 | switch (fep->u.ofdm.bandwidth) { | 112 | switch (fep->u.ofdm.bandwidth) { |
114 | case BANDWIDTH_8_MHZ: bw = 8; break; | 113 | case BANDWIDTH_8_MHZ: bwbuf[1] = 8; break; |
115 | case BANDWIDTH_7_MHZ: bw = 7; break; | 114 | case BANDWIDTH_7_MHZ: bwbuf[1] = 7; break; |
116 | case BANDWIDTH_6_MHZ: bw = 6; break; | 115 | case BANDWIDTH_6_MHZ: bwbuf[1] = 6; break; |
117 | case BANDWIDTH_AUTO: return -EOPNOTSUPP; | 116 | case BANDWIDTH_AUTO: return -EOPNOTSUPP; |
118 | default: | 117 | default: |
119 | return -EINVAL; | 118 | return -EINVAL; |
120 | } | 119 | } |
121 | deb_info("set_frontend\n"); | ||
122 | 120 | ||
123 | bwbuf[1] = bw; | ||
124 | dvb_usb_generic_write(state->d,bwbuf,2); | 121 | dvb_usb_generic_write(state->d,bwbuf,2); |
125 | 122 | ||
126 | freqbuf[1] = freq & 0xff; | 123 | freqbuf[1] = freq & 0xff; |
127 | freqbuf[2] = (freq >> 8) & 0xff; | 124 | freqbuf[2] = (freq >> 8) & 0xff; |
128 | dvb_usb_generic_write(state->d,freqbuf,3); | 125 | dvb_usb_generic_write(state->d,freqbuf,3); |
129 | 126 | ||
130 | memcpy(&state->fep,fep,sizeof(struct dvb_frontend_parameters)); | 127 | for (i = 0; i < 30; i++) { |
128 | msleep(20); | ||
129 | dtt200u_fe_read_status(fe, &st); | ||
130 | if (st & FE_TIMEDOUT) | ||
131 | continue; | ||
132 | } | ||
131 | 133 | ||
132 | return 0; | 134 | return 0; |
133 | } | 135 | } |
@@ -174,7 +176,7 @@ success: | |||
174 | 176 | ||
175 | static struct dvb_frontend_ops dtt200u_fe_ops = { | 177 | static struct dvb_frontend_ops dtt200u_fe_ops = { |
176 | .info = { | 178 | .info = { |
177 | .name = "DTT200U (Yakumo/Typhoon/Hama) DVB-T", | 179 | .name = "WideView USB DVB-T", |
178 | .type = FE_OFDM, | 180 | .type = FE_OFDM, |
179 | .frequency_min = 44250000, | 181 | .frequency_min = 44250000, |
180 | .frequency_max = 867250000, | 182 | .frequency_max = 867250000, |