Skip to content

Commit

Permalink
V4L/DVB (6765): ivtv: convert to bus-based i2c API
Browse files Browse the repository at this point in the history
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Jan 25, 2008
1 parent 9d1a16a commit d900920
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 83 deletions.
47 changes: 47 additions & 0 deletions drivers/media/video/ivtv/ivtv-cards.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,27 @@
#define MSP_MONO MSP_INPUT(MSP_IN_MONO, MSP_IN_TUNER1, \
MSP_DSP_IN_SCART, MSP_DSP_IN_SCART)

/* usual i2c tuner addresses to probe */
static struct ivtv_card_tuner_i2c ivtv_i2c_std = {
.radio = { I2C_CLIENT_END },
.demod = { 0x43, I2C_CLIENT_END },
.tv = { 0x61, 0x60, I2C_CLIENT_END },
};

/* as above, but with possible radio tuner */
static struct ivtv_card_tuner_i2c ivtv_i2c_radio = {
.radio = { 0x60, I2C_CLIENT_END },
.demod = { 0x43, I2C_CLIENT_END },
.tv = { 0x61, I2C_CLIENT_END },
};

/* using the tda8290+75a combo */
static struct ivtv_card_tuner_i2c ivtv_i2c_tda8290 = {
.radio = { I2C_CLIENT_END },
.demod = { I2C_CLIENT_END },
.tv = { 0x4b, I2C_CLIENT_END },
};

/********************** card configuration *******************************/

/* Please add new PCI IDs to: http://pci-ids.ucw.cz/iii
Expand Down Expand Up @@ -73,6 +94,7 @@ static const struct ivtv_card ivtv_card_pvr250 = {
{ IVTV_CARD_INPUT_LINE_IN2, MSP_SCART3 },
},
.radio_input = { IVTV_CARD_INPUT_AUD_TUNER, MSP_SCART2 },
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -127,6 +149,7 @@ static const struct ivtv_card ivtv_card_pvr350 = {
{ IVTV_CARD_INPUT_LINE_IN2, MSP_SCART3 },
},
.radio_input = { IVTV_CARD_INPUT_AUD_TUNER, MSP_SCART2 },
.i2c = &ivtv_i2c_std,
};

/* PVR-350 V1 boards have a different audio tuner input and use a
Expand Down Expand Up @@ -158,6 +181,7 @@ static const struct ivtv_card ivtv_card_pvr350_v1 = {
{ IVTV_CARD_INPUT_LINE_IN2, MSP_SCART3 },
},
.radio_input = { IVTV_CARD_INPUT_AUD_TUNER, MSP_SCART2 },
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -193,6 +217,7 @@ static const struct ivtv_card ivtv_card_pvr150 = {
CX25840_AUDIO_SERIAL, WM8775_AIN4 },
/* apparently needed for the IR blaster */
.gpio_init = { .direction = 0x1f01, .initial_value = 0x26f3 },
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -235,6 +260,7 @@ static const struct ivtv_card ivtv_card_m179 = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_NTSC },
},
.pci_list = ivtv_pci_m179,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -276,6 +302,7 @@ static const struct ivtv_card ivtv_card_mpg600 = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FQ1286 },
},
.pci_list = ivtv_pci_mpg600,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -316,6 +343,7 @@ static const struct ivtv_card ivtv_card_mpg160 = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FQ1286 },
},
.pci_list = ivtv_pci_mpg160,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -351,6 +379,7 @@ static const struct ivtv_card ivtv_card_pg600 = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FQ1286 },
},
.pci_list = ivtv_pci_pg600,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -394,6 +423,7 @@ static const struct ivtv_card ivtv_card_avc2410 = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FM1236_MK3 },
},
.pci_list = ivtv_pci_avc2410,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -464,6 +494,7 @@ static const struct ivtv_card ivtv_card_tg5000tv = {
{ .std = V4L2_STD_525_60, .tuner = TUNER_PHILIPS_FQ1286 },
},
.pci_list = ivtv_pci_tg5000tv,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -494,6 +525,7 @@ static const struct ivtv_card ivtv_card_va2000 = {
{ .std = V4L2_STD_525_60, .tuner = TUNER_PHILIPS_FQ1286 },
},
.pci_list = ivtv_pci_va2000,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -538,6 +570,7 @@ static const struct ivtv_card ivtv_card_cx23416gyc = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FM1236_MK3 },
},
.pci_list = ivtv_pci_cx23416gyc,
.i2c = &ivtv_i2c_std,
};

