提交 c8793b03 编写于 作者: M Mauro Carvalho Chehab

V4L/DVB (7021): Move all board specific configuration to em28xx-cards.c

This cleanup moves the board-specific configurations to em28xx-cards.c.
Signed-off-by: NMauro Carvalho Chehab <mchehab@infradead.org>
上级 15b9becc
...@@ -42,12 +42,36 @@ static int tuner = -1; ...@@ -42,12 +42,36 @@ static int tuner = -1;
module_param(tuner, int, 0444); module_param(tuner, int, 0444);
MODULE_PARM_DESC(tuner, "tuner type"); MODULE_PARM_DESC(tuner, "tuner type");
static unsigned int disable_ir;
module_param(disable_ir, int, 0444);
MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
struct em28xx_hash_table { struct em28xx_hash_table {
unsigned long hash; unsigned long hash;
unsigned int model; unsigned int model;
unsigned int tuner; unsigned int tuner;
}; };
/* Boards supported by driver */
#define EM2800_BOARD_UNKNOWN 0
#define EM2820_BOARD_UNKNOWN 1
#define EM2820_BOARD_TERRATEC_CINERGY_250 2
#define EM2820_BOARD_PINNACLE_USB_2 3
#define EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 4
#define EM2820_BOARD_MSI_VOX_USB_2 5
#define EM2800_BOARD_TERRATEC_CINERGY_200 6
#define EM2800_BOARD_LEADTEK_WINFAST_USBII 7
#define EM2800_BOARD_KWORLD_USB2800 8
#define EM2820_BOARD_PINNACLE_DVC_90 9
#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 10
#define EM2880_BOARD_TERRATEC_HYBRID_XS 11
#define EM2820_BOARD_KWORLD_PVRTV2800RF 12
#define EM2880_BOARD_TERRATEC_PRODIGY_XS 13
#define EM2820_BOARD_PROLINK_PLAYTV_USB2 14
#define EM2800_BOARD_VGEAR_POCKETTV 15
#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 16
struct em28xx_board em28xx_boards[] = { struct em28xx_board em28xx_boards[] = {
[EM2800_BOARD_UNKNOWN] = { [EM2800_BOARD_UNKNOWN] = {
.name = "Unknown EM2800 video grabber", .name = "Unknown EM2800 video grabber",
...@@ -245,26 +269,28 @@ struct em28xx_board em28xx_boards[] = { ...@@ -245,26 +269,28 @@ struct em28xx_board em28xx_boards[] = {
} }, } },
}, },
[EM2820_BOARD_MSI_VOX_USB_2] = { [EM2820_BOARD_MSI_VOX_USB_2] = {
.name = "MSI VOX USB 2.0", .name = "MSI VOX USB 2.0",
.vchannels = 3, .vchannels = 3,
.tuner_type = TUNER_LG_PAL_NEW_TAPC, .tuner_type = TUNER_LG_PAL_NEW_TAPC,
.tda9887_conf = TDA9887_PRESENT | .tda9887_conf = TDA9887_PRESENT |
TDA9887_PORT1_ACTIVE | TDA9887_PORT1_ACTIVE |
TDA9887_PORT2_ACTIVE, TDA9887_PORT2_ACTIVE,
.has_tuner = 1, .has_tuner = 1,
.decoder = EM28XX_SAA7114, .max_range_640_480 = 1,
.input = { {
.type = EM28XX_VMUX_TELEVISION, .decoder = EM28XX_SAA7114,
.vmux = SAA7115_COMPOSITE4, .input = { {
.amux = 0, .type = EM28XX_VMUX_TELEVISION,
.vmux = SAA7115_COMPOSITE4,
.amux = 0,
}, { }, {
.type = EM28XX_VMUX_COMPOSITE1, .type = EM28XX_VMUX_COMPOSITE1,
.vmux = SAA7115_COMPOSITE0, .vmux = SAA7115_COMPOSITE0,
.amux = 1, .amux = 1,
}, { }, {
.type = EM28XX_VMUX_SVIDEO, .type = EM28XX_VMUX_SVIDEO,
.vmux = SAA7115_SVIDEO3, .vmux = SAA7115_SVIDEO3,
.amux = 1, .amux = 1,
} }, } },
}, },
[EM2800_BOARD_TERRATEC_CINERGY_200] = { [EM2800_BOARD_TERRATEC_CINERGY_200] = {
...@@ -649,11 +675,54 @@ static void em28xx_set_model(struct em28xx *dev) ...@@ -649,11 +675,54 @@ static void em28xx_set_model(struct em28xx *dev)
dev->video_inputs = em28xx_boards[dev->model].vchannels; dev->video_inputs = em28xx_boards[dev->model].vchannels;
dev->analog_gpio = em28xx_boards[dev->model].analog_gpio; dev->analog_gpio = em28xx_boards[dev->model].analog_gpio;
dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s; dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s;
dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480;
if (!em28xx_boards[dev->model].has_tuner) if (!em28xx_boards[dev->model].has_tuner)
dev->tuner_type = UNSET; dev->tuner_type = UNSET;
} }
/* ----------------------------------------------------------------------- */
void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir)
{
if (disable_ir) {
ir->get_key = NULL;
return ;
}
/* detect & configure */
switch (dev->model) {
case (EM2800_BOARD_UNKNOWN):
break;
case (EM2820_BOARD_UNKNOWN):
break;
case (EM2800_BOARD_TERRATEC_CINERGY_200):
case (EM2820_BOARD_TERRATEC_CINERGY_250):
ir->ir_codes = ir_codes_em_terratec;
ir->get_key = em28xx_get_key_terratec;
snprintf(ir->c.name, sizeof(ir->c.name),
"i2c IR (EM28XX Terratec)");
break;
case (EM2820_BOARD_PINNACLE_USB_2):
ir->ir_codes = ir_codes_pinnacle_grey;
ir->get_key = em28xx_get_key_pinnacle_usb_grey;
snprintf(ir->c.name, sizeof(ir->c.name),
"i2c IR (EM28XX Pinnacle PCTV)");
break;
case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
ir->ir_codes = ir_codes_hauppauge_new;
ir->get_key = em28xx_get_key_em_haup;
snprintf(ir->c.name, sizeof(ir->c.name),
"i2c IR (EM2840 Hauppauge)");
break;
case (EM2820_BOARD_MSI_VOX_USB_2):
break;
case (EM2800_BOARD_LEADTEK_WINFAST_USBII):
break;
case (EM2800_BOARD_KWORLD_USB2800):
break;
}
}
void em28xx_card_setup(struct em28xx *dev) void em28xx_card_setup(struct em28xx *dev)
{ {
em28xx_set_model(dev); em28xx_set_model(dev);
......
...@@ -30,11 +30,7 @@ ...@@ -30,11 +30,7 @@
#include "em28xx.h" #include "em28xx.h"
static unsigned int disable_ir = 0; static unsigned int ir_debug;
module_param(disable_ir, int, 0444);
MODULE_PARM_DESC(disable_ir,"disable infrared remote support");
static unsigned int ir_debug = 0;
module_param(ir_debug, int, 0644); module_param(ir_debug, int, 0644);
MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]");
...@@ -43,7 +39,7 @@ MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); ...@@ -43,7 +39,7 @@ MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]");
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
{ {
unsigned char b; unsigned char b;
...@@ -72,7 +68,7 @@ static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) ...@@ -72,7 +68,7 @@ static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
} }
static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
{ {
unsigned char buf[2]; unsigned char buf[2];
unsigned char code; unsigned char code;
...@@ -103,7 +99,8 @@ static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) ...@@ -103,7 +99,8 @@ static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
return 1; return 1;
} }
static int get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
u32 *ir_raw)
{ {
unsigned char buf[3]; unsigned char buf[3];
...@@ -125,45 +122,6 @@ static int get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw ...@@ -125,45 +122,6 @@ static int get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw
return 1; return 1;
} }
/* ----------------------------------------------------------------------- */
void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir)
{
if (disable_ir) {
ir->get_key=NULL;
return ;
}
/* detect & configure */
switch (dev->model) {
case (EM2800_BOARD_UNKNOWN):
break;
case (EM2820_BOARD_UNKNOWN):
break;
case (EM2800_BOARD_TERRATEC_CINERGY_200):
case (EM2820_BOARD_TERRATEC_CINERGY_250):
ir->ir_codes = ir_codes_em_terratec;
ir->get_key = get_key_terratec;
snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Terratec)");
break;
case (EM2820_BOARD_PINNACLE_USB_2):
ir->ir_codes = ir_codes_pinnacle_grey;
ir->get_key = get_key_pinnacle_usb_grey;
snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Pinnacle PCTV)");
break;
case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
ir->ir_codes = ir_codes_hauppauge_new;
ir->get_key = get_key_em_haup;
snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM2840 Hauppauge)");
break;
case (EM2820_BOARD_MSI_VOX_USB_2):
break;
case (EM2800_BOARD_LEADTEK_WINFAST_USBII):
break;
case (EM2800_BOARD_KWORLD_USB2800):
break;
}
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
* Local variables: * Local variables:
* c-basic-offset: 8 * c-basic-offset: 8
......
...@@ -30,26 +30,6 @@ ...@@ -30,26 +30,6 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <media/ir-kbd-i2c.h> #include <media/ir-kbd-i2c.h>
/* Boards supported by driver */
#define EM2800_BOARD_UNKNOWN 0
#define EM2820_BOARD_UNKNOWN 1
#define EM2820_BOARD_TERRATEC_CINERGY_250 2
#define EM2820_BOARD_PINNACLE_USB_2 3
#define EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 4
#define EM2820_BOARD_MSI_VOX_USB_2 5
#define EM2800_BOARD_TERRATEC_CINERGY_200 6
#define EM2800_BOARD_LEADTEK_WINFAST_USBII 7
#define EM2800_BOARD_KWORLD_USB2800 8
#define EM2820_BOARD_PINNACLE_DVC_90 9
#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 10
#define EM2880_BOARD_TERRATEC_HYBRID_XS 11
#define EM2820_BOARD_KWORLD_PVRTV2800RF 12
#define EM2880_BOARD_TERRATEC_PRODIGY_XS 13
#define EM2820_BOARD_PROLINK_PLAYTV_USB2 14
#define EM2800_BOARD_VGEAR_POCKETTV 15
#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 16
#define UNSET -1 #define UNSET -1
/* maximum number of em28xx boards */ /* maximum number of em28xx boards */
...@@ -185,6 +165,7 @@ struct em28xx_board { ...@@ -185,6 +165,7 @@ struct em28xx_board {
unsigned int has_msp34xx:1; unsigned int has_msp34xx:1;
unsigned int mts_firmware:1; unsigned int mts_firmware:1;
unsigned int has_12mhz_i2s:1; unsigned int has_12mhz_i2s:1;
unsigned int max_range_640_480:1;
unsigned int analog_gpio; unsigned int analog_gpio;
...@@ -251,6 +232,7 @@ struct em28xx { ...@@ -251,6 +232,7 @@ struct em28xx {
unsigned int stream_on:1; /* Locks streams */ unsigned int stream_on:1; /* Locks streams */
unsigned int has_audio_class:1; unsigned int has_audio_class:1;
unsigned int has_12mhz_i2s:1; unsigned int has_12mhz_i2s:1;
unsigned int max_range_640_480:1;
int video_inputs; /* number of video inputs */ int video_inputs; /* number of video inputs */
struct list_head devlist; struct list_head devlist;
...@@ -352,10 +334,6 @@ void em28xx_do_i2c_scan(struct em28xx *dev); ...@@ -352,10 +334,6 @@ void em28xx_do_i2c_scan(struct em28xx *dev);
int em28xx_i2c_register(struct em28xx *dev); int em28xx_i2c_register(struct em28xx *dev);
int em28xx_i2c_unregister(struct em28xx *dev); int em28xx_i2c_unregister(struct em28xx *dev);
/* Provided by em28xx-input.c */
void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir);
/* Provided by em28xx-core.c */ /* Provided by em28xx-core.c */
u32 em28xx_request_buffers(struct em28xx *dev, u32 count); u32 em28xx_request_buffers(struct em28xx *dev, u32 count);
...@@ -393,6 +371,14 @@ extern void em28xx_card_setup(struct em28xx *dev); ...@@ -393,6 +371,14 @@ extern void em28xx_card_setup(struct em28xx *dev);
extern struct em28xx_board em28xx_boards[]; extern struct em28xx_board em28xx_boards[];
extern struct usb_device_id em28xx_id_table[]; extern struct usb_device_id em28xx_id_table[];
extern const unsigned int em28xx_bcount; extern const unsigned int em28xx_bcount;
void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir);
/* Provided by em28xx-input.c */
/* TODO: Check if the standard get_key handlers on ir-common can be used */
int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw);
int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw);
int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
u32 *ir_raw);
/* em2800 registers */ /* em2800 registers */
#define EM2800_AUDIOSRC_REG 0x08 #define EM2800_AUDIOSRC_REG 0x08
...@@ -550,21 +536,17 @@ inline static int em28xx_gamma_set(struct em28xx *dev, s32 val) ...@@ -550,21 +536,17 @@ inline static int em28xx_gamma_set(struct em28xx *dev, s32 val)
/*FIXME: maxw should be dependent of alt mode */ /*FIXME: maxw should be dependent of alt mode */
inline static unsigned int norm_maxw(struct em28xx *dev) inline static unsigned int norm_maxw(struct em28xx *dev)
{ {
switch (dev->model) { if (dev->max_range_640_480)
case EM2820_BOARD_MSI_VOX_USB_2:
return 640; return 640;
default: else
return 720; return 720;
}
} }
inline static unsigned int norm_maxh(struct em28xx *dev) inline static unsigned int norm_maxh(struct em28xx *dev)
{ {
switch (dev->model) { if (dev->max_range_640_480)
case EM2820_BOARD_MSI_VOX_USB_2:
return 480; return 480;
default: else
return (dev->norm & V4L2_STD_625_50) ? 576 : 480; return (dev->norm & V4L2_STD_625_50) ? 576 : 480;
}
} }
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册