static void cx18_process_eeprom(struct cx18 *cx) { struct tveeprom tv; cx18_read_eeprom(cx, &tv); switch (tv.model) { case 74000 ... 74999: cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); break; case 0x718: return; case 0xffffffff: CX18_INFO("Unknown EEPROM encoding\n"); return; case 0: CX18_ERR("Invalid EEPROM\n"); return; default: CX18_ERR("Unknown model %d, defaulting to HVR-1600\n", tv.model); cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); break; } cx->v4l2_cap = cx->card->v4l2_capabilities; cx->card_name = cx->card->name; cx->card_i2c = cx->card->i2c; CX18_INFO("Autodetected %s\n", cx->card_name); if (tv.tuner_type == TUNER_ABSENT) CX18_ERR("tveeprom cannot autodetect tuner!\n"); if (cx->options.tuner == -1) cx->options.tuner = tv.tuner_type; if (cx->options.radio == -1) cx->options.radio = (tv.has_radio != 0); if (cx->std != 0) return; if (tv.tuner_formats & V4L2_STD_PAL) { CX18_DEBUG_INFO("PAL tuner detected\n"); cx->std |= V4L2_STD_PAL_BG | V4L2_STD_PAL_H; } else if (tv.tuner_formats & V4L2_STD_NTSC) { CX18_DEBUG_INFO("NTSC tuner detected\n"); cx->std |= V4L2_STD_NTSC_M; } else if (tv.tuner_formats & V4L2_STD_SECAM) { CX18_DEBUG_INFO("SECAM tuner detected\n"); cx->std |= V4L2_STD_SECAM_L; } else { CX18_INFO("No tuner detected, default to NTSC-M\n"); cx->std |= V4L2_STD_NTSC_M; } }
static void cx18_process_eeprom(struct cx18 *cx) { struct tveeprom tv; cx18_read_eeprom(cx, &tv); /* Many thanks to Steven Toth from Hauppauge for providing the model numbers */ /* Note: the Samsung memory models cannot be reliably determined from the model number. Use the cardtype module option if you have one of these preproduction models. */ switch (tv.model) { case 74000 ... 74999: cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); break; case 0: CX18_ERR("Invalid EEPROM\n"); return; default: CX18_ERR("Unknown model %d, defaulting to HVR-1600\n", tv.model); cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); break; } cx->v4l2_cap = cx->card->v4l2_capabilities; cx->card_name = cx->card->name; cx->card_i2c = cx->card->i2c; CX18_INFO("Autodetected %s\n", cx->card_name); if (tv.tuner_type == TUNER_ABSENT) CX18_ERR("tveeprom cannot autodetect tuner!"); if (cx->options.tuner == -1) cx->options.tuner = tv.tuner_type; if (cx->options.radio == -1) cx->options.radio = (tv.has_radio != 0); if (cx->std != 0) /* user specified tuner standard */ return; /* autodetect tuner standard */ if (tv.tuner_formats & V4L2_STD_PAL) { CX18_DEBUG_INFO("PAL tuner detected\n"); cx->std |= V4L2_STD_PAL_BG | V4L2_STD_PAL_H; } else if (tv.tuner_formats & V4L2_STD_NTSC) { CX18_DEBUG_INFO("NTSC tuner detected\n"); cx->std |= V4L2_STD_NTSC_M; } else if (tv.tuner_formats & V4L2_STD_SECAM) { CX18_DEBUG_INFO("SECAM tuner detected\n"); cx->std |= V4L2_STD_SECAM_L; } else { CX18_INFO("No tuner detected, default to NTSC-M\n"); cx->std |= V4L2_STD_NTSC_M; } }
static int cx18_log_status(struct file *file, void *fh) { struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct v4l2_input vidin; struct v4l2_audio audin; int i; CX18_INFO("================= START STATUS CARD #%d =================\n", cx->num); if (cx->hw_flags & CX18_HW_TVEEPROM) { struct tveeprom tv; cx18_read_eeprom(cx, &tv); } cx18_call_i2c_clients(cx, VIDIOC_LOG_STATUS, NULL); cx18_get_input(cx, cx->active_input, &vidin); cx18_get_audio_input(cx, cx->audio_input, &audin); CX18_INFO("Video Input: %s\n", vidin.name); CX18_INFO("Audio Input: %s\n", audin.name); mutex_lock(&cx->gpio_lock); CX18_INFO("GPIO: direction 0x%08x, value 0x%08x\n", cx->gpio_dir, cx->gpio_val); mutex_unlock(&cx->gpio_lock); CX18_INFO("Tuner: %s\n", test_bit(CX18_F_I_RADIO_USER, &cx->i_flags) ? "Radio" : "TV"); cx2341x_log_status(&cx->params, cx->name); CX18_INFO("Status flags: 0x%08lx\n", cx->i_flags); for (i = 0; i < CX18_MAX_STREAMS; i++) { struct cx18_stream *s = &cx->streams[i]; if (s->v4l2dev == NULL || s->buffers == 0) continue; CX18_INFO("Stream %s: status 0x%04lx, %d%% of %d KiB (%d buffers) in use\n", s->name, s->s_flags, (s->buffers - atomic_read(&s->q_free.buffers)) * 100 / s->buffers, (s->buffers * s->buf_size) / 1024, s->buffers); } CX18_INFO("Read MPEG/VBI: %lld/%lld bytes\n", (long long)cx->mpg_data_received, (long long)cx->vbi_data_inserted); cx18_log_statistics(cx); CX18_INFO("================== END STATUS CARD #%d ==================\n", cx->num); return 0; }
static void cx18_process_eeprom(struct cx18 *cx) { struct tveeprom tv; cx18_read_eeprom(cx, &tv); /* Many thanks to Steven Toth from Hauppauge for providing the model numbers */ /* Note: the Samsung memory models cannot be reliably determined from the model number. Use the cardtype module option if you have one of these preproduction models. */ switch (tv.model) { case 74301: /* Retail models */ case 74321: case 74351: /* OEM models */ case 74361: /* Digital side is s5h1411/tda18271 */ cx->card = cx18_get_card(CX18_CARD_HVR_1600_S5H1411); break; case 74021: /* Retail models */ case 74031: case 74041: case 74141: case 74541: /* OEM models */ case 74551: case 74591: case 74651: case 74691: case 74751: case 74891: /* Digital side is s5h1409/mxl5005s */ cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); break; case 0x718: return; case 0xffffffff: CX18_INFO("Unknown EEPROM encoding\n"); return; case 0: CX18_ERR("Invalid EEPROM\n"); return; default: CX18_ERR("Unknown model %d, defaulting to original HVR-1600 " "(cardtype=1)\n", tv.model); cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); break; } cx->v4l2_cap = cx->card->v4l2_capabilities; cx->card_name = cx->card->name; cx->card_i2c = cx->card->i2c; CX18_INFO("Autodetected %s\n", cx->card_name); if (tv.tuner_type == TUNER_ABSENT) CX18_ERR("tveeprom cannot autodetect tuner!\n"); if (cx->options.tuner == -1) cx->options.tuner = tv.tuner_type; if (cx->options.radio == -1) cx->options.radio = (tv.has_radio != 0); if (cx->std != 0) /* user specified tuner standard */ return; /* autodetect tuner standard */ #define TVEEPROM_TUNER_FORMAT_ALL (V4L2_STD_B | V4L2_STD_GH | \ V4L2_STD_MN | \ V4L2_STD_PAL_I | \ V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC | \ V4L2_STD_DK) if ((tv.tuner_formats & TVEEPROM_TUNER_FORMAT_ALL) == TVEEPROM_TUNER_FORMAT_ALL) { CX18_DEBUG_INFO("Worldwide tuner detected\n"); cx->std = V4L2_STD_ALL; } else if (tv.tuner_formats & V4L2_STD_PAL) { CX18_DEBUG_INFO("PAL tuner detected\n"); cx->std |= V4L2_STD_PAL_BG | V4L2_STD_PAL_H; } else if (tv.tuner_formats & V4L2_STD_NTSC) { CX18_DEBUG_INFO("NTSC tuner detected\n"); cx->std |= V4L2_STD_NTSC_M; } else if (tv.tuner_formats & V4L2_STD_SECAM) { CX18_DEBUG_INFO("SECAM tuner detected\n"); cx->std |= V4L2_STD_SECAM_L; } else { CX18_INFO("No tuner detected, default to NTSC-M\n"); cx->std |= V4L2_STD_NTSC_M; } }