Loading drivers/media/video/tveeprom.c +237 −234 Original line number Diff line number Diff line Loading @@ -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) Loading @@ -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) /* Loading Loading @@ -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; } Loading @@ -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) Loading Loading @@ -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 */ Loading Loading @@ -571,10 +575,10 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, /* 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? */ /* not a TV tuner? */ if (t_format2 == 0) tvee->has_radio = 1; /* must be radio */ } } break; case 0x0b: Loading @@ -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? */ } } Loading Loading @@ -658,28 +663,25 @@ 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); } 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; Loading @@ -691,11 +693,10 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, 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 "); Loading @@ -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; } Loading @@ -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; Loading Loading
drivers/media/video/tveeprom.c +237 −234 Original line number Diff line number Diff line Loading @@ -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) Loading @@ -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) /* Loading Loading @@ -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; } Loading @@ -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) Loading Loading @@ -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 */ Loading Loading @@ -571,10 +575,10 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, /* 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? */ /* not a TV tuner? */ if (t_format2 == 0) tvee->has_radio = 1; /* must be radio */ } } break; case 0x0b: Loading @@ -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? */ } } Loading Loading @@ -658,28 +663,25 @@ 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); } 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; Loading @@ -691,11 +693,10 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, 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 "); Loading @@ -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; } Loading @@ -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; Loading