summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-12-22 01:33:36 +0100
committerHans Verkuil <hverkuil@xs4all.nl>2007-12-22 01:33:36 +0100
commit9542e383f613070c986fbdfee8d8dc582e99f75f (patch)
treebe6344747b39b1b8c2d3424ed3e41151ac57d2ef /linux
parent0845ae16e220be09645b258217b87a1640f80f75 (diff)
downloadmediapointer-dvb-s2-9542e383f613070c986fbdfee8d8dc582e99f75f.tar.gz
mediapointer-dvb-s2-9542e383f613070c986fbdfee8d8dc582e99f75f.tar.bz2
ivtv: add XC2028 support for Club3D cards
From: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-cards.c44
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-driver.c19
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-driver.h4
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-gpio.c8
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-i2c.c4
5 files changed, 40 insertions, 39 deletions
diff --git a/linux/drivers/media/video/ivtv/ivtv-cards.c b/linux/drivers/media/video/ivtv/ivtv-cards.c
index 654d225a5..3289a7b9e 100644
--- a/linux/drivers/media/video/ivtv/ivtv-cards.c
+++ b/linux/drivers/media/video/ivtv/ivtv-cards.c
@@ -880,8 +880,10 @@ static const struct ivtv_card ivtv_card_pg600v2 = {
.hw_video = IVTV_HW_CX25840,
.hw_audio = IVTV_HW_CX25840,
.hw_audio_ctrl = IVTV_HW_CX25840,
+#if 0
.hw_all = IVTV_HW_CX25840 | IVTV_HW_TUNER,
-#ifdef HAVE_XC2028
+ /* XC2028 support has not yet been tested on this card, until
+ that's done support for this tuner is disabled. */
.video_inputs = {
{ IVTV_CARD_INPUT_VID_TUNER, 0, CX25840_COMPOSITE2 },
{ IVTV_CARD_INPUT_SVIDEO1, 1,
@@ -894,7 +896,11 @@ static const struct ivtv_card ivtv_card_pg600v2 = {
},
.radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 },
.gpio_init = { .direction = 0x1000, .initial_value = 0x1000 }, /* tuner reset */
+ .tuners = {
+ { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
+ },
#else
+ .hw_all = IVTV_HW_CX25840,
.video_inputs = {
{ IVTV_CARD_INPUT_SVIDEO1, 0,
CX25840_SVIDEO_LUMA3 | CX25840_SVIDEO_CHROMA4 },
@@ -904,9 +910,6 @@ static const struct ivtv_card ivtv_card_pg600v2 = {
{ IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL },
},
#endif
- .tuners = {
- { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
- },
.pci_list = ivtv_pci_pg600v2,
.i2c = &ivtv_i2c_std,
};
@@ -928,7 +931,6 @@ static const struct ivtv_card ivtv_card_club3d = {
.hw_audio = IVTV_HW_CX25840,
.hw_audio_ctrl = IVTV_HW_CX25840,
.hw_all = IVTV_HW_CX25840 | IVTV_HW_TUNER,
-#ifdef HAVE_XC2028
.video_inputs = {
{ IVTV_CARD_INPUT_VID_TUNER, 0, CX25840_COMPOSITE2 },
{ IVTV_CARD_INPUT_SVIDEO1, 1,
@@ -941,16 +943,6 @@ static const struct ivtv_card ivtv_card_club3d = {
},
.radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 },
.gpio_init = { .direction = 0x1000, .initial_value = 0x1000 }, /* tuner reset */
-#else
- .video_inputs = {
- { IVTV_CARD_INPUT_SVIDEO1, 0,
- CX25840_SVIDEO_LUMA3 | CX25840_SVIDEO_CHROMA4 },
- { IVTV_CARD_INPUT_COMPOSITE1, 0, CX25840_COMPOSITE3 },
- },
- .audio_inputs = {
- { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL },
- },
-#endif
.tuners = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
},
@@ -974,20 +966,25 @@ static const struct ivtv_card ivtv_card_avertv_mce116 = {
.hw_video = IVTV_HW_CX25840,
.hw_audio = IVTV_HW_CX25840,
.hw_audio_ctrl = IVTV_HW_CX25840,
+#if 0
+ /* XC2028 support has problems with fw loading on this card,
+ so don't support this tuner for this card until this issue
+ has been solved. */
.hw_all = IVTV_HW_CX25840 | IVTV_HW_TUNER | IVTV_HW_WM8739,
-#ifdef HAVE_XC2028
.video_inputs = {
- { IVTV_CARD_INPUT_VID_TUNER, 0, CX25840_COMPOSITE2 },
- { IVTV_CARD_INPUT_SVIDEO1, 1, CX25840_SVIDEO3 },
- { IVTV_CARD_INPUT_COMPOSITE1, 1, CX25840_COMPOSITE1 },
+ { IVTV_CARD_INPUT_SVIDEO1, 0, CX25840_SVIDEO3 },
+ { IVTV_CARD_INPUT_COMPOSITE1, 0, CX25840_COMPOSITE1 },
},
.audio_inputs = {
- { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5, 0 },
{ IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL, 1 },
},
- .radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 },
- .gpio_init = { .direction = 0xf000, .initial_value = 0x5000 }, /* tuner reset & enable line-in */
+ /* enable line-in */
+ .gpio_init = { .direction = 0xf000, .initial_value = 0x5000 },
+ .tuners = {
+ { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
+ },
#else
+ .hw_all = IVTV_HW_CX25840 | IVTV_HW_WM8739,
.video_inputs = {
{ IVTV_CARD_INPUT_SVIDEO1, 0, CX25840_SVIDEO3 },
{ IVTV_CARD_INPUT_COMPOSITE1, 0, CX25840_COMPOSITE1 },
@@ -997,9 +994,6 @@ static const struct ivtv_card ivtv_card_avertv_mce116 = {
},
.gpio_init = { .direction = 0xe000, .initial_value = 0x4000 }, /* enable line-in */
#endif
- .tuners = {
- { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
- },
.pci_list = ivtv_pci_avertv_mce116,
.i2c = &ivtv_i2c_std,
};
diff --git a/linux/drivers/media/video/ivtv/ivtv-driver.c b/linux/drivers/media/video/ivtv/ivtv-driver.c
index 8cb43fc09..eb6430249 100644
--- a/linux/drivers/media/video/ivtv/ivtv-driver.c
+++ b/linux/drivers/media/video/ivtv/ivtv-driver.c
@@ -59,6 +59,7 @@
#include <media/tveeprom.h>
#include <media/saa7115.h>
#include <media/v4l2-chip-ident.h>
+#include "tuner-xc2028.h"
/* var to keep track of the number of array elements in use */
int ivtv_cards_active = 0;
@@ -848,11 +849,6 @@ static void ivtv_load_and_init_modules(struct ivtv *itv)
unsigned i;
/* load modules */
- if ((hw & IVTV_HW_TUNER) && itv->options.tuner == TUNER_XC2028) {
- IVTV_INFO("Xceive tuner not yet supported, only composite\n");
- IVTV_INFO("and S-Video inputs will be available\n");
- hw &= ~IVTV_HW_TUNER;
- }
#ifndef CONFIG_VIDEO_TUNER
hw = ivtv_request_module(itv, hw, "tuner", IVTV_HW_TUNER);
#endif
@@ -1154,7 +1150,20 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
setup.addr = ADDR_UNSET;
setup.type = itv->options.tuner;
setup.mode_mask = T_ANALOG_TV; /* matches TV tuners */
+ setup.tuner_callback = (setup.type == TUNER_XC2028) ?
+ ivtv_reset_tuner_gpio : NULL;
ivtv_call_i2c_clients(itv, TUNER_SET_TYPE_ADDR, &setup);
+ if (setup.type == TUNER_XC2028) {
+ static struct xc2028_ctrl ctrl = {
+ .fname = XC2028_DEFAULT_FIRMWARE,
+ .max_len = 64,
+ };
+ struct v4l2_priv_tun_config cfg = {
+ .tuner = itv->options.tuner,
+ .priv = &ctrl,
+ };
+ ivtv_call_i2c_clients(itv, TUNER_SET_CONFIG, &cfg);
+ }
}
/* The tuner is fixed to the standard. The other inputs (e.g. S-Video)
diff --git a/linux/drivers/media/video/ivtv/ivtv-driver.h b/linux/drivers/media/video/ivtv/ivtv-driver.h
index 5b2bd0be0..ab8ba6fb4 100644
--- a/linux/drivers/media/video/ivtv/ivtv-driver.h
+++ b/linux/drivers/media/video/ivtv/ivtv-driver.h
@@ -68,10 +68,6 @@
#include <linux/ivtv.h>
-#if 0
-#define HAVE_XC2028 1
-#endif
-
/* Memory layout */
#define IVTV_ENCODER_OFFSET 0x00000000
#define IVTV_ENCODER_SIZE 0x00800000 /* Total size is 0x01000000, but only first half is used */
diff --git a/linux/drivers/media/video/ivtv/ivtv-gpio.c b/linux/drivers/media/video/ivtv/ivtv-gpio.c
index 14f57285d..688cd3856 100644
--- a/linux/drivers/media/video/ivtv/ivtv-gpio.c
+++ b/linux/drivers/media/video/ivtv/ivtv-gpio.c
@@ -22,6 +22,7 @@
#include "ivtv-driver.h"
#include "ivtv-cards.h"
#include "ivtv-gpio.h"
+#include "tuner-xc2028.h"
#include <media/tuner.h>
/*
@@ -122,13 +123,15 @@ void ivtv_reset_ir_gpio(struct ivtv *itv)
write_reg(curdir, IVTV_REG_GPIO_DIR);
}
-#ifdef HAVE_XC2028
/* Xceive tuner reset function */
int ivtv_reset_tuner_gpio(void *dev, int cmd, int value)
{
- struct ivtv *itv = (struct ivtv *)dev;
+ struct i2c_algo_bit_data *algo = dev;
+ struct ivtv *itv = algo->data;
int curdir, curout;
+ if (cmd != XC2028_TUNER_RESET)
+ return 0;
IVTV_DEBUG_INFO("Resetting tuner\n");
curout = read_reg(IVTV_REG_GPIO_OUT);
curdir = read_reg(IVTV_REG_GPIO_DIR);
@@ -143,7 +146,6 @@ int ivtv_reset_tuner_gpio(void *dev, int cmd, int value)
schedule_timeout_interruptible(msecs_to_jiffies(1));
return 0;
}
-#endif
void ivtv_gpio_init(struct ivtv *itv)
{
diff --git a/linux/drivers/media/video/ivtv/ivtv-i2c.c b/linux/drivers/media/video/ivtv/ivtv-i2c.c
index 481f76903..e84ed02b5 100644
--- a/linux/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/linux/drivers/media/video/ivtv/ivtv-i2c.c
@@ -809,9 +809,9 @@ int init_ivtv_i2c(struct ivtv *itv)
/* The mspx4xx chips need a longer delay for some reason */
if (itv->hw_flags & IVTV_HW_MSP34XX)
itv->i2c_algo.udelay = 10;
- itv->i2c_algo.data = itv;
- itv->i2c_adap.algo_data = &itv->i2c_algo;
}
+ itv->i2c_algo.data = itv;
+ itv->i2c_adap.algo_data = &itv->i2c_algo;
sprintf(itv->i2c_adap.name + strlen(itv->i2c_adap.name), " #%d",
itv->num);