diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb-frontends/rtl2830.c | 57 | ||||
-rw-r--r-- | drivers/media/dvb-frontends/rtl2830.h | 7 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 3 |
3 files changed, 33 insertions, 34 deletions
diff --git a/drivers/media/dvb-frontends/rtl2830.c b/drivers/media/dvb-frontends/rtl2830.c index eca1d72f0684..3954760f2bde 100644 --- a/drivers/media/dvb-frontends/rtl2830.c +++ b/drivers/media/dvb-frontends/rtl2830.c | |||
@@ -182,9 +182,6 @@ static int rtl2830_init(struct dvb_frontend *fe) | |||
182 | { | 182 | { |
183 | struct rtl2830_priv *priv = fe->demodulator_priv; | 183 | struct rtl2830_priv *priv = fe->demodulator_priv; |
184 | int ret, i; | 184 | int ret, i; |
185 | u64 num; | ||
186 | u8 buf[3], tmp; | ||
187 | u32 if_ctl; | ||
188 | struct rtl2830_reg_val_mask tab[] = { | 185 | struct rtl2830_reg_val_mask tab[] = { |
189 | { 0x00d, 0x01, 0x03 }, | 186 | { 0x00d, 0x01, 0x03 }, |
190 | { 0x00d, 0x10, 0x10 }, | 187 | { 0x00d, 0x10, 0x10 }, |
@@ -240,26 +237,6 @@ static int rtl2830_init(struct dvb_frontend *fe) | |||
240 | if (ret) | 237 | if (ret) |
241 | goto err; | 238 | goto err; |
242 | 239 | ||
243 | num = priv->cfg.if_dvbt % priv->cfg.xtal; | ||
244 | num *= 0x400000; | ||
245 | num = div_u64(num, priv->cfg.xtal); | ||
246 | num = -num; | ||
247 | if_ctl = num & 0x3fffff; | ||
248 | dev_dbg(&priv->i2c->dev, "%s: if_ctl=%08x\n", __func__, if_ctl); | ||
249 | |||
250 | ret = rtl2830_rd_reg_mask(priv, 0x119, &tmp, 0xc0); /* b[7:6] */ | ||
251 | if (ret) | ||
252 | goto err; | ||
253 | |||
254 | buf[0] = tmp << 6; | ||
255 | buf[0] = (if_ctl >> 16) & 0x3f; | ||
256 | buf[1] = (if_ctl >> 8) & 0xff; | ||
257 | buf[2] = (if_ctl >> 0) & 0xff; | ||
258 | |||
259 | ret = rtl2830_wr_regs(priv, 0x119, buf, 3); | ||
260 | if (ret) | ||
261 | goto err; | ||
262 | |||
263 | /* TODO: spec init */ | 240 | /* TODO: spec init */ |
264 | 241 | ||
265 | /* soft reset */ | 242 | /* soft reset */ |
@@ -301,6 +278,9 @@ static int rtl2830_set_frontend(struct dvb_frontend *fe) | |||
301 | struct rtl2830_priv *priv = fe->demodulator_priv; | 278 | struct rtl2830_priv *priv = fe->demodulator_priv; |
302 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 279 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
303 | int ret, i; | 280 | int ret, i; |
281 | u64 num; | ||
282 | u8 buf[3], tmp; | ||
283 | u32 if_ctl, if_frequency; | ||
304 | static u8 bw_params1[3][34] = { | 284 | static u8 bw_params1[3][34] = { |
305 | { | 285 | { |
306 | 0x1f, 0xf0, 0x1f, 0xf0, 0x1f, 0xfa, 0x00, 0x17, 0x00, 0x41, | 286 | 0x1f, 0xf0, 0x1f, 0xf0, 0x1f, 0xfa, 0x00, 0x17, 0x00, 0x41, |
@@ -325,7 +305,6 @@ static int rtl2830_set_frontend(struct dvb_frontend *fe) | |||
325 | {0xae, 0xba, 0xf3, 0x26, 0x66, 0x64,}, /* 8 MHz */ | 305 | {0xae, 0xba, 0xf3, 0x26, 0x66, 0x64,}, /* 8 MHz */ |
326 | }; | 306 | }; |
327 | 307 | ||
328 | |||
329 | dev_dbg(&priv->i2c->dev, | 308 | dev_dbg(&priv->i2c->dev, |
330 | "%s: frequency=%d bandwidth_hz=%d inversion=%d\n", | 309 | "%s: frequency=%d bandwidth_hz=%d inversion=%d\n", |
331 | __func__, c->frequency, c->bandwidth_hz, c->inversion); | 310 | __func__, c->frequency, c->bandwidth_hz, c->inversion); |
@@ -353,6 +332,36 @@ static int rtl2830_set_frontend(struct dvb_frontend *fe) | |||
353 | if (ret) | 332 | if (ret) |
354 | goto err; | 333 | goto err; |
355 | 334 | ||
335 | /* program if frequency */ | ||
336 | if (fe->ops.tuner_ops.get_if_frequency) | ||
337 | ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency); | ||
338 | else | ||
339 | ret = -EINVAL; | ||
340 | |||
341 | if (ret < 0) | ||
342 | goto err; | ||
343 | |||
344 | num = if_frequency % priv->cfg.xtal; | ||
345 | num *= 0x400000; | ||
346 | num = div_u64(num, priv->cfg.xtal); | ||
347 | num = -num; | ||
348 | if_ctl = num & 0x3fffff; | ||
349 | dev_dbg(&priv->i2c->dev, "%s: if_frequency=%d if_ctl=%08x\n", | ||
350 | __func__, if_frequency, if_ctl); | ||
351 | |||
352 | ret = rtl2830_rd_reg_mask(priv, 0x119, &tmp, 0xc0); /* b[7:6] */ | ||
353 | if (ret) | ||
354 | goto err; | ||
355 | |||
356 | buf[0] = tmp << 6; | ||
357 | buf[0] |= (if_ctl >> 16) & 0x3f; | ||
358 | buf[1] = (if_ctl >> 8) & 0xff; | ||
359 | buf[2] = (if_ctl >> 0) & 0xff; | ||
360 | |||
361 | ret = rtl2830_wr_regs(priv, 0x119, buf, 3); | ||
362 | if (ret) | ||
363 | goto err; | ||
364 | |||
356 | /* 1/2 split I2C write */ | 365 | /* 1/2 split I2C write */ |
357 | ret = rtl2830_wr_regs(priv, 0x11c, &bw_params1[i][0], 17); | 366 | ret = rtl2830_wr_regs(priv, 0x11c, &bw_params1[i][0], 17); |
358 | if (ret) | 367 | if (ret) |
diff --git a/drivers/media/dvb-frontends/rtl2830.h b/drivers/media/dvb-frontends/rtl2830.h index e125166eed95..f4349a1fc03e 100644 --- a/drivers/media/dvb-frontends/rtl2830.h +++ b/drivers/media/dvb-frontends/rtl2830.h | |||
@@ -47,13 +47,6 @@ struct rtl2830_config { | |||
47 | bool spec_inv; | 47 | bool spec_inv; |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * IFs for all used modes. | ||
51 | * Hz | ||
52 | * 4570000, 4571429, 36000000, 36125000, 36166667, 44000000 | ||
53 | */ | ||
54 | u32 if_dvbt; | ||
55 | |||
56 | /* | ||
57 | */ | 50 | */ |
58 | u8 vtop; | 51 | u8 vtop; |
59 | 52 | ||
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index 31c9f440a4e2..c3e2602af81e 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c | |||
@@ -259,7 +259,6 @@ static struct rtl2830_config rtl28xxu_rtl2830_mt2060_config = { | |||
259 | .xtal = 28800000, | 259 | .xtal = 28800000, |
260 | .ts_mode = 0, | 260 | .ts_mode = 0, |
261 | .spec_inv = 1, | 261 | .spec_inv = 1, |
262 | .if_dvbt = 36150000, | ||
263 | .vtop = 0x20, | 262 | .vtop = 0x20, |
264 | .krf = 0x04, | 263 | .krf = 0x04, |
265 | .agc_targ_val = 0x2d, | 264 | .agc_targ_val = 0x2d, |
@@ -271,7 +270,6 @@ static struct rtl2830_config rtl28xxu_rtl2830_qt1010_config = { | |||
271 | .xtal = 28800000, | 270 | .xtal = 28800000, |
272 | .ts_mode = 0, | 271 | .ts_mode = 0, |
273 | .spec_inv = 1, | 272 | .spec_inv = 1, |
274 | .if_dvbt = 36125000, | ||
275 | .vtop = 0x20, | 273 | .vtop = 0x20, |
276 | .krf = 0x04, | 274 | .krf = 0x04, |
277 | .agc_targ_val = 0x2d, | 275 | .agc_targ_val = 0x2d, |
@@ -282,7 +280,6 @@ static struct rtl2830_config rtl28xxu_rtl2830_mxl5005s_config = { | |||
282 | .xtal = 28800000, | 280 | .xtal = 28800000, |
283 | .ts_mode = 0, | 281 | .ts_mode = 0, |
284 | .spec_inv = 0, | 282 | .spec_inv = 0, |
285 | .if_dvbt = 4570000, | ||
286 | .vtop = 0x3f, | 283 | .vtop = 0x3f, |
287 | .krf = 0x04, | 284 | .krf = 0x04, |
288 | .agc_targ_val = 0x3e, | 285 | .agc_targ_val = 0x3e, |