summaryrefslogtreecommitdiff
path: root/v4l_experimental/pvrusb2/pvrusb2-eeprom.c
diff options
context:
space:
mode:
Diffstat (limited to 'v4l_experimental/pvrusb2/pvrusb2-eeprom.c')
-rw-r--r--v4l_experimental/pvrusb2/pvrusb2-eeprom.c166
1 files changed, 1 insertions, 165 deletions
diff --git a/v4l_experimental/pvrusb2/pvrusb2-eeprom.c b/v4l_experimental/pvrusb2/pvrusb2-eeprom.c
index e963cf480..9df9fd3eb 100644
--- a/v4l_experimental/pvrusb2/pvrusb2-eeprom.c
+++ b/v4l_experimental/pvrusb2/pvrusb2-eeprom.c
@@ -1,6 +1,6 @@
/*
*
- * $Id: pvrusb2-eeprom.c,v 1.4 2005/12/02 13:32:17 mcisely Exp $
+ * $Id: pvrusb2-eeprom.c,v 1.5 2006/01/14 19:09:50 mcisely Exp $
*
* Copyright (C) 2005 Mike Isely <isely@pobox.com>
* Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
@@ -74,45 +74,7 @@
*/
-#ifdef PVR2_EEPROM_INDIRECT
-/*VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV*/
-/* BEGIN INDIRECT METHOD */
-
-#include "pvrusb2-i2c.h"
-
-/* Use I2C client interface to retrieve usable information from within
- * tveeprom. This tends to be more stable than directly calling. */
-
-int pvr2_eeprom_analyze(struct pvr2_hdw *hdw)
-{
- u32 props[5];
- int stat;
- stat = pvr2_i2c_tveeprom_cmd(hdw,0,props);
- if (stat < 0) {
- pvr2_trace(PVR2_TRACE_ERROR_LEGS,
- "Failed to retrieve eeprom data stat=%d",stat);
- return stat;
- }
-
- trace_eeprom("eeprom client query results:");
- trace_eeprom("tuner_type=%d",props[0]);
- trace_eeprom("tuner_formats=0x%x",props[1]);
- trace_eeprom("model=%d",props[2]);
- trace_eeprom("revision=%d",props[3]);
- trace_eeprom("has_radio=%d",props[4]);
-
- hdw->tuner_type = props[0];
- hdw->video_standards = props[1];
-
- return 0;
-}
-
-/* END INDIRECT METHOD */
-/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
-#endif /* PVR2_EEPROM_INDIRECT */
-
-#ifndef PVR2_EEPROM_INDIRECT
/* Stuff common to direct approach of operation tveeprom */
@@ -179,7 +141,6 @@ static u8 *pvr2_eeprom_fetch(struct pvr2_hdw *hdw)
}
-#ifndef PVR2_EEPROM_IVTV
/*VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV*/
/* BEGIN DIRECT METHOD, V4L ONLY */
@@ -230,136 +191,11 @@ int pvr2_eeprom_analyze(struct pvr2_hdw *hdw)
/* END DIRECT METHOD, V4L ONLY */
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
-#endif /* PVR2_EEPROM_IVTV */
-
-
-
-
-#ifdef PVR2_EEPROM_IVTV
-/*VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV*/
-/* BEGIN DIRECT METHOD, V4L OR IVTV */
-
-/* Directly call eeprom analysis function within tveeprom. This has
- portability issues because the internal API has been changing. We
- have to do something positively gross here. The two variants of
- tveeprom that we deal with (ivtv and v4l) use completely different
- definitions for the tveeprom structure. To accomodate this, we'll
- allocate enough storage for the larger of the two, initialize it to
- bad but predictable data, and then call the analysis function.
- Upon return, we'll check how much data was changed and use that as
- a hint to determine exactly which tveeprom structure had been
- used. Did I say this was ugly? It's disgusting. */
-
-
-/* This has to be an EXACT(!!) match with the tveeprom structure
- defined in our local copy of tveeprom.c. */
-struct tveeprom_ivtv {
- u32 has_radio;
-
- u32 tuner_type;
- u32 tuner_formats;
-
- u32 digitizer;
- u32 digitizer_formats;
-
- u32 audio_processor;
- u32 decoder_processor;
- /* a_p_fmts? */
-
- u32 model;
- u32 revision;
- u32 serial_number;
- char rev_str[5];
-};
-
-int pvr2_eeprom_analyze(struct pvr2_hdw *hdw)
-{
- u8 *eeprom;
- unsigned tcnt;
- int tp;
- union {
- struct tveeprom v4l;
- struct tveeprom_ivtv ivtv;
- } tvdata;
- memset(&tvdata,0x93,sizeof(tvdata));
- eeprom = pvr2_eeprom_fetch(hdw);
- if (!eeprom) return -EINVAL;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
- {
- struct i2c_client fake_client;
- /* Newer version expects a useless client interface */
- fake_client.addr = PVR_EEPROM_I2C_ADDR;
- fake_client.adapter = &hdw->i2c_adap;
- tveeprom_hauppauge_analog(&fake_client,
- (struct tveeprom *)&tvdata,eeprom);
- }
-#else
- tveeprom_hauppauge_analog((struct tveeprom *)&tvdata,eeprom);
-#endif
-
- /* Now figure out which structure was used */
- for (tcnt = 0; tcnt < sizeof(tvdata); tcnt++) {
- if (((unsigned char *)(&tvdata))[sizeof(tvdata) - (tcnt+1)] !=
- 0x93) {
- break;
- }
- }
- tcnt = sizeof(tvdata) - tcnt;
-
- if (sizeof(tvdata.ivtv) < sizeof(tvdata.v4l)) {
- tp = 0;
- if (tcnt > sizeof(tvdata.ivtv)) tp = 1;
- } else {
- tp = 1;
- if (tcnt > sizeof(tvdata.v4l)) tp = 0;
- }
-
- if (tp) {
- /* v4l */
- trace_eeprom("eeprom detected v4l tveeprom module");
- trace_eeprom("eeprom direct call results:");
- trace_eeprom("has_radio=%d",tvdata.v4l.has_radio);
- trace_eeprom("tuner_type=%d",tvdata.v4l.tuner_type);
- trace_eeprom("tuner_formats=0x%x",tvdata.v4l.tuner_formats);
- trace_eeprom("audio_processor=%d",tvdata.v4l.audio_processor);
- trace_eeprom("model=%d",tvdata.v4l.model);
- trace_eeprom("revision=%d",tvdata.v4l.revision);
- trace_eeprom("serial_number=%d",tvdata.v4l.serial_number);
- trace_eeprom("rev_str=%s",tvdata.v4l.rev_str);
- hdw->tuner_type = tvdata.v4l.tuner_type;
- hdw->serial_number = tvdata.v4l.serial_number;
- hdw->video_standards = tvdata.v4l.tuner_formats;
- } else {
- /* ivtv */
- trace_eeprom("eeprom detected ivtv tveeprom module");
- trace_eeprom("eeprom direct call results:");
- trace_eeprom("has_radio=%d",tvdata.ivtv.has_radio);
- trace_eeprom("tuner_type=%d",tvdata.ivtv.tuner_type);
- trace_eeprom("tuner_formats=0x%x",tvdata.ivtv.tuner_formats);
- trace_eeprom("audio_processor=%d",tvdata.ivtv.audio_processor);
- trace_eeprom("model=%d",tvdata.ivtv.model);
- trace_eeprom("revision=%d",tvdata.ivtv.revision);
- trace_eeprom("serial_number=%d",tvdata.ivtv.serial_number);
- trace_eeprom("rev_str=%s",tvdata.ivtv.rev_str);
- hdw->tuner_type = tvdata.ivtv.tuner_type;
- hdw->serial_number = tvdata.ivtv.serial_number;
- hdw->video_standards = tvdata.ivtv.tuner_formats;
- }
-
- kfree(eeprom);
-
- return 0;
-}
-
-/* END DIRECT METHOD, V4L OR IVTV */
-/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
-#endif /* PVR2_EEPROM_V4L */
-#endif /* PVR2_EEPROM_INDIRECT */
static v4l2_std_id std_choices[] = {