Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+106 -97
+87 -18
drivers/media/video/em28xx/em28xx-cards.c
··· 42 42 module_param(tuner, int, 0444); 43 43 MODULE_PARM_DESC(tuner, "tuner type"); 44 44 45 + static unsigned int disable_ir; 46 + module_param(disable_ir, int, 0444); 47 + MODULE_PARM_DESC(disable_ir, "disable infrared remote support"); 48 + 45 49 struct em28xx_hash_table { 46 50 unsigned long hash; 47 51 unsigned int model; 48 52 unsigned int tuner; 49 53 }; 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 50 74 51 75 struct em28xx_board em28xx_boards[] = { 52 76 [EM2800_BOARD_UNKNOWN] = { ··· 269 245 } }, 270 246 }, 271 247 [EM2820_BOARD_MSI_VOX_USB_2] = { 272 - .name = "MSI VOX USB 2.0", 273 - .vchannels = 3, 274 - .tuner_type = TUNER_LG_PAL_NEW_TAPC, 275 - .tda9887_conf = TDA9887_PRESENT | 276 - TDA9887_PORT1_ACTIVE | 277 - TDA9887_PORT2_ACTIVE, 278 - .has_tuner = 1, 279 - .decoder = EM28XX_SAA7114, 280 - .input = { { 281 - .type = EM28XX_VMUX_TELEVISION, 282 - .vmux = SAA7115_COMPOSITE4, 283 - .amux = 0, 248 + .name = "MSI VOX USB 2.0", 249 + .vchannels = 3, 250 + .tuner_type = TUNER_LG_PAL_NEW_TAPC, 251 + .tda9887_conf = TDA9887_PRESENT | 252 + TDA9887_PORT1_ACTIVE | 253 + TDA9887_PORT2_ACTIVE, 254 + .has_tuner = 1, 255 + .max_range_640_480 = 1, 256 + 257 + .decoder = EM28XX_SAA7114, 258 + .input = { { 259 + .type = EM28XX_VMUX_TELEVISION, 260 + .vmux = SAA7115_COMPOSITE4, 261 + .amux = 0, 284 262 }, { 285 - .type = EM28XX_VMUX_COMPOSITE1, 286 - .vmux = SAA7115_COMPOSITE0, 287 - .amux = 1, 263 + .type = EM28XX_VMUX_COMPOSITE1, 264 + .vmux = SAA7115_COMPOSITE0, 265 + .amux = 1, 288 266 }, { 289 - .type = EM28XX_VMUX_SVIDEO, 290 - .vmux = SAA7115_SVIDEO3, 291 - .amux = 1, 267 + .type = EM28XX_VMUX_SVIDEO, 268 + .vmux = SAA7115_SVIDEO3, 269 + .amux = 1, 292 270 } }, 293 271 }, 294 272 [EM2800_BOARD_TERRATEC_CINERGY_200] = { ··· 675 649 dev->video_inputs = em28xx_boards[dev->model].vchannels; 676 650 dev->analog_gpio = em28xx_boards[dev->model].analog_gpio; 677 651 dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s; 652 + dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480; 678 653 679 654 if (!em28xx_boards[dev->model].has_tuner) 680 655 dev->tuner_type = UNSET; 656 + } 657 + 658 + /* ----------------------------------------------------------------------- */ 659 + void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir) 660 + { 661 + if (disable_ir) { 662 + ir->get_key = NULL; 663 + return ; 664 + } 665 + 666 + /* detect & configure */ 667 + switch (dev->model) { 668 + case (EM2800_BOARD_UNKNOWN): 669 + break; 670 + case (EM2820_BOARD_UNKNOWN): 671 + break; 672 + case (EM2800_BOARD_TERRATEC_CINERGY_200): 673 + case (EM2820_BOARD_TERRATEC_CINERGY_250): 674 + ir->ir_codes = ir_codes_em_terratec; 675 + ir->get_key = em28xx_get_key_terratec; 676 + snprintf(ir->c.name, sizeof(ir->c.name), 677 + "i2c IR (EM28XX Terratec)"); 678 + break; 679 + case (EM2820_BOARD_PINNACLE_USB_2): 680 + ir->ir_codes = ir_codes_pinnacle_grey; 681 + ir->get_key = em28xx_get_key_pinnacle_usb_grey; 682 + snprintf(ir->c.name, sizeof(ir->c.name), 683 + "i2c IR (EM28XX Pinnacle PCTV)"); 684 + break; 685 + case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2): 686 + ir->ir_codes = ir_codes_hauppauge_new; 687 + ir->get_key = em28xx_get_key_em_haup; 688 + snprintf(ir->c.name, sizeof(ir->c.name), 689 + "i2c IR (EM2840 Hauppauge)"); 690 + break; 691 + case (EM2820_BOARD_MSI_VOX_USB_2): 692 + break; 693 + case (EM2800_BOARD_LEADTEK_WINFAST_USBII): 694 + break; 695 + case (EM2800_BOARD_KWORLD_USB2800): 696 + break; 697 + } 681 698 } 682 699 683 700 void em28xx_card_setup(struct em28xx *dev)
+5 -47
drivers/media/video/em28xx/em28xx-input.c
··· 30 30 31 31 #include "em28xx.h" 32 32 33 - static unsigned int disable_ir = 0; 34 - module_param(disable_ir, int, 0444); 35 - MODULE_PARM_DESC(disable_ir,"disable infrared remote support"); 36 - 37 - static unsigned int ir_debug = 0; 33 + static unsigned int ir_debug; 38 34 module_param(ir_debug, int, 0644); 39 35 MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); 40 36 ··· 39 43 40 44 /* ----------------------------------------------------------------------- */ 41 45 42 - static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 46 + int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 43 47 { 44 48 unsigned char b; 45 49 ··· 68 72 } 69 73 70 74 71 - static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 75 + int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 72 76 { 73 77 unsigned char buf[2]; 74 78 unsigned char code; ··· 99 103 return 1; 100 104 } 101 105 102 - static int get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 106 + int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, 107 + u32 *ir_raw) 103 108 { 104 109 unsigned char buf[3]; 105 110 ··· 120 123 *ir_raw = buf[2]&0x3f; 121 124 122 125 return 1; 123 - } 124 - 125 - /* ----------------------------------------------------------------------- */ 126 - void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir) 127 - { 128 - if (disable_ir) { 129 - ir->get_key=NULL; 130 - return ; 131 - } 132 - 133 - /* detect & configure */ 134 - switch (dev->model) { 135 - case (EM2800_BOARD_UNKNOWN): 136 - break; 137 - case (EM2820_BOARD_UNKNOWN): 138 - break; 139 - case (EM2800_BOARD_TERRATEC_CINERGY_200): 140 - case (EM2820_BOARD_TERRATEC_CINERGY_250): 141 - ir->ir_codes = ir_codes_em_terratec; 142 - ir->get_key = get_key_terratec; 143 - snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Terratec)"); 144 - break; 145 - case (EM2820_BOARD_PINNACLE_USB_2): 146 - ir->ir_codes = ir_codes_pinnacle_grey; 147 - ir->get_key = get_key_pinnacle_usb_grey; 148 - snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Pinnacle PCTV)"); 149 - break; 150 - case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2): 151 - ir->ir_codes = ir_codes_hauppauge_new; 152 - ir->get_key = get_key_em_haup; 153 - snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM2840 Hauppauge)"); 154 - break; 155 - case (EM2820_BOARD_MSI_VOX_USB_2): 156 - break; 157 - case (EM2800_BOARD_LEADTEK_WINFAST_USBII): 158 - break; 159 - case (EM2800_BOARD_KWORLD_USB2800): 160 - break; 161 - } 162 126 } 163 127 164 128 /* ----------------------------------------------------------------------
+14 -32
drivers/media/video/em28xx/em28xx.h
··· 30 30 #include <linux/mutex.h> 31 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 33 #define UNSET -1 54 34 55 35 /* maximum number of em28xx boards */ ··· 165 185 unsigned int has_msp34xx:1; 166 186 unsigned int mts_firmware:1; 167 187 unsigned int has_12mhz_i2s:1; 188 + unsigned int max_range_640_480:1; 168 189 169 190 unsigned int analog_gpio; 170 191 ··· 232 251 unsigned int stream_on:1; /* Locks streams */ 233 252 unsigned int has_audio_class:1; 234 253 unsigned int has_12mhz_i2s:1; 254 + unsigned int max_range_640_480:1; 235 255 236 256 int video_inputs; /* number of video inputs */ 237 257 struct list_head devlist; ··· 334 352 int em28xx_i2c_register(struct em28xx *dev); 335 353 int em28xx_i2c_unregister(struct em28xx *dev); 336 354 337 - /* Provided by em28xx-input.c */ 338 - 339 - void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir); 340 - 341 355 /* Provided by em28xx-core.c */ 342 356 343 357 u32 em28xx_request_buffers(struct em28xx *dev, u32 count); ··· 371 393 extern struct em28xx_board em28xx_boards[]; 372 394 extern struct usb_device_id em28xx_id_table[]; 373 395 extern const unsigned int em28xx_bcount; 396 + void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir); 397 + 398 + /* Provided by em28xx-input.c */ 399 + /* TODO: Check if the standard get_key handlers on ir-common can be used */ 400 + int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw); 401 + int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw); 402 + int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, 403 + u32 *ir_raw); 374 404 375 405 /* em2800 registers */ 376 406 #define EM2800_AUDIOSRC_REG 0x08 ··· 536 550 /*FIXME: maxw should be dependent of alt mode */ 537 551 inline static unsigned int norm_maxw(struct em28xx *dev) 538 552 { 539 - switch (dev->model) { 540 - case EM2820_BOARD_MSI_VOX_USB_2: 553 + if (dev->max_range_640_480) 541 554 return 640; 542 - default: 555 + else 543 556 return 720; 544 - } 545 557 } 546 558 547 559 inline static unsigned int norm_maxh(struct em28xx *dev) 548 560 { 549 - switch (dev->model) { 550 - case EM2820_BOARD_MSI_VOX_USB_2: 561 + if (dev->max_range_640_480) 551 562 return 480; 552 - default: 563 + else 553 564 return (dev->norm & V4L2_STD_625_50) ? 576 : 480; 554 - } 555 565 } 556 566 #endif