diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-20 19:49:12 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-31 05:27:01 -0500 |
commit | 82c0126ff2e3278ecf1d6c7d0bf71838e189dbdc (patch) | |
tree | 1507eb243233f53f68108b6209f0a286c0dae6fc | |
parent | 9f1791618a0d0e3c809706df4d4758a828b3ba5f (diff) |
[media] mt2266: use DVBv5 parameters for set_params()
Instead of using DVBv3 parameters, rely on DVBv5 parameters to
set the tuner.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/common/tuners/mt2266.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/media/common/tuners/mt2266.c b/drivers/media/common/tuners/mt2266.c index 25a8ea342c46..dd883d781968 100644 --- a/drivers/media/common/tuners/mt2266.c +++ b/drivers/media/common/tuners/mt2266.c | |||
@@ -124,6 +124,7 @@ static u8 mt2266_vhf[] = { 0x1d, 0xfe, 0x00, 0x00, 0xb4, 0x03, 0xa5, 0xa5, | |||
124 | 124 | ||
125 | static int mt2266_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 125 | static int mt2266_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
126 | { | 126 | { |
127 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
127 | struct mt2266_priv *priv; | 128 | struct mt2266_priv *priv; |
128 | int ret=0; | 129 | int ret=0; |
129 | u32 freq; | 130 | u32 freq; |
@@ -135,30 +136,32 @@ static int mt2266_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame | |||
135 | 136 | ||
136 | priv = fe->tuner_priv; | 137 | priv = fe->tuner_priv; |
137 | 138 | ||
138 | freq = params->frequency / 1000; // Hz -> kHz | 139 | freq = priv->frequency / 1000; /* Hz -> kHz */ |
139 | if (freq < 470000 && freq > 230000) | 140 | if (freq < 470000 && freq > 230000) |
140 | return -EINVAL; /* Gap between VHF and UHF bands */ | 141 | return -EINVAL; /* Gap between VHF and UHF bands */ |
141 | priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0; | ||
142 | priv->frequency = freq * 1000; | ||
143 | 142 | ||
143 | priv->frequency = c->frequency; | ||
144 | tune = 2 * freq * (8192/16) / (FREF/16); | 144 | tune = 2 * freq * (8192/16) / (FREF/16); |
145 | band = (freq < 300000) ? MT2266_VHF : MT2266_UHF; | 145 | band = (freq < 300000) ? MT2266_VHF : MT2266_UHF; |
146 | if (band == MT2266_VHF) | 146 | if (band == MT2266_VHF) |
147 | tune *= 2; | 147 | tune *= 2; |
148 | 148 | ||
149 | switch (params->u.ofdm.bandwidth) { | 149 | switch (c->bandwidth_hz) { |
150 | case BANDWIDTH_6_MHZ: | 150 | case 6000000: |
151 | mt2266_writeregs(priv, mt2266_init_6mhz, | 151 | mt2266_writeregs(priv, mt2266_init_6mhz, |
152 | sizeof(mt2266_init_6mhz)); | 152 | sizeof(mt2266_init_6mhz)); |
153 | priv->bandwidth = BANDWIDTH_6_MHZ; | ||
153 | break; | 154 | break; |
154 | case BANDWIDTH_7_MHZ: | 155 | case 8000000: |
155 | mt2266_writeregs(priv, mt2266_init_7mhz, | ||
156 | sizeof(mt2266_init_7mhz)); | ||
157 | break; | ||
158 | case BANDWIDTH_8_MHZ: | ||
159 | default: | ||
160 | mt2266_writeregs(priv, mt2266_init_8mhz, | 156 | mt2266_writeregs(priv, mt2266_init_8mhz, |
161 | sizeof(mt2266_init_8mhz)); | 157 | sizeof(mt2266_init_8mhz)); |
158 | priv->bandwidth = BANDWIDTH_8_MHZ; | ||
159 | break; | ||
160 | case 7000000: | ||
161 | default: | ||
162 | mt2266_writeregs(priv, mt2266_init_7mhz, | ||
163 | sizeof(mt2266_init_7mhz)); | ||
164 | priv->bandwidth = BANDWIDTH_7_MHZ; | ||
162 | break; | 165 | break; |
163 | } | 166 | } |
164 | 167 | ||