aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci/budget.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/ttpci/budget.c')
-rw-r--r--drivers/media/dvb/ttpci/budget.c68
1 files changed, 43 insertions, 25 deletions
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index d238fb9371a7..b21bcce66708 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -200,19 +200,25 @@ static int budget_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t m
200 return 0; 200 return 0;
201} 201}
202 202
203static int alps_bsrv2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 203static int alps_bsrv2_tuner_set_params(struct dvb_frontend *fe)
204{ 204{
205 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
205 struct budget* budget = (struct budget*) fe->dvb->priv; 206 struct budget* budget = (struct budget*) fe->dvb->priv;
206 u8 pwr = 0; 207 u8 pwr = 0;
207 u8 buf[4]; 208 u8 buf[4];
208 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; 209 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) };
209 u32 div = (params->frequency + 479500) / 125; 210 u32 div = (c->frequency + 479500) / 125;
210 211
211 if (params->frequency > 2000000) pwr = 3; 212 if (c->frequency > 2000000)
212 else if (params->frequency > 1800000) pwr = 2; 213 pwr = 3;
213 else if (params->frequency > 1600000) pwr = 1; 214 else if (c->frequency > 1800000)
214 else if (params->frequency > 1200000) pwr = 0; 215 pwr = 2;
215 else if (params->frequency >= 1100000) pwr = 1; 216 else if (c->frequency > 1600000)
217 pwr = 1;
218 else if (c->frequency > 1200000)
219 pwr = 0;
220 else if (c->frequency >= 1100000)
221 pwr = 1;
216 else pwr = 2; 222 else pwr = 2;
217 223
218 buf[0] = (div >> 8) & 0x7f; 224 buf[0] = (div >> 8) & 0x7f;
@@ -236,19 +242,20 @@ static struct ves1x93_config alps_bsrv2_config =
236 .invert_pwm = 0, 242 .invert_pwm = 0,
237}; 243};
238 244
239static int alps_tdbe2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 245static int alps_tdbe2_tuner_set_params(struct dvb_frontend *fe)
240{ 246{
247 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
241 struct budget* budget = (struct budget*) fe->dvb->priv; 248 struct budget* budget = (struct budget*) fe->dvb->priv;
242 u32 div; 249 u32 div;
243 u8 data[4]; 250 u8 data[4];
244 struct i2c_msg msg = { .addr = 0x62, .flags = 0, .buf = data, .len = sizeof(data) }; 251 struct i2c_msg msg = { .addr = 0x62, .flags = 0, .buf = data, .len = sizeof(data) };
245 252
246 div = (params->frequency + 35937500 + 31250) / 62500; 253 div = (c->frequency + 35937500 + 31250) / 62500;
247 254
248 data[0] = (div >> 8) & 0x7f; 255 data[0] = (div >> 8) & 0x7f;
249 data[1] = div & 0xff; 256 data[1] = div & 0xff;
250 data[2] = 0x85 | ((div >> 10) & 0x60); 257 data[2] = 0x85 | ((div >> 10) & 0x60);
251 data[3] = (params->frequency < 174000000 ? 0x88 : params->frequency < 470000000 ? 0x84 : 0x81); 258 data[3] = (c->frequency < 174000000 ? 0x88 : c->frequency < 470000000 ? 0x84 : 0x81);
252 259
253 if (fe->ops.i2c_gate_ctrl) 260 if (fe->ops.i2c_gate_ctrl)
254 fe->ops.i2c_gate_ctrl(fe, 1); 261 fe->ops.i2c_gate_ctrl(fe, 1);
@@ -263,8 +270,9 @@ static struct ves1820_config alps_tdbe2_config = {
263 .selagc = VES1820_SELAGC_SIGNAMPERR, 270 .selagc = VES1820_SELAGC_SIGNAMPERR,
264}; 271};
265 272
266static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 273static int grundig_29504_401_tuner_set_params(struct dvb_frontend *fe)
267{ 274{
275 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
268 struct budget *budget = fe->dvb->priv; 276 struct budget *budget = fe->dvb->priv;
269 u8 *tuner_addr = fe->tuner_priv; 277 u8 *tuner_addr = fe->tuner_priv;
270 u32 div; 278 u32 div;
@@ -277,19 +285,27 @@ static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, struct dv
277 else 285 else
278 msg.addr = 0x61; 286 msg.addr = 0x61;
279 287
280 div = (36125000 + params->frequency) / 166666; 288 div = (36125000 + c->frequency) / 166666;
281 289
282 cfg = 0x88; 290 cfg = 0x88;
283 291
284 if (params->frequency < 175000000) cpump = 2; 292 if (c->frequency < 175000000)
285 else if (params->frequency < 390000000) cpump = 1; 293 cpump = 2;
286 else if (params->frequency < 470000000) cpump = 2; 294 else if (c->frequency < 390000000)
287 else if (params->frequency < 750000000) cpump = 1; 295 cpump = 1;
288 else cpump = 3; 296 else if (c->frequency < 470000000)
297 cpump = 2;
298 else if (c->frequency < 750000000)
299 cpump = 1;
300 else
301 cpump = 3;
289 302
290 if (params->frequency < 175000000) band_select = 0x0e; 303 if (c->frequency < 175000000)
291 else if (params->frequency < 470000000) band_select = 0x05; 304 band_select = 0x0e;
292 else band_select = 0x03; 305 else if (c->frequency < 470000000)
306 band_select = 0x05;
307 else
308 band_select = 0x03;
293 309
294 data[0] = (div >> 8) & 0x7f; 310 data[0] = (div >> 8) & 0x7f;
295 data[1] = div & 0xff; 311 data[1] = div & 0xff;
@@ -312,14 +328,15 @@ static struct l64781_config grundig_29504_401_config_activy = {
312 328
313static u8 tuner_address_grundig_29504_401_activy = 0x60; 329static u8 tuner_address_grundig_29504_401_activy = 0x60;
314 330
315static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 331static int grundig_29504_451_tuner_set_params(struct dvb_frontend *fe)
316{ 332{
333 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
317 struct budget* budget = (struct budget*) fe->dvb->priv; 334 struct budget* budget = (struct budget*) fe->dvb->priv;
318 u32 div; 335 u32 div;
319 u8 data[4]; 336 u8 data[4];
320 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; 337 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
321 338
322 div = params->frequency / 125; 339 div = c->frequency / 125;
323 data[0] = (div >> 8) & 0x7f; 340 data[0] = (div >> 8) & 0x7f;
324 data[1] = div & 0xff; 341 data[1] = div & 0xff;
325 data[2] = 0x8e; 342 data[2] = 0x8e;
@@ -335,14 +352,15 @@ static struct tda8083_config grundig_29504_451_config = {
335 .demod_address = 0x68, 352 .demod_address = 0x68,
336}; 353};
337 354
338static int s5h1420_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) 355static int s5h1420_tuner_set_params(struct dvb_frontend *fe)
339{ 356{
357 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
340 struct budget* budget = (struct budget*) fe->dvb->priv; 358 struct budget* budget = (struct budget*) fe->dvb->priv;
341 u32 div; 359 u32 div;
342 u8 data[4]; 360 u8 data[4];
343 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; 361 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
344 362
345 div = params->frequency / 1000; 363 div = c->frequency / 1000;
346 data[0] = (div >> 8) & 0x7f; 364 data[0] = (div >> 8) & 0x7f;
347 data[1] = div & 0xff; 365 data[1] = div & 0xff;
348 data[2] = 0xc2; 366 data[2] = 0xc2;