diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-11-25 05:05:06 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-29 14:53:41 -0500 |
commit | a2070c665459ac37a36bebae5e97bb4a2568990e (patch) | |
tree | 1ceaae36fa9a2c937acf835c8f50ebf3dd402de8 /drivers | |
parent | 6d676d8af852e483044837240ad9ca669a01aaf2 (diff) |
V4L/DVB (9747): em28xx: Properly handles XCLK and I2C speed
The previous patches removed XCLK and I2C magic. Now, we finally know
what those registers do. Also, only a very few cards need different
setups for those.
Instead of keeping the setups for those values inside the per-device
hack magic switch, move the uncommon values to the board-specific
struct, and have a common setup for all other boards.
So, almost 100 lines of hacking magic were removed.
A co-lateral effect of this patch is that it also fixes a bug at em28xx-core, where xclk
were set, without taking any care about not overriding a previous xclk setup.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 158 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-core.c | 8 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx.h | 6 |
3 files changed, 39 insertions, 133 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 83f352a41041..729c76c59ec5 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -55,6 +55,7 @@ struct em28xx_board em28xx_boards[] = { | |||
55 | [EM2750_BOARD_UNKNOWN] = { | 55 | [EM2750_BOARD_UNKNOWN] = { |
56 | .name = "Unknown EM2750/EM2751 webcam grabber", | 56 | .name = "Unknown EM2750/EM2751 webcam grabber", |
57 | .vchannels = 1, | 57 | .vchannels = 1, |
58 | .xclk = EM28XX_XCLK_FREQUENCY_48MHZ, | ||
58 | .input = { { | 59 | .input = { { |
59 | .type = EM28XX_VMUX_COMPOSITE1, | 60 | .type = EM28XX_VMUX_COMPOSITE1, |
60 | .vmux = 0, | 61 | .vmux = 0, |
@@ -78,15 +79,15 @@ struct em28xx_board em28xx_boards[] = { | |||
78 | } }, | 79 | } }, |
79 | }, | 80 | }, |
80 | [EM2820_BOARD_UNKNOWN] = { | 81 | [EM2820_BOARD_UNKNOWN] = { |
81 | .name = "Unknown EM2750/28xx video grabber", | 82 | .name = "Unknown EM2750/28xx video grabber", |
82 | .is_em2800 = 0, | 83 | .tuner_type = TUNER_ABSENT, |
83 | .tuner_type = TUNER_ABSENT, | ||
84 | }, | 84 | }, |
85 | [EM2750_BOARD_DLCW_130] = { | 85 | [EM2750_BOARD_DLCW_130] = { |
86 | /* Beijing Huaqi Information Digital Technology Co., Ltd */ | 86 | /* Beijing Huaqi Information Digital Technology Co., Ltd */ |
87 | .name = "Huaqi DLCW-130", | 87 | .name = "Huaqi DLCW-130", |
88 | .valid = EM28XX_BOARD_NOT_VALIDATED, | 88 | .valid = EM28XX_BOARD_NOT_VALIDATED, |
89 | .vchannels = 1, | 89 | .vchannels = 1, |
90 | .xclk = EM28XX_XCLK_FREQUENCY_48MHZ, | ||
90 | .input = { { | 91 | .input = { { |
91 | .type = EM28XX_VMUX_COMPOSITE1, | 92 | .type = EM28XX_VMUX_COMPOSITE1, |
92 | .vmux = 0, | 93 | .vmux = 0, |
@@ -514,6 +515,10 @@ struct em28xx_board em28xx_boards[] = { | |||
514 | .name = "Pinnacle PCTV DVB-T", | 515 | .name = "Pinnacle PCTV DVB-T", |
515 | .valid = EM28XX_BOARD_NOT_VALIDATED, | 516 | .valid = EM28XX_BOARD_NOT_VALIDATED, |
516 | .tuner_type = TUNER_ABSENT, /* MT2060 */ | 517 | .tuner_type = TUNER_ABSENT, /* MT2060 */ |
518 | |||
519 | /* djh - I have serious doubts this is right... */ | ||
520 | .xclk = EM28XX_XCLK_IR_RC5_MODE | | ||
521 | EM28XX_XCLK_FREQUENCY_10MHZ, | ||
517 | }, | 522 | }, |
518 | [EM2870_BOARD_COMPRO_VIDEOMATE] = { | 523 | [EM2870_BOARD_COMPRO_VIDEOMATE] = { |
519 | .name = "Compro, VideoMate U3", | 524 | .name = "Compro, VideoMate U3", |
@@ -547,7 +552,7 @@ struct em28xx_board em28xx_boards[] = { | |||
547 | .tda9887_conf = TDA9887_PRESENT, | 552 | .tda9887_conf = TDA9887_PRESENT, |
548 | .tuner_type = TUNER_XC2028, | 553 | .tuner_type = TUNER_XC2028, |
549 | .mts_firmware = 1, | 554 | .mts_firmware = 1, |
550 | .has_dvb = 1, | 555 | .has_dvb = 1, |
551 | .decoder = EM28XX_TVP5150, | 556 | .decoder = EM28XX_TVP5150, |
552 | .input = { { | 557 | .input = { { |
553 | .type = EM28XX_VMUX_TELEVISION, | 558 | .type = EM28XX_VMUX_TELEVISION, |
@@ -589,7 +594,6 @@ struct em28xx_board em28xx_boards[] = { | |||
589 | .vchannels = 3, | 594 | .vchannels = 3, |
590 | .tuner_type = TUNER_XC2028, | 595 | .tuner_type = TUNER_XC2028, |
591 | .mts_firmware = 1, | 596 | .mts_firmware = 1, |
592 | .has_12mhz_i2s = 1, | ||
593 | .has_dvb = 1, | 597 | .has_dvb = 1, |
594 | .ir_codes = ir_codes_hauppauge_new, | 598 | .ir_codes = ir_codes_hauppauge_new, |
595 | .decoder = EM28XX_TVP5150, | 599 | .decoder = EM28XX_TVP5150, |
@@ -612,7 +616,6 @@ struct em28xx_board em28xx_boards[] = { | |||
612 | .vchannels = 3, | 616 | .vchannels = 3, |
613 | .tuner_type = TUNER_XC2028, | 617 | .tuner_type = TUNER_XC2028, |
614 | .mts_firmware = 1, | 618 | .mts_firmware = 1, |
615 | .has_12mhz_i2s = 1, | ||
616 | .has_dvb = 1, | 619 | .has_dvb = 1, |
617 | .ir_codes = ir_codes_pinnacle_pctv_hd, | 620 | .ir_codes = ir_codes_pinnacle_pctv_hd, |
618 | .decoder = EM28XX_TVP5150, | 621 | .decoder = EM28XX_TVP5150, |
@@ -635,7 +638,6 @@ struct em28xx_board em28xx_boards[] = { | |||
635 | .vchannels = 3, | 638 | .vchannels = 3, |
636 | .tuner_type = TUNER_XC2028, | 639 | .tuner_type = TUNER_XC2028, |
637 | .mts_firmware = 1, | 640 | .mts_firmware = 1, |
638 | .has_12mhz_i2s = 1, | ||
639 | .has_dvb = 1, | 641 | .has_dvb = 1, |
640 | .ir_codes = ir_codes_ati_tv_wonder_hd_600, | 642 | .ir_codes = ir_codes_ati_tv_wonder_hd_600, |
641 | .decoder = EM28XX_TVP5150, | 643 | .decoder = EM28XX_TVP5150, |
@@ -1091,9 +1093,12 @@ struct em28xx_board em28xx_boards[] = { | |||
1091 | .name = "Pinnacle PCTV HD Mini", | 1093 | .name = "Pinnacle PCTV HD Mini", |
1092 | .vchannels = 0, | 1094 | .vchannels = 0, |
1093 | .tuner_type = TUNER_ABSENT, | 1095 | .tuner_type = TUNER_ABSENT, |
1094 | .has_dvb = 1, | 1096 | .has_dvb = 1, |
1095 | .ir_codes = ir_codes_pinnacle_pctv_hd, | 1097 | .ir_codes = ir_codes_pinnacle_pctv_hd, |
1096 | .decoder = EM28XX_NODECODER, | 1098 | .decoder = EM28XX_NODECODER, |
1099 | .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1100 | EM2874_I2C_SECONDARY_BUS_SELECT | | ||
1101 | EM28XX_I2C_FREQ_400_KHZ, | ||
1097 | #ifdef DJH_DEBUG | 1102 | #ifdef DJH_DEBUG |
1098 | .input = { { | 1103 | .input = { { |
1099 | .type = EM28XX_VMUX_TELEVISION, | 1104 | .type = EM28XX_VMUX_TELEVISION, |
@@ -1326,7 +1331,8 @@ static void em28xx_set_model(struct em28xx *dev) | |||
1326 | dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf; | 1331 | dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf; |
1327 | dev->decoder = em28xx_boards[dev->model].decoder; | 1332 | dev->decoder = em28xx_boards[dev->model].decoder; |
1328 | dev->video_inputs = em28xx_boards[dev->model].vchannels; | 1333 | dev->video_inputs = em28xx_boards[dev->model].vchannels; |
1329 | dev->has_12mhz_i2s = em28xx_boards[dev->model].has_12mhz_i2s; | 1334 | dev->xclk = em28xx_boards[dev->model].xclk; |
1335 | dev->i2c_speed = em28xx_boards[dev->model].i2c_speed; | ||
1330 | dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480; | 1336 | dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480; |
1331 | dev->has_dvb = em28xx_boards[dev->model].has_dvb; | 1337 | dev->has_dvb = em28xx_boards[dev->model].has_dvb; |
1332 | dev->has_snapshot_button = em28xx_boards[dev->model].has_snapshot_button; | 1338 | dev->has_snapshot_button = em28xx_boards[dev->model].has_snapshot_button; |
@@ -1385,6 +1391,21 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1385 | 1391 | ||
1386 | em28xx_set_model(dev); | 1392 | em28xx_set_model(dev); |
1387 | 1393 | ||
1394 | /* Those are the default values for the majority of boards | ||
1395 | Use those values if not specified otherwise at boards entry | ||
1396 | */ | ||
1397 | if (!dev->xclk) | ||
1398 | dev->xclk = EM28XX_XCLK_IR_RC5_MODE | | ||
1399 | EM28XX_XCLK_FREQUENCY_12MHZ; | ||
1400 | |||
1401 | if (!dev->i2c_speed) | ||
1402 | dev->i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1403 | EM28XX_I2C_FREQ_100_KHZ; | ||
1404 | |||
1405 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->xclk & 0x7f); | ||
1406 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->i2c_speed); | ||
1407 | msleep(50); | ||
1408 | |||
1388 | /* request some modules */ | 1409 | /* request some modules */ |
1389 | switch (dev->model) { | 1410 | switch (dev->model) { |
1390 | case EM2880_BOARD_TERRATEC_PRODIGY_XS: | 1411 | case EM2880_BOARD_TERRATEC_PRODIGY_XS: |
@@ -1396,14 +1417,6 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1396 | case EM2882_BOARD_PINNACLE_HYBRID_PRO: | 1417 | case EM2882_BOARD_PINNACLE_HYBRID_PRO: |
1397 | case EM2883_BOARD_KWORLD_HYBRID_A316: | 1418 | case EM2883_BOARD_KWORLD_HYBRID_A316: |
1398 | case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600: | 1419 | case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600: |
1399 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | ||
1400 | EM28XX_XCLK_IR_RC5_MODE | | ||
1401 | EM28XX_XCLK_FREQUENCY_12MHZ); | ||
1402 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1403 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1404 | EM28XX_I2C_FREQ_100_KHZ); | ||
1405 | msleep(50); | ||
1406 | |||
1407 | /* Sets GPO/GPIO sequences for this device */ | 1420 | /* Sets GPO/GPIO sequences for this device */ |
1408 | dev->analog_gpio = hauppauge_wintv_hvr_900_analog; | 1421 | dev->analog_gpio = hauppauge_wintv_hvr_900_analog; |
1409 | dev->digital_gpio = hauppauge_wintv_hvr_900_digital; | 1422 | dev->digital_gpio = hauppauge_wintv_hvr_900_digital; |
@@ -1412,16 +1425,6 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1412 | break; | 1425 | break; |
1413 | 1426 | ||
1414 | case EM2882_BOARD_TERRATEC_HYBRID_XS: | 1427 | case EM2882_BOARD_TERRATEC_HYBRID_XS: |
1415 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | ||
1416 | EM28XX_XCLK_IR_RC5_MODE | | ||
1417 | EM28XX_XCLK_FREQUENCY_12MHZ); | ||
1418 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1419 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1420 | EM28XX_I2C_FREQ_100_KHZ); | ||
1421 | msleep(50); | ||
1422 | |||
1423 | /* should be added ir_codes here */ | ||
1424 | |||
1425 | /* Sets GPO/GPIO sequences for this device */ | 1428 | /* Sets GPO/GPIO sequences for this device */ |
1426 | dev->analog_gpio = hauppauge_wintv_hvr_900_analog; | 1429 | dev->analog_gpio = hauppauge_wintv_hvr_900_analog; |
1427 | dev->digital_gpio = hauppauge_wintv_hvr_900_digital; | 1430 | dev->digital_gpio = hauppauge_wintv_hvr_900_digital; |
@@ -1436,14 +1439,6 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1436 | case EM2880_BOARD_KWORLD_DVB_310U: | 1439 | case EM2880_BOARD_KWORLD_DVB_310U: |
1437 | case EM2870_BOARD_KWORLD_350U: | 1440 | case EM2870_BOARD_KWORLD_350U: |
1438 | case EM2881_BOARD_DNT_DA2_HYBRID: | 1441 | case EM2881_BOARD_DNT_DA2_HYBRID: |
1439 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | ||
1440 | EM28XX_XCLK_IR_RC5_MODE | | ||
1441 | EM28XX_XCLK_FREQUENCY_12MHZ); | ||
1442 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1443 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1444 | EM28XX_I2C_FREQ_100_KHZ); | ||
1445 | msleep(50); | ||
1446 | |||
1447 | /* NOTE: EM2881_DNT_DA2_HYBRID spend 140 msleep for digital | 1442 | /* NOTE: EM2881_DNT_DA2_HYBRID spend 140 msleep for digital |
1448 | and analog commands. If this commands doesn't work, | 1443 | and analog commands. If this commands doesn't work, |
1449 | add this timer. */ | 1444 | add this timer. */ |
@@ -1457,14 +1452,6 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1457 | 1452 | ||
1458 | case EM2880_BOARD_MSI_DIGIVOX_AD: | 1453 | case EM2880_BOARD_MSI_DIGIVOX_AD: |
1459 | case EM2880_BOARD_MSI_DIGIVOX_AD_II: | 1454 | case EM2880_BOARD_MSI_DIGIVOX_AD_II: |
1460 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | ||
1461 | EM28XX_XCLK_IR_RC5_MODE | | ||
1462 | EM28XX_XCLK_FREQUENCY_12MHZ); | ||
1463 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1464 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1465 | EM28XX_I2C_FREQ_100_KHZ); | ||
1466 | msleep(50); | ||
1467 | |||
1468 | /* Sets GPO/GPIO sequences for this device */ | 1455 | /* Sets GPO/GPIO sequences for this device */ |
1469 | dev->analog_gpio = em2880_msi_digivox_ad_analog; | 1456 | dev->analog_gpio = em2880_msi_digivox_ad_analog; |
1470 | dev->digital_gpio = em2880_msi_digivox_ad_digital; | 1457 | dev->digital_gpio = em2880_msi_digivox_ad_digital; |
@@ -1472,19 +1459,7 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1472 | dev->tun_digital_gpio = default_callback; | 1459 | dev->tun_digital_gpio = default_callback; |
1473 | break; | 1460 | break; |
1474 | 1461 | ||
1475 | case EM2750_BOARD_UNKNOWN: | ||
1476 | case EM2750_BOARD_DLCW_130: | ||
1477 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | ||
1478 | EM28XX_XCLK_FREQUENCY_48MHZ); | ||
1479 | break; | ||
1480 | |||
1481 | case EM2861_BOARD_PLEXTOR_PX_TV100U: | 1462 | case EM2861_BOARD_PLEXTOR_PX_TV100U: |
1482 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | ||
1483 | EM28XX_XCLK_IR_RC5_MODE | | ||
1484 | EM28XX_XCLK_FREQUENCY_12MHZ); | ||
1485 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1486 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1487 | EM28XX_I2C_FREQ_100_KHZ); | ||
1488 | /* FIXME guess */ | 1463 | /* FIXME guess */ |
1489 | /* Turn on analog audio output */ | 1464 | /* Turn on analog audio output */ |
1490 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd); | 1465 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd); |
@@ -1492,13 +1467,6 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1492 | 1467 | ||
1493 | case EM2861_BOARD_KWORLD_PVRTV_300U: | 1468 | case EM2861_BOARD_KWORLD_PVRTV_300U: |
1494 | case EM2880_BOARD_KWORLD_DVB_305U: | 1469 | case EM2880_BOARD_KWORLD_DVB_305U: |
1495 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | ||
1496 | EM28XX_XCLK_IR_RC5_MODE | | ||
1497 | EM28XX_XCLK_FREQUENCY_12MHZ); | ||
1498 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1499 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1500 | EM28XX_I2C_FREQ_100_KHZ); | ||
1501 | msleep(10); | ||
1502 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x6d); | 1470 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x6d); |
1503 | msleep(10); | 1471 | msleep(10); |
1504 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x7d); | 1472 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0x7d); |
@@ -1506,25 +1474,11 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1506 | break; | 1474 | break; |
1507 | 1475 | ||
1508 | case EM2870_BOARD_KWORLD_355U: | 1476 | case EM2870_BOARD_KWORLD_355U: |
1509 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | ||
1510 | EM28XX_XCLK_IR_RC5_MODE | | ||
1511 | EM28XX_XCLK_FREQUENCY_12MHZ); | ||
1512 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1513 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1514 | EM28XX_I2C_FREQ_100_KHZ); | ||
1515 | msleep(50); | ||
1516 | |||
1517 | /* Sets GPO/GPIO sequences for this device */ | 1477 | /* Sets GPO/GPIO sequences for this device */ |
1518 | dev->digital_gpio = em2870_kworld_355u_digital; | 1478 | dev->digital_gpio = em2870_kworld_355u_digital; |
1519 | break; | 1479 | break; |
1520 | 1480 | ||
1521 | case EM2870_BOARD_COMPRO_VIDEOMATE: | 1481 | case EM2870_BOARD_COMPRO_VIDEOMATE: |
1522 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | ||
1523 | EM28XX_XCLK_IR_RC5_MODE | | ||
1524 | EM28XX_XCLK_FREQUENCY_12MHZ); | ||
1525 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1526 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1527 | EM28XX_I2C_FREQ_100_KHZ); | ||
1528 | /* TODO: someone can do some cleanup here... | 1482 | /* TODO: someone can do some cleanup here... |
1529 | not everything's needed */ | 1483 | not everything's needed */ |
1530 | em28xx_write_reg(dev, EM2880_R04_GPO, 0x00); | 1484 | em28xx_write_reg(dev, EM2880_R04_GPO, 0x00); |
@@ -1542,12 +1496,6 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1542 | break; | 1496 | break; |
1543 | 1497 | ||
1544 | case EM2870_BOARD_TERRATEC_XS_MT2060: | 1498 | case EM2870_BOARD_TERRATEC_XS_MT2060: |
1545 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | ||
1546 | EM28XX_XCLK_IR_RC5_MODE | | ||
1547 | EM28XX_XCLK_FREQUENCY_12MHZ); | ||
1548 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1549 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1550 | EM28XX_I2C_FREQ_100_KHZ); | ||
1551 | /* this device needs some gpio writes to get the DVB-T | 1499 | /* this device needs some gpio writes to get the DVB-T |
1552 | demod work */ | 1500 | demod work */ |
1553 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe); | 1501 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe); |
@@ -1559,10 +1507,6 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1559 | break; | 1507 | break; |
1560 | 1508 | ||
1561 | case EM2870_BOARD_PINNACLE_PCTV_DVB: | 1509 | case EM2870_BOARD_PINNACLE_PCTV_DVB: |
1562 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1563 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1564 | EM28XX_I2C_FREQ_100_KHZ); | ||
1565 | |||
1566 | /* this device needs some gpio writes to get the | 1510 | /* this device needs some gpio writes to get the |
1567 | DVB-T demod work */ | 1511 | DVB-T demod work */ |
1568 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe); | 1512 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe); |
@@ -1571,53 +1515,15 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1571 | mdelay(70); | 1515 | mdelay(70); |
1572 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe); | 1516 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfe); |
1573 | mdelay(70); | 1517 | mdelay(70); |
1574 | /* switch em2880 rc protocol */ | ||
1575 | /* djh - I have serious doubts this is right... */ | ||
1576 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | ||
1577 | EM28XX_XCLK_IR_RC5_MODE | | ||
1578 | EM28XX_XCLK_FREQUENCY_10MHZ); | ||
1579 | /* should be added ir_codes here */ | ||
1580 | break; | 1518 | break; |
1581 | 1519 | ||
1582 | case EM2820_BOARD_GADMEI_UTV310: | 1520 | case EM2820_BOARD_GADMEI_UTV310: |
1583 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | ||
1584 | EM28XX_XCLK_IR_RC5_MODE | | ||
1585 | EM28XX_XCLK_FREQUENCY_12MHZ); | ||
1586 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1587 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1588 | EM28XX_I2C_FREQ_100_KHZ); | ||
1589 | /* Turn on analog audio output */ | ||
1590 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd); | ||
1591 | break; | ||
1592 | |||
1593 | case EM2860_BOARD_GADMEI_UTV330: | ||
1594 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | ||
1595 | EM28XX_XCLK_IR_RC5_MODE | | ||
1596 | EM28XX_XCLK_FREQUENCY_12MHZ); | ||
1597 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1598 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1599 | EM28XX_I2C_FREQ_100_KHZ); | ||
1600 | /* should be added ir_codes here */ | ||
1601 | break; | ||
1602 | |||
1603 | case EM2820_BOARD_MSI_VOX_USB_2: | 1521 | case EM2820_BOARD_MSI_VOX_USB_2: |
1604 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, | 1522 | /* enables audio for that devices */ |
1605 | EM28XX_XCLK_IR_RC5_MODE | | ||
1606 | EM28XX_XCLK_FREQUENCY_12MHZ); | ||
1607 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1608 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1609 | EM28XX_I2C_FREQ_100_KHZ); | ||
1610 | /* enables audio for that device */ | ||
1611 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd); | 1523 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd); |
1612 | break; | 1524 | break; |
1613 | 1525 | ||
1614 | case EM2874_BOARD_PINNACLE_PCTV_80E: | 1526 | case EM2874_BOARD_PINNACLE_PCTV_80E: |
1615 | /* Set 400 KHz clock and select secondary i2c bus */ | ||
1616 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, | ||
1617 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
1618 | EM2874_I2C_SECONDARY_BUS_SELECT | | ||
1619 | EM28XX_I2C_FREQ_400_KHZ); | ||
1620 | |||
1621 | dev->digital_gpio = em2874_pinnacle_80e_digital; | 1527 | dev->digital_gpio = em2874_pinnacle_80e_digital; |
1622 | break; | 1528 | break; |
1623 | } | 1529 | } |
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 413428aeccd7..53c7252416f0 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -399,7 +399,7 @@ struct em28xx_vol_table outputs[] = { | |||
399 | int em28xx_audio_analog_set(struct em28xx *dev) | 399 | int em28xx_audio_analog_set(struct em28xx *dev) |
400 | { | 400 | { |
401 | int ret, i; | 401 | int ret, i; |
402 | u8 xclk = 0x07; | 402 | u8 xclk; |
403 | 403 | ||
404 | if (!dev->audio_mode.has_audio) | 404 | if (!dev->audio_mode.has_audio) |
405 | return 0; | 405 | return 0; |
@@ -417,13 +417,11 @@ int em28xx_audio_analog_set(struct em28xx *dev) | |||
417 | } | 417 | } |
418 | } | 418 | } |
419 | 419 | ||
420 | if (dev->has_12mhz_i2s) | 420 | xclk = dev->xclk & 0x7f; |
421 | xclk |= 0x20; | ||
422 | |||
423 | if (!dev->mute) | 421 | if (!dev->mute) |
424 | xclk |= 0x80; | 422 | xclk |= 0x80; |
425 | 423 | ||
426 | ret = em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, xclk, 0xa7); | 424 | ret = em28xx_write_reg(dev, EM28XX_R0F_XCLK, xclk); |
427 | if (ret < 0) | 425 | if (ret < 0) |
428 | return ret; | 426 | return ret; |
429 | msleep(10); | 427 | msleep(10); |
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 4d50d60278c5..3bf23d384266 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -338,12 +338,13 @@ struct em28xx_board { | |||
338 | unsigned int is_em2800:1; | 338 | unsigned int is_em2800:1; |
339 | unsigned int has_msp34xx:1; | 339 | unsigned int has_msp34xx:1; |
340 | unsigned int mts_firmware:1; | 340 | unsigned int mts_firmware:1; |
341 | unsigned int has_12mhz_i2s:1; | ||
342 | unsigned int max_range_640_480:1; | 341 | unsigned int max_range_640_480:1; |
343 | unsigned int has_dvb:1; | 342 | unsigned int has_dvb:1; |
344 | unsigned int has_snapshot_button:1; | 343 | unsigned int has_snapshot_button:1; |
345 | unsigned int valid:1; | 344 | unsigned int valid:1; |
346 | 345 | ||
346 | unsigned char xclk, i2c_speed; | ||
347 | |||
347 | enum em28xx_decoder decoder; | 348 | enum em28xx_decoder decoder; |
348 | 349 | ||
349 | struct em28xx_input input[MAX_EM28XX_INPUT]; | 350 | struct em28xx_input input[MAX_EM28XX_INPUT]; |
@@ -422,12 +423,13 @@ struct em28xx { | |||
422 | unsigned int stream_on:1; /* Locks streams */ | 423 | unsigned int stream_on:1; /* Locks streams */ |
423 | unsigned int has_audio_class:1; | 424 | unsigned int has_audio_class:1; |
424 | unsigned int has_alsa_audio:1; | 425 | unsigned int has_alsa_audio:1; |
425 | unsigned int has_12mhz_i2s:1; | ||
426 | unsigned int max_range_640_480:1; | 426 | unsigned int max_range_640_480:1; |
427 | unsigned int has_dvb:1; | 427 | unsigned int has_dvb:1; |
428 | unsigned int has_snapshot_button:1; | 428 | unsigned int has_snapshot_button:1; |
429 | unsigned int valid:1; /* report for validated boards */ | 429 | unsigned int valid:1; /* report for validated boards */ |
430 | 430 | ||
431 | unsigned char xclk, i2c_speed; | ||
432 | |||
431 | struct em28xx_IR *ir; | 433 | struct em28xx_IR *ir; |
432 | 434 | ||
433 | /* Some older em28xx chips needs a waiting time after writing */ | 435 | /* Some older em28xx chips needs a waiting time after writing */ |