Commit f19a73d6 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (6860): tveeprom: CodingStyle cleanup

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 5412c820
......@@ -46,11 +46,12 @@ MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver");
MODULE_AUTHOR("John Klar");
MODULE_LICENSE("GPL");
static int debug = 0;
static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Debug level (0-1)");
#define STRM(array,i) (i < sizeof(array)/sizeof(char*) ? array[i] : "unknown")
#define STRM(array, i) \
(i < sizeof(array) / sizeof(char *) ? array[i] : "unknown")
#define tveeprom_info(fmt, arg...) \
v4l_printk(KERN_INFO, "tveeprom", c->adapter, c->addr, fmt , ## arg)
......@@ -58,7 +59,8 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)");
v4l_printk(KERN_WARNING, "tveeprom", c->adapter, c->addr, fmt , ## arg)
#define tveeprom_dbg(fmt, arg...) do { \
if (debug) \
v4l_printk(KERN_DEBUG, "tveeprom", c->adapter, c->addr, fmt , ## arg); \
v4l_printk(KERN_DEBUG, "tveeprom", \
c->adapter, c->addr, fmt , ## arg); \
} while (0)
/*
......@@ -101,13 +103,13 @@ hauppauge_tuner[] =
{ TUNER_PHILIPS_SECAM, "Philips FI1216MF" },
{ TUNER_PHILIPS_NTSC, "Philips FI1236" },
{ TUNER_PHILIPS_PAL_I, "Philips FI1246" },
{ TUNER_PHILIPS_PAL_DK,"Philips FI1256" },
{ TUNER_PHILIPS_PAL_DK, "Philips FI1256" },
{ TUNER_PHILIPS_PAL, "Philips FI1216 MK2" },
{ TUNER_PHILIPS_SECAM, "Philips FI1216MF MK2" },
/* 10-19 */
{ TUNER_PHILIPS_NTSC, "Philips FI1236 MK2" },
{ TUNER_PHILIPS_PAL_I, "Philips FI1246 MK2" },
{ TUNER_PHILIPS_PAL_DK,"Philips FI1256 MK2" },
{ TUNER_PHILIPS_PAL_DK, "Philips FI1256 MK2" },
{ TUNER_TEMIC_NTSC, "Temic 4032FY5" },
{ TUNER_TEMIC_PAL, "Temic 4002FH5" },
{ TUNER_TEMIC_PAL_I, "Temic 4062FY5" },
......@@ -116,12 +118,12 @@ hauppauge_tuner[] =
{ TUNER_PHILIPS_NTSC, "Philips FR1236 MK2" },
{ TUNER_PHILIPS_PAL_I, "Philips FR1246 MK2" },
/* 20-29 */
{ TUNER_PHILIPS_PAL_DK,"Philips FR1256 MK2" },
{ TUNER_PHILIPS_PAL_DK, "Philips FR1256 MK2" },
{ TUNER_PHILIPS_PAL, "Philips FM1216" },
{ TUNER_PHILIPS_SECAM, "Philips FM1216MF" },
{ TUNER_PHILIPS_NTSC, "Philips FM1236" },
{ TUNER_PHILIPS_PAL_I, "Philips FM1246" },
{ TUNER_PHILIPS_PAL_DK,"Philips FM1256" },
{ TUNER_PHILIPS_PAL_DK, "Philips FM1256" },
{ TUNER_TEMIC_4036FY5_NTSC, "Temic 4036FY5" },
{ TUNER_ABSENT, "Samsung TCPN9082D" },
{ TUNER_ABSENT, "Samsung TCPM9092P" },
......@@ -344,36 +346,36 @@ static const char *decoderIC[] = {
static int hasRadioTuner(int tunerType)
{
switch (tunerType) {
case 18: //PNPEnv_TUNER_FR1236_MK2:
case 23: //PNPEnv_TUNER_FM1236:
case 38: //PNPEnv_TUNER_FMR1236:
case 16: //PNPEnv_TUNER_FR1216_MK2:
case 19: //PNPEnv_TUNER_FR1246_MK2:
case 21: //PNPEnv_TUNER_FM1216:
case 24: //PNPEnv_TUNER_FM1246:
case 17: //PNPEnv_TUNER_FR1216MF_MK2:
case 22: //PNPEnv_TUNER_FM1216MF:
case 20: //PNPEnv_TUNER_FR1256_MK2:
case 25: //PNPEnv_TUNER_FM1256:
case 33: //PNPEnv_TUNER_4039FR5:
case 42: //PNPEnv_TUNER_4009FR5:
case 52: //PNPEnv_TUNER_4049FM5:
case 54: //PNPEnv_TUNER_4049FM5_AltI2C:
case 44: //PNPEnv_TUNER_4009FN5:
case 31: //PNPEnv_TUNER_TCPB9085P:
case 30: //PNPEnv_TUNER_TCPN9085D:
case 46: //PNPEnv_TUNER_TP18NSR01F:
case 47: //PNPEnv_TUNER_TP18PSB01D:
case 49: //PNPEnv_TUNER_TAPC_I001D:
case 60: //PNPEnv_TUNER_TAPE_S001D_MK3:
case 57: //PNPEnv_TUNER_FM1216ME_MK3:
case 59: //PNPEnv_TUNER_FM1216MP_MK3:
case 58: //PNPEnv_TUNER_FM1236_MK3:
case 68: //PNPEnv_TUNER_TAPE_H001F_MK3:
case 61: //PNPEnv_TUNER_TAPE_M001D_MK3:
case 78: //PNPEnv_TUNER_TDA8275C1_8290_FM:
case 89: //PNPEnv_TUNER_TCL_MFPE05_2:
case 92: //PNPEnv_TUNER_PHILIPS_FQ1236A_MK4:
case 18: /* PNPEnv_TUNER_FR1236_MK2 */
case 23: /* PNPEnv_TUNER_FM1236 */
case 38: /* PNPEnv_TUNER_FMR1236 */
case 16: /* PNPEnv_TUNER_FR1216_MK2 */
case 19: /* PNPEnv_TUNER_FR1246_MK2 */
case 21: /* PNPEnv_TUNER_FM1216 */
case 24: /* PNPEnv_TUNER_FM1246 */
case 17: /* PNPEnv_TUNER_FR1216MF_MK2 */
case 22: /* PNPEnv_TUNER_FM1216MF */
case 20: /* PNPEnv_TUNER_FR1256_MK2 */
case 25: /* PNPEnv_TUNER_FM1256 */
case 33: /* PNPEnv_TUNER_4039FR5 */
case 42: /* PNPEnv_TUNER_4009FR5 */
case 52: /* PNPEnv_TUNER_4049FM5 */
case 54: /* PNPEnv_TUNER_4049FM5_AltI2C */
case 44: /* PNPEnv_TUNER_4009FN5 */
case 31: /* PNPEnv_TUNER_TCPB9085P */
case 30: /* PNPEnv_TUNER_TCPN9085D */
case 46: /* PNPEnv_TUNER_TP18NSR01F */
case 47: /* PNPEnv_TUNER_TP18PSB01D */
case 49: /* PNPEnv_TUNER_TAPC_I001D */
case 60: /* PNPEnv_TUNER_TAPE_S001D_MK3 */
case 57: /* PNPEnv_TUNER_FM1216ME_MK3 */
case 59: /* PNPEnv_TUNER_FM1216MP_MK3 */
case 58: /* PNPEnv_TUNER_FM1236_MK3 */
case 68: /* PNPEnv_TUNER_TAPE_H001F_MK3 */
case 61: /* PNPEnv_TUNER_TAPE_M001D_MK3 */
case 78: /* PNPEnv_TUNER_TDA8275C1_8290_FM */
case 89: /* PNPEnv_TUNER_TCL_MFPE05_2 */
case 92: /* PNPEnv_TUNER_PHILIPS_FQ1236A_MK4 */
case 105:
return 1;
}
......@@ -392,7 +394,8 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
**
** In our (ivtv) case we're interested in the following:
** tuner type: tag [00].05 or [0a].01 (index into hauppauge_tuner)
** tuner fmts: tag [00].04 or [0a].00 (bitmask index into hauppauge_tuner_fmt)
** tuner fmts: tag [00].04 or [0a].00 (bitmask index into
** hauppauge_tuner_fmt)
** radio: tag [00].{last} or [0e].00 (bitmask. bit2=FM)
** audio proc: tag [02].01 or [05].00 (mask with 0x7f)
** decoder proc: tag [09].01)
......@@ -451,16 +454,17 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
++i;
} else {
tveeprom_warn("Encountered bad packet header [%02x]. "
"Corrupt or not a Hauppauge eeprom.\n", eeprom_data[i]);
"Corrupt or not a Hauppauge eeprom.\n",
eeprom_data[i]);
return;
}
if (debug) {
tveeprom_info("Tag [%02x] + %d bytes:", eeprom_data[i], len - 1);
for(j = 1; j < len; j++) {
printk(" %02x", eeprom_data[i + j]);
}
printk("\n");
tveeprom_info("Tag [%02x] + %d bytes:",
eeprom_data[i], len - 1);
for (j = 1; j < len; j++)
printk(KERN_CONT " %02x", eeprom_data[i + j]);
printk(KERN_CONT "\n");
}
/* process by tag */
......@@ -511,8 +515,8 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
(eeprom_data[i+6] << 8) +
(eeprom_data[i+7] << 16);
if ( (eeprom_data[i + 8] & 0xf0) &&
(tvee->serial_number < 0xffffff) ) {
if ((eeprom_data[i + 8] & 0xf0) &&
(tvee->serial_number < 0xffffff)) {
tvee->MAC_address[0] = 0x00;
tvee->MAC_address[1] = 0x0D;
tvee->MAC_address[2] = 0xFE;
......@@ -544,7 +548,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
(eeprom_data[i + 3] << 16) +
(eeprom_data[i + 4] << 24);
tvee->revision =
eeprom_data[i +5 ] +
eeprom_data[i + 5] +
(eeprom_data[i + 6] << 8) +
(eeprom_data[i + 7] << 16);
break;
......@@ -564,17 +568,17 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
case 0x0a:
/* tag 'Tuner' */
if (beenhere == 0) {
tuner1 = eeprom_data[i+2];
t_format1 = eeprom_data[i+1];
tuner1 = eeprom_data[i + 2];
t_format1 = eeprom_data[i + 1];
beenhere = 1;
} else {
/* a second (radio) tuner may be present */
tuner2 = eeprom_data[i+2];
t_format2 = eeprom_data[i+1];
if (t_format2 == 0) { /* not a TV tuner? */
tuner2 = eeprom_data[i + 2];
t_format2 = eeprom_data[i + 1];
/* not a TV tuner? */
if (t_format2 == 0)
tvee->has_radio = 1; /* must be radio */
}
}
break;
case 0x0b:
......@@ -601,7 +605,8 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
/* case 0x12: tag 'InfoBits' */
default:
tveeprom_dbg("Not sure what to do with tag [%02x]\n", tag);
tveeprom_dbg("Not sure what to do with tag [%02x]\n",
tag);
/* dump the rest of the packet? */
}
}
......@@ -615,7 +620,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
tvee->rev_str[0] = 32 + ((tvee->revision >> 18) & 0x3f);
tvee->rev_str[1] = 32 + ((tvee->revision >> 12) & 0x3f);
tvee->rev_str[2] = 32 + ((tvee->revision >> 6) & 0x3f);
tvee->rev_str[3] = 32 + ( tvee->revision & 0x3f);
tvee->rev_str[3] = 32 + (tvee->revision & 0x3f);
tvee->rev_str[4] = 0;
}
......@@ -658,44 +663,40 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
tveeprom_info("Hauppauge model %d, rev %s, serial# %d\n",
tvee->model, tvee->rev_str, tvee->serial_number);
if (tvee->has_MAC_address == 1) {
if (tvee->has_MAC_address == 1)
tveeprom_info("MAC address is %02X-%02X-%02X-%02X-%02X-%02X\n",
tvee->MAC_address[0], tvee->MAC_address[1],
tvee->MAC_address[2], tvee->MAC_address[3],
tvee->MAC_address[4], tvee->MAC_address[5]);
}
tveeprom_info("tuner model is %s (idx %d, type %d)\n",
t_name1, tuner1, tvee->tuner_type);
tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
t_fmt_name1[0], t_fmt_name1[1], t_fmt_name1[2], t_fmt_name1[3],
t_fmt_name1[4], t_fmt_name1[5], t_fmt_name1[6], t_fmt_name1[7],
t_format1);
if (tuner2) {
t_fmt_name1[0], t_fmt_name1[1], t_fmt_name1[2],
t_fmt_name1[3], t_fmt_name1[4], t_fmt_name1[5],
t_fmt_name1[6], t_fmt_name1[7], t_format1);
if (tuner2)
tveeprom_info("second tuner model is %s (idx %d, type %d)\n",
t_name2, tuner2, tvee->tuner2_type);
}
if (t_format2) {
if (t_format2)
tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
t_fmt_name2[0], t_fmt_name2[1], t_fmt_name2[2], t_fmt_name2[3],
t_fmt_name2[4], t_fmt_name2[5], t_fmt_name2[6], t_fmt_name2[7],
t_format2);
}
if (audioic<0) {
t_fmt_name2[0], t_fmt_name2[1], t_fmt_name2[2],
t_fmt_name2[3], t_fmt_name2[4], t_fmt_name2[5],
t_fmt_name2[6], t_fmt_name2[7], t_format2);
if (audioic < 0) {
tveeprom_info("audio processor is unknown (no idx)\n");
tvee->audio_processor=AUDIO_CHIP_UNKNOWN;
tvee->audio_processor = AUDIO_CHIP_UNKNOWN;
} else {
if (audioic < ARRAY_SIZE(audioIC))
tveeprom_info("audio processor is %s (idx %d)\n",
audioIC[audioic].name,audioic);
audioIC[audioic].name, audioic);
else
tveeprom_info("audio processor is unknown (idx %d)\n",
audioic);
}
if (tvee->decoder_processor) {
if (tvee->decoder_processor)
tveeprom_info("decoder processor is %s (idx %d)\n",
STRM(decoderIC, tvee->decoder_processor),
tvee->decoder_processor);
}
if (tvee->has_ir == -1)
tveeprom_info("has %sradio\n",
tvee->has_radio ? "" : "no ");
......@@ -716,11 +717,13 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len)
int err;
buf = 0;
if (1 != (err = i2c_master_send(c, &buf, 1))) {
err = i2c_master_send(c, &buf, 1);
if (err != 1) {
tveeprom_info("Huh, no eeprom present (err=%d)?\n", err);
return -1;
}
if (len != (err = i2c_master_recv(c, eedata, len))) {
err = i2c_master_recv(c, eedata, len);
if (err != len) {
tveeprom_warn("i2c eeprom read error (err=%d)\n", err);
return -1;
}
......@@ -731,9 +734,9 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len)
for (i = 0; i < len; i++) {
if (0 == (i % 16))
tveeprom_info("%02x:", i);
printk(" %02x", eedata[i]);
printk(KERN_CONT " %02x", eedata[i]);
if (15 == (i % 16))
printk("\n");
printk(KERN_CONT "\n");
}
}
return 0;
......@@ -765,9 +768,9 @@ tveeprom_command(struct i2c_client *client,
switch (cmd) {
case 0:
buf = kzalloc(256,GFP_KERNEL);
tveeprom_read(client,buf,256);
tveeprom_hauppauge_analog(client, &eeprom,buf);
buf = kzalloc(256, GFP_KERNEL);
tveeprom_read(client, buf, 256);
tveeprom_hauppauge_analog(client, &eeprom, buf);
kfree(buf);
eeprom_props[0] = eeprom.tuner_type;
eeprom_props[1] = eeprom.tuner_formats;
......@@ -801,7 +804,7 @@ tveeprom_detect_client(struct i2c_adapter *adapter,
}
static int
tveeprom_attach_adapter (struct i2c_adapter *adapter)
tveeprom_attach_adapter(struct i2c_adapter *adapter)
{
if (adapter->class & I2C_CLASS_TV_ANALOG)
return i2c_probe(adapter, &addr_data, tveeprom_detect_client);
......@@ -809,7 +812,7 @@ tveeprom_attach_adapter (struct i2c_adapter *adapter)
}
static int
tveeprom_detach_client (struct i2c_client *client)
tveeprom_detach_client(struct i2c_client *client)
{
int err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment