aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/via/hw.c60
-rw-r--r--drivers/video/via/hw.h2
2 files changed, 28 insertions, 34 deletions
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 8c1393e49b0a..a7a5614c1ad8 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -1677,40 +1677,36 @@ static u32 vx855_encode_pll(struct pll_config pll)
1677u32 viafb_get_clk_value(int clk) 1677u32 viafb_get_clk_value(int clk)
1678{ 1678{
1679 u32 value = 0; 1679 u32 value = 0;
1680 int i = 0; 1680 int i, best = 0;
1681 1681
1682 while (i < NUM_TOTAL_PLL_TABLE && clk != pll_value[i].clk) 1682 for (i = 1; i < ARRAY_SIZE(pll_value); i++) {
1683 i++; 1683 if (abs(pll_value[i].clk - clk)
1684 1684 < abs(pll_value[best].clk - clk))
1685 if (i == NUM_TOTAL_PLL_TABLE) { 1685 best = i;
1686 printk(KERN_WARNING "viafb_get_clk_value: PLL lookup failed!"); 1686 }
1687 } else {
1688 switch (viaparinfo->chip_info->gfx_chip_name) {
1689 case UNICHROME_CLE266:
1690 case UNICHROME_K400:
1691 value = cle266_encode_pll(pll_value[i].cle266_pll);
1692 break;
1693
1694 case UNICHROME_K800:
1695 case UNICHROME_PM800:
1696 case UNICHROME_CN700:
1697 value = k800_encode_pll(pll_value[i].k800_pll);
1698 break;
1699
1700 case UNICHROME_CX700:
1701 case UNICHROME_CN750:
1702 case UNICHROME_K8M890:
1703 case UNICHROME_P4M890:
1704 case UNICHROME_P4M900:
1705 case UNICHROME_VX800:
1706 value = k800_encode_pll(pll_value[i].cx700_pll);
1707 break;
1708 1687
1709 case UNICHROME_VX855: 1688 switch (viaparinfo->chip_info->gfx_chip_name) {
1710 case UNICHROME_VX900: 1689 case UNICHROME_CLE266:
1711 value = vx855_encode_pll(pll_value[i].vx855_pll); 1690 case UNICHROME_K400:
1712 break; 1691 value = cle266_encode_pll(pll_value[best].cle266_pll);
1713 } 1692 break;
1693 case UNICHROME_K800:
1694 case UNICHROME_PM800:
1695 case UNICHROME_CN700:
1696 value = k800_encode_pll(pll_value[best].k800_pll);
1697 break;
1698 case UNICHROME_CX700:
1699 case UNICHROME_CN750:
1700 case UNICHROME_K8M890:
1701 case UNICHROME_P4M890:
1702 case UNICHROME_P4M900:
1703 case UNICHROME_VX800:
1704 value = k800_encode_pll(pll_value[best].cx700_pll);
1705 break;
1706 case UNICHROME_VX855:
1707 case UNICHROME_VX900:
1708 value = vx855_encode_pll(pll_value[best].vx855_pll);
1709 break;
1714 } 1710 }
1715 1711
1716 return value; 1712 return value;
diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
index 668d534542ef..7295263299f7 100644
--- a/drivers/video/via/hw.h
+++ b/drivers/video/via/hw.h
@@ -893,8 +893,6 @@ struct iga2_crtc_timing {
893/* VT3410 chipset*/ 893/* VT3410 chipset*/
894#define VX900_FUNCTION3 0x3410 894#define VX900_FUNCTION3 0x3410
895 895
896#define NUM_TOTAL_PLL_TABLE ARRAY_SIZE(pll_value)
897
898struct IODATA { 896struct IODATA {
899 u8 Index; 897 u8 Index;
900 u8 Mask; 898 u8 Mask;