aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/common/tuners/max2165.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/drivers/media/common/tuners/max2165.c b/drivers/media/common/tuners/max2165.c
index 9883617b7862..03434491e333 100644
--- a/drivers/media/common/tuners/max2165.c
+++ b/drivers/media/common/tuners/max2165.c
@@ -151,7 +151,7 @@ static int max2165_set_bandwidth(struct max2165_priv *priv, u32 bw)
151{ 151{
152 u8 val; 152 u8 val;
153 153
154 if (bw == BANDWIDTH_8_MHZ) 154 if (bw == 8000000)
155 val = priv->bb_filter_8mhz_cfg; 155 val = priv->bb_filter_8mhz_cfg;
156 else 156 else
157 val = priv->bb_filter_7mhz_cfg; 157 val = priv->bb_filter_7mhz_cfg;
@@ -261,35 +261,25 @@ static int max2165_set_params(struct dvb_frontend *fe,
261 struct dvb_frontend_parameters *params) 261 struct dvb_frontend_parameters *params)
262{ 262{
263 struct max2165_priv *priv = fe->tuner_priv; 263 struct max2165_priv *priv = fe->tuner_priv;
264 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
264 int ret; 265 int ret;
265 266
266 dprintk("%s() frequency=%d (Hz)\n", __func__, params->frequency); 267 switch (c->bandwidth_hz) {
267 if (fe->ops.info.type == FE_ATSC) { 268 case 7000000:
268 return -EINVAL; 269 case 8000000:
269 } else if (fe->ops.info.type == FE_OFDM) { 270 priv->frequency = c->frequency;
270 dprintk("%s() OFDM\n", __func__); 271 break;
271 switch (params->u.ofdm.bandwidth) { 272 default:
272 case BANDWIDTH_6_MHZ: 273 printk(KERN_INFO "MAX2165: bandwidth %d Hz not supported.\n",
273 return -EINVAL; 274 c->bandwidth_hz);
274 case BANDWIDTH_7_MHZ:
275 case BANDWIDTH_8_MHZ:
276 priv->frequency = params->frequency;
277 priv->bandwidth = params->u.ofdm.bandwidth;
278 break;
279 default:
280 printk(KERN_ERR "MAX2165 bandwidth not set!\n");
281 return -EINVAL;
282 }
283 } else {
284 printk(KERN_ERR "MAX2165 modulation type not supported!\n");
285 return -EINVAL; 275 return -EINVAL;
286 } 276 }
287 277
288 dprintk("%s() frequency=%d\n", __func__, priv->frequency); 278 dprintk("%s() frequency=%d\n", __func__, c->frequency);
289 279
290 if (fe->ops.i2c_gate_ctrl) 280 if (fe->ops.i2c_gate_ctrl)
291 fe->ops.i2c_gate_ctrl(fe, 1); 281 fe->ops.i2c_gate_ctrl(fe, 1);
292 max2165_set_bandwidth(priv, priv->bandwidth); 282 max2165_set_bandwidth(priv, c->bandwidth_hz);
293 ret = max2165_set_rf(priv, priv->frequency); 283 ret = max2165_set_rf(priv, priv->frequency);
294 mdelay(50); 284 mdelay(50);
295 max2165_debug_status(priv); 285 max2165_debug_status(priv);
@@ -370,7 +360,7 @@ static int max2165_init(struct dvb_frontend *fe)
370 360
371 max2165_read_rom_table(priv); 361 max2165_read_rom_table(priv);
372 362
373 max2165_set_bandwidth(priv, BANDWIDTH_8_MHZ); 363 max2165_set_bandwidth(priv, 8000000);
374 364
375 if (fe->ops.i2c_gate_ctrl) 365 if (fe->ops.i2c_gate_ctrl)
376 fe->ops.i2c_gate_ctrl(fe, 0); 366 fe->ops.i2c_gate_ctrl(fe, 0);