static const struct ivtv_card ivtv_card_cx23416gyc_nogr = {
Expand Down Expand Up @@ -568,6 +601,7 @@ static const struct ivtv_card ivtv_card_cx23416gyc_nogr = {
{ .std = V4L2_STD_625_50, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
{ .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FM1236_MK3 },
},
.i2c = &ivtv_i2c_std,
};

static const struct ivtv_card ivtv_card_cx23416gyc_nogrycs = {
Expand Down Expand Up @@ -597,6 +631,7 @@ static const struct ivtv_card ivtv_card_cx23416gyc_nogrycs = {
{ .std = V4L2_STD_625_50, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
{ .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FM1236_MK3 },
},
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -636,6 +671,7 @@ static const struct ivtv_card ivtv_card_gv_mvprx = {
{ .std = V4L2_STD_525_60, .tuner = TUNER_PANASONIC_VP27 },
},
.pci_list = ivtv_pci_gv_mvprx,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -672,6 +708,7 @@ static const struct ivtv_card ivtv_card_gv_mvprx2e = {
{ .std = V4L2_STD_525_60, .tuner = TUNER_PANASONIC_VP27 },
},
.pci_list = ivtv_pci_gv_mvprx2e,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -706,6 +743,7 @@ static const struct ivtv_card ivtv_card_gotview_pci_dvd = {
{ .std = V4L2_STD_625_50, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
},
.pci_list = ivtv_pci_gotview_pci_dvd,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -744,6 +782,7 @@ static const struct ivtv_card ivtv_card_gotview_pci_dvd2 = {
{ .std = V4L2_STD_625_50, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
},
.pci_list = ivtv_pci_gotview_pci_dvd2,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -779,6 +818,7 @@ static const struct ivtv_card ivtv_card_yuan_mpc622 = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_TDA8290 },
},
.pci_list = ivtv_pci_yuan_mpc622,
.i2c = &ivtv_i2c_tda8290,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -820,6 +860,7 @@ static const struct ivtv_card ivtv_card_dctmvtvp1 = {
{ .std = V4L2_STD_525_60, .tuner = TUNER_PHILIPS_FQ1286 },
},
.pci_list = ivtv_pci_dctmvtvp1,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -852,6 +893,7 @@ static const struct ivtv_card ivtv_card_pg600v2 = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
},
.pci_list = ivtv_pci_pg600v2,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -883,6 +925,7 @@ static const struct ivtv_card ivtv_card_club3d = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
},
.pci_list = ivtv_pci_club3d,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -914,6 +957,7 @@ static const struct ivtv_card ivtv_card_avertv_mce116 = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
},
.pci_list = ivtv_pci_avertv_mce116,
.i2c = &ivtv_i2c_std,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -952,6 +996,7 @@ static const struct ivtv_card ivtv_card_aver_pvr150 = {
{ .std = V4L2_STD_525_60, .tuner = TUNER_TCL_2002N },
},
.pci_list = ivtv_pci_aver_pvr150,
.i2c = &ivtv_i2c_radio,
};

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -979,6 +1024,7 @@ static const struct ivtv_card ivtv_card_aver_ezmaker = {
{ IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL, 0 },
},
.gpio_init = { .direction = 0x4000, .initial_value = 0x4000 },
/* Does not have a tuner */
.pci_list = ivtv_pci_aver_ezmaker,
};

Expand Down Expand Up @@ -1018,6 +1064,7 @@ static const struct ivtv_card ivtv_card_asus_falcon2 = {
{ .std = V4L2_STD_525_60, .tuner = TUNER_PHILIPS_FM1236_MK3 },
},
.pci_list = ivtv_pci_asus_falcon2,
.i2c = &ivtv_i2c_std,
};

static const struct ivtv_card *ivtv_card_list[] = {
Expand Down
24 changes: 15 additions & 9 deletions drivers/media/video/ivtv/ivtv-cards.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
#define IVTV_PCI_ID_GOTVIEW1 0xffac
#define IVTV_PCI_ID_GOTVIEW2 0xffad

/* hardware flags */
/* hardware flags, no gaps allowed, IVTV_HW_GPIO must always be last */
#define IVTV_HW_CX25840 (1 << 0)
#define IVTV_HW_SAA7115 (1 << 1)
#define IVTV_HW_SAA7127 (1 << 2)
Expand All @@ -94,14 +94,13 @@
#define IVTV_HW_CS53L32A (1 << 6)
#define IVTV_HW_TVEEPROM (1 << 7)
#define IVTV_HW_SAA7114 (1 << 8)
#define IVTV_HW_TVAUDIO (1 << 9)
#define IVTV_HW_UPD64031A (1 << 10)
#define IVTV_HW_UPD6408X (1 << 11)
#define IVTV_HW_SAA717X (1 << 12)
#define IVTV_HW_WM8739 (1 << 13)
#define IVTV_HW_VP27SMPX (1 << 14)
#define IVTV_HW_M52790 (1 << 15)
#define IVTV_HW_GPIO (1 << 16)
#define IVTV_HW_UPD64031A (1 << 9)
#define IVTV_HW_UPD6408X (1 << 10)
#define IVTV_HW_SAA717X (1 << 11)
#define IVTV_HW_WM8739 (1 << 12)
#define IVTV_HW_VP27SMPX (1 << 13)
#define IVTV_HW_M52790 (1 << 14)
#define IVTV_HW_GPIO (1 << 15)

#define IVTV_HW_SAA711X (IVTV_HW_SAA7115 | IVTV_HW_SAA7114)

Expand Down Expand Up @@ -235,6 +234,12 @@ struct ivtv_card_tuner {
int tuner; /* tuner ID (from tuner.h) */
};

struct ivtv_card_tuner_i2c {
unsigned short radio[2];/* radio tuner i2c address to probe */
unsigned short demod[2];/* demodulator i2c address to probe */
unsigned short tv[4]; /* tv tuner i2c addresses to probe */
};

/* for card information/parameters */
struct ivtv_card {
int type;
Expand Down Expand Up @@ -262,6 +267,7 @@ struct ivtv_card {
struct ivtv_gpio_audio_detect gpio_audio_detect;

struct ivtv_card_tuner tuners[IVTV_CARD_MAX_TUNERS];
struct ivtv_card_tuner_i2c *i2c;

/* list of device and subsystem vendor/devices that
correspond to this card type. */
Expand Down
Loading

0 comments on commit d900920

Please sign in to comment.