aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorSteven Toth <stoth@linuxtv.org>2008-10-16 19:24:42 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-17 16:27:45 -0400
commit98c948236923bf30031ab94cf6dba2291d9af72a (patch)
tree43d43908c1ec3c7f4e3667fdc5473451a56e0efb /drivers/media/dvb
parent4e3599a5f0c4c5be15e31d802c94b4593d9af9c9 (diff)
V4L/DVB (9257): cx24116: Checkpatch compliance #3
cx24116: Checkpatch compliance #3 Signed-off-by: Steven Toth <stoth@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/frontends/cx24116.c105
1 files changed, 65 insertions, 40 deletions
diff --git a/drivers/media/dvb/frontends/cx24116.c b/drivers/media/dvb/frontends/cx24116.c
index 751792a092e2..8afdfbec551b 100644
--- a/drivers/media/dvb/frontends/cx24116.c
+++ b/drivers/media/dvb/frontends/cx24116.c
@@ -48,7 +48,7 @@ MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)");
48#define dprintk(args...) \ 48#define dprintk(args...) \
49 do { \ 49 do { \
50 if (debug) \ 50 if (debug) \
51 printk("cx24116: " args); \ 51 printk(KERN_INFO "cx24116: " args); \
52 } while (0) 52 } while (0)
53 53
54#define CX24116_DEFAULT_FIRMWARE "dvb-fe-cx24116.fw" 54#define CX24116_DEFAULT_FIRMWARE "dvb-fe-cx24116.fw"
@@ -72,13 +72,20 @@ MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)");
72#define CX24116_REG_UCB8 (0xca) 72#define CX24116_REG_UCB8 (0xca)
73#define CX24116_REG_CLKDIV (0xf3) 73#define CX24116_REG_CLKDIV (0xf3)
74#define CX24116_REG_RATEDIV (0xf9) 74#define CX24116_REG_RATEDIV (0xf9)
75#define CX24116_REG_FECSTATUS (0x9c) /* configured fec (not tuned) or actual FEC (tuned) 1=1/2 2=2/3 etc */ 75
76/* configured fec (not tuned) or actual FEC (tuned) 1=1/2 2=2/3 etc */
77#define CX24116_REG_FECSTATUS (0x9c)
76 78
77/* FECSTATUS bits */ 79/* FECSTATUS bits */
78#define CX24116_FEC_FECMASK (0x1f) /* mask to determine configured fec (not tuned) or actual fec (tuned) */ 80/* mask to determine configured fec (not tuned) or actual fec (tuned) */
79#define CX24116_FEC_DVBS (0x20) /* Select DVB-S demodulator, else DVB-S2 */ 81#define CX24116_FEC_FECMASK (0x1f)
82
83/* Select DVB-S demodulator, else DVB-S2 */
84#define CX24116_FEC_DVBS (0x20)
80#define CX24116_FEC_UNKNOWN (0x40) /* Unknown/unused */ 85#define CX24116_FEC_UNKNOWN (0x40) /* Unknown/unused */
81#define CX24116_FEC_PILOT (0x80) /* Pilot mode requested when tuning else always reset when tuned */ 86
87/* Pilot mode requested when tuning else always reset when tuned */
88#define CX24116_FEC_PILOT (0x80)
82 89
83/* arg buffer size */ 90/* arg buffer size */
84#define CX24116_ARGLEN (0x1e) 91#define CX24116_ARGLEN (0x1e)
@@ -121,12 +128,14 @@ MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)");
121/* DiSEqC tone burst */ 128/* DiSEqC tone burst */
122static int toneburst = 1; 129static int toneburst = 1;
123module_param(toneburst, int, 0644); 130module_param(toneburst, int, 0644);
124MODULE_PARM_DESC(toneburst, "DiSEqC toneburst 0=OFF, 1=TONE CACHE, 2=MESSAGE CACHE (default:1)"); 131MODULE_PARM_DESC(toneburst, "DiSEqC toneburst 0=OFF, 1=TONE CACHE, "\
132 "2=MESSAGE CACHE (default:1)");
125 133
126/* SNR measurements */ 134/* SNR measurements */
127static int esno_snr; 135static int esno_snr;
128module_param(esno_snr, int, 0644); 136module_param(esno_snr, int, 0644);
129MODULE_PARM_DESC(debug, "SNR return units, 0=PERCENTAGE 0-100, 1=ESNO(db * 10) (default:0)"); 137MODULE_PARM_DESC(debug, "SNR return units, 0=PERCENTAGE 0-100, "\
138 "1=ESNO(db * 10) (default:0)");
130 139
131enum cmds { 140enum cmds {
132 CMD_SET_VCO = 0x10, 141 CMD_SET_VCO = 0x10,
@@ -196,7 +205,7 @@ static int cx24116_writereg(struct cx24116_state *state, int reg, int data)
196 205
197 err = i2c_transfer(state->i2c, &msg, 1); 206 err = i2c_transfer(state->i2c, &msg, 1);
198 if (err != 1) { 207 if (err != 1) {
199 printk("%s: writereg error(err == %i, reg == 0x%02x," 208 printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x,"
200 " value == 0x%02x)\n", __func__, err, reg, data); 209 " value == 0x%02x)\n", __func__, err, reg, data);
201 return -EREMOTEIO; 210 return -EREMOTEIO;
202 } 211 }
@@ -228,12 +237,12 @@ static int cx24116_writeregN(struct cx24116_state *state, int reg,
228 msg.len = len + 1; 237 msg.len = len + 1;
229 238
230 if (debug > 1) 239 if (debug > 1)
231 printk("cx24116: %s: write regN 0x%02x, len = %d\n", 240 printk(KERN_INFO "cx24116: %s: write regN 0x%02x, len = %d\n",
232 __func__, reg, len); 241 __func__, reg, len);
233 242
234 ret = i2c_transfer(state->i2c, &msg, 1); 243 ret = i2c_transfer(state->i2c, &msg, 1);
235 if (ret != 1) { 244 if (ret != 1) {
236 printk("%s: writereg error(err == %i, reg == 0x%02x\n", 245 printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x\n",
237 __func__, ret, reg); 246 __func__, ret, reg);
238 ret = -EREMOTEIO; 247 ret = -EREMOTEIO;
239 } 248 }
@@ -259,18 +268,20 @@ static int cx24116_readreg(struct cx24116_state *state, u8 reg)
259 ret = i2c_transfer(state->i2c, msg, 2); 268 ret = i2c_transfer(state->i2c, msg, 2);
260 269
261 if (ret != 2) { 270 if (ret != 2) {
262 printk("%s: reg=0x%x (error=%d)\n", __func__, reg, ret); 271 printk(KERN_ERR "%s: reg=0x%x (error=%d)\n",
272 __func__, reg, ret);
263 return ret; 273 return ret;
264 } 274 }
265 275
266 if (debug > 1) 276 if (debug > 1)
267 printk("cx24116: read reg 0x%02x, value 0x%02x\n", 277 printk(KERN_INFO "cx24116: read reg 0x%02x, value 0x%02x\n",
268 reg, b1[0]); 278 reg, b1[0]);
269 279
270 return b1[0]; 280 return b1[0];
271} 281}
272 282
273static int cx24116_set_inversion(struct cx24116_state *state, fe_spectral_inversion_t inversion) 283static int cx24116_set_inversion(struct cx24116_state *state,
284 fe_spectral_inversion_t inversion)
274{ 285{
275 dprintk("%s(%d)\n", __func__, inversion); 286 dprintk("%s(%d)\n", __func__, inversion);
276 287
@@ -318,10 +329,10 @@ static int cx24116_set_inversion(struct cx24116_state *state, fe_spectral_invers
318 * Eg.(2/3) szap "Zone Horror" 329 * Eg.(2/3) szap "Zone Horror"
319 * 330 *
320 * mask/val = 0x04, 0x20 331 * mask/val = 0x04, 0x20
321 * status 1f | signal c3c0 | snr a333 | ber 00000098 | unc 00000000 | FE_HAS_LOCK 332 * status 1f | signal c3c0 | snr a333 | ber 00000098 | unc 0 | FE_HAS_LOCK
322 * 333 *
323 * mask/val = 0x04, 0x30 334 * mask/val = 0x04, 0x30
324 * status 1f | signal c3c0 | snr a333 | ber 00000000 | unc 00000000 | FE_HAS_LOCK 335 * status 1f | signal c3c0 | snr a333 | ber 00000000 | unc 0 | FE_HAS_LOCK
325 * 336 *
326 * After tuning FECSTATUS contains actual FEC 337 * After tuning FECSTATUS contains actual FEC
327 * in use numbered 1 through to 8 for 1/2 .. 2/3 etc 338 * in use numbered 1 through to 8 for 1/2 .. 2/3 etc
@@ -417,7 +428,8 @@ static int cx24116_lookup_fecmod(struct cx24116_state *state,
417 return ret; 428 return ret;
418} 429}
419 430
420static int cx24116_set_fec(struct cx24116_state *state, fe_modulation_t mod, fe_code_rate_t fec) 431static int cx24116_set_fec(struct cx24116_state *state,
432 fe_modulation_t mod, fe_code_rate_t fec)
421{ 433{
422 int ret = 0; 434 int ret = 0;
423 435
@@ -471,25 +483,32 @@ static int cx24116_firmware_ondemand(struct dvb_frontend *fe)
471 return 0; 483 return 0;
472 484
473 /* Load firmware */ 485 /* Load firmware */
474 /* request the firmware, this will block until someone uploads it */ 486 /* request the firmware, this will block until loaded */
475 printk("%s: Waiting for firmware upload (%s)...\n", __func__, CX24116_DEFAULT_FIRMWARE); 487 printk(KERN_INFO "%s: Waiting for firmware upload (%s)...\n",
476 ret = request_firmware(&fw, CX24116_DEFAULT_FIRMWARE, &state->i2c->dev); 488 __func__, CX24116_DEFAULT_FIRMWARE);
477 printk("%s: Waiting for firmware upload(2)...\n", __func__); 489 ret = request_firmware(&fw, CX24116_DEFAULT_FIRMWARE,
490 &state->i2c->dev);
491 printk(KERN_INFO "%s: Waiting for firmware upload(2)...\n",
492 __func__);
478 if (ret) { 493 if (ret) {
479 printk("%s: No firmware uploaded (timeout or file not found?)\n", __func__); 494 printk(KERN_ERR "%s: No firmware uploaded "
495 "(timeout or file not found?)\n", __func__);
480 return ret; 496 return ret;
481 } 497 }
482 498
483 /* Make sure we don't recurse back through here during loading */ 499 /* Make sure we don't recurse back through here
500 * during loading */
484 state->skip_fw_load = 1; 501 state->skip_fw_load = 1;
485 502
486 ret = cx24116_load_firmware(fe, fw); 503 ret = cx24116_load_firmware(fe, fw);
487 if (ret) 504 if (ret)
488 printk("%s: Writing firmware to device failed\n", __func__); 505 printk(KERN_ERR "%s: Writing firmware to device failed\n",
506 __func__);
489 507
490 release_firmware(fw); 508 release_firmware(fw);
491 509
492 printk("%s: Firmware upload %s\n", __func__, ret == 0 ? "complete" : "failed"); 510 printk(KERN_INFO "%s: Firmware upload %s\n", __func__,
511 ret == 0 ? "complete" : "failed");
493 512
494 /* Ensure firmware is always loaded if required */ 513 /* Ensure firmware is always loaded if required */
495 state->skip_fw_load = 0; 514 state->skip_fw_load = 0;
@@ -498,7 +517,9 @@ static int cx24116_firmware_ondemand(struct dvb_frontend *fe)
498 return ret; 517 return ret;
499} 518}
500 519
501/* Take a basic firmware command structure, format it and forward it for processing */ 520/* Take a basic firmware command structure, format it
521 * and forward it for processing
522 */
502static int cx24116_cmd_execute(struct dvb_frontend *fe, struct cx24116_cmd *cmd) 523static int cx24116_cmd_execute(struct dvb_frontend *fe, struct cx24116_cmd *cmd)
503{ 524{
504 struct cx24116_state *state = fe->demodulator_priv; 525 struct cx24116_state *state = fe->demodulator_priv;
@@ -509,7 +530,8 @@ static int cx24116_cmd_execute(struct dvb_frontend *fe, struct cx24116_cmd *cmd)
509 /* Load the firmware if required */ 530 /* Load the firmware if required */
510 ret = cx24116_firmware_ondemand(fe); 531 ret = cx24116_firmware_ondemand(fe);
511 if (ret != 0) { 532 if (ret != 0) {
512 printk("%s(): Unable initialise the firmware\n", __func__); 533 printk(KERN_ERR "%s(): Unable initialise the firmware\n",
534 __func__);
513 return ret; 535 return ret;
514 } 536 }
515 537
@@ -524,8 +546,10 @@ static int cx24116_cmd_execute(struct dvb_frontend *fe, struct cx24116_cmd *cmd)
524 while (cx24116_readreg(state, CX24116_REG_EXECUTE)) { 546 while (cx24116_readreg(state, CX24116_REG_EXECUTE)) {
525 msleep(10); 547 msleep(10);
526 if (i++ > 64) { 548 if (i++ > 64) {
527 /* Avoid looping forever if the firmware does no respond */ 549 /* Avoid looping forever if the firmware does
528 printk("%s() Firmware not responding\n", __func__); 550 not respond */
551 printk(KERN_WARNING "%s() Firmware not responding\n",
552 __func__);
529 return -EREMOTEIO; 553 return -EREMOTEIO;
530 } 554 }
531 } 555 }
@@ -635,7 +659,7 @@ static int cx24116_load_firmware(struct dvb_frontend *fe,
635 return ret; 659 return ret;
636 vers[i] = cx24116_readreg(state, CX24116_REG_MAILBOX); 660 vers[i] = cx24116_readreg(state, CX24116_REG_MAILBOX);
637 } 661 }
638 printk("%s: FW version %i.%i.%i.%i\n", __func__, 662 printk(KERN_INFO "%s: FW version %i.%i.%i.%i\n", __func__,
639 vers[0], vers[1], vers[2], vers[3]); 663 vers[0], vers[1], vers[2], vers[3]);
640 664
641 return 0; 665 return 0;
@@ -818,7 +842,7 @@ static int cx24116_set_tone(struct dvb_frontend *fe,
818 842
819 dprintk("%s(%d)\n", __func__, tone); 843 dprintk("%s(%d)\n", __func__, tone);
820 if ((tone != SEC_TONE_ON) && (tone != SEC_TONE_OFF)) { 844 if ((tone != SEC_TONE_ON) && (tone != SEC_TONE_OFF)) {
821 printk("%s: Invalid, tone=%d\n", __func__, tone); 845 printk(KERN_ERR "%s: Invalid, tone=%d\n", __func__, tone);
822 return -EINVAL; 846 return -EINVAL;
823 } 847 }
824 848
@@ -891,7 +915,8 @@ static int cx24116_diseqc_init(struct dvb_frontend *fe)
891 /* Unknown */ 915 /* Unknown */
892 state->dsec_cmd.args[CX24116_DISEQC_ARG2_2] = 0x02; 916 state->dsec_cmd.args[CX24116_DISEQC_ARG2_2] = 0x02;
893 state->dsec_cmd.args[CX24116_DISEQC_ARG3_0] = 0x00; 917 state->dsec_cmd.args[CX24116_DISEQC_ARG3_0] = 0x00;
894 state->dsec_cmd.args[CX24116_DISEQC_ARG4_0] = 0x00; /* Continuation flag? */ 918 /* Continuation flag? */
919 state->dsec_cmd.args[CX24116_DISEQC_ARG4_0] = 0x00;
895 920
896 /* DiSEqC message length */ 921 /* DiSEqC message length */
897 state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = 0x00; 922 state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = 0x00;
@@ -911,11 +936,11 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,
911 936
912 /* Dump DiSEqC message */ 937 /* Dump DiSEqC message */
913 if (debug) { 938 if (debug) {
914 printk("cx24116: %s(", __func__); 939 printk(KERN_INFO "cx24116: %s(", __func__);
915 for (i = 0 ; i < d->msg_len ;) { 940 for (i = 0 ; i < d->msg_len ;) {
916 printk("0x%02x", d->msg[i]); 941 printk(KERN_INFO "0x%02x", d->msg[i]);
917 if (++i < d->msg_len) 942 if (++i < d->msg_len)
918 printk(", "); 943 printk(KERN_INFO ", ");
919 } 944 }
920 printk(") toneburst=%d\n", toneburst); 945 printk(") toneburst=%d\n", toneburst);
921 } 946 }
@@ -1072,10 +1097,8 @@ struct dvb_frontend *cx24116_attach(const struct cx24116_config *config,
1072 1097
1073 /* allocate memory for the internal state */ 1098 /* allocate memory for the internal state */
1074 state = kmalloc(sizeof(struct cx24116_state), GFP_KERNEL); 1099 state = kmalloc(sizeof(struct cx24116_state), GFP_KERNEL);
1075 if (state == NULL) { 1100 if (state == NULL)
1076 printk("Unable to kmalloc\n");
1077 goto error1; 1101 goto error1;
1078 }
1079 1102
1080 /* setup the state */ 1103 /* setup the state */
1081 memset(state, 0, sizeof(struct cx24116_state)); 1104 memset(state, 0, sizeof(struct cx24116_state));
@@ -1084,14 +1107,16 @@ struct dvb_frontend *cx24116_attach(const struct cx24116_config *config,
1084 state->i2c = i2c; 1107 state->i2c = i2c;
1085 1108
1086 /* check if the demod is present */ 1109 /* check if the demod is present */
1087 ret = (cx24116_readreg(state, 0xFF) << 8) | cx24116_readreg(state, 0xFE); 1110 ret = (cx24116_readreg(state, 0xFF) << 8) |
1111 cx24116_readreg(state, 0xFE);
1088 if (ret != 0x0501) { 1112 if (ret != 0x0501) {
1089 printk("Invalid probe, probably not a CX24116 device\n"); 1113 printk(KERN_INFO "Invalid probe, probably not a CX24116 device\n");
1090 goto error2; 1114 goto error2;
1091 } 1115 }
1092 1116
1093 /* create dvb_frontend */ 1117 /* create dvb_frontend */
1094 memcpy(&state->frontend.ops, &cx24116_ops, sizeof(struct dvb_frontend_ops)); 1118 memcpy(&state->frontend.ops, &cx24116_ops,
1119 sizeof(struct dvb_frontend_ops));
1095 state->frontend.demodulator_priv = state; 1120 state->frontend.demodulator_priv = state;
1096 return &state->frontend; 1121 return &state->frontend;
1097 1122