aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-01-13 13:42:17 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:04:55 -0500
commitc8793b035df7b18997d1cf34254064dac166f009 (patch)
tree29765d7aeb6c349c339e62582e9791f08a9f8b5b /drivers/media
parent15b9becc68793209a2afd6c580bf71a71fee90a6 (diff)
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: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c105
-rw-r--r--drivers/media/video/em28xx/em28xx-input.c52
-rw-r--r--drivers/media/video/em28xx/em28xx.h46
3 files changed, 106 insertions, 97 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index fe0ee451847..368a766eb80 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -42,12 +42,36 @@ static int tuner = -1;
42module_param(tuner, int, 0444); 42module_param(tuner, int, 0444);
43MODULE_PARM_DESC(tuner, "tuner type"); 43MODULE_PARM_DESC(tuner, "tuner type");
44 44
45static unsigned int disable_ir;
46module_param(disable_ir, int, 0444);
47MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
48
45struct em28xx_hash_table { 49struct em28xx_hash_table {
46 unsigned long hash; 50 unsigned long hash;
47 unsigned int model; 51 unsigned int model;
48 unsigned int tuner; 52 unsigned int tuner;
49}; 53};
50 54
55/* Boards supported by driver */
56
57#define EM2800_BOARD_UNKNOWN 0
58#define EM2820_BOARD_UNKNOWN 1
59#define EM2820_BOARD_TERRATEC_CINERGY_250 2
60#define EM2820_BOARD_PINNACLE_USB_2 3
61#define EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 4
62#define EM2820_BOARD_MSI_VOX_USB_2 5
63#define EM2800_BOARD_TERRATEC_CINERGY_200 6
64#define EM2800_BOARD_LEADTEK_WINFAST_USBII 7
65#define EM2800_BOARD_KWORLD_USB2800 8
66#define EM2820_BOARD_PINNACLE_DVC_90 9
67#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 10
68#define EM2880_BOARD_TERRATEC_HYBRID_XS 11
69#define EM2820_BOARD_KWORLD_PVRTV2800RF 12
70#define EM2880_BOARD_TERRATEC_PRODIGY_XS 13
71#define EM2820_BOARD_PROLINK_PLAYTV_USB2 14
72#define EM2800_BOARD_VGEAR_POCKETTV 15
73#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 16
74
51struct em28xx_board em28xx_boards[] = { 75struct em28xx_board em28xx_boards[] = {
52 [EM2800_BOARD_UNKNOWN] = { 76 [EM2800_BOARD_UNKNOWN] = {
53 .name = "Unknown EM2800 video grabber", 77 .name = "Unknown EM2800 video grabber",
@@ -245,26 +269,28 @@ struct em28xx_board em28xx_boards[] = {
245 } }, 269 } },
246 }, 270 },
247 [EM2820_BOARD_MSI_VOX_USB_2] = { 271 [EM2820_BOARD_MSI_VOX_USB_2] = {
248 .name = "MSI VOX USB 2.0", 272 .name = "MSI VOX USB 2.0",
249 .vchannels = 3, 273 .vchannels = 3,
250 .tuner_type = TUNER_LG_PAL_NEW_TAPC, 274 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
251 .tda9887_conf = TDA9887_PRESENT | 275 .tda9887_conf = TDA9887_PRESENT |
252 TDA9887_PORT1_ACTIVE | 276 TDA9887_PORT1_ACTIVE |
253 TDA9887_PORT2_ACTIVE, 277 TDA9887_PORT2_ACTIVE,
254 .has_tuner = 1, 278 .has_tuner = 1,
255 .decoder = EM28XX_SAA7114, 279 .max_range_640_480 = 1,
256 .input = { { 280
257 .type = EM28XX_VMUX_TELEVISION, 281 .decoder = EM28XX_SAA7114,
258 .vmux = SAA7115_COMPOSITE4, 282 .input = { {
259 .amux = 0, 283 .type = EM28XX_VMUX_TELEVISION,
284 .vmux = SAA7115_COMPOSITE4,
285 .amux = 0,
260 }, { 286 }, {
261 .type = EM28XX_VMUX_COMPOSITE1, 287 .type = EM28XX_VMUX_COMPOSITE1,
262 .vmux = SAA7115_COMPOSITE0, 288 .vmux = SAA7115_COMPOSITE0,
263 .amux = 1, 289 .amux = 1,
264 }, { 290 }, {
265 .type = EM28XX_VMUX_SVIDEO, 291 .type = EM28XX_VMUX_SVIDEO,
266 .vmux = SAA7115_SVIDEO3, 292 .vmux = SAA7115_SVIDEO3,
267 .amux = 1, 293 .amux = 1,
268 } }, 294 } },
269 }, 295 },
270 [EM2800_BOARD_TERRATEC_CINERGY_200] = { 296 [EM2800_BOARD_TERRATEC_CINERGY_200] = {
@@ -649,11 +675,54 @@ static void em28xx_set_model(struct em28xx *dev)
649 dev->video_inputs = em28xx_boards[dev->model].vchannels; 675 dev->video_inputs = em28xx_boards[dev->model].vchannels;
650 dev->analog_gpio = em28xx_boards[dev->model].analog_gpio; 676 dev->analog_gpio = em28xx_boards[dev->model].analog_gpio;
651 dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s; 677 dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s;
678 dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480;
652 679
653 if (!em28xx_boards[dev->model].has_tuner) 680 if (!em28xx_boards[dev->model].has_tuner)
654 dev->tuner_type = UNSET; 681 dev->tuner_type = UNSET;
655} 682}
656 683
684/* ----------------------------------------------------------------------- */
685void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir)
686{
687 if (disable_ir) {
688 ir->get_key = NULL;
689 return ;
690 }
691
692 /* detect & configure */
693 switch (dev->model) {
694 case (EM2800_BOARD_UNKNOWN):
695 break;
696 case (EM2820_BOARD_UNKNOWN):
697 break;
698 case (EM2800_BOARD_TERRATEC_CINERGY_200):
699 case (EM2820_BOARD_TERRATEC_CINERGY_250):
700 ir->ir_codes = ir_codes_em_terratec;
701 ir->get_key = em28xx_get_key_terratec;
702 snprintf(ir->c.name, sizeof(ir->c.name),
703 "i2c IR (EM28XX Terratec)");
704 break;
705 case (EM2820_BOARD_PINNACLE_USB_2):
706 ir->ir_codes = ir_codes_pinnacle_grey;
707 ir->get_key = em28xx_get_key_pinnacle_usb_grey;
708 snprintf(ir->c.name, sizeof(ir->c.name),
709 "i2c IR (EM28XX Pinnacle PCTV)");
710 break;
711 case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
712 ir->ir_codes = ir_codes_hauppauge_new;
713 ir->get_key = em28xx_get_key_em_haup;
714 snprintf(ir->c.name, sizeof(ir->c.name),
715 "i2c IR (EM2840 Hauppauge)");
716 break;
717 case (EM2820_BOARD_MSI_VOX_USB_2):
718 break;
719 case (EM2800_BOARD_LEADTEK_WINFAST_USBII):
720 break;
721 case (EM2800_BOARD_KWORLD_USB2800):
722 break;
723 }
724}
725
657void em28xx_card_setup(struct em28xx *dev) 726void em28xx_card_setup(struct em28xx *dev)
658{ 727{
659 em28xx_set_model(dev); 728 em28xx_set_model(dev);
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c
index e3894b68c4e..10da2fd8d98 100644
--- a/drivers/media/video/em28xx/em28xx-input.c
+++ b/drivers/media/video/em28xx/em28xx-input.c
@@ -30,11 +30,7 @@
30 30
31#include "em28xx.h" 31#include "em28xx.h"
32 32
33static unsigned int disable_ir = 0; 33static unsigned int ir_debug;
34module_param(disable_ir, int, 0444);
35MODULE_PARM_DESC(disable_ir,"disable infrared remote support");
36
37static unsigned int ir_debug = 0;
38module_param(ir_debug, int, 0644); 34module_param(ir_debug, int, 0644);
39MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); 35MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]");
40 36
@@ -43,7 +39,7 @@ MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]");
43 39
44/* ----------------------------------------------------------------------- */ 40/* ----------------------------------------------------------------------- */
45 41
46static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 42int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
47{ 43{
48 unsigned char b; 44 unsigned char b;
49 45
@@ -72,7 +68,7 @@ static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
72} 68}
73 69
74 70
75static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 71int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
76{ 72{
77 unsigned char buf[2]; 73 unsigned char buf[2];
78 unsigned char code; 74 unsigned char code;
@@ -103,7 +99,8 @@ static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
103 return 1; 99 return 1;
104} 100}
105 101
106static int get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 102int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
103 u32 *ir_raw)
107{ 104{
108 unsigned char buf[3]; 105 unsigned char buf[3];
109 106
@@ -125,45 +122,6 @@ static int get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw
125 return 1; 122 return 1;
126} 123}
127 124
128/* ----------------------------------------------------------------------- */
129void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir)
130{
131 if (disable_ir) {
132 ir->get_key=NULL;
133 return ;
134 }
135
136 /* detect & configure */
137 switch (dev->model) {
138 case (EM2800_BOARD_UNKNOWN):
139 break;
140 case (EM2820_BOARD_UNKNOWN):
141 break;
142 case (EM2800_BOARD_TERRATEC_CINERGY_200):
143 case (EM2820_BOARD_TERRATEC_CINERGY_250):
144 ir->ir_codes = ir_codes_em_terratec;
145 ir->get_key = get_key_terratec;
146 snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Terratec)");
147 break;
148 case (EM2820_BOARD_PINNACLE_USB_2):
149 ir->ir_codes = ir_codes_pinnacle_grey;
150 ir->get_key = get_key_pinnacle_usb_grey;
151 snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Pinnacle PCTV)");
152 break;
153 case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
154 ir->ir_codes = ir_codes_hauppauge_new;
155 ir->get_key = get_key_em_haup;
156 snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM2840 Hauppauge)");
157 break;
158 case (EM2820_BOARD_MSI_VOX_USB_2):
159 break;
160 case (EM2800_BOARD_LEADTEK_WINFAST_USBII):
161 break;
162 case (EM2800_BOARD_KWORLD_USB2800):
163 break;
164 }
165}
166
167/* ---------------------------------------------------------------------- 125/* ----------------------------------------------------------------------
168 * Local variables: 126 * Local variables:
169 * c-basic-offset: 8 127 * c-basic-offset: 8
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index 2ba34e5b4cc..3ef80d8b566 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -30,26 +30,6 @@
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <media/ir-kbd-i2c.h> 31#include <media/ir-kbd-i2c.h>
32 32
33/* Boards supported by driver */
34
35#define EM2800_BOARD_UNKNOWN 0
36#define EM2820_BOARD_UNKNOWN 1
37#define EM2820_BOARD_TERRATEC_CINERGY_250 2
38#define EM2820_BOARD_PINNACLE_USB_2 3
39#define EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 4
40#define EM2820_BOARD_MSI_VOX_USB_2 5
41#define EM2800_BOARD_TERRATEC_CINERGY_200 6
42#define EM2800_BOARD_LEADTEK_WINFAST_USBII 7
43#define EM2800_BOARD_KWORLD_USB2800 8
44#define EM2820_BOARD_PINNACLE_DVC_90 9
45#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 10
46#define EM2880_BOARD_TERRATEC_HYBRID_XS 11
47#define EM2820_BOARD_KWORLD_PVRTV2800RF 12
48#define EM2880_BOARD_TERRATEC_PRODIGY_XS 13
49#define EM2820_BOARD_PROLINK_PLAYTV_USB2 14
50#define EM2800_BOARD_VGEAR_POCKETTV 15
51#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 16
52
53#define UNSET -1 33#define UNSET -1
54 34
55/* maximum number of em28xx boards */ 35/* maximum number of em28xx boards */
@@ -185,6 +165,7 @@ struct em28xx_board {
185 unsigned int has_msp34xx:1; 165 unsigned int has_msp34xx:1;
186 unsigned int mts_firmware:1; 166 unsigned int mts_firmware:1;
187 unsigned int has_12mhz_i2s:1; 167 unsigned int has_12mhz_i2s:1;
168 unsigned int max_range_640_480:1;
188 169
189 unsigned int analog_gpio; 170 unsigned int analog_gpio;
190 171
@@ -251,6 +232,7 @@ struct em28xx {
251 unsigned int stream_on:1; /* Locks streams */ 232 unsigned int stream_on:1; /* Locks streams */
252 unsigned int has_audio_class:1; 233 unsigned int has_audio_class:1;
253 unsigned int has_12mhz_i2s:1; 234 unsigned int has_12mhz_i2s:1;
235 unsigned int max_range_640_480:1;
254 236
255 int video_inputs; /* number of video inputs */ 237 int video_inputs; /* number of video inputs */
256 struct list_head devlist; 238 struct list_head devlist;
@@ -352,10 +334,6 @@ void em28xx_do_i2c_scan(struct em28xx *dev);
352int em28xx_i2c_register(struct em28xx *dev); 334int em28xx_i2c_register(struct em28xx *dev);
353int em28xx_i2c_unregister(struct em28xx *dev); 335int em28xx_i2c_unregister(struct em28xx *dev);
354 336
355/* Provided by em28xx-input.c */
356
357void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir);
358
359/* Provided by em28xx-core.c */ 337/* Provided by em28xx-core.c */
360 338
361u32 em28xx_request_buffers(struct em28xx *dev, u32 count); 339u32 em28xx_request_buffers(struct em28xx *dev, u32 count);
@@ -393,6 +371,14 @@ extern void em28xx_card_setup(struct em28xx *dev);
393extern struct em28xx_board em28xx_boards[]; 371extern struct em28xx_board em28xx_boards[];
394extern struct usb_device_id em28xx_id_table[]; 372extern struct usb_device_id em28xx_id_table[];
395extern const unsigned int em28xx_bcount; 373extern const unsigned int em28xx_bcount;
374void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir);
375
376/* Provided by em28xx-input.c */
377/* TODO: Check if the standard get_key handlers on ir-common can be used */
378int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw);
379int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw);
380int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
381 u32 *ir_raw);
396 382
397/* em2800 registers */ 383/* em2800 registers */
398#define EM2800_AUDIOSRC_REG 0x08 384#define EM2800_AUDIOSRC_REG 0x08
@@ -550,21 +536,17 @@ inline static int em28xx_gamma_set(struct em28xx *dev, s32 val)
550/*FIXME: maxw should be dependent of alt mode */ 536/*FIXME: maxw should be dependent of alt mode */
551inline static unsigned int norm_maxw(struct em28xx *dev) 537inline static unsigned int norm_maxw(struct em28xx *dev)
552{ 538{
553 switch (dev->model) { 539 if (dev->max_range_640_480)
554 case EM2820_BOARD_MSI_VOX_USB_2:
555 return 640; 540 return 640;
556 default: 541 else
557 return 720; 542 return 720;
558 }
559} 543}
560 544
561inline static unsigned int norm_maxh(struct em28xx *dev) 545inline static unsigned int norm_maxh(struct em28xx *dev)
562{ 546{
563 switch (dev->model) { 547 if (dev->max_range_640_480)
564 case EM2820_BOARD_MSI_VOX_USB_2:
565 return 480; 548 return 480;
566 default: 549 else
567 return (dev->norm & V4L2_STD_625_50) ? 576 : 480; 550 return (dev->norm & V4L2_STD_625_50) ? 576 : 480;
568 }
569} 551}
570#endif 552#endif