From 95a838243b906e096275b179d4e7302f282c990e Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Tue, 24 Jul 2007 08:06:45 -0300 Subject: [PATCH] V4L/DVB (12782): tm6000: Correct some device capabilities Add tuner reset GPIO and demodulator address fields to the tm6000_core struct. Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 22 ++++++++++++---------- drivers/staging/tm6000/tm6000-video.c | 15 ++++++++++++++- drivers/staging/tm6000/tm6000.h | 8 ++++++-- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index a10c9ef..e8f88ea 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -34,11 +34,10 @@ #define TM5600_BOARD_GENERIC 1 #define TM6000_BOARD_GENERIC 2 #define TM5600_BOARD_10MOONS_UT821 3 -#define TM6000_BOARD_10MOONS_UT330 4 +#define TM5600_BOARD_10MOONS_UT330 4 #define TM6000_BOARD_ADSTECH_DUAL_TV 5 #define TM6000_BOARD_FREECOM_AND_SIMILAR 6 - #define TM6000_MAXBOARDS 16 static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; @@ -52,8 +51,8 @@ struct tm6000_board { int tuner_type; /* type of the tuner */ int tuner_addr; /* tuner address */ - - int gpio_addr_tun_reset; /* GPIO used for reset tuner */ + int demod_addr; /* demodulator address */ + int gpio_addr_tun_reset; /* GPIO used for tuner reset */ }; @@ -94,17 +93,16 @@ struct tm6000_board tm6000_boards[] = { }, .gpio_addr_tun_reset = TM6000_GPIO_1, }, - [TM6000_BOARD_10MOONS_UT330] = { + [TM5600_BOARD_10MOONS_UT330] = { .name = "10Moons UT 330", - .tuner_type = TUNER_XC2028, + .tuner_type = TUNER_PHILIPS_FQ1216AME_MK4, .tuner_addr = 0xc8, .caps = { .has_tuner = 1, - .has_dvb = 1, - .has_zl10353 = 1, + .has_dvb = 0, + .has_zl10353 = 0, .has_eeprom = 1, }, - .gpio_addr_tun_reset = TM6000_GPIO_4, }, [TM6000_BOARD_ADSTECH_DUAL_TV] = { .name = "ADSTECH Dual TV USB", @@ -122,14 +120,15 @@ struct tm6000_board tm6000_boards[] = { .name = "Freecom Hybrid Stick / Moka DVB-T Receiver Dual", .tuner_type = TUNER_XC2028, .tuner_addr = 0xc2, + .demod_addr = 0x1e, .caps = { .has_tuner = 1, .has_dvb = 1, .has_zl10353 = 1, .has_eeprom = 0, }, + .gpio_addr_tun_reset = TM6000_GPIO_4, }, - }; /* table of devices that work with this driver */ @@ -152,6 +151,9 @@ static int tm6000_init_dev(struct tm6000_core *dev) /* Initializa board-specific data */ dev->tuner_type = tm6000_boards[dev->model].tuner_type; dev->tuner_addr = tm6000_boards[dev->model].tuner_addr; + dev->tuner_reset_gpio = tm6000_boards[dev->model].gpio_addr_tun_reset; + + dev->demod_addr = tm6000_boards[dev->model].demod_addr; dev->caps = tm6000_boards[dev->model].caps; diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index df3d835..d8e9f27 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -46,6 +46,10 @@ #define BUFFER_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ +/* Limits minimum and default number of buffers */ +#define TM6000_MIN_BUF 4 +#define TM6000_DEF_BUF 8 + /* Declare static vars that will be used as parameters */ static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ @@ -696,6 +700,7 @@ static void tm6000_vid_timeout(unsigned long data) /* ------------------------------------------------------------------ Videobuf operations ------------------------------------------------------------------*/ + static int buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) { @@ -703,9 +708,17 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) *size = fh->fmt->depth * fh->width * fh->height >> 3; if (0 == *count) - *count = 32; + *count = TM6000_DEF_BUF; + + if (*count < TM6000_MIN_BUF) { + *count=TM6000_MIN_BUF; + } + +printk("Requesting %d buffers\n",*count); + while (*size * *count > vid_limit * 1024 * 1024) (*count)--; + return 0; } diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index e8ae81d..27bee62 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -110,8 +110,12 @@ struct tm6000_core { struct tm6000_capabilities caps; /* Tuner configuration */ - int tuner_type; /* type of the tuner */ - int tuner_addr; /* tuner address */ + int tuner_type; /* type of the tuner */ + int tuner_addr; /* tuner address */ + int tuner_reset_gpio; /* GPIO used for tuner reset */ + + /* Demodulator configuration */ + int demod_addr; /* demodulator address */ /* i2c i/o */ struct i2c_adapter i2c_adap; -- 2.7.4