diff options
author | Steven Toth <stoth@linuxtv.org> | 2008-10-16 19:22:01 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-17 16:27:34 -0400 |
commit | f11ec7d4ee4308592dbd9b1db645ab14fe32719c (patch) | |
tree | b34dec1b2416a86ef4a4e8aeb032179de695a299 /drivers | |
parent | d93356a22014f555ab6f9fbeb697fc73b565841a (diff) |
V4L/DVB (9254): cx24116: Checkpatch compliance #2
cx24116: Checkpatch compliance #2
Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/frontends/cx24116.c | 493 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/cx24116.h | 19 |
2 files changed, 266 insertions, 246 deletions
diff --git a/drivers/media/dvb/frontends/cx24116.c b/drivers/media/dvb/frontends/cx24116.c index deb36f469ada..751792a092e2 100644 --- a/drivers/media/dvb/frontends/cx24116.c +++ b/drivers/media/dvb/frontends/cx24116.c | |||
@@ -41,10 +41,14 @@ | |||
41 | #include "dvb_frontend.h" | 41 | #include "dvb_frontend.h" |
42 | #include "cx24116.h" | 42 | #include "cx24116.h" |
43 | 43 | ||
44 | static int debug = 0; | 44 | static int debug; |
45 | module_param(debug, int, 0644); | ||
46 | MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); | ||
47 | |||
45 | #define dprintk(args...) \ | 48 | #define dprintk(args...) \ |
46 | do { \ | 49 | do { \ |
47 | if (debug) printk ("cx24116: " args); \ | 50 | if (debug) \ |
51 | printk("cx24116: " args); \ | ||
48 | } while (0) | 52 | } while (0) |
49 | 53 | ||
50 | #define CX24116_DEFAULT_FIRMWARE "dvb-fe-cx24116.fw" | 54 | #define CX24116_DEFAULT_FIRMWARE "dvb-fe-cx24116.fw" |
@@ -116,12 +120,15 @@ static int debug = 0; | |||
116 | 120 | ||
117 | /* DiSEqC tone burst */ | 121 | /* DiSEqC tone burst */ |
118 | static int toneburst = 1; | 122 | static int toneburst = 1; |
123 | module_param(toneburst, int, 0644); | ||
124 | MODULE_PARM_DESC(toneburst, "DiSEqC toneburst 0=OFF, 1=TONE CACHE, 2=MESSAGE CACHE (default:1)"); | ||
119 | 125 | ||
120 | /* SNR measurements */ | 126 | /* SNR measurements */ |
121 | static int esno_snr = 0; | 127 | static int esno_snr; |
128 | module_param(esno_snr, int, 0644); | ||
129 | MODULE_PARM_DESC(debug, "SNR return units, 0=PERCENTAGE 0-100, 1=ESNO(db * 10) (default:0)"); | ||
122 | 130 | ||
123 | enum cmds | 131 | enum cmds { |
124 | { | ||
125 | CMD_SET_VCO = 0x10, | 132 | CMD_SET_VCO = 0x10, |
126 | CMD_TUNEREQUEST = 0x11, | 133 | CMD_TUNEREQUEST = 0x11, |
127 | CMD_MPEGCONFIG = 0x13, | 134 | CMD_MPEGCONFIG = 0x13, |
@@ -138,8 +145,7 @@ enum cmds | |||
138 | }; | 145 | }; |
139 | 146 | ||
140 | /* The Demod/Tuner can't easily provide these, we cache them */ | 147 | /* The Demod/Tuner can't easily provide these, we cache them */ |
141 | struct cx24116_tuning | 148 | struct cx24116_tuning { |
142 | { | ||
143 | u32 frequency; | 149 | u32 frequency; |
144 | u32 symbol_rate; | 150 | u32 symbol_rate; |
145 | fe_spectral_inversion_t inversion; | 151 | fe_spectral_inversion_t inversion; |
@@ -158,16 +164,14 @@ struct cx24116_tuning | |||
158 | }; | 164 | }; |
159 | 165 | ||
160 | /* Basic commands that are sent to the firmware */ | 166 | /* Basic commands that are sent to the firmware */ |
161 | struct cx24116_cmd | 167 | struct cx24116_cmd { |
162 | { | ||
163 | u8 len; | 168 | u8 len; |
164 | u8 args[CX24116_ARGLEN]; | 169 | u8 args[CX24116_ARGLEN]; |
165 | }; | 170 | }; |
166 | 171 | ||
167 | struct cx24116_state | 172 | struct cx24116_state { |
168 | { | 173 | struct i2c_adapter *i2c; |
169 | struct i2c_adapter* i2c; | 174 | const struct cx24116_config *config; |
170 | const struct cx24116_config* config; | ||
171 | 175 | ||
172 | struct dvb_frontend frontend; | 176 | struct dvb_frontend frontend; |
173 | 177 | ||
@@ -179,18 +183,19 @@ struct cx24116_state | |||
179 | struct cx24116_cmd dsec_cmd; | 183 | struct cx24116_cmd dsec_cmd; |
180 | }; | 184 | }; |
181 | 185 | ||
182 | static int cx24116_writereg(struct cx24116_state* state, int reg, int data) | 186 | static int cx24116_writereg(struct cx24116_state *state, int reg, int data) |
183 | { | 187 | { |
184 | u8 buf[] = { reg, data }; | 188 | u8 buf[] = { reg, data }; |
185 | struct i2c_msg msg = { .addr = state->config->demod_address, | 189 | struct i2c_msg msg = { .addr = state->config->demod_address, |
186 | .flags = 0, .buf = buf, .len = 2 }; | 190 | .flags = 0, .buf = buf, .len = 2 }; |
187 | int err; | 191 | int err; |
188 | 192 | ||
189 | if (debug>1) | 193 | if (debug > 1) |
190 | printk("cx24116: %s: write reg 0x%02x, value 0x%02x\n", | 194 | printk("cx24116: %s: write reg 0x%02x, value 0x%02x\n", |
191 | __func__,reg, data); | 195 | __func__, reg, data); |
192 | 196 | ||
193 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 197 | err = i2c_transfer(state->i2c, &msg, 1); |
198 | if (err != 1) { | ||
194 | printk("%s: writereg error(err == %i, reg == 0x%02x," | 199 | printk("%s: writereg error(err == %i, reg == 0x%02x," |
195 | " value == 0x%02x)\n", __func__, err, reg, data); | 200 | " value == 0x%02x)\n", __func__, err, reg, data); |
196 | return -EREMOTEIO; | 201 | return -EREMOTEIO; |
@@ -200,7 +205,8 @@ static int cx24116_writereg(struct cx24116_state* state, int reg, int data) | |||
200 | } | 205 | } |
201 | 206 | ||
202 | /* Bulk byte writes to a single I2C address, for 32k firmware load */ | 207 | /* Bulk byte writes to a single I2C address, for 32k firmware load */ |
203 | static int cx24116_writeregN(struct cx24116_state* state, int reg, u8 *data, u16 len) | 208 | static int cx24116_writeregN(struct cx24116_state *state, int reg, |
209 | u8 *data, u16 len) | ||
204 | { | 210 | { |
205 | int ret = -EREMOTEIO; | 211 | int ret = -EREMOTEIO; |
206 | struct i2c_msg msg; | 212 | struct i2c_msg msg; |
@@ -221,11 +227,12 @@ static int cx24116_writeregN(struct cx24116_state* state, int reg, u8 *data, u16 | |||
221 | msg.buf = buf; | 227 | msg.buf = buf; |
222 | msg.len = len + 1; | 228 | msg.len = len + 1; |
223 | 229 | ||
224 | if (debug>1) | 230 | if (debug > 1) |
225 | printk("cx24116: %s: write regN 0x%02x, len = %d\n", | 231 | printk("cx24116: %s: write regN 0x%02x, len = %d\n", |
226 | __func__,reg, len); | 232 | __func__, reg, len); |
227 | 233 | ||
228 | if ((ret = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 234 | ret = i2c_transfer(state->i2c, &msg, 1); |
235 | if (ret != 1) { | ||
229 | printk("%s: writereg error(err == %i, reg == 0x%02x\n", | 236 | printk("%s: writereg error(err == %i, reg == 0x%02x\n", |
230 | __func__, ret, reg); | 237 | __func__, ret, reg); |
231 | ret = -EREMOTEIO; | 238 | ret = -EREMOTEIO; |
@@ -237,14 +244,16 @@ error: | |||
237 | return ret; | 244 | return ret; |
238 | } | 245 | } |
239 | 246 | ||
240 | static int cx24116_readreg(struct cx24116_state* state, u8 reg) | 247 | static int cx24116_readreg(struct cx24116_state *state, u8 reg) |
241 | { | 248 | { |
242 | int ret; | 249 | int ret; |
243 | u8 b0[] = { reg }; | 250 | u8 b0[] = { reg }; |
244 | u8 b1[] = { 0 }; | 251 | u8 b1[] = { 0 }; |
245 | struct i2c_msg msg[] = { | 252 | struct i2c_msg msg[] = { |
246 | { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }, | 253 | { .addr = state->config->demod_address, .flags = 0, |
247 | { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } | 254 | .buf = b0, .len = 1 }, |
255 | { .addr = state->config->demod_address, .flags = I2C_M_RD, | ||
256 | .buf = b1, .len = 1 } | ||
248 | }; | 257 | }; |
249 | 258 | ||
250 | ret = i2c_transfer(state->i2c, msg, 2); | 259 | ret = i2c_transfer(state->i2c, msg, 2); |
@@ -254,13 +263,14 @@ static int cx24116_readreg(struct cx24116_state* state, u8 reg) | |||
254 | return ret; | 263 | return ret; |
255 | } | 264 | } |
256 | 265 | ||
257 | if (debug>1) | 266 | if (debug > 1) |
258 | printk("cx24116: read reg 0x%02x, value 0x%02x\n",reg, b1[0]); | 267 | printk("cx24116: read reg 0x%02x, value 0x%02x\n", |
268 | reg, b1[0]); | ||
259 | 269 | ||
260 | return b1[0]; | 270 | return b1[0]; |
261 | } | 271 | } |
262 | 272 | ||
263 | static int cx24116_set_inversion(struct cx24116_state* state, fe_spectral_inversion_t inversion) | 273 | static int cx24116_set_inversion(struct cx24116_state *state, fe_spectral_inversion_t inversion) |
264 | { | 274 | { |
265 | dprintk("%s(%d)\n", __func__, inversion); | 275 | dprintk("%s(%d)\n", __func__, inversion); |
266 | 276 | ||
@@ -389,18 +399,16 @@ struct cx24116_modfec { | |||
389 | */ | 399 | */ |
390 | }; | 400 | }; |
391 | 401 | ||
392 | static int cx24116_lookup_fecmod(struct cx24116_state* state, | 402 | static int cx24116_lookup_fecmod(struct cx24116_state *state, |
393 | fe_modulation_t m, fe_code_rate_t f) | 403 | fe_modulation_t m, fe_code_rate_t f) |
394 | { | 404 | { |
395 | int i, ret = -EOPNOTSUPP; | 405 | int i, ret = -EOPNOTSUPP; |
396 | 406 | ||
397 | dprintk("%s(0x%02x,0x%02x)\n", __func__, m, f); | 407 | dprintk("%s(0x%02x,0x%02x)\n", __func__, m, f); |
398 | 408 | ||
399 | for(i=0 ; i < sizeof(CX24116_MODFEC_MODES) / sizeof(struct cx24116_modfec) ; i++) | 409 | for (i = 0; i < ARRAY_SIZE(CX24116_MODFEC_MODES); i++) { |
400 | { | 410 | if ((m == CX24116_MODFEC_MODES[i].modulation) && |
401 | if( (m == CX24116_MODFEC_MODES[i].modulation) && | 411 | (f == CX24116_MODFEC_MODES[i].fec)) { |
402 | (f == CX24116_MODFEC_MODES[i].fec) ) | ||
403 | { | ||
404 | ret = i; | 412 | ret = i; |
405 | break; | 413 | break; |
406 | } | 414 | } |
@@ -409,7 +417,7 @@ static int cx24116_lookup_fecmod(struct cx24116_state* state, | |||
409 | return ret; | 417 | return ret; |
410 | } | 418 | } |
411 | 419 | ||
412 | static int cx24116_set_fec(struct cx24116_state* state, fe_modulation_t mod, fe_code_rate_t fec) | 420 | static int cx24116_set_fec(struct cx24116_state *state, fe_modulation_t mod, fe_code_rate_t fec) |
413 | { | 421 | { |
414 | int ret = 0; | 422 | int ret = 0; |
415 | 423 | ||
@@ -417,7 +425,7 @@ static int cx24116_set_fec(struct cx24116_state* state, fe_modulation_t mod, fe_ | |||
417 | 425 | ||
418 | ret = cx24116_lookup_fecmod(state, mod, fec); | 426 | ret = cx24116_lookup_fecmod(state, mod, fec); |
419 | 427 | ||
420 | if(ret < 0) | 428 | if (ret < 0) |
421 | return ret; | 429 | return ret; |
422 | 430 | ||
423 | state->dnxt.fec = fec; | 431 | state->dnxt.fec = fec; |
@@ -429,7 +437,7 @@ static int cx24116_set_fec(struct cx24116_state* state, fe_modulation_t mod, fe_ | |||
429 | return 0; | 437 | return 0; |
430 | } | 438 | } |
431 | 439 | ||
432 | static int cx24116_set_symbolrate(struct cx24116_state* state, u32 rate) | 440 | static int cx24116_set_symbolrate(struct cx24116_state *state, u32 rate) |
433 | { | 441 | { |
434 | dprintk("%s(%d)\n", __func__, rate); | 442 | dprintk("%s(%d)\n", __func__, rate); |
435 | 443 | ||
@@ -446,18 +454,18 @@ static int cx24116_set_symbolrate(struct cx24116_state* state, u32 rate) | |||
446 | return 0; | 454 | return 0; |
447 | } | 455 | } |
448 | 456 | ||
449 | static int cx24116_load_firmware (struct dvb_frontend* fe, const struct firmware *fw); | 457 | static int cx24116_load_firmware(struct dvb_frontend *fe, |
458 | const struct firmware *fw); | ||
450 | 459 | ||
451 | static int cx24116_firmware_ondemand(struct dvb_frontend* fe) | 460 | static int cx24116_firmware_ondemand(struct dvb_frontend *fe) |
452 | { | 461 | { |
453 | struct cx24116_state *state = fe->demodulator_priv; | 462 | struct cx24116_state *state = fe->demodulator_priv; |
454 | const struct firmware *fw; | 463 | const struct firmware *fw; |
455 | int ret = 0; | 464 | int ret = 0; |
456 | 465 | ||
457 | dprintk("%s()\n",__func__); | 466 | dprintk("%s()\n", __func__); |
458 | 467 | ||
459 | if (cx24116_readreg(state, 0x20) > 0) | 468 | if (cx24116_readreg(state, 0x20) > 0) { |
460 | { | ||
461 | 469 | ||
462 | if (state->skip_fw_load) | 470 | if (state->skip_fw_load) |
463 | return 0; | 471 | return 0; |
@@ -491,7 +499,7 @@ static int cx24116_firmware_ondemand(struct dvb_frontend* fe) | |||
491 | } | 499 | } |
492 | 500 | ||
493 | /* Take a basic firmware command structure, format it and forward it for processing */ | 501 | /* Take a basic firmware command structure, format it and forward it for processing */ |
494 | static int cx24116_cmd_execute(struct dvb_frontend* fe, struct cx24116_cmd *cmd) | 502 | static int cx24116_cmd_execute(struct dvb_frontend *fe, struct cx24116_cmd *cmd) |
495 | { | 503 | { |
496 | struct cx24116_state *state = fe->demodulator_priv; | 504 | struct cx24116_state *state = fe->demodulator_priv; |
497 | int i, ret; | 505 | int i, ret; |
@@ -499,26 +507,23 @@ static int cx24116_cmd_execute(struct dvb_frontend* fe, struct cx24116_cmd *cmd) | |||
499 | dprintk("%s()\n", __func__); | 507 | dprintk("%s()\n", __func__); |
500 | 508 | ||
501 | /* Load the firmware if required */ | 509 | /* Load the firmware if required */ |
502 | if ( (ret = cx24116_firmware_ondemand(fe)) != 0) | 510 | ret = cx24116_firmware_ondemand(fe); |
503 | { | 511 | if (ret != 0) { |
504 | printk("%s(): Unable initialise the firmware\n", __func__); | 512 | printk("%s(): Unable initialise the firmware\n", __func__); |
505 | return ret; | 513 | return ret; |
506 | } | 514 | } |
507 | 515 | ||
508 | /* Write the command */ | 516 | /* Write the command */ |
509 | for(i = 0; i < cmd->len ; i++) | 517 | for (i = 0; i < cmd->len ; i++) { |
510 | { | ||
511 | dprintk("%s: 0x%02x == 0x%02x\n", __func__, i, cmd->args[i]); | 518 | dprintk("%s: 0x%02x == 0x%02x\n", __func__, i, cmd->args[i]); |
512 | cx24116_writereg(state, i, cmd->args[i]); | 519 | cx24116_writereg(state, i, cmd->args[i]); |
513 | } | 520 | } |
514 | 521 | ||
515 | /* Start execution and wait for cmd to terminate */ | 522 | /* Start execution and wait for cmd to terminate */ |
516 | cx24116_writereg(state, CX24116_REG_EXECUTE, 0x01); | 523 | cx24116_writereg(state, CX24116_REG_EXECUTE, 0x01); |
517 | while( cx24116_readreg(state, CX24116_REG_EXECUTE) ) | 524 | while (cx24116_readreg(state, CX24116_REG_EXECUTE)) { |
518 | { | ||
519 | msleep(10); | 525 | msleep(10); |
520 | if(i++ > 64) | 526 | if (i++ > 64) { |
521 | { | ||
522 | /* Avoid looping forever if the firmware does no respond */ | 527 | /* Avoid looping forever if the firmware does no respond */ |
523 | printk("%s() Firmware not responding\n", __func__); | 528 | printk("%s() Firmware not responding\n", __func__); |
524 | return -EREMOTEIO; | 529 | return -EREMOTEIO; |
@@ -527,21 +532,21 @@ static int cx24116_cmd_execute(struct dvb_frontend* fe, struct cx24116_cmd *cmd) | |||
527 | return 0; | 532 | return 0; |
528 | } | 533 | } |
529 | 534 | ||
530 | static int cx24116_load_firmware (struct dvb_frontend* fe, const struct firmware *fw) | 535 | static int cx24116_load_firmware(struct dvb_frontend *fe, |
536 | const struct firmware *fw) | ||
531 | { | 537 | { |
532 | struct cx24116_state* state = fe->demodulator_priv; | 538 | struct cx24116_state *state = fe->demodulator_priv; |
533 | struct cx24116_cmd cmd; | 539 | struct cx24116_cmd cmd; |
534 | int i, ret; | 540 | int i, ret; |
535 | unsigned char vers[4]; | 541 | unsigned char vers[4]; |
536 | 542 | ||
537 | dprintk("%s\n", __func__); | 543 | dprintk("%s\n", __func__); |
538 | dprintk("Firmware is %zu bytes (%02x %02x .. %02x %02x)\n" | 544 | dprintk("Firmware is %zu bytes (%02x %02x .. %02x %02x)\n", |
539 | ,fw->size | 545 | fw->size, |
540 | ,fw->data[0] | 546 | fw->data[0], |
541 | ,fw->data[1] | 547 | fw->data[1], |
542 | ,fw->data[ fw->size-2 ] | 548 | fw->data[fw->size-2], |
543 | ,fw->data[ fw->size-1 ] | 549 | fw->data[fw->size-1]); |
544 | ); | ||
545 | 550 | ||
546 | /* Toggle 88x SRST pin to reset demod */ | 551 | /* Toggle 88x SRST pin to reset demod */ |
547 | if (state->config->reset_device) | 552 | if (state->config->reset_device) |
@@ -587,7 +592,7 @@ static int cx24116_load_firmware (struct dvb_frontend* fe, const struct firmware | |||
587 | cmd.args[0x07] = 0x9d; | 592 | cmd.args[0x07] = 0x9d; |
588 | cmd.args[0x08] = 0xfc; | 593 | cmd.args[0x08] = 0xfc; |
589 | cmd.args[0x09] = 0x06; | 594 | cmd.args[0x09] = 0x06; |
590 | cmd.len= 0x0a; | 595 | cmd.len = 0x0a; |
591 | ret = cx24116_cmd_execute(fe, &cmd); | 596 | ret = cx24116_cmd_execute(fe, &cmd); |
592 | if (ret != 0) | 597 | if (ret != 0) |
593 | return ret; | 598 | return ret; |
@@ -598,7 +603,7 @@ static int cx24116_load_firmware (struct dvb_frontend* fe, const struct firmware | |||
598 | cmd.args[0x00] = CMD_TUNERINIT; | 603 | cmd.args[0x00] = CMD_TUNERINIT; |
599 | cmd.args[0x01] = 0x00; | 604 | cmd.args[0x01] = 0x00; |
600 | cmd.args[0x02] = 0x00; | 605 | cmd.args[0x02] = 0x00; |
601 | cmd.len= 0x03; | 606 | cmd.len = 0x03; |
602 | ret = cx24116_cmd_execute(fe, &cmd); | 607 | ret = cx24116_cmd_execute(fe, &cmd); |
603 | if (ret != 0) | 608 | if (ret != 0) |
604 | return ret; | 609 | return ret; |
@@ -615,20 +620,20 @@ static int cx24116_load_firmware (struct dvb_frontend* fe, const struct firmware | |||
615 | else | 620 | else |
616 | cmd.args[0x04] = 0x02; | 621 | cmd.args[0x04] = 0x02; |
617 | cmd.args[0x05] = 0x00; | 622 | cmd.args[0x05] = 0x00; |
618 | cmd.len= 0x06; | 623 | cmd.len = 0x06; |
619 | ret = cx24116_cmd_execute(fe, &cmd); | 624 | ret = cx24116_cmd_execute(fe, &cmd); |
620 | if (ret != 0) | 625 | if (ret != 0) |
621 | return ret; | 626 | return ret; |
622 | 627 | ||
623 | /* Firmware CMD 35: Get firmware version */ | 628 | /* Firmware CMD 35: Get firmware version */ |
624 | cmd.args[0x00] = CMD_UPDFWVERS; | 629 | cmd.args[0x00] = CMD_UPDFWVERS; |
625 | cmd.len= 0x02; | 630 | cmd.len = 0x02; |
626 | for(i=0; i<4; i++) { | 631 | for (i = 0; i < 4; i++) { |
627 | cmd.args[0x01] = i; | 632 | cmd.args[0x01] = i; |
628 | ret = cx24116_cmd_execute(fe, &cmd); | 633 | ret = cx24116_cmd_execute(fe, &cmd); |
629 | if (ret != 0) | 634 | if (ret != 0) |
630 | return ret; | 635 | return ret; |
631 | vers[i]= cx24116_readreg(state, CX24116_REG_MAILBOX); | 636 | vers[i] = cx24116_readreg(state, CX24116_REG_MAILBOX); |
632 | } | 637 | } |
633 | printk("%s: FW version %i.%i.%i.%i\n", __func__, | 638 | printk("%s: FW version %i.%i.%i.%i\n", __func__, |
634 | vers[0], vers[1], vers[2], vers[3]); | 639 | vers[0], vers[1], vers[2], vers[3]); |
@@ -636,15 +641,17 @@ static int cx24116_load_firmware (struct dvb_frontend* fe, const struct firmware | |||
636 | return 0; | 641 | return 0; |
637 | } | 642 | } |
638 | 643 | ||
639 | static int cx24116_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) | 644 | static int cx24116_set_voltage(struct dvb_frontend *fe, |
645 | fe_sec_voltage_t voltage) | ||
640 | { | 646 | { |
641 | /* The isl6421 module will override this function in the fops. */ | 647 | /* The isl6421 module will override this function in the fops. */ |
642 | dprintk("%s() This should never appear if the isl6421 module is loaded correctly\n",__func__); | 648 | dprintk("%s() This should never appear if the isl6421 module " |
649 | "is loaded correctly\n", __func__); | ||
643 | 650 | ||
644 | return -EOPNOTSUPP; | 651 | return -EOPNOTSUPP; |
645 | } | 652 | } |
646 | 653 | ||
647 | static int cx24116_read_status(struct dvb_frontend* fe, fe_status_t* status) | 654 | static int cx24116_read_status(struct dvb_frontend *fe, fe_status_t *status) |
648 | { | 655 | { |
649 | struct cx24116_state *state = fe->demodulator_priv; | 656 | struct cx24116_state *state = fe->demodulator_priv; |
650 | 657 | ||
@@ -666,22 +673,23 @@ static int cx24116_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
666 | return 0; | 673 | return 0; |
667 | } | 674 | } |
668 | 675 | ||
669 | static int cx24116_read_ber(struct dvb_frontend* fe, u32* ber) | 676 | static int cx24116_read_ber(struct dvb_frontend *fe, u32 *ber) |
670 | { | 677 | { |
671 | struct cx24116_state *state = fe->demodulator_priv; | 678 | struct cx24116_state *state = fe->demodulator_priv; |
672 | 679 | ||
673 | dprintk("%s()\n", __func__); | 680 | dprintk("%s()\n", __func__); |
674 | 681 | ||
675 | *ber = ( cx24116_readreg(state, CX24116_REG_BER24) << 24 ) | | 682 | *ber = (cx24116_readreg(state, CX24116_REG_BER24) << 24) | |
676 | ( cx24116_readreg(state, CX24116_REG_BER16) << 16 ) | | 683 | (cx24116_readreg(state, CX24116_REG_BER16) << 16) | |
677 | ( cx24116_readreg(state, CX24116_REG_BER8 ) << 8 ) | | 684 | (cx24116_readreg(state, CX24116_REG_BER8) << 8) | |
678 | cx24116_readreg(state, CX24116_REG_BER0 ); | 685 | cx24116_readreg(state, CX24116_REG_BER0); |
679 | 686 | ||
680 | return 0; | 687 | return 0; |
681 | } | 688 | } |
682 | 689 | ||
683 | /* TODO Determine function and scale appropriately */ | 690 | /* TODO Determine function and scale appropriately */ |
684 | static int cx24116_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) | 691 | static int cx24116_read_signal_strength(struct dvb_frontend *fe, |
692 | u16 *signal_strength) | ||
685 | { | 693 | { |
686 | struct cx24116_state *state = fe->demodulator_priv; | 694 | struct cx24116_state *state = fe->demodulator_priv; |
687 | struct cx24116_cmd cmd; | 695 | struct cx24116_cmd cmd; |
@@ -692,39 +700,43 @@ static int cx24116_read_signal_strength(struct dvb_frontend* fe, u16* signal_str | |||
692 | 700 | ||
693 | /* Firmware CMD 19: Get AGC */ | 701 | /* Firmware CMD 19: Get AGC */ |
694 | cmd.args[0x00] = CMD_GETAGC; | 702 | cmd.args[0x00] = CMD_GETAGC; |
695 | cmd.len= 0x01; | 703 | cmd.len = 0x01; |
696 | ret = cx24116_cmd_execute(fe, &cmd); | 704 | ret = cx24116_cmd_execute(fe, &cmd); |
697 | if (ret != 0) | 705 | if (ret != 0) |
698 | return ret; | 706 | return ret; |
699 | 707 | ||
700 | sig_reading = ( cx24116_readreg(state, CX24116_REG_SSTATUS) & CX24116_SIGNAL_MASK ) | | 708 | sig_reading = |
701 | ( cx24116_readreg(state, CX24116_REG_SIGNAL) << 6 ); | 709 | (cx24116_readreg(state, |
702 | *signal_strength= 0 - sig_reading; | 710 | CX24116_REG_SSTATUS) & CX24116_SIGNAL_MASK) | |
711 | (cx24116_readreg(state, CX24116_REG_SIGNAL) << 6); | ||
712 | *signal_strength = 0 - sig_reading; | ||
703 | 713 | ||
704 | dprintk("%s: raw / cooked = 0x%04x / 0x%04x\n", __func__, sig_reading, *signal_strength); | 714 | dprintk("%s: raw / cooked = 0x%04x / 0x%04x\n", |
715 | __func__, sig_reading, *signal_strength); | ||
705 | 716 | ||
706 | return 0; | 717 | return 0; |
707 | } | 718 | } |
708 | 719 | ||
709 | /* SNR (0..100)% = (sig & 0xf0) * 10 + (sig & 0x0f) * 10 / 16 */ | 720 | /* SNR (0..100)% = (sig & 0xf0) * 10 + (sig & 0x0f) * 10 / 16 */ |
710 | static int cx24116_read_snr_pct(struct dvb_frontend* fe, u16* snr) | 721 | static int cx24116_read_snr_pct(struct dvb_frontend *fe, u16 *snr) |
711 | { | 722 | { |
712 | struct cx24116_state *state = fe->demodulator_priv; | 723 | struct cx24116_state *state = fe->demodulator_priv; |
713 | u8 snr_reading; | 724 | u8 snr_reading; |
714 | static const u32 snr_tab[] = { /* 10 x Table (rounded up) */ | 725 | static const u32 snr_tab[] = { /* 10 x Table (rounded up) */ |
715 | 0x00000,0x0199A,0x03333,0x04ccD,0x06667, | 726 | 0x00000, 0x0199A, 0x03333, 0x04ccD, 0x06667, |
716 | 0x08000,0x0999A,0x0b333,0x0cccD,0x0e667, | 727 | 0x08000, 0x0999A, 0x0b333, 0x0cccD, 0x0e667, |
717 | 0x10000,0x1199A,0x13333,0x14ccD,0x16667,0x18000 }; | 728 | 0x10000, 0x1199A, 0x13333, 0x14ccD, 0x16667, |
729 | 0x18000 }; | ||
718 | 730 | ||
719 | dprintk("%s()\n", __func__); | 731 | dprintk("%s()\n", __func__); |
720 | 732 | ||
721 | snr_reading = cx24116_readreg(state, CX24116_REG_QUALITY0); | 733 | snr_reading = cx24116_readreg(state, CX24116_REG_QUALITY0); |
722 | 734 | ||
723 | if(snr_reading >= 0xa0 /* 100% */) | 735 | if (snr_reading >= 0xa0 /* 100% */) |
724 | *snr = 0xffff; | 736 | *snr = 0xffff; |
725 | else | 737 | else |
726 | *snr = snr_tab [ ( snr_reading & 0xf0 ) >> 4 ] + | 738 | *snr = snr_tab[(snr_reading & 0xf0) >> 4] + |
727 | ( snr_tab [ ( snr_reading & 0x0f ) ] >> 4 ); | 739 | (snr_tab[(snr_reading & 0x0f)] >> 4); |
728 | 740 | ||
729 | dprintk("%s: raw / cooked = 0x%02x / 0x%04x\n", __func__, | 741 | dprintk("%s: raw / cooked = 0x%02x / 0x%04x\n", __func__, |
730 | snr_reading, *snr); | 742 | snr_reading, *snr); |
@@ -736,7 +748,7 @@ static int cx24116_read_snr_pct(struct dvb_frontend* fe, u16* snr) | |||
736 | * ESNO, from 0->30db (values 0->300). We provide this value by | 748 | * ESNO, from 0->30db (values 0->300). We provide this value by |
737 | * default. | 749 | * default. |
738 | */ | 750 | */ |
739 | static int cx24116_read_snr_esno(struct dvb_frontend* fe, u16* snr) | 751 | static int cx24116_read_snr_esno(struct dvb_frontend *fe, u16 *snr) |
740 | { | 752 | { |
741 | struct cx24116_state *state = fe->demodulator_priv; | 753 | struct cx24116_state *state = fe->demodulator_priv; |
742 | 754 | ||
@@ -750,7 +762,7 @@ static int cx24116_read_snr_esno(struct dvb_frontend* fe, u16* snr) | |||
750 | return 0; | 762 | return 0; |
751 | } | 763 | } |
752 | 764 | ||
753 | static int cx24116_read_snr(struct dvb_frontend* fe, u16* snr) | 765 | static int cx24116_read_snr(struct dvb_frontend *fe, u16 *snr) |
754 | { | 766 | { |
755 | if (esno_snr == 1) | 767 | if (esno_snr == 1) |
756 | return cx24116_read_snr_esno(fe, snr); | 768 | return cx24116_read_snr_esno(fe, snr); |
@@ -758,27 +770,27 @@ static int cx24116_read_snr(struct dvb_frontend* fe, u16* snr) | |||
758 | return cx24116_read_snr_pct(fe, snr); | 770 | return cx24116_read_snr_pct(fe, snr); |
759 | } | 771 | } |
760 | 772 | ||
761 | static int cx24116_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 773 | static int cx24116_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) |
762 | { | 774 | { |
763 | struct cx24116_state *state = fe->demodulator_priv; | 775 | struct cx24116_state *state = fe->demodulator_priv; |
764 | 776 | ||
765 | dprintk("%s()\n", __func__); | 777 | dprintk("%s()\n", __func__); |
766 | 778 | ||
767 | *ucblocks = ( cx24116_readreg(state, CX24116_REG_UCB8) << 8 ) | | 779 | *ucblocks = (cx24116_readreg(state, CX24116_REG_UCB8) << 8) | |
768 | cx24116_readreg(state, CX24116_REG_UCB0); | 780 | cx24116_readreg(state, CX24116_REG_UCB0); |
769 | 781 | ||
770 | return 0; | 782 | return 0; |
771 | } | 783 | } |
772 | 784 | ||
773 | /* Overwrite the current tuning params, we are about to tune */ | 785 | /* Overwrite the current tuning params, we are about to tune */ |
774 | static void cx24116_clone_params(struct dvb_frontend* fe) | 786 | static void cx24116_clone_params(struct dvb_frontend *fe) |
775 | { | 787 | { |
776 | struct cx24116_state *state = fe->demodulator_priv; | 788 | struct cx24116_state *state = fe->demodulator_priv; |
777 | memcpy(&state->dcur, &state->dnxt, sizeof(state->dcur)); | 789 | memcpy(&state->dcur, &state->dnxt, sizeof(state->dcur)); |
778 | } | 790 | } |
779 | 791 | ||
780 | /* Wait for LNB */ | 792 | /* Wait for LNB */ |
781 | static int cx24116_wait_for_lnb(struct dvb_frontend* fe) | 793 | static int cx24116_wait_for_lnb(struct dvb_frontend *fe) |
782 | { | 794 | { |
783 | struct cx24116_state *state = fe->demodulator_priv; | 795 | struct cx24116_state *state = fe->demodulator_priv; |
784 | int i; | 796 | int i; |
@@ -787,7 +799,7 @@ static int cx24116_wait_for_lnb(struct dvb_frontend* fe) | |||
787 | cx24116_readreg(state, CX24116_REG_QSTATUS)); | 799 | cx24116_readreg(state, CX24116_REG_QSTATUS)); |
788 | 800 | ||
789 | /* Wait for up to 300 ms */ | 801 | /* Wait for up to 300 ms */ |
790 | for(i = 0; i < 30 ; i++) { | 802 | for (i = 0; i < 30 ; i++) { |
791 | if (cx24116_readreg(state, CX24116_REG_QSTATUS) & 0x20) | 803 | if (cx24116_readreg(state, CX24116_REG_QSTATUS) & 0x20) |
792 | return 0; | 804 | return 0; |
793 | msleep(10); | 805 | msleep(10); |
@@ -798,20 +810,21 @@ static int cx24116_wait_for_lnb(struct dvb_frontend* fe) | |||
798 | return -ETIMEDOUT; /* -EBUSY ? */ | 810 | return -ETIMEDOUT; /* -EBUSY ? */ |
799 | } | 811 | } |
800 | 812 | ||
801 | static int cx24116_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | 813 | static int cx24116_set_tone(struct dvb_frontend *fe, |
814 | fe_sec_tone_mode_t tone) | ||
802 | { | 815 | { |
803 | struct cx24116_cmd cmd; | 816 | struct cx24116_cmd cmd; |
804 | int ret; | 817 | int ret; |
805 | 818 | ||
806 | dprintk("%s(%d)\n", __func__, tone); | 819 | dprintk("%s(%d)\n", __func__, tone); |
807 | if ( (tone != SEC_TONE_ON) && (tone != SEC_TONE_OFF) ) { | 820 | if ((tone != SEC_TONE_ON) && (tone != SEC_TONE_OFF)) { |
808 | printk("%s: Invalid, tone=%d\n", __func__, tone); | 821 | printk("%s: Invalid, tone=%d\n", __func__, tone); |
809 | return -EINVAL; | 822 | return -EINVAL; |
810 | } | 823 | } |
811 | 824 | ||
812 | /* Wait for LNB ready */ | 825 | /* Wait for LNB ready */ |
813 | ret = cx24116_wait_for_lnb(fe); | 826 | ret = cx24116_wait_for_lnb(fe); |
814 | if(ret != 0) | 827 | if (ret != 0) |
815 | return ret; | 828 | return ret; |
816 | 829 | ||
817 | /* Min delay time after DiSEqC send */ | 830 | /* Min delay time after DiSEqC send */ |
@@ -820,7 +833,7 @@ static int cx24116_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
820 | /* This is always done before the tone is set */ | 833 | /* This is always done before the tone is set */ |
821 | cmd.args[0x00] = CMD_SET_TONEPRE; | 834 | cmd.args[0x00] = CMD_SET_TONEPRE; |
822 | cmd.args[0x01] = 0x00; | 835 | cmd.args[0x01] = 0x00; |
823 | cmd.len= 0x02; | 836 | cmd.len = 0x02; |
824 | ret = cx24116_cmd_execute(fe, &cmd); | 837 | ret = cx24116_cmd_execute(fe, &cmd); |
825 | if (ret != 0) | 838 | if (ret != 0) |
826 | return ret; | 839 | return ret; |
@@ -836,11 +849,11 @@ static int cx24116_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
836 | cmd.args[0x03] = 0x01; | 849 | cmd.args[0x03] = 0x01; |
837 | break; | 850 | break; |
838 | case SEC_TONE_OFF: | 851 | case SEC_TONE_OFF: |
839 | dprintk("%s: setting tone off\n",__func__); | 852 | dprintk("%s: setting tone off\n", __func__); |
840 | cmd.args[0x03] = 0x00; | 853 | cmd.args[0x03] = 0x00; |
841 | break; | 854 | break; |
842 | } | 855 | } |
843 | cmd.len= 0x04; | 856 | cmd.len = 0x04; |
844 | 857 | ||
845 | /* Min delay time before DiSEqC send */ | 858 | /* Min delay time before DiSEqC send */ |
846 | msleep(15); /* XXX determine is FW does this, see send_diseqc/burst */ | 859 | msleep(15); /* XXX determine is FW does this, see send_diseqc/burst */ |
@@ -849,7 +862,7 @@ static int cx24116_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
849 | } | 862 | } |
850 | 863 | ||
851 | /* Initialise DiSEqC */ | 864 | /* Initialise DiSEqC */ |
852 | static int cx24116_diseqc_init(struct dvb_frontend* fe) | 865 | static int cx24116_diseqc_init(struct dvb_frontend *fe) |
853 | { | 866 | { |
854 | struct cx24116_state *state = fe->demodulator_priv; | 867 | struct cx24116_state *state = fe->demodulator_priv; |
855 | struct cx24116_cmd cmd; | 868 | struct cx24116_cmd cmd; |
@@ -864,7 +877,7 @@ static int cx24116_diseqc_init(struct dvb_frontend* fe) | |||
864 | cmd.args[0x05] = 0x28; | 877 | cmd.args[0x05] = 0x28; |
865 | cmd.args[0x06] = (toneburst == CX24116_DISEQC_TONEOFF) ? 0x00 : 0x01; | 878 | cmd.args[0x06] = (toneburst == CX24116_DISEQC_TONEOFF) ? 0x00 : 0x01; |
866 | cmd.args[0x07] = 0x01; | 879 | cmd.args[0x07] = 0x01; |
867 | cmd.len= 0x08; | 880 | cmd.len = 0x08; |
868 | ret = cx24116_cmd_execute(fe, &cmd); | 881 | ret = cx24116_cmd_execute(fe, &cmd); |
869 | if (ret != 0) | 882 | if (ret != 0) |
870 | return ret; | 883 | return ret; |
@@ -884,13 +897,14 @@ static int cx24116_diseqc_init(struct dvb_frontend* fe) | |||
884 | state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = 0x00; | 897 | state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = 0x00; |
885 | 898 | ||
886 | /* Command length */ | 899 | /* Command length */ |
887 | state->dsec_cmd.len= CX24116_DISEQC_MSGOFS; | 900 | state->dsec_cmd.len = CX24116_DISEQC_MSGOFS; |
888 | 901 | ||
889 | return 0; | 902 | return 0; |
890 | } | 903 | } |
891 | 904 | ||
892 | /* Send DiSEqC message with derived burst (hack) || previous burst */ | 905 | /* Send DiSEqC message with derived burst (hack) || previous burst */ |
893 | static int cx24116_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *d) | 906 | static int cx24116_send_diseqc_msg(struct dvb_frontend *fe, |
907 | struct dvb_diseqc_master_cmd *d) | ||
894 | { | 908 | { |
895 | struct cx24116_state *state = fe->demodulator_priv; | 909 | struct cx24116_state *state = fe->demodulator_priv; |
896 | int i, ret; | 910 | int i, ret; |
@@ -898,16 +912,16 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma | |||
898 | /* Dump DiSEqC message */ | 912 | /* Dump DiSEqC message */ |
899 | if (debug) { | 913 | if (debug) { |
900 | printk("cx24116: %s(", __func__); | 914 | printk("cx24116: %s(", __func__); |
901 | for(i = 0 ; i < d->msg_len ;) { | 915 | for (i = 0 ; i < d->msg_len ;) { |
902 | printk("0x%02x", d->msg[i]); | 916 | printk("0x%02x", d->msg[i]); |
903 | if(++i < d->msg_len) | 917 | if (++i < d->msg_len) |
904 | printk(", "); | 918 | printk(", "); |
905 | } | 919 | } |
906 | printk(") toneburst=%d\n", toneburst); | 920 | printk(") toneburst=%d\n", toneburst); |
907 | } | 921 | } |
908 | 922 | ||
909 | /* Validate length */ | 923 | /* Validate length */ |
910 | if(d->msg_len > (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS)) | 924 | if (d->msg_len > (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS)) |
911 | return -EINVAL; | 925 | return -EINVAL; |
912 | 926 | ||
913 | /* DiSEqC message */ | 927 | /* DiSEqC message */ |
@@ -918,18 +932,19 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma | |||
918 | state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = d->msg_len; | 932 | state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = d->msg_len; |
919 | 933 | ||
920 | /* Command length */ | 934 | /* Command length */ |
921 | state->dsec_cmd.len= CX24116_DISEQC_MSGOFS + state->dsec_cmd.args[CX24116_DISEQC_MSGLEN]; | 935 | state->dsec_cmd.len = CX24116_DISEQC_MSGOFS + |
936 | state->dsec_cmd.args[CX24116_DISEQC_MSGLEN]; | ||
922 | 937 | ||
923 | /* DiSEqC toneburst */ | 938 | /* DiSEqC toneburst */ |
924 | if(toneburst == CX24116_DISEQC_MESGCACHE) | 939 | if (toneburst == CX24116_DISEQC_MESGCACHE) |
925 | /* Message is cached */ | 940 | /* Message is cached */ |
926 | return 0; | 941 | return 0; |
927 | 942 | ||
928 | else if(toneburst == CX24116_DISEQC_TONEOFF) | 943 | else if (toneburst == CX24116_DISEQC_TONEOFF) |
929 | /* Message is sent without burst */ | 944 | /* Message is sent without burst */ |
930 | state->dsec_cmd.args[CX24116_DISEQC_BURST] = 0; | 945 | state->dsec_cmd.args[CX24116_DISEQC_BURST] = 0; |
931 | 946 | ||
932 | else if(toneburst == CX24116_DISEQC_TONECACHE) { | 947 | else if (toneburst == CX24116_DISEQC_TONECACHE) { |
933 | /* | 948 | /* |
934 | * Message is sent with derived else cached burst | 949 | * Message is sent with derived else cached burst |
935 | * | 950 | * |
@@ -948,15 +963,17 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma | |||
948 | * Y = VOLTAGE (0=13V, 1=18V) | 963 | * Y = VOLTAGE (0=13V, 1=18V) |
949 | * Z = BAND (0=LOW, 1=HIGH(22K)) | 964 | * Z = BAND (0=LOW, 1=HIGH(22K)) |
950 | */ | 965 | */ |
951 | if(d->msg_len >= 4 && d->msg[2] == 0x38) | 966 | if (d->msg_len >= 4 && d->msg[2] == 0x38) |
952 | state->dsec_cmd.args[CX24116_DISEQC_BURST] = ((d->msg[3] & 4) >> 2); | 967 | state->dsec_cmd.args[CX24116_DISEQC_BURST] = |
953 | if(debug) | 968 | ((d->msg[3] & 4) >> 2); |
954 | dprintk("%s burst=%d\n", __func__, state->dsec_cmd.args[CX24116_DISEQC_BURST]); | 969 | if (debug) |
970 | dprintk("%s burst=%d\n", __func__, | ||
971 | state->dsec_cmd.args[CX24116_DISEQC_BURST]); | ||
955 | } | 972 | } |
956 | 973 | ||
957 | /* Wait for LNB ready */ | 974 | /* Wait for LNB ready */ |
958 | ret = cx24116_wait_for_lnb(fe); | 975 | ret = cx24116_wait_for_lnb(fe); |
959 | if(ret != 0) | 976 | if (ret != 0) |
960 | return ret; | 977 | return ret; |
961 | 978 | ||
962 | /* Wait for voltage/min repeat delay */ | 979 | /* Wait for voltage/min repeat delay */ |
@@ -964,7 +981,7 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma | |||
964 | 981 | ||
965 | /* Command */ | 982 | /* Command */ |
966 | ret = cx24116_cmd_execute(fe, &state->dsec_cmd); | 983 | ret = cx24116_cmd_execute(fe, &state->dsec_cmd); |
967 | if(ret != 0) | 984 | if (ret != 0) |
968 | return ret; | 985 | return ret; |
969 | /* | 986 | /* |
970 | * Wait for send | 987 | * Wait for send |
@@ -976,29 +993,33 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma | |||
976 | * 12.5ms burst + | 993 | * 12.5ms burst + |
977 | * >15ms delay (XXX determine if FW does this, see set_tone) | 994 | * >15ms delay (XXX determine if FW does this, see set_tone) |
978 | */ | 995 | */ |
979 | msleep( (state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) + ((toneburst == CX24116_DISEQC_TONEOFF) ? 30 : 60) ); | 996 | msleep((state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) + |
997 | ((toneburst == CX24116_DISEQC_TONEOFF) ? 30 : 60)); | ||
980 | 998 | ||
981 | return 0; | 999 | return 0; |
982 | } | 1000 | } |
983 | 1001 | ||
984 | /* Send DiSEqC burst */ | 1002 | /* Send DiSEqC burst */ |
985 | static int cx24116_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) | 1003 | static int cx24116_diseqc_send_burst(struct dvb_frontend *fe, |
1004 | fe_sec_mini_cmd_t burst) | ||
986 | { | 1005 | { |
987 | struct cx24116_state *state = fe->demodulator_priv; | 1006 | struct cx24116_state *state = fe->demodulator_priv; |
988 | int ret; | 1007 | int ret; |
989 | 1008 | ||
990 | dprintk("%s(%d) toneburst=%d\n",__func__, burst, toneburst); | 1009 | dprintk("%s(%d) toneburst=%d\n", __func__, burst, toneburst); |
991 | 1010 | ||
992 | /* DiSEqC burst */ | 1011 | /* DiSEqC burst */ |
993 | if (burst == SEC_MINI_A) | 1012 | if (burst == SEC_MINI_A) |
994 | state->dsec_cmd.args[CX24116_DISEQC_BURST] = CX24116_DISEQC_MINI_A; | 1013 | state->dsec_cmd.args[CX24116_DISEQC_BURST] = |
995 | else if(burst == SEC_MINI_B) | 1014 | CX24116_DISEQC_MINI_A; |
996 | state->dsec_cmd.args[CX24116_DISEQC_BURST] = CX24116_DISEQC_MINI_B; | 1015 | else if (burst == SEC_MINI_B) |
1016 | state->dsec_cmd.args[CX24116_DISEQC_BURST] = | ||
1017 | CX24116_DISEQC_MINI_B; | ||
997 | else | 1018 | else |
998 | return -EINVAL; | 1019 | return -EINVAL; |
999 | 1020 | ||
1000 | /* DiSEqC toneburst */ | 1021 | /* DiSEqC toneburst */ |
1001 | if(toneburst != CX24116_DISEQC_MESGCACHE) | 1022 | if (toneburst != CX24116_DISEQC_MESGCACHE) |
1002 | /* Burst is cached */ | 1023 | /* Burst is cached */ |
1003 | return 0; | 1024 | return 0; |
1004 | 1025 | ||
@@ -1006,7 +1027,7 @@ static int cx24116_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t | |||
1006 | 1027 | ||
1007 | /* Wait for LNB ready */ | 1028 | /* Wait for LNB ready */ |
1008 | ret = cx24116_wait_for_lnb(fe); | 1029 | ret = cx24116_wait_for_lnb(fe); |
1009 | if(ret != 0) | 1030 | if (ret != 0) |
1010 | return ret; | 1031 | return ret; |
1011 | 1032 | ||
1012 | /* Wait for voltage/min repeat delay */ | 1033 | /* Wait for voltage/min repeat delay */ |
@@ -1014,7 +1035,7 @@ static int cx24116_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t | |||
1014 | 1035 | ||
1015 | /* Command */ | 1036 | /* Command */ |
1016 | ret = cx24116_cmd_execute(fe, &state->dsec_cmd); | 1037 | ret = cx24116_cmd_execute(fe, &state->dsec_cmd); |
1017 | if(ret != 0) | 1038 | if (ret != 0) |
1018 | return ret; | 1039 | return ret; |
1019 | 1040 | ||
1020 | /* | 1041 | /* |
@@ -1027,27 +1048,27 @@ static int cx24116_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t | |||
1027 | * 12.5ms burst + | 1048 | * 12.5ms burst + |
1028 | * >15ms delay (XXX determine if FW does this, see set_tone) | 1049 | * >15ms delay (XXX determine if FW does this, see set_tone) |
1029 | */ | 1050 | */ |
1030 | msleep( (state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) + 60 ); | 1051 | msleep((state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) + 60); |
1031 | 1052 | ||
1032 | return 0; | 1053 | return 0; |
1033 | } | 1054 | } |
1034 | 1055 | ||
1035 | static void cx24116_release(struct dvb_frontend* fe) | 1056 | static void cx24116_release(struct dvb_frontend *fe) |
1036 | { | 1057 | { |
1037 | struct cx24116_state* state = fe->demodulator_priv; | 1058 | struct cx24116_state *state = fe->demodulator_priv; |
1038 | dprintk("%s\n",__func__); | 1059 | dprintk("%s\n", __func__); |
1039 | kfree(state); | 1060 | kfree(state); |
1040 | } | 1061 | } |
1041 | 1062 | ||
1042 | static struct dvb_frontend_ops cx24116_ops; | 1063 | static struct dvb_frontend_ops cx24116_ops; |
1043 | 1064 | ||
1044 | struct dvb_frontend* cx24116_attach(const struct cx24116_config* config, | 1065 | struct dvb_frontend *cx24116_attach(const struct cx24116_config *config, |
1045 | struct i2c_adapter* i2c) | 1066 | struct i2c_adapter *i2c) |
1046 | { | 1067 | { |
1047 | struct cx24116_state* state = NULL; | 1068 | struct cx24116_state *state = NULL; |
1048 | int ret; | 1069 | int ret; |
1049 | 1070 | ||
1050 | dprintk("%s\n",__func__); | 1071 | dprintk("%s\n", __func__); |
1051 | 1072 | ||
1052 | /* allocate memory for the internal state */ | 1073 | /* allocate memory for the internal state */ |
1053 | state = kmalloc(sizeof(struct cx24116_state), GFP_KERNEL); | 1074 | state = kmalloc(sizeof(struct cx24116_state), GFP_KERNEL); |
@@ -1077,18 +1098,20 @@ struct dvb_frontend* cx24116_attach(const struct cx24116_config* config, | |||
1077 | error2: kfree(state); | 1098 | error2: kfree(state); |
1078 | error1: return NULL; | 1099 | error1: return NULL; |
1079 | } | 1100 | } |
1101 | EXPORT_SYMBOL(cx24116_attach); | ||
1102 | |||
1080 | /* | 1103 | /* |
1081 | * Initialise or wake up device | 1104 | * Initialise or wake up device |
1082 | * | 1105 | * |
1083 | * Power config will reset and load initial firmware if required | 1106 | * Power config will reset and load initial firmware if required |
1084 | */ | 1107 | */ |
1085 | static int cx24116_initfe(struct dvb_frontend* fe) | 1108 | static int cx24116_initfe(struct dvb_frontend *fe) |
1086 | { | 1109 | { |
1087 | struct cx24116_state* state = fe->demodulator_priv; | 1110 | struct cx24116_state *state = fe->demodulator_priv; |
1088 | struct cx24116_cmd cmd; | 1111 | struct cx24116_cmd cmd; |
1089 | int ret; | 1112 | int ret; |
1090 | 1113 | ||
1091 | dprintk("%s()\n",__func__); | 1114 | dprintk("%s()\n", __func__); |
1092 | 1115 | ||
1093 | /* Power on */ | 1116 | /* Power on */ |
1094 | cx24116_writereg(state, 0xe0, 0); | 1117 | cx24116_writereg(state, 0xe0, 0); |
@@ -1098,9 +1121,9 @@ static int cx24116_initfe(struct dvb_frontend* fe) | |||
1098 | /* Firmware CMD 36: Power config */ | 1121 | /* Firmware CMD 36: Power config */ |
1099 | cmd.args[0x00] = CMD_TUNERSLEEP; | 1122 | cmd.args[0x00] = CMD_TUNERSLEEP; |
1100 | cmd.args[0x01] = 0; | 1123 | cmd.args[0x01] = 0; |
1101 | cmd.len= 0x02; | 1124 | cmd.len = 0x02; |
1102 | ret = cx24116_cmd_execute(fe, &cmd); | 1125 | ret = cx24116_cmd_execute(fe, &cmd); |
1103 | if(ret != 0) | 1126 | if (ret != 0) |
1104 | return ret; | 1127 | return ret; |
1105 | 1128 | ||
1106 | return cx24116_diseqc_init(fe); | 1129 | return cx24116_diseqc_init(fe); |
@@ -1109,20 +1132,20 @@ static int cx24116_initfe(struct dvb_frontend* fe) | |||
1109 | /* | 1132 | /* |
1110 | * Put device to sleep | 1133 | * Put device to sleep |
1111 | */ | 1134 | */ |
1112 | static int cx24116_sleep(struct dvb_frontend* fe) | 1135 | static int cx24116_sleep(struct dvb_frontend *fe) |
1113 | { | 1136 | { |
1114 | struct cx24116_state* state = fe->demodulator_priv; | 1137 | struct cx24116_state *state = fe->demodulator_priv; |
1115 | struct cx24116_cmd cmd; | 1138 | struct cx24116_cmd cmd; |
1116 | int ret; | 1139 | int ret; |
1117 | 1140 | ||
1118 | dprintk("%s()\n",__func__); | 1141 | dprintk("%s()\n", __func__); |
1119 | 1142 | ||
1120 | /* Firmware CMD 36: Power config */ | 1143 | /* Firmware CMD 36: Power config */ |
1121 | cmd.args[0x00] = CMD_TUNERSLEEP; | 1144 | cmd.args[0x00] = CMD_TUNERSLEEP; |
1122 | cmd.args[0x01] = 1; | 1145 | cmd.args[0x01] = 1; |
1123 | cmd.len= 0x02; | 1146 | cmd.len = 0x02; |
1124 | ret = cx24116_cmd_execute(fe, &cmd); | 1147 | ret = cx24116_cmd_execute(fe, &cmd); |
1125 | if(ret != 0) | 1148 | if (ret != 0) |
1126 | return ret; | 1149 | return ret; |
1127 | 1150 | ||
1128 | /* Power off (Shutdown clocks) */ | 1151 | /* Power off (Shutdown clocks) */ |
@@ -1133,13 +1156,15 @@ static int cx24116_sleep(struct dvb_frontend* fe) | |||
1133 | return 0; | 1156 | return 0; |
1134 | } | 1157 | } |
1135 | 1158 | ||
1136 | static int cx24116_set_property(struct dvb_frontend *fe, struct dtv_property* tvp) | 1159 | static int cx24116_set_property(struct dvb_frontend *fe, |
1160 | struct dtv_property *tvp) | ||
1137 | { | 1161 | { |
1138 | dprintk("%s(..)\n", __func__); | 1162 | dprintk("%s(..)\n", __func__); |
1139 | return 0; | 1163 | return 0; |
1140 | } | 1164 | } |
1141 | 1165 | ||
1142 | static int cx24116_get_property(struct dvb_frontend *fe, struct dtv_property* tvp) | 1166 | static int cx24116_get_property(struct dvb_frontend *fe, |
1167 | struct dtv_property *tvp) | ||
1143 | { | 1168 | { |
1144 | dprintk("%s(..)\n", __func__); | 1169 | dprintk("%s(..)\n", __func__); |
1145 | return 0; | 1170 | return 0; |
@@ -1148,7 +1173,8 @@ static int cx24116_get_property(struct dvb_frontend *fe, struct dtv_property* tv | |||
1148 | /* dvb-core told us to tune, the tv property cache will be complete, | 1173 | /* dvb-core told us to tune, the tv property cache will be complete, |
1149 | * it's safe for is to pull values and use them for tuning purposes. | 1174 | * it's safe for is to pull values and use them for tuning purposes. |
1150 | */ | 1175 | */ |
1151 | static int cx24116_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 1176 | static int cx24116_set_frontend(struct dvb_frontend *fe, |
1177 | struct dvb_frontend_parameters *p) | ||
1152 | { | 1178 | { |
1153 | struct cx24116_state *state = fe->demodulator_priv; | 1179 | struct cx24116_state *state = fe->demodulator_priv; |
1154 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 1180 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
@@ -1156,96 +1182,99 @@ static int cx24116_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
1156 | fe_status_t tunerstat; | 1182 | fe_status_t tunerstat; |
1157 | int i, status, ret, retune; | 1183 | int i, status, ret, retune; |
1158 | 1184 | ||
1159 | dprintk("%s()\n",__func__); | 1185 | dprintk("%s()\n", __func__); |
1160 | 1186 | ||
1161 | switch(c->delivery_system) { | 1187 | switch (c->delivery_system) { |
1162 | case SYS_DVBS: | 1188 | case SYS_DVBS: |
1163 | dprintk("%s: DVB-S delivery system selected\n",__func__); | 1189 | dprintk("%s: DVB-S delivery system selected\n", __func__); |
1164 | 1190 | ||
1165 | /* Only QPSK is supported for DVB-S */ | 1191 | /* Only QPSK is supported for DVB-S */ |
1166 | if(c->modulation != QPSK) { | 1192 | if (c->modulation != QPSK) { |
1167 | dprintk("%s: unsupported modulation selected (%d)\n", | 1193 | dprintk("%s: unsupported modulation selected (%d)\n", |
1168 | __func__, c->modulation); | 1194 | __func__, c->modulation); |
1169 | return -EOPNOTSUPP; | 1195 | return -EOPNOTSUPP; |
1170 | } | 1196 | } |
1171 | 1197 | ||
1172 | /* Pilot doesn't exist in DVB-S, turn bit off */ | 1198 | /* Pilot doesn't exist in DVB-S, turn bit off */ |
1173 | state->dnxt.pilot_val = CX24116_PILOT_OFF; | 1199 | state->dnxt.pilot_val = CX24116_PILOT_OFF; |
1174 | retune = 1; | 1200 | retune = 1; |
1175 | 1201 | ||
1176 | /* DVB-S only supports 0.35 */ | 1202 | /* DVB-S only supports 0.35 */ |
1177 | if(c->rolloff != ROLLOFF_35) { | 1203 | if (c->rolloff != ROLLOFF_35) { |
1178 | dprintk("%s: unsupported rolloff selected (%d)\n", | 1204 | dprintk("%s: unsupported rolloff selected (%d)\n", |
1179 | __func__, c->rolloff); | 1205 | __func__, c->rolloff); |
1180 | return -EOPNOTSUPP; | 1206 | return -EOPNOTSUPP; |
1181 | } | 1207 | } |
1182 | state->dnxt.rolloff_val = CX24116_ROLLOFF_035; | 1208 | state->dnxt.rolloff_val = CX24116_ROLLOFF_035; |
1183 | break; | 1209 | break; |
1184 | 1210 | ||
1185 | case SYS_DVBS2: | 1211 | case SYS_DVBS2: |
1186 | dprintk("%s: DVB-S2 delivery system selected\n",__func__); | 1212 | dprintk("%s: DVB-S2 delivery system selected\n", __func__); |
1187 | |||
1188 | /* | ||
1189 | * NBC 8PSK/QPSK with DVB-S is supported for DVB-S2, | ||
1190 | * but not hardware auto detection | ||
1191 | */ | ||
1192 | if(c->modulation != PSK_8 && c->modulation != QPSK) { | ||
1193 | dprintk("%s: unsupported modulation selected (%d)\n", | ||
1194 | __func__, c->modulation); | ||
1195 | return -EOPNOTSUPP; | ||
1196 | } | ||
1197 | 1213 | ||
1198 | switch(c->pilot) { | 1214 | /* |
1199 | case PILOT_AUTO: /* Not supported but emulated */ | 1215 | * NBC 8PSK/QPSK with DVB-S is supported for DVB-S2, |
1200 | retune = 2; /* Fall-through */ | 1216 | * but not hardware auto detection |
1201 | case PILOT_OFF: | 1217 | */ |
1202 | state->dnxt.pilot_val = CX24116_PILOT_OFF; | 1218 | if (c->modulation != PSK_8 && c->modulation != QPSK) { |
1203 | break; | 1219 | dprintk("%s: unsupported modulation selected (%d)\n", |
1204 | case PILOT_ON: | 1220 | __func__, c->modulation); |
1205 | state->dnxt.pilot_val = CX24116_PILOT_ON; | 1221 | return -EOPNOTSUPP; |
1206 | break; | 1222 | } |
1207 | default: | ||
1208 | dprintk("%s: unsupported pilot mode selected (%d)\n", | ||
1209 | __func__, c->pilot); | ||
1210 | return -EOPNOTSUPP; | ||
1211 | } | ||
1212 | 1223 | ||
1213 | switch(c->rolloff) { | 1224 | switch (c->pilot) { |
1214 | case ROLLOFF_20: | 1225 | case PILOT_AUTO: /* Not supported but emulated */ |
1215 | state->dnxt.rolloff_val= CX24116_ROLLOFF_020; | 1226 | retune = 2; /* Fall-through */ |
1216 | break; | 1227 | case PILOT_OFF: |
1217 | case ROLLOFF_25: | 1228 | state->dnxt.pilot_val = CX24116_PILOT_OFF; |
1218 | state->dnxt.rolloff_val= CX24116_ROLLOFF_025; | 1229 | break; |
1219 | break; | 1230 | case PILOT_ON: |
1220 | case ROLLOFF_35: | 1231 | state->dnxt.pilot_val = CX24116_PILOT_ON; |
1221 | state->dnxt.rolloff_val= CX24116_ROLLOFF_035; | ||
1222 | break; | ||
1223 | case ROLLOFF_AUTO: /* Rolloff must be explicit */ | ||
1224 | default: | ||
1225 | dprintk("%s: unsupported rolloff selected (%d)\n", | ||
1226 | __func__, c->rolloff); | ||
1227 | return -EOPNOTSUPP; | ||
1228 | } | ||
1229 | break; | 1232 | break; |
1233 | default: | ||
1234 | dprintk("%s: unsupported pilot mode selected (%d)\n", | ||
1235 | __func__, c->pilot); | ||
1236 | return -EOPNOTSUPP; | ||
1237 | } | ||
1230 | 1238 | ||
1239 | switch (c->rolloff) { | ||
1240 | case ROLLOFF_20: | ||
1241 | state->dnxt.rolloff_val = CX24116_ROLLOFF_020; | ||
1242 | break; | ||
1243 | case ROLLOFF_25: | ||
1244 | state->dnxt.rolloff_val = CX24116_ROLLOFF_025; | ||
1245 | break; | ||
1246 | case ROLLOFF_35: | ||
1247 | state->dnxt.rolloff_val = CX24116_ROLLOFF_035; | ||
1248 | break; | ||
1249 | case ROLLOFF_AUTO: /* Rolloff must be explicit */ | ||
1231 | default: | 1250 | default: |
1232 | dprintk("%s: unsupported delivery system selected (%d)\n", | 1251 | dprintk("%s: unsupported rolloff selected (%d)\n", |
1233 | __func__, c->delivery_system); | 1252 | __func__, c->rolloff); |
1234 | return -EOPNOTSUPP; | 1253 | return -EOPNOTSUPP; |
1254 | } | ||
1255 | break; | ||
1256 | |||
1257 | default: | ||
1258 | dprintk("%s: unsupported delivery system selected (%d)\n", | ||
1259 | __func__, c->delivery_system); | ||
1260 | return -EOPNOTSUPP; | ||
1235 | } | 1261 | } |
1236 | state->dnxt.modulation = c->modulation; | 1262 | state->dnxt.modulation = c->modulation; |
1237 | state->dnxt.frequency = c->frequency; | 1263 | state->dnxt.frequency = c->frequency; |
1238 | state->dnxt.pilot = c->pilot; | 1264 | state->dnxt.pilot = c->pilot; |
1239 | state->dnxt.rolloff = c->rolloff; | 1265 | state->dnxt.rolloff = c->rolloff; |
1240 | 1266 | ||
1241 | if ((ret = cx24116_set_inversion(state, c->inversion)) != 0) | 1267 | ret = cx24116_set_inversion(state, c->inversion); |
1268 | if (ret != 0) | ||
1242 | return ret; | 1269 | return ret; |
1243 | 1270 | ||
1244 | /* FEC_NONE/AUTO for DVB-S2 is not supported and detected here */ | 1271 | /* FEC_NONE/AUTO for DVB-S2 is not supported and detected here */ |
1245 | if ((ret = cx24116_set_fec(state, c->modulation, c->fec_inner)) != 0) | 1272 | ret = cx24116_set_fec(state, c->modulation, c->fec_inner); |
1273 | if (ret != 0) | ||
1246 | return ret; | 1274 | return ret; |
1247 | 1275 | ||
1248 | if ((ret = cx24116_set_symbolrate(state, c->symbol_rate)) != 0) | 1276 | ret = cx24116_set_symbolrate(state, c->symbol_rate); |
1277 | if (ret != 0) | ||
1249 | return ret; | 1278 | return ret; |
1250 | 1279 | ||
1251 | /* discard the 'current' tuning parameters and prepare to tune */ | 1280 | /* discard the 'current' tuning parameters and prepare to tune */ |
@@ -1271,7 +1300,7 @@ static int cx24116_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
1271 | /* Set/Reset B/W */ | 1300 | /* Set/Reset B/W */ |
1272 | cmd.args[0x00] = CMD_BANDWIDTH; | 1301 | cmd.args[0x00] = CMD_BANDWIDTH; |
1273 | cmd.args[0x01] = 0x01; | 1302 | cmd.args[0x01] = 0x01; |
1274 | cmd.len= 0x02; | 1303 | cmd.len = 0x02; |
1275 | ret = cx24116_cmd_execute(fe, &cmd); | 1304 | ret = cx24116_cmd_execute(fe, &cmd); |
1276 | if (ret != 0) | 1305 | if (ret != 0) |
1277 | return ret; | 1306 | return ret; |
@@ -1319,7 +1348,7 @@ static int cx24116_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
1319 | cx24116_writereg(state, CX24116_REG_RATEDIV, 0x00); | 1348 | cx24116_writereg(state, CX24116_REG_RATEDIV, 0x00); |
1320 | } | 1349 | } |
1321 | 1350 | ||
1322 | cmd.len= 0x13; | 1351 | cmd.len = 0x13; |
1323 | 1352 | ||
1324 | /* We need to support pilot and non-pilot tuning in the | 1353 | /* We need to support pilot and non-pilot tuning in the |
1325 | * driver automatically. This is a workaround for because | 1354 | * driver automatically. This is a workaround for because |
@@ -1327,12 +1356,13 @@ static int cx24116_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
1327 | */ | 1356 | */ |
1328 | do { | 1357 | do { |
1329 | /* Reset status register */ | 1358 | /* Reset status register */ |
1330 | status = cx24116_readreg(state, CX24116_REG_SSTATUS) & CX24116_SIGNAL_MASK; | 1359 | status = cx24116_readreg(state, CX24116_REG_SSTATUS) |
1360 | & CX24116_SIGNAL_MASK; | ||
1331 | cx24116_writereg(state, CX24116_REG_SSTATUS, status); | 1361 | cx24116_writereg(state, CX24116_REG_SSTATUS, status); |
1332 | 1362 | ||
1333 | /* Tune */ | 1363 | /* Tune */ |
1334 | ret = cx24116_cmd_execute(fe, &cmd); | 1364 | ret = cx24116_cmd_execute(fe, &cmd); |
1335 | if( ret != 0 ) | 1365 | if (ret != 0) |
1336 | break; | 1366 | break; |
1337 | 1367 | ||
1338 | /* | 1368 | /* |
@@ -1341,28 +1371,27 @@ static int cx24116_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
1341 | * If we are able to tune then generally it occurs within 100ms. | 1371 | * If we are able to tune then generally it occurs within 100ms. |
1342 | * If it takes longer, try a different toneburst setting. | 1372 | * If it takes longer, try a different toneburst setting. |
1343 | */ | 1373 | */ |
1344 | for(i = 0; i < 50 ; i++) { | 1374 | for (i = 0; i < 50 ; i++) { |
1345 | cx24116_read_status(fe, &tunerstat); | 1375 | cx24116_read_status(fe, &tunerstat); |
1346 | status = tunerstat & (FE_HAS_SIGNAL | FE_HAS_SYNC); | 1376 | status = tunerstat & (FE_HAS_SIGNAL | FE_HAS_SYNC); |
1347 | if(status == (FE_HAS_SIGNAL | FE_HAS_SYNC)) { | 1377 | if (status == (FE_HAS_SIGNAL | FE_HAS_SYNC)) { |
1348 | dprintk("%s: Tuned\n",__func__); | 1378 | dprintk("%s: Tuned\n", __func__); |
1349 | goto tuned; | 1379 | goto tuned; |
1350 | } | 1380 | } |
1351 | msleep(10); | 1381 | msleep(10); |
1352 | } | 1382 | } |
1353 | 1383 | ||
1354 | dprintk("%s: Not tuned\n",__func__); | 1384 | dprintk("%s: Not tuned\n", __func__); |
1355 | 1385 | ||
1356 | /* Toggle pilot bit when in auto-pilot */ | 1386 | /* Toggle pilot bit when in auto-pilot */ |
1357 | if(state->dcur.pilot == PILOT_AUTO) | 1387 | if (state->dcur.pilot == PILOT_AUTO) |
1358 | cmd.args[0x07] ^= CX24116_PILOT_ON; | 1388 | cmd.args[0x07] ^= CX24116_PILOT_ON; |
1359 | } | 1389 | } while (--retune); |
1360 | while(--retune); | ||
1361 | 1390 | ||
1362 | tuned: /* Set/Reset B/W */ | 1391 | tuned: /* Set/Reset B/W */ |
1363 | cmd.args[0x00] = CMD_BANDWIDTH; | 1392 | cmd.args[0x00] = CMD_BANDWIDTH; |
1364 | cmd.args[0x01] = 0x00; | 1393 | cmd.args[0x01] = 0x00; |
1365 | cmd.len= 0x02; | 1394 | cmd.len = 0x02; |
1366 | ret = cx24116_cmd_execute(fe, &cmd); | 1395 | ret = cx24116_cmd_execute(fe, &cmd); |
1367 | if (ret != 0) | 1396 | if (ret != 0) |
1368 | return ret; | 1397 | return ret; |
@@ -1407,17 +1436,7 @@ static struct dvb_frontend_ops cx24116_ops = { | |||
1407 | .set_frontend = cx24116_set_frontend, | 1436 | .set_frontend = cx24116_set_frontend, |
1408 | }; | 1437 | }; |
1409 | 1438 | ||
1410 | module_param(debug, int, 0644); | ||
1411 | MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); | ||
1412 | |||
1413 | module_param(toneburst, int, 0644); | ||
1414 | MODULE_PARM_DESC(toneburst, "DiSEqC toneburst 0=OFF, 1=TONE CACHE, 2=MESSAGE CACHE (default:1)"); | ||
1415 | |||
1416 | module_param(esno_snr, int, 0644); | ||
1417 | MODULE_PARM_DESC(debug, "SNR return units, 0=PERCENTAGE 0-100, 1=ESNO(db * 10) (default:0)"); | ||
1418 | |||
1419 | MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24116/cx24118 hardware"); | 1439 | MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24116/cx24118 hardware"); |
1420 | MODULE_AUTHOR("Steven Toth"); | 1440 | MODULE_AUTHOR("Steven Toth"); |
1421 | MODULE_LICENSE("GPL"); | 1441 | MODULE_LICENSE("GPL"); |
1422 | 1442 | ||
1423 | EXPORT_SYMBOL(cx24116_attach); | ||
diff --git a/drivers/media/dvb/frontends/cx24116.h b/drivers/media/dvb/frontends/cx24116.h index 2b09e10872fd..4cb3ddd6c626 100644 --- a/drivers/media/dvb/frontends/cx24116.h +++ b/drivers/media/dvb/frontends/cx24116.h | |||
@@ -23,31 +23,32 @@ | |||
23 | 23 | ||
24 | #include <linux/dvb/frontend.h> | 24 | #include <linux/dvb/frontend.h> |
25 | 25 | ||
26 | struct cx24116_config | 26 | struct cx24116_config { |
27 | { | ||
28 | /* the demodulator's i2c address */ | 27 | /* the demodulator's i2c address */ |
29 | u8 demod_address; | 28 | u8 demod_address; |
30 | 29 | ||
31 | /* Need to set device param for start_dma */ | 30 | /* Need to set device param for start_dma */ |
32 | int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); | 31 | int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured); |
33 | 32 | ||
34 | /* Need to reset device during firmware loading */ | 33 | /* Need to reset device during firmware loading */ |
35 | int (*reset_device)(struct dvb_frontend* fe); | 34 | int (*reset_device)(struct dvb_frontend *fe); |
36 | 35 | ||
37 | /* Need to set MPEG parameters */ | 36 | /* Need to set MPEG parameters */ |
38 | u8 mpg_clk_pos_pol:0x02; | 37 | u8 mpg_clk_pos_pol:0x02; |
39 | }; | 38 | }; |
40 | 39 | ||
41 | #if defined(CONFIG_DVB_CX24116) || defined(CONFIG_DVB_CX24116_MODULE) | 40 | #if defined(CONFIG_DVB_CX24116) || defined(CONFIG_DVB_CX24116_MODULE) |
42 | extern struct dvb_frontend* cx24116_attach(const struct cx24116_config* config, | 41 | extern struct dvb_frontend *cx24116_attach( |
43 | struct i2c_adapter* i2c); | 42 | const struct cx24116_config *config, |
43 | struct i2c_adapter *i2c); | ||
44 | #else | 44 | #else |
45 | static inline struct dvb_frontend* cx24116_attach(const struct cx24116_config* config, | 45 | static inline struct dvb_frontend *cx24116_attach( |
46 | struct i2c_adapter* i2c) | 46 | const struct cx24116_config *config, |
47 | struct i2c_adapter *i2c) | ||
47 | { | 48 | { |
48 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | 49 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
49 | return NULL; | 50 | return NULL; |
50 | } | 51 | } |
51 | #endif // CONFIG_DVB_CX24116 | 52 | #endif |
52 | 53 | ||
53 | #endif /* CX24116_H */ | 54 | #endif /* CX24116_H */ |