aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx
diff options
context:
space:
mode:
authorDevin Heitmueller <devin.heitmueller@gmail.com>2008-11-25 04:03:31 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:41 -0500
commit55927684e7c616b0b0976cc52926997f2da5930d (patch)
tree52e97907f181cc7412a3b72c63cb685dc6b502ea /drivers/media/video/em28xx
parent2f56c34b2bc25a5a3419715f38f7d761fcd61b23 (diff)
V4L/DVB (9744): em28xx: cleanup XCLK register usage
Convert over to setting the XCLK register usage with the new em28xx_write_reg() function. Thanks to Ray Lu from Empia for providing the em2860/2880 datasheet. Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c57
-rw-r--r--drivers/media/video/em28xx/em28xx-reg.h18
2 files changed, 60 insertions, 15 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 5751b66564f..f3f84692856 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -1396,7 +1396,9 @@ void em28xx_pre_card_setup(struct em28xx *dev)
1396 case EM2882_BOARD_PINNACLE_HYBRID_PRO: 1396 case EM2882_BOARD_PINNACLE_HYBRID_PRO:
1397 case EM2883_BOARD_KWORLD_HYBRID_A316: 1397 case EM2883_BOARD_KWORLD_HYBRID_A316:
1398 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600: 1398 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
1399 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1); 1399 em28xx_write_reg(dev, EM28XX_R0F_XCLK,
1400 EM28XX_XCLK_IR_RC5_MODE |
1401 EM28XX_XCLK_FREQUENCY_12MHZ);
1400 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 1402 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK,
1401 EM28XX_I2C_CLK_WAIT_ENABLE | 1403 EM28XX_I2C_CLK_WAIT_ENABLE |
1402 EM28XX_I2C_FREQ_100_KHZ); 1404 EM28XX_I2C_FREQ_100_KHZ);
@@ -1410,7 +1412,9 @@ void em28xx_pre_card_setup(struct em28xx *dev)
1410 break; 1412 break;
1411 1413
1412 case EM2882_BOARD_TERRATEC_HYBRID_XS: 1414 case EM2882_BOARD_TERRATEC_HYBRID_XS:
1413 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1); 1415 em28xx_write_reg(dev, EM28XX_R0F_XCLK,
1416 EM28XX_XCLK_IR_RC5_MODE |
1417 EM28XX_XCLK_FREQUENCY_12MHZ);
1414 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 1418 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK,
1415 EM28XX_I2C_CLK_WAIT_ENABLE | 1419 EM28XX_I2C_CLK_WAIT_ENABLE |
1416 EM28XX_I2C_FREQ_100_KHZ); 1420 EM28XX_I2C_FREQ_100_KHZ);
@@ -1432,7 +1436,9 @@ void em28xx_pre_card_setup(struct em28xx *dev)
1432 case EM2880_BOARD_KWORLD_DVB_310U: 1436 case EM2880_BOARD_KWORLD_DVB_310U:
1433 case EM2870_BOARD_KWORLD_350U: 1437 case EM2870_BOARD_KWORLD_350U:
1434 case EM2881_BOARD_DNT_DA2_HYBRID: 1438 case EM2881_BOARD_DNT_DA2_HYBRID:
1435 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1); 1439 em28xx_write_reg(dev, EM28XX_R0F_XCLK,
1440 EM28XX_XCLK_IR_RC5_MODE |
1441 EM28XX_XCLK_FREQUENCY_12MHZ);
1436 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 1442 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK,
1437 EM28XX_I2C_CLK_WAIT_ENABLE | 1443 EM28XX_I2C_CLK_WAIT_ENABLE |
1438 EM28XX_I2C_FREQ_100_KHZ); 1444 EM28XX_I2C_FREQ_100_KHZ);
@@ -1451,7 +1457,9 @@ void em28xx_pre_card_setup(struct em28xx *dev)
1451 1457
1452 case EM2880_BOARD_MSI_DIGIVOX_AD: 1458 case EM2880_BOARD_MSI_DIGIVOX_AD:
1453 case EM2880_BOARD_MSI_DIGIVOX_AD_II: 1459 case EM2880_BOARD_MSI_DIGIVOX_AD_II:
1454 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1); 1460 em28xx_write_reg(dev, EM28XX_R0F_XCLK,
1461 EM28XX_XCLK_IR_RC5_MODE |
1462 EM28XX_XCLK_FREQUENCY_12MHZ);
1455 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 1463 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK,
1456 EM28XX_I2C_CLK_WAIT_ENABLE | 1464 EM28XX_I2C_CLK_WAIT_ENABLE |
1457 EM28XX_I2C_FREQ_100_KHZ); 1465 EM28XX_I2C_FREQ_100_KHZ);
@@ -1466,11 +1474,14 @@ void em28xx_pre_card_setup(struct em28xx *dev)
1466 1474
1467 case EM2750_BOARD_UNKNOWN: 1475 case EM2750_BOARD_UNKNOWN:
1468 case EM2750_BOARD_DLCW_130: 1476 case EM2750_BOARD_DLCW_130:
1469 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x0a", 1); 1477 em28xx_write_reg(dev, EM28XX_R0F_XCLK,
1478 EM28XX_XCLK_FREQUENCY_48MHZ);
1470 break; 1479 break;
1471 1480
1472 case EM2861_BOARD_PLEXTOR_PX_TV100U: 1481 case EM2861_BOARD_PLEXTOR_PX_TV100U:
1473 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1); 1482 em28xx_write_reg(dev, EM28XX_R0F_XCLK,
1483 EM28XX_XCLK_IR_RC5_MODE |
1484 EM28XX_XCLK_FREQUENCY_12MHZ);
1474 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 1485 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK,
1475 EM28XX_I2C_CLK_WAIT_ENABLE | 1486 EM28XX_I2C_CLK_WAIT_ENABLE |
1476 EM28XX_I2C_FREQ_100_KHZ); 1487 EM28XX_I2C_FREQ_100_KHZ);
@@ -1481,7 +1492,9 @@ void em28xx_pre_card_setup(struct em28xx *dev)
1481 1492
1482 case EM2861_BOARD_KWORLD_PVRTV_300U: 1493 case EM2861_BOARD_KWORLD_PVRTV_300U:
1483 case EM2880_BOARD_KWORLD_DVB_305U: 1494 case EM2880_BOARD_KWORLD_DVB_305U:
1484 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1); 1495 em28xx_write_reg(dev, EM28XX_R0F_XCLK,
1496 EM28XX_XCLK_IR_RC5_MODE |
1497 EM28XX_XCLK_FREQUENCY_12MHZ);
1485 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 1498 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK,
1486 EM28XX_I2C_CLK_WAIT_ENABLE | 1499 EM28XX_I2C_CLK_WAIT_ENABLE |
1487 EM28XX_I2C_FREQ_100_KHZ); 1500 EM28XX_I2C_FREQ_100_KHZ);
@@ -1493,7 +1506,9 @@ void em28xx_pre_card_setup(struct em28xx *dev)
1493 break; 1506 break;
1494 1507
1495 case EM2870_BOARD_KWORLD_355U: 1508 case EM2870_BOARD_KWORLD_355U:
1496 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1); 1509 em28xx_write_reg(dev, EM28XX_R0F_XCLK,
1510 EM28XX_XCLK_IR_RC5_MODE |
1511 EM28XX_XCLK_FREQUENCY_12MHZ);
1497 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 1512 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK,
1498 EM28XX_I2C_CLK_WAIT_ENABLE | 1513 EM28XX_I2C_CLK_WAIT_ENABLE |
1499 EM28XX_I2C_FREQ_100_KHZ); 1514 EM28XX_I2C_FREQ_100_KHZ);
@@ -1504,7 +1519,9 @@ void em28xx_pre_card_setup(struct em28xx *dev)
1504 break; 1519 break;
1505 1520
1506 case EM2870_BOARD_COMPRO_VIDEOMATE: 1521 case EM2870_BOARD_COMPRO_VIDEOMATE:
1507 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1); 1522 em28xx_write_reg(dev, EM28XX_R0F_XCLK,
1523 EM28XX_XCLK_IR_RC5_MODE |
1524 EM28XX_XCLK_FREQUENCY_12MHZ);
1508 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 1525 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK,
1509 EM28XX_I2C_CLK_WAIT_ENABLE | 1526 EM28XX_I2C_CLK_WAIT_ENABLE |
1510 EM28XX_I2C_FREQ_100_KHZ); 1527 EM28XX_I2C_FREQ_100_KHZ);
@@ -1525,7 +1542,9 @@ void em28xx_pre_card_setup(struct em28xx *dev)
1525 break; 1542 break;
1526 1543
1527 case EM2870_BOARD_TERRATEC_XS_MT2060: 1544 case EM2870_BOARD_TERRATEC_XS_MT2060:
1528 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1); 1545 em28xx_write_reg(dev, EM28XX_R0F_XCLK,
1546 EM28XX_XCLK_IR_RC5_MODE |
1547 EM28XX_XCLK_FREQUENCY_12MHZ);
1529 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 1548 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK,
1530 EM28XX_I2C_CLK_WAIT_ENABLE | 1549 EM28XX_I2C_CLK_WAIT_ENABLE |
1531 EM28XX_I2C_FREQ_100_KHZ); 1550 EM28XX_I2C_FREQ_100_KHZ);
@@ -1553,12 +1572,17 @@ void em28xx_pre_card_setup(struct em28xx *dev)
1553 em28xx_write_regs(dev, 0x08, "\xfe", 1); 1572 em28xx_write_regs(dev, 0x08, "\xfe", 1);
1554 mdelay(70); 1573 mdelay(70);
1555 /* switch em2880 rc protocol */ 1574 /* switch em2880 rc protocol */
1556 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x22", 1); 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);
1557 /* should be added ir_codes here */ 1579 /* should be added ir_codes here */
1558 break; 1580 break;
1559 1581
1560 case EM2820_BOARD_GADMEI_UTV310: 1582 case EM2820_BOARD_GADMEI_UTV310:
1561 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1); 1583 em28xx_write_reg(dev, EM28XX_R0F_XCLK,
1584 EM28XX_XCLK_IR_RC5_MODE |
1585 EM28XX_XCLK_FREQUENCY_12MHZ);
1562 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 1586 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK,
1563 EM28XX_I2C_CLK_WAIT_ENABLE | 1587 EM28XX_I2C_CLK_WAIT_ENABLE |
1564 EM28XX_I2C_FREQ_100_KHZ); 1588 EM28XX_I2C_FREQ_100_KHZ);
@@ -1567,8 +1591,9 @@ void em28xx_pre_card_setup(struct em28xx *dev)
1567 break; 1591 break;
1568 1592
1569 case EM2860_BOARD_GADMEI_UTV330: 1593 case EM2860_BOARD_GADMEI_UTV330:
1570 /* Turn on IR */ 1594 em28xx_write_reg(dev, EM28XX_R0F_XCLK,
1571 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x07", 1); 1595 EM28XX_XCLK_IR_RC5_MODE |
1596 EM28XX_XCLK_FREQUENCY_12MHZ);
1572 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 1597 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK,
1573 EM28XX_I2C_CLK_WAIT_ENABLE | 1598 EM28XX_I2C_CLK_WAIT_ENABLE |
1574 EM28XX_I2C_FREQ_100_KHZ); 1599 EM28XX_I2C_FREQ_100_KHZ);
@@ -1576,7 +1601,9 @@ void em28xx_pre_card_setup(struct em28xx *dev)
1576 break; 1601 break;
1577 1602
1578 case EM2820_BOARD_MSI_VOX_USB_2: 1603 case EM2820_BOARD_MSI_VOX_USB_2:
1579 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1); 1604 em28xx_write_reg(dev, EM28XX_R0F_XCLK,
1605 EM28XX_XCLK_IR_RC5_MODE |
1606 EM28XX_XCLK_FREQUENCY_12MHZ);
1580 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 1607 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK,
1581 EM28XX_I2C_CLK_WAIT_ENABLE | 1608 EM28XX_I2C_CLK_WAIT_ENABLE |
1582 EM28XX_I2C_FREQ_100_KHZ); 1609 EM28XX_I2C_FREQ_100_KHZ);
diff --git a/drivers/media/video/em28xx/em28xx-reg.h b/drivers/media/video/em28xx/em28xx-reg.h
index 98e95054e81..45d588c3a6c 100644
--- a/drivers/media/video/em28xx/em28xx-reg.h
+++ b/drivers/media/video/em28xx/em28xx-reg.h
@@ -51,6 +51,24 @@
51#define EM28XX_R0E_AUDIOSRC 0x0e 51#define EM28XX_R0E_AUDIOSRC 0x0e
52#define EM28XX_R0F_XCLK 0x0f 52#define EM28XX_R0F_XCLK 0x0f
53 53
54/* em28xx XCLK Register (0x0f) */
55#define EM28XX_XCLK_AUDIO_UNMUTE 0x80 /* otherwise audio muted */
56#define EM28XX_XCLK_I2S_MSB_TIMING 0x40 /* otherwise standard timing */
57#define EM28XX_XCLK_IR_RC5_MODE 0x20 /* otherwise NEC mode */
58#define EM28XX_XCLK_IR_NEC_CHK_PARITY 0x10
59#define EM28XX_XCLK_FREQUENCY_30MHZ 0x00 /* Freq. select (bits [3-0]) */
60#define EM28XX_XCLK_FREQUENCY_15MHZ 0x01
61#define EM28XX_XCLK_FREQUENCY_10MHZ 0x02
62#define EM28XX_XCLK_FREQUENCY_7_5MHZ 0x03
63#define EM28XX_XCLK_FREQUENCY_6MHZ 0x04
64#define EM28XX_XCLK_FREQUENCY_5MHZ 0x05
65#define EM28XX_XCLK_FREQUENCY_4_3MHZ 0x06
66#define EM28XX_XCLK_FREQUENCY_12MHZ 0x07
67#define EM28XX_XCLK_FREQUENCY_20MHZ 0x08
68#define EM28XX_XCLK_FREQUENCY_20MHZ_2 0x09
69#define EM28XX_XCLK_FREQUENCY_48MHZ 0x0a
70#define EM28XX_XCLK_FREQUENCY_24MHZ 0x0b
71
54#define EM28XX_R10_VINMODE 0x10 72#define EM28XX_R10_VINMODE 0x10
55#define EM28XX_R11_VINCTRL 0x11 73#define EM28XX_R11_VINCTRL 0x11
56#define EM28XX_R12_VINENABLE 0x12 /* */ 74#define EM28XX_R12_VINENABLE 0x12 /* */