diff options
-rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 45 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx.h | 13 |
2 files changed, 48 insertions, 10 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index e00de3286055..78be0dc25720 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -179,6 +179,7 @@ struct em28xx_board em28xx_boards[] = { | |||
179 | .tda9887_conf = TDA9887_PRESENT, | 179 | .tda9887_conf = TDA9887_PRESENT, |
180 | .tuner_type = TUNER_XC2028, | 180 | .tuner_type = TUNER_XC2028, |
181 | .has_tuner = 1, | 181 | .has_tuner = 1, |
182 | .mts_firmware = 1, | ||
182 | .decoder = EM28XX_TVP5150, | 183 | .decoder = EM28XX_TVP5150, |
183 | .input = { { | 184 | .input = { { |
184 | .type = EM28XX_VMUX_TELEVISION, | 185 | .type = EM28XX_VMUX_TELEVISION, |
@@ -193,6 +194,9 @@ struct em28xx_board em28xx_boards[] = { | |||
193 | .vmux = TVP5150_SVIDEO, | 194 | .vmux = TVP5150_SVIDEO, |
194 | .amux = 1, | 195 | .amux = 1, |
195 | } }, | 196 | } }, |
197 | |||
198 | /* gpio's 4, 1, 0 */ | ||
199 | .analog_gpio = 0x003d2d, | ||
196 | }, | 200 | }, |
197 | [EM2880_BOARD_TERRATEC_HYBRID_XS] = { | 201 | [EM2880_BOARD_TERRATEC_HYBRID_XS] = { |
198 | .name = "Terratec Hybrid XS", | 202 | .name = "Terratec Hybrid XS", |
@@ -453,8 +457,18 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
453 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: | 457 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: |
454 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950: | 458 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950: |
455 | case EM2880_BOARD_TERRATEC_HYBRID_XS: | 459 | case EM2880_BOARD_TERRATEC_HYBRID_XS: |
456 | /* reset through GPIO? */ | 460 | em28xx_write_regs(dev, XCLK_REG, "\x27", 1); |
457 | em28xx_write_regs_req(dev, 0x00, 0x08, "\x7d", 1); | 461 | em28xx_write_regs(dev, I2C_CLK_REG, "\x40", 1); |
462 | em28xx_write_regs(dev, 0x08, "\xff", 1); | ||
463 | em28xx_write_regs(dev, 0x04, "\x00", 1); | ||
464 | msleep(100); | ||
465 | em28xx_write_regs(dev, 0x04, "\x08", 1); | ||
466 | msleep(100); | ||
467 | em28xx_write_regs(dev, 0x08, "\xff", 1); | ||
468 | msleep(50); | ||
469 | em28xx_write_regs(dev, 0x08, "\x2d", 1); | ||
470 | msleep(50); | ||
471 | em28xx_write_regs(dev, 0x08, "\x3d", 1); | ||
458 | break; | 472 | break; |
459 | } | 473 | } |
460 | } | 474 | } |
@@ -469,13 +483,31 @@ static int em28xx_tuner_callback(void *ptr, int command, int arg) | |||
469 | 483 | ||
470 | switch (command) { | 484 | switch (command) { |
471 | case XC2028_TUNER_RESET: | 485 | case XC2028_TUNER_RESET: |
472 | /* FIXME: This is device-dependent */ | 486 | { |
487 | char gpio0, gpio1, gpio4; | ||
488 | |||
489 | /* GPIO and initialization codes for analog TV */ | ||
490 | gpio0 = dev->analog_gpio & 0xff; | ||
491 | gpio1 = (dev->analog_gpio >> 8) & 0xff; | ||
492 | gpio4 = dev->analog_gpio >> 24; | ||
493 | |||
473 | dev->em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1); | 494 | dev->em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1); |
474 | dev->em28xx_write_regs_req(dev, 0x00, 0x12, "\x67", 1); | 495 | dev->em28xx_write_regs_req(dev, 0x00, 0x12, "\x67", 1); |
475 | 496 | ||
476 | msleep(140); | 497 | if (gpio4) { |
498 | dev->em28xx_write_regs(dev, 0x04, &gpio4, 1); | ||
499 | msleep(140); | ||
500 | } | ||
501 | |||
502 | msleep(6); | ||
503 | dev->em28xx_write_regs(dev, 0x08, &gpio0, 1); | ||
504 | msleep(10); | ||
505 | dev->em28xx_write_regs(dev, 0x08, &gpio1, 1); | ||
506 | msleep(5); | ||
507 | |||
477 | break; | 508 | break; |
478 | } | 509 | } |
510 | } | ||
479 | return rc; | 511 | return rc; |
480 | } | 512 | } |
481 | 513 | ||
@@ -608,6 +640,7 @@ static void em28xx_set_model(struct em28xx *dev) | |||
608 | dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf; | 640 | dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf; |
609 | dev->decoder = em28xx_boards[dev->model].decoder; | 641 | dev->decoder = em28xx_boards[dev->model].decoder; |
610 | dev->video_inputs = em28xx_boards[dev->model].vchannels; | 642 | dev->video_inputs = em28xx_boards[dev->model].vchannels; |
643 | dev->analog_gpio = em28xx_boards[dev->model].analog_gpio; | ||
611 | 644 | ||
612 | if (!em28xx_boards[dev->model].has_tuner) | 645 | if (!em28xx_boards[dev->model].has_tuner) |
613 | dev->tuner_type = UNSET; | 646 | dev->tuner_type = UNSET; |
@@ -643,7 +676,9 @@ void em28xx_card_setup(struct em28xx *dev) | |||
643 | if (tv.has_ir) | 676 | if (tv.has_ir) |
644 | request_module("ir-kbd-i2c"); | 677 | request_module("ir-kbd-i2c"); |
645 | #endif | 678 | #endif |
646 | /* FIXME: Should also retrieve decoder processor type */ | 679 | /* enable audio 12 mhz i2s */ |
680 | em28xx_write_regs(dev, XCLK_REG, "\xa7", 1); | ||
681 | msleep(10); | ||
647 | 682 | ||
648 | break; | 683 | break; |
649 | } | 684 | } |
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index abde13ecb4a8..1fb3c230e232 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -178,12 +178,13 @@ struct em28xx_board { | |||
178 | int tuner_type; | 178 | int tuner_type; |
179 | 179 | ||
180 | /* i2c flags */ | 180 | /* i2c flags */ |
181 | unsigned int is_em2800; | ||
182 | unsigned int tda9887_conf; | 181 | unsigned int tda9887_conf; |
183 | 182 | ||
183 | unsigned int is_em2800:1; | ||
184 | unsigned int has_tuner:1; | 184 | unsigned int has_tuner:1; |
185 | unsigned int has_msp34xx:1; | 185 | unsigned int has_msp34xx:1; |
186 | unsigned int mts_firmware:1; | 186 | unsigned int mts_firmware:1; |
187 | unsigned int analog_gpio; | ||
187 | 188 | ||
188 | enum em28xx_decoder decoder; | 189 | enum em28xx_decoder decoder; |
189 | 190 | ||
@@ -217,15 +218,16 @@ struct em28xx { | |||
217 | char name[30]; /* name (including minor) of the device */ | 218 | char name[30]; /* name (including minor) of the device */ |
218 | int model; /* index in the device_data struct */ | 219 | int model; /* index in the device_data struct */ |
219 | int devno; /* marks the number of this device */ | 220 | int devno; /* marks the number of this device */ |
220 | unsigned int is_em2800; | 221 | unsigned int analog_gpio; |
221 | int video_inputs; /* number of video inputs */ | 222 | unsigned int is_em2800:1; |
222 | struct list_head devlist; | ||
223 | unsigned int has_tuner:1; | 223 | unsigned int has_tuner:1; |
224 | unsigned int has_msp34xx:1; | 224 | unsigned int has_msp34xx:1; |
225 | unsigned int has_tda9887:1; | 225 | unsigned int has_tda9887:1; |
226 | |||
227 | unsigned int stream_on:1; /* Locks streams */ | 226 | unsigned int stream_on:1; /* Locks streams */ |
228 | 227 | ||
228 | int video_inputs; /* number of video inputs */ | ||
229 | struct list_head devlist; | ||
230 | |||
229 | u32 i2s_speed; /* I2S speed for audio digital stream */ | 231 | u32 i2s_speed; /* I2S speed for audio digital stream */ |
230 | 232 | ||
231 | enum em28xx_decoder decoder; | 233 | enum em28xx_decoder decoder; |
@@ -351,6 +353,7 @@ extern const unsigned int em28xx_bcount; | |||
351 | #define EM2800_AUDIOSRC_REG 0x08 | 353 | #define EM2800_AUDIOSRC_REG 0x08 |
352 | 354 | ||
353 | /* em28xx registers */ | 355 | /* em28xx registers */ |
356 | #define I2C_CLK_REG 0x06 | ||
354 | #define CHIPID_REG 0x0a | 357 | #define CHIPID_REG 0x0a |
355 | #define USBSUSP_REG 0x0c /* */ | 358 | #define USBSUSP_REG 0x0c /* */ |
356 | 359 | ||