aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/Kconfig3
-rw-r--r--drivers/video/console/sticore.c4
-rw-r--r--drivers/video/fbdev/Kconfig8
-rw-r--r--drivers/video/fbdev/amba-clcd.c3
-rw-r--r--drivers/video/fbdev/atmel_lcdfb.c31
-rw-r--r--drivers/video/fbdev/aty/aty128fb.c2
-rw-r--r--drivers/video/fbdev/aty/mach64_ct.c2
-rw-r--r--drivers/video/fbdev/aty/radeon_base.c21
-rw-r--r--drivers/video/fbdev/au1100fb.c9
-rw-r--r--drivers/video/fbdev/fsl-diu-fb.c6
-rw-r--r--drivers/video/fbdev/matrox/matroxfb_crtc2.c5
-rw-r--r--drivers/video/fbdev/offb.c2
-rw-r--r--drivers/video/fbdev/s3c-fb.c168
-rw-r--r--drivers/video/fbdev/sis/init.h76
-rw-r--r--drivers/video/fbdev/sis/init301.c326
-rw-r--r--drivers/video/fbdev/sis/init301.h320
-rw-r--r--drivers/video/fbdev/sis/sis.h131
-rw-r--r--drivers/video/fbdev/sis/sis_main.c51
-rw-r--r--drivers/video/fbdev/sis/sis_main.h117
-rw-r--r--drivers/video/fbdev/smscufx.c59
-rw-r--r--drivers/video/fbdev/ssd1307fb.c3
-rw-r--r--drivers/video/fbdev/stifb.c6
-rw-r--r--drivers/video/fbdev/udlfb.c39
-rw-r--r--drivers/video/fbdev/vermilion/vermilion.c2
-rw-r--r--drivers/video/fbdev/via/via_aux_sii164.c2
-rw-r--r--drivers/video/fbdev/via/via_aux_vt1631.c2
-rw-r--r--drivers/video/fbdev/via/via_aux_vt1632.c2
-rw-r--r--drivers/video/fbdev/via/via_aux_vt1636.c2
-rw-r--r--drivers/video/of_display_timing.c20
-rw-r--r--include/video/of_display_timing.h5
30 files changed, 609 insertions, 818 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 4f950c686055..83d3d271ca15 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -9,9 +9,6 @@ if HAS_IOMEM
9config HAVE_FB_ATMEL 9config HAVE_FB_ATMEL
10 bool 10 bool
11 11
12config SH_LCD_MIPI_DSI
13 bool
14
15source "drivers/char/agp/Kconfig" 12source "drivers/char/agp/Kconfig"
16 13
17source "drivers/gpu/vga/Kconfig" 14source "drivers/gpu/vga/Kconfig"
diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index d1d3796773aa..08b822656846 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -827,10 +827,8 @@ static struct sti_struct *sti_try_rom_generic(unsigned long address,
827 } 827 }
828 828
829 sti = kzalloc(sizeof(*sti), GFP_KERNEL); 829 sti = kzalloc(sizeof(*sti), GFP_KERNEL);
830 if (!sti) { 830 if (!sti)
831 printk(KERN_ERR "Not enough memory !\n");
832 return NULL; 831 return NULL;
833 }
834 832
835 spin_lock_init(&sti->lock); 833 spin_lock_init(&sti->lock);
836 834
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 399573742487..d94254263ea5 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -1053,6 +1053,11 @@ config FB_I810_I2C
1053 bool "Enable DDC Support" 1053 bool "Enable DDC Support"
1054 depends on FB_I810 && FB_I810_GTF 1054 depends on FB_I810 && FB_I810_GTF
1055 select FB_DDC 1055 select FB_DDC
1056 help
1057 Add DDC/I2C support for i810fb. This will allow the driver to get
1058 display information, especially for monitors with fickle timings.
1059
1060 If unsure, say Y.
1056 1061
1057config FB_LE80578 1062config FB_LE80578
1058 tristate "Intel LE80578 (Vermilion) support" 1063 tristate "Intel LE80578 (Vermilion) support"
@@ -1917,8 +1922,7 @@ config FB_TMIO_ACCELL
1917 1922
1918config FB_S3C 1923config FB_S3C
1919 tristate "Samsung S3C framebuffer support" 1924 tristate "Samsung S3C framebuffer support"
1920 depends on FB && (CPU_S3C2416 || ARCH_S3C64XX || \ 1925 depends on FB && (CPU_S3C2416 || ARCH_S3C64XX)
1921 ARCH_S5PV210 || ARCH_EXYNOS)
1922 select FB_CFB_FILLRECT 1926 select FB_CFB_FILLRECT
1923 select FB_CFB_COPYAREA 1927 select FB_CFB_COPYAREA
1924 select FB_CFB_IMAGEBLIT 1928 select FB_CFB_IMAGEBLIT
diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c
index 36d25190b48c..38c1f324ce15 100644
--- a/drivers/video/fbdev/amba-clcd.c
+++ b/drivers/video/fbdev/amba-clcd.c
@@ -967,9 +967,8 @@ static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id)
967 goto out; 967 goto out;
968 } 968 }
969 969
970 fb = kzalloc(sizeof(struct clcd_fb), GFP_KERNEL); 970 fb = kzalloc(sizeof(*fb), GFP_KERNEL);
971 if (!fb) { 971 if (!fb) {
972 printk(KERN_INFO "CLCD: could not allocate new clcd_fb struct\n");
973 ret = -ENOMEM; 972 ret = -ENOMEM;
974 goto free_region; 973 goto free_region;
975 } 974 }
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
index 3dee267d7c75..076d24afbd72 100644
--- a/drivers/video/fbdev/atmel_lcdfb.c
+++ b/drivers/video/fbdev/atmel_lcdfb.c
@@ -18,10 +18,10 @@
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/backlight.h> 19#include <linux/backlight.h>
20#include <linux/gfp.h> 20#include <linux/gfp.h>
21#include <linux/gpio/consumer.h>
21#include <linux/module.h> 22#include <linux/module.h>
22#include <linux/of.h> 23#include <linux/of.h>
23#include <linux/of_device.h> 24#include <linux/of_device.h>
24#include <linux/of_gpio.h>
25#include <video/of_display_timing.h> 25#include <video/of_display_timing.h>
26#include <linux/regulator/consumer.h> 26#include <linux/regulator/consumer.h>
27#include <video/videomode.h> 27#include <video/videomode.h>
@@ -61,8 +61,7 @@ struct atmel_lcdfb_info {
61}; 61};
62 62
63struct atmel_lcdfb_power_ctrl_gpio { 63struct atmel_lcdfb_power_ctrl_gpio {
64 int gpio; 64 struct gpio_desc *gpiod;
65 int active_low;
66 65
67 struct list_head list; 66 struct list_head list;
68}; 67};
@@ -1018,7 +1017,7 @@ static void atmel_lcdfb_power_control_gpio(struct atmel_lcdfb_pdata *pdata, int
1018 struct atmel_lcdfb_power_ctrl_gpio *og; 1017 struct atmel_lcdfb_power_ctrl_gpio *og;
1019 1018
1020 list_for_each_entry(og, &pdata->pwr_gpios, list) 1019 list_for_each_entry(og, &pdata->pwr_gpios, list)
1021 gpio_set_value(og->gpio, on); 1020 gpiod_set_value(og->gpiod, on);
1022} 1021}
1023 1022
1024static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) 1023static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
@@ -1031,11 +1030,11 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
1031 struct device_node *display_np; 1030 struct device_node *display_np;
1032 struct device_node *timings_np; 1031 struct device_node *timings_np;
1033 struct display_timings *timings; 1032 struct display_timings *timings;
1034 enum of_gpio_flags flags;
1035 struct atmel_lcdfb_power_ctrl_gpio *og; 1033 struct atmel_lcdfb_power_ctrl_gpio *og;
1036 bool is_gpio_power = false; 1034 bool is_gpio_power = false;
1035 struct gpio_desc *gpiod;
1037 int ret = -ENOENT; 1036 int ret = -ENOENT;
1038 int i, gpio; 1037 int i;
1039 1038
1040 sinfo->config = (struct atmel_lcdfb_config*) 1039 sinfo->config = (struct atmel_lcdfb_config*)
1041 of_match_device(atmel_lcdfb_dt_ids, dev)->data; 1040 of_match_device(atmel_lcdfb_dt_ids, dev)->data;
@@ -1072,28 +1071,22 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
1072 1071
1073 INIT_LIST_HEAD(&pdata->pwr_gpios); 1072 INIT_LIST_HEAD(&pdata->pwr_gpios);
1074 ret = -ENOMEM; 1073 ret = -ENOMEM;
1075 for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) { 1074 for (i = 0; i < gpiod_count(dev, "atmel,power-control"); i++) {
1076 gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio", 1075 gpiod = devm_gpiod_get_index(dev, "atmel,power-control",
1077 i, &flags); 1076 i, GPIOD_ASIS);
1078 if (gpio < 0) 1077 if (IS_ERR(gpiod))
1079 continue; 1078 continue;
1080 1079
1081 og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL); 1080 og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL);
1082 if (!og) 1081 if (!og)
1083 goto put_display_node; 1082 goto put_display_node;
1084 1083
1085 og->gpio = gpio; 1084 og->gpiod = gpiod;
1086 og->active_low = flags & OF_GPIO_ACTIVE_LOW;
1087 is_gpio_power = true; 1085 is_gpio_power = true;
1088 ret = devm_gpio_request(dev, gpio, "lcd-power-control-gpio");
1089 if (ret) {
1090 dev_err(dev, "request gpio %d failed\n", gpio);
1091 goto put_display_node;
1092 }
1093 1086
1094 ret = gpio_direction_output(gpio, og->active_low); 1087 ret = gpiod_direction_output(gpiod, gpiod_is_active_low(gpiod));
1095 if (ret) { 1088 if (ret) {
1096 dev_err(dev, "set direction output gpio %d failed\n", gpio); 1089 dev_err(dev, "set direction output gpio atmel,power-control[%d] failed\n", i);
1097 goto put_display_node; 1090 goto put_display_node;
1098 } 1091 }
1099 list_add(&og->list, &pdata->pwr_gpios); 1092 list_add(&og->list, &pdata->pwr_gpios);
diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c
index db18474607c9..09b0e558dce8 100644
--- a/drivers/video/fbdev/aty/aty128fb.c
+++ b/drivers/video/fbdev/aty/aty128fb.c
@@ -1716,7 +1716,7 @@ static int aty128fb_setup(char *options)
1716 continue; 1716 continue;
1717 } 1717 }
1718 if(!strncmp(this_opt, "nomtrr", 6)) { 1718 if(!strncmp(this_opt, "nomtrr", 6)) {
1719 mtrr = 0; 1719 mtrr = false;
1720 continue; 1720 continue;
1721 } 1721 }
1722#ifdef CONFIG_PPC_PMAC 1722#ifdef CONFIG_PPC_PMAC
diff --git a/drivers/video/fbdev/aty/mach64_ct.c b/drivers/video/fbdev/aty/mach64_ct.c
index 7d3bd723d3d5..74a62aa193c0 100644
--- a/drivers/video/fbdev/aty/mach64_ct.c
+++ b/drivers/video/fbdev/aty/mach64_ct.c
@@ -180,7 +180,7 @@ static int aty_dsp_gt(const struct fb_info *info, u32 bpp, struct pll_ct *pll)
180 dsp_on = ((multiplier << vshift) + divider) / divider; 180 dsp_on = ((multiplier << vshift) + divider) / divider;
181 tmp = ((ras_multiplier << xshift) + ras_divider) / ras_divider; 181 tmp = ((ras_multiplier << xshift) + ras_divider) / ras_divider;
182 if (dsp_on < tmp) 182 if (dsp_on < tmp)
183 dsp_on = tmp; 183 dsp_on = tmp;
184 dsp_on = dsp_on + (tmp * 2) + (pll->xclkpagefaultdelay << xshift); 184 dsp_on = dsp_on + (tmp * 2) + (pll->xclkpagefaultdelay << xshift);
185 } 185 }
186 186
diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c
index 87608c0b2351..e8594bbaea60 100644
--- a/drivers/video/fbdev/aty/radeon_base.c
+++ b/drivers/video/fbdev/aty/radeon_base.c
@@ -2255,6 +2255,23 @@ static const struct bin_attribute edid2_attr = {
2255 .read = radeon_show_edid2, 2255 .read = radeon_show_edid2,
2256}; 2256};
2257 2257
2258static int radeon_kick_out_firmware_fb(struct pci_dev *pdev)
2259{
2260 struct apertures_struct *ap;
2261
2262 ap = alloc_apertures(1);
2263 if (!ap)
2264 return -ENOMEM;
2265
2266 ap->ranges[0].base = pci_resource_start(pdev, 0);
2267 ap->ranges[0].size = pci_resource_len(pdev, 0);
2268
2269 remove_conflicting_framebuffers(ap, KBUILD_MODNAME, false);
2270
2271 kfree(ap);
2272
2273 return 0;
2274}
2258 2275
2259static int radeonfb_pci_register(struct pci_dev *pdev, 2276static int radeonfb_pci_register(struct pci_dev *pdev,
2260 const struct pci_device_id *ent) 2277 const struct pci_device_id *ent)
@@ -2308,6 +2325,10 @@ static int radeonfb_pci_register(struct pci_dev *pdev,
2308 rinfo->fb_base_phys = pci_resource_start (pdev, 0); 2325 rinfo->fb_base_phys = pci_resource_start (pdev, 0);
2309 rinfo->mmio_base_phys = pci_resource_start (pdev, 2); 2326 rinfo->mmio_base_phys = pci_resource_start (pdev, 2);
2310 2327
2328 ret = radeon_kick_out_firmware_fb(pdev);
2329 if (ret)
2330 return ret;
2331
2311 /* request the mem regions */ 2332 /* request the mem regions */
2312 ret = pci_request_region(pdev, 0, "radeonfb framebuffer"); 2333 ret = pci_request_region(pdev, 0, "radeonfb framebuffer");
2313 if (ret < 0) { 2334 if (ret < 0) {
diff --git a/drivers/video/fbdev/au1100fb.c b/drivers/video/fbdev/au1100fb.c
index 8de42f617d16..7c9a672e9811 100644
--- a/drivers/video/fbdev/au1100fb.c
+++ b/drivers/video/fbdev/au1100fb.c
@@ -410,18 +410,15 @@ static int au1100fb_setup(struct au1100fb_device *fbdev)
410 410
411static int au1100fb_drv_probe(struct platform_device *dev) 411static int au1100fb_drv_probe(struct platform_device *dev)
412{ 412{
413 struct au1100fb_device *fbdev = NULL; 413 struct au1100fb_device *fbdev;
414 struct resource *regs_res; 414 struct resource *regs_res;
415 unsigned long page; 415 unsigned long page;
416 struct clk *c; 416 struct clk *c;
417 417
418 /* Allocate new device private */ 418 /* Allocate new device private */
419 fbdev = devm_kzalloc(&dev->dev, sizeof(struct au1100fb_device), 419 fbdev = devm_kzalloc(&dev->dev, sizeof(*fbdev), GFP_KERNEL);
420 GFP_KERNEL); 420 if (!fbdev)
421 if (!fbdev) {
422 print_err("fail to allocate device private record");
423 return -ENOMEM; 421 return -ENOMEM;
424 }
425 422
426 if (au1100fb_setup(fbdev)) 423 if (au1100fb_setup(fbdev))
427 goto failed; 424 goto failed;
diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c
index 25abbcf38913..1bfd13cbd4e3 100644
--- a/drivers/video/fbdev/fsl-diu-fb.c
+++ b/drivers/video/fbdev/fsl-diu-fb.c
@@ -1960,12 +1960,8 @@ static int __init fsl_diu_init(void)
1960 1960
1961 of_node_put(np); 1961 of_node_put(np);
1962 coherence_data = vmalloc(coherence_data_size); 1962 coherence_data = vmalloc(coherence_data_size);
1963 if (!coherence_data) { 1963 if (!coherence_data)
1964 pr_err("fsl-diu-fb: could not allocate coherence data "
1965 "(size=%zu)\n", coherence_data_size);
1966 return -ENOMEM; 1964 return -ENOMEM;
1967 }
1968
1969#endif 1965#endif
1970 1966
1971 ret = platform_driver_register(&fsl_diu_driver); 1967 ret = platform_driver_register(&fsl_diu_driver);
diff --git a/drivers/video/fbdev/matrox/matroxfb_crtc2.c b/drivers/video/fbdev/matrox/matroxfb_crtc2.c
index 02796a4317a9..f64e1d55d7a1 100644
--- a/drivers/video/fbdev/matrox/matroxfb_crtc2.c
+++ b/drivers/video/fbdev/matrox/matroxfb_crtc2.c
@@ -696,10 +696,9 @@ static void* matroxfb_crtc2_probe(struct matrox_fb_info* minfo) {
696 if (!minfo->devflags.crtc2) 696 if (!minfo->devflags.crtc2)
697 return NULL; 697 return NULL;
698 m2info = kzalloc(sizeof(*m2info), GFP_KERNEL); 698 m2info = kzalloc(sizeof(*m2info), GFP_KERNEL);
699 if (!m2info) { 699 if (!m2info)
700 printk(KERN_ERR "matroxfb_crtc2: Not enough memory for CRTC2 control structs\n");
701 return NULL; 700 return NULL;
702 } 701
703 m2info->primary_dev = minfo; 702 m2info->primary_dev = minfo;
704 if (matroxfb_dh_registerfb(m2info)) { 703 if (matroxfb_dh_registerfb(m2info)) {
705 kfree(m2info); 704 kfree(m2info);
diff --git a/drivers/video/fbdev/offb.c b/drivers/video/fbdev/offb.c
index 90d38de34479..77c0a2f45b3b 100644
--- a/drivers/video/fbdev/offb.c
+++ b/drivers/video/fbdev/offb.c
@@ -280,6 +280,7 @@ static void offb_destroy(struct fb_info *info)
280 if (info->screen_base) 280 if (info->screen_base)
281 iounmap(info->screen_base); 281 iounmap(info->screen_base);
282 release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); 282 release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size);
283 fb_dealloc_cmap(&info->cmap);
283 framebuffer_release(info); 284 framebuffer_release(info);
284} 285}
285 286
@@ -518,6 +519,7 @@ static void __init offb_init_fb(const char *name,
518 return; 519 return;
519 520
520out_err: 521out_err:
522 fb_dealloc_cmap(&info->cmap);
521 iounmap(info->screen_base); 523 iounmap(info->screen_base);
522out_aper: 524out_aper:
523 iounmap(par->cmap_adr); 525 iounmap(par->cmap_adr);
diff --git a/drivers/video/fbdev/s3c-fb.c b/drivers/video/fbdev/s3c-fb.c
index 5f4f696c2ecf..9ec85ccd0ce9 100644
--- a/drivers/video/fbdev/s3c-fb.c
+++ b/drivers/video/fbdev/s3c-fb.c
@@ -1383,11 +1383,9 @@ static int s3c_fb_probe(struct platform_device *pdev)
1383 return -EINVAL; 1383 return -EINVAL;
1384 } 1384 }
1385 1385
1386 sfb = devm_kzalloc(dev, sizeof(struct s3c_fb), GFP_KERNEL); 1386 sfb = devm_kzalloc(dev, sizeof(*sfb), GFP_KERNEL);
1387 if (!sfb) { 1387 if (!sfb)
1388 dev_err(dev, "no memory for framebuffers\n");
1389 return -ENOMEM; 1388 return -ENOMEM;
1390 }
1391 1389
1392 dev_dbg(dev, "allocate new framebuffer %p\n", sfb); 1390 dev_dbg(dev, "allocate new framebuffer %p\n", sfb);
1393 1391
@@ -1716,63 +1714,6 @@ static struct s3c_fb_win_variant s3c_fb_data_64xx_wins[] = {
1716 }, 1714 },
1717}; 1715};
1718 1716
1719static struct s3c_fb_win_variant s3c_fb_data_s5p_wins[] = {
1720 [0] = {
1721 .has_osd_c = 1,
1722 .osd_size_off = 0x8,
1723 .palette_sz = 256,
1724 .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) |
1725 VALID_BPP(15) | VALID_BPP(16) |
1726 VALID_BPP(18) | VALID_BPP(19) |
1727 VALID_BPP(24) | VALID_BPP(25) |
1728 VALID_BPP(32)),
1729 },
1730 [1] = {
1731 .has_osd_c = 1,
1732 .has_osd_d = 1,
1733 .osd_size_off = 0xc,
1734 .has_osd_alpha = 1,
1735 .palette_sz = 256,
1736 .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) |
1737 VALID_BPP(15) | VALID_BPP(16) |
1738 VALID_BPP(18) | VALID_BPP(19) |
1739 VALID_BPP(24) | VALID_BPP(25) |
1740 VALID_BPP(32)),
1741 },
1742 [2] = {
1743 .has_osd_c = 1,
1744 .has_osd_d = 1,
1745 .osd_size_off = 0xc,
1746 .has_osd_alpha = 1,
1747 .palette_sz = 256,
1748 .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) |
1749 VALID_BPP(15) | VALID_BPP(16) |
1750 VALID_BPP(18) | VALID_BPP(19) |
1751 VALID_BPP(24) | VALID_BPP(25) |
1752 VALID_BPP(32)),
1753 },
1754 [3] = {
1755 .has_osd_c = 1,
1756 .has_osd_alpha = 1,
1757 .palette_sz = 256,
1758 .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) |
1759 VALID_BPP(15) | VALID_BPP(16) |
1760 VALID_BPP(18) | VALID_BPP(19) |
1761 VALID_BPP(24) | VALID_BPP(25) |
1762 VALID_BPP(32)),
1763 },
1764 [4] = {
1765 .has_osd_c = 1,
1766 .has_osd_alpha = 1,
1767 .palette_sz = 256,
1768 .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) |
1769 VALID_BPP(15) | VALID_BPP(16) |
1770 VALID_BPP(18) | VALID_BPP(19) |
1771 VALID_BPP(24) | VALID_BPP(25) |
1772 VALID_BPP(32)),
1773 },
1774};
1775
1776static struct s3c_fb_driverdata s3c_fb_data_64xx = { 1717static struct s3c_fb_driverdata s3c_fb_data_64xx = {
1777 .variant = { 1718 .variant = {
1778 .nr_windows = 5, 1719 .nr_windows = 5,
@@ -1804,102 +1745,6 @@ static struct s3c_fb_driverdata s3c_fb_data_64xx = {
1804 .win[4] = &s3c_fb_data_64xx_wins[4], 1745 .win[4] = &s3c_fb_data_64xx_wins[4],
1805}; 1746};
1806 1747
1807static struct s3c_fb_driverdata s3c_fb_data_s5pv210 = {
1808 .variant = {
1809 .nr_windows = 5,
1810 .vidtcon = VIDTCON0,
1811 .wincon = WINCON(0),
1812 .winmap = WINxMAP(0),
1813 .keycon = WKEYCON,
1814 .osd = VIDOSD_BASE,
1815 .osd_stride = 16,
1816 .buf_start = VIDW_BUF_START(0),
1817 .buf_size = VIDW_BUF_SIZE(0),
1818 .buf_end = VIDW_BUF_END(0),
1819
1820 .palette = {
1821 [0] = 0x2400,
1822 [1] = 0x2800,
1823 [2] = 0x2c00,
1824 [3] = 0x3000,
1825 [4] = 0x3400,
1826 },
1827
1828 .has_shadowcon = 1,
1829 .has_blendcon = 1,
1830 .has_clksel = 1,
1831 .has_fixvclk = 1,
1832 },
1833 .win[0] = &s3c_fb_data_s5p_wins[0],
1834 .win[1] = &s3c_fb_data_s5p_wins[1],
1835 .win[2] = &s3c_fb_data_s5p_wins[2],
1836 .win[3] = &s3c_fb_data_s5p_wins[3],
1837 .win[4] = &s3c_fb_data_s5p_wins[4],
1838};
1839
1840static struct s3c_fb_driverdata s3c_fb_data_exynos4 = {
1841 .variant = {
1842 .nr_windows = 5,
1843 .vidtcon = VIDTCON0,
1844 .wincon = WINCON(0),
1845 .winmap = WINxMAP(0),
1846 .keycon = WKEYCON,
1847 .osd = VIDOSD_BASE,
1848 .osd_stride = 16,
1849 .buf_start = VIDW_BUF_START(0),
1850 .buf_size = VIDW_BUF_SIZE(0),
1851 .buf_end = VIDW_BUF_END(0),
1852
1853 .palette = {
1854 [0] = 0x2400,
1855 [1] = 0x2800,
1856 [2] = 0x2c00,
1857 [3] = 0x3000,
1858 [4] = 0x3400,
1859 },
1860
1861 .has_shadowcon = 1,
1862 .has_blendcon = 1,
1863 .has_fixvclk = 1,
1864 },
1865 .win[0] = &s3c_fb_data_s5p_wins[0],
1866 .win[1] = &s3c_fb_data_s5p_wins[1],
1867 .win[2] = &s3c_fb_data_s5p_wins[2],
1868 .win[3] = &s3c_fb_data_s5p_wins[3],
1869 .win[4] = &s3c_fb_data_s5p_wins[4],
1870};
1871
1872static struct s3c_fb_driverdata s3c_fb_data_exynos5 = {
1873 .variant = {
1874 .nr_windows = 5,
1875 .vidtcon = FIMD_V8_VIDTCON0,
1876 .wincon = WINCON(0),
1877 .winmap = WINxMAP(0),
1878 .keycon = WKEYCON,
1879 .osd = VIDOSD_BASE,
1880 .osd_stride = 16,
1881 .buf_start = VIDW_BUF_START(0),
1882 .buf_size = VIDW_BUF_SIZE(0),
1883 .buf_end = VIDW_BUF_END(0),
1884
1885 .palette = {
1886 [0] = 0x2400,
1887 [1] = 0x2800,
1888 [2] = 0x2c00,
1889 [3] = 0x3000,
1890 [4] = 0x3400,
1891 },
1892 .has_shadowcon = 1,
1893 .has_blendcon = 1,
1894 .has_fixvclk = 1,
1895 },
1896 .win[0] = &s3c_fb_data_s5p_wins[0],
1897 .win[1] = &s3c_fb_data_s5p_wins[1],
1898 .win[2] = &s3c_fb_data_s5p_wins[2],
1899 .win[3] = &s3c_fb_data_s5p_wins[3],
1900 .win[4] = &s3c_fb_data_s5p_wins[4],
1901};
1902
1903/* S3C2443/S3C2416 style hardware */ 1748/* S3C2443/S3C2416 style hardware */
1904static struct s3c_fb_driverdata s3c_fb_data_s3c2443 = { 1749static struct s3c_fb_driverdata s3c_fb_data_s3c2443 = {
1905 .variant = { 1750 .variant = {
@@ -1942,15 +1787,6 @@ static const struct platform_device_id s3c_fb_driver_ids[] = {
1942 .name = "s3c-fb", 1787 .name = "s3c-fb",
1943 .driver_data = (unsigned long)&s3c_fb_data_64xx, 1788 .driver_data = (unsigned long)&s3c_fb_data_64xx,
1944 }, { 1789 }, {
1945 .name = "s5pv210-fb",
1946 .driver_data = (unsigned long)&s3c_fb_data_s5pv210,
1947 }, {
1948 .name = "exynos4-fb",
1949 .driver_data = (unsigned long)&s3c_fb_data_exynos4,
1950 }, {
1951 .name = "exynos5-fb",
1952 .driver_data = (unsigned long)&s3c_fb_data_exynos5,
1953 }, {
1954 .name = "s3c2443-fb", 1790 .name = "s3c2443-fb",
1955 .driver_data = (unsigned long)&s3c_fb_data_s3c2443, 1791 .driver_data = (unsigned long)&s3c_fb_data_s3c2443,
1956 }, 1792 },
diff --git a/drivers/video/fbdev/sis/init.h b/drivers/video/fbdev/sis/init.h
index 85d6738b6c64..400b0e5681b2 100644
--- a/drivers/video/fbdev/sis/init.h
+++ b/drivers/video/fbdev/sis/init.h
@@ -1461,81 +1461,5 @@ static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1640x480_1_H[] =
1461 0x00}} 1461 0x00}}
1462}; 1462};
1463 1463
1464bool SiSInitPtr(struct SiS_Private *SiS_Pr);
1465unsigned short SiS_GetModeID_LCD(int VGAEngine, unsigned int VBFlags, int HDisplay,
1466 int VDisplay, int Depth, bool FSTN,
1467 unsigned short CustomT, int LCDwith, int LCDheight,
1468 unsigned int VBFlags2);
1469unsigned short SiS_GetModeID_TV(int VGAEngine, unsigned int VBFlags, int HDisplay,
1470 int VDisplay, int Depth, unsigned int VBFlags2);
1471unsigned short SiS_GetModeID_VGA2(int VGAEngine, unsigned int VBFlags, int HDisplay,
1472 int VDisplay, int Depth, unsigned int VBFlags2);
1473
1474void SiS_DisplayOn(struct SiS_Private *SiS_Pr);
1475void SiS_DisplayOff(struct SiS_Private *SiS_Pr);
1476void SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr);
1477void SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable);
1478void SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable);
1479unsigned short SiS_GetModeFlag(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1480 unsigned short ModeIdIndex);
1481bool SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr);
1482
1483bool SiS_SearchModeID(struct SiS_Private *SiS_Pr, unsigned short *ModeNo,
1484 unsigned short *ModeIdIndex);
1485unsigned short SiS_GetModePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1486 unsigned short ModeIdIndex);
1487unsigned short SiS_GetRefCRTVCLK(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide);
1488unsigned short SiS_GetRefCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide);
1489unsigned short SiS_GetColorDepth(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1490 unsigned short ModeIdIndex);
1491unsigned short SiS_GetOffset(struct SiS_Private *SiS_Pr,unsigned short ModeNo,
1492 unsigned short ModeIdIndex, unsigned short RRTI);
1493#ifdef CONFIG_FB_SIS_300
1494void SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *idx1,
1495 unsigned short *idx2);
1496unsigned short SiS_GetFIFOThresholdB300(unsigned short idx1, unsigned short idx2);
1497unsigned short SiS_GetLatencyFactor630(struct SiS_Private *SiS_Pr, unsigned short index);
1498#endif
1499void SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex);
1500bool SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
1501void SiS_CalcCRRegisters(struct SiS_Private *SiS_Pr, int depth);
1502void SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1503 unsigned short ModeIdIndex);
1504void SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, int xres,
1505 int yres, struct fb_var_screeninfo *var, bool writeres);
1506
1507/* From init301.c: */
1508extern void SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1509 unsigned short ModeIdIndex, int chkcrt2mode);
1510extern void SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1511 unsigned short ModeIdIndex);
1512extern void SiS_SetYPbPr(struct SiS_Private *SiS_Pr);
1513extern void SiS_SetTVMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1514 unsigned short ModeIdIndex);
1515extern void SiS_UnLockCRT2(struct SiS_Private *SiS_Pr);
1516extern void SiS_DisableBridge(struct SiS_Private *);
1517extern bool SiS_SetCRT2Group(struct SiS_Private *, unsigned short);
1518extern unsigned short SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1519 unsigned short ModeIdIndex);
1520extern void SiS_WaitRetrace1(struct SiS_Private *SiS_Pr);
1521extern unsigned short SiS_GetResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1522 unsigned short ModeIdIndex);
1523extern unsigned short SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short tempax);
1524extern unsigned short SiS_GetVCLK2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1525 unsigned short ModeIdIndex, unsigned short RRTI);
1526extern bool SiS_IsVAMode(struct SiS_Private *);
1527extern bool SiS_IsDualEdge(struct SiS_Private *);
1528
1529#ifdef CONFIG_FB_SIS_300
1530extern unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg);
1531extern void sisfb_write_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg,
1532 unsigned int val);
1533#endif
1534#ifdef CONFIG_FB_SIS_315
1535extern void sisfb_write_nbridge_pci_byte(struct SiS_Private *SiS_Pr, int reg,
1536 unsigned char val);
1537extern unsigned int sisfb_read_mio_pci_word(struct SiS_Private *SiS_Pr, int reg);
1538#endif
1539
1540#endif 1464#endif
1541 1465
diff --git a/drivers/video/fbdev/sis/init301.c b/drivers/video/fbdev/sis/init301.c
index 02ee752d5000..27a2b72e50e8 100644
--- a/drivers/video/fbdev/sis/init301.c
+++ b/drivers/video/fbdev/sis/init301.c
@@ -82,6 +82,332 @@
82#define SiS_I2CDELAY 1000 82#define SiS_I2CDELAY 1000
83#define SiS_I2CDELAYSHORT 150 83#define SiS_I2CDELAYSHORT 150
84 84
85static const unsigned char SiS_YPbPrTable[3][64] = {
86 {
87 0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c,
88 0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a,
89 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b,
90 0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17,
91 0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02,
92 0x03,0x0a,0x65,0x9d /*0x8d*/,0x08,0x92,0x8f,0x40,
93 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x53 /*0x50*/,
94 0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00
95 },
96 {
97 0x33,0x06,0x06,0x09,0x0b,0x0c,0x0c,0x0c,
98 0x98,0x0a,0x01,0x0d,0x06,0x0d,0x04,0x0a,
99 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
100 0x0c,0x50,0xb2,0x9f,0x16,0x59,0x4f,0x13,
101 0xad,0x11,0xad,0x1d,0x40,0x8a,0x3d,0xb8,
102 0x51,0x5e,0x60,0x49,0x7d,0x92,0x0f,0x40,
103 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x4e,
104 0x43,0x41,0x11,0x00,0xfc,0xff,0x32,0x00
105 },
106 {
107#if 0 /* OK, but sticks to left edge */
108 0x13,0x1d,0xe8,0x09,0x09,0xed,0x0c,0x0c,
109 0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a,
110 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
111 0xed,0x50,0x70,0x9f,0x16,0x59,0x21 /*0x2b*/,0x13,
112 0x27,0x0b,0x27,0xfc,0x30,0x27,0x1c,0xb0,
113 0x4b,0x4b,0x65 /*0x6f*/,0x2f,0x63,0x92,0x0f,0x40,
114 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x27,
115 0x00,0x40,0x11,0x00,0xfc,0xff,0x32,0x00
116#endif
117#if 1 /* Perfect */
118 0x23,0x2d,0xe8,0x09,0x09,0xed,0x0c,0x0c,
119 0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a,
120 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
121 0xed,0x50,0x70,0x9f,0x16,0x59,0x60,0x13,
122 0x27,0x0b,0x27,0xfc,0x30,0x27,0x1c,0xb0,
123 0x4b,0x4b,0x6f,0x2f,0x63,0x92,0x0f,0x40,
124 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x73,
125 0x00,0x40,0x11,0x00,0xfc,0xff,0x32,0x00
126#endif
127 }
128};
129
130static const unsigned char SiS_TVPhase[] =
131{
132 0x21,0xED,0xBA,0x08, /* 0x00 SiS_NTSCPhase */
133 0x2A,0x05,0xE3,0x00, /* 0x01 SiS_PALPhase */
134 0x21,0xE4,0x2E,0x9B, /* 0x02 SiS_PALMPhase */
135 0x21,0xF4,0x3E,0xBA, /* 0x03 SiS_PALNPhase */
136 0x1E,0x8B,0xA2,0xA7,
137 0x1E,0x83,0x0A,0xE0, /* 0x05 SiS_SpecialPhaseM */
138 0x00,0x00,0x00,0x00,
139 0x00,0x00,0x00,0x00,
140 0x21,0xF0,0x7B,0xD6, /* 0x08 SiS_NTSCPhase2 */
141 0x2A,0x09,0x86,0xE9, /* 0x09 SiS_PALPhase2 */
142 0x21,0xE6,0xEF,0xA4, /* 0x0a SiS_PALMPhase2 */
143 0x21,0xF6,0x94,0x46, /* 0x0b SiS_PALNPhase2 */
144 0x1E,0x8B,0xA2,0xA7,
145 0x1E,0x83,0x0A,0xE0, /* 0x0d SiS_SpecialPhaseM */
146 0x00,0x00,0x00,0x00,
147 0x00,0x00,0x00,0x00,
148 0x1e,0x8c,0x5c,0x7a, /* 0x10 SiS_SpecialPhase */
149 0x25,0xd4,0xfd,0x5e /* 0x11 SiS_SpecialPhaseJ */
150};
151
152static const unsigned char SiS_HiTVGroup3_1[] = {
153 0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x13,
154 0xb1, 0x41, 0x62, 0x62, 0xff, 0xf4, 0x45, 0xa6,
155 0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20,
156 0xac, 0xda, 0x60, 0xfe, 0x6a, 0x9a, 0x06, 0x10,
157 0xd1, 0x04, 0x18, 0x0a, 0xff, 0x80, 0x00, 0x80,
158 0x3b, 0x77, 0x00, 0xef, 0xe0, 0x10, 0xb0, 0xe0,
159 0x10, 0x4f, 0x0f, 0x0f, 0x05, 0x0f, 0x08, 0x6e,
160 0x1a, 0x1f, 0x25, 0x2a, 0x4c, 0xaa, 0x01
161};
162
163static const unsigned char SiS_HiTVGroup3_2[] = {
164 0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x7a,
165 0x54, 0x41, 0xe7, 0xe7, 0xff, 0xf4, 0x45, 0xa6,
166 0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20,
167 0xac, 0x6a, 0x60, 0x2b, 0x52, 0xcd, 0x61, 0x10,
168 0x51, 0x04, 0x18, 0x0a, 0x1f, 0x80, 0x00, 0x80,
169 0xff, 0xa4, 0x04, 0x2b, 0x94, 0x21, 0x72, 0x94,
170 0x26, 0x05, 0x01, 0x0f, 0xed, 0x0f, 0x0a, 0x64,
171 0x18, 0x1d, 0x23, 0x28, 0x4c, 0xaa, 0x01
172};
173
174/* 301C / 302ELV extended Part2 TV registers (4 tap scaler) */
175
176static const unsigned char SiS_Part2CLVX_1[] = {
177 0x00,0x00,
178 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
179 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C,
180 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C,
181 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E
182};
183
184static const unsigned char SiS_Part2CLVX_2[] = {
185 0x00,0x00,
186 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
187 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C,
188 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C,
189 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E
190};
191
192static const unsigned char SiS_Part2CLVX_3[] = { /* NTSC, 525i, 525p */
193 0xE0,0x01,
194 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D,
195 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C,
196 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E,
197 0x7D,0x0C,0x19,0x7E,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02,
198 0x58,0x02,
199 0x07,0x14,0x07,0x7E,0x06,0x14,0x09,0x7D,0x05,0x14,0x0A,0x7D,0x04,0x13,0x0B,0x7E,
200 0x03,0x13,0x0C,0x7E,0x02,0x12,0x0D,0x7F,0x01,0x12,0x0E,0x7F,0x01,0x11,0x0F,0x7F,
201 0x00,0x10,0x10,0x00,0x7F,0x0F,0x11,0x01,0x7F,0x0E,0x12,0x01,0x7E,0x0D,0x12,0x03,
202 0x7E,0x0C,0x13,0x03,0x7E,0x0B,0x13,0x04,0x7E,0x0A,0x14,0x04,0x7D,0x09,0x14,0x06,
203 0x00,0x03,
204 0x09,0x0F,0x09,0x7F,0x08,0x0F,0x09,0x00,0x07,0x0F,0x0A,0x00,0x06,0x0F,0x0A,0x01,
205 0x06,0x0E,0x0B,0x01,0x05,0x0E,0x0B,0x02,0x04,0x0E,0x0C,0x02,0x04,0x0D,0x0C,0x03,
206 0x03,0x0D,0x0D,0x03,0x02,0x0C,0x0D,0x05,0x02,0x0C,0x0E,0x04,0x01,0x0B,0x0E,0x06,
207 0x01,0x0B,0x0E,0x06,0x00,0x0A,0x0F,0x07,0x00,0x0A,0x0F,0x07,0x00,0x09,0x0F,0x08,
208 0xFF,0xFF
209};
210
211static const unsigned char SiS_Part2CLVX_4[] = { /* PAL */
212 0x58,0x02,
213 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D,
214 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
215 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E,
216 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04,
217 0x00,0x03,
218 0x08,0x12,0x08,0x7E,0x07,0x12,0x09,0x7E,0x06,0x12,0x0A,0x7E,0x05,0x11,0x0B,0x7F,
219 0x04,0x11,0x0C,0x7F,0x03,0x11,0x0C,0x00,0x03,0x10,0x0D,0x00,0x02,0x0F,0x0E,0x01,
220 0x01,0x0F,0x0F,0x01,0x01,0x0E,0x0F,0x02,0x00,0x0D,0x10,0x03,0x7F,0x0C,0x11,0x04,
221 0x7F,0x0C,0x11,0x04,0x7F,0x0B,0x11,0x05,0x7E,0x0A,0x12,0x06,0x7E,0x09,0x12,0x07,
222 0x40,0x02,
223 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D,
224 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C,
225 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F,
226 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02,
227 0xFF,0xFF
228};
229
230static const unsigned char SiS_Part2CLVX_5[] = { /* 750p */
231 0x00,0x03,
232 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D,
233 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
234 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E,
235 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04,
236 0xFF,0xFF
237};
238
239static const unsigned char SiS_Part2CLVX_6[] = { /* 1080i */
240 0x00,0x04,
241 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D,
242 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C,
243 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F,
244 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02,
245 0xFF,0xFF,
246};
247
248#ifdef CONFIG_FB_SIS_315
249/* 661 et al LCD data structure (2.03.00) */
250static const unsigned char SiS_LCDStruct661[] = {
251 /* 1024x768 */
252/* type|CR37| HDE | VDE | HT | VT | hss | hse */
253 0x02,0xC0,0x00,0x04,0x00,0x03,0x40,0x05,0x26,0x03,0x10,0x00,0x88,
254 0x00,0x02,0x00,0x06,0x00,0x41,0x5A,0x64,0x00,0x00,0x00,0x00,0x04,
255 /* | vss | vse |clck| clock |CRT2DataP|CRT2DataP|idx */
256 /* VESA non-VESA noscale */
257 /* 1280x1024 */
258 0x03,0xC0,0x00,0x05,0x00,0x04,0x98,0x06,0x2A,0x04,0x30,0x00,0x70,
259 0x00,0x01,0x00,0x03,0x00,0x6C,0xF8,0x2F,0x00,0x00,0x00,0x00,0x08,
260 /* 1400x1050 */
261 0x09,0x20,0x78,0x05,0x1A,0x04,0x98,0x06,0x2A,0x04,0x18,0x00,0x38,
262 0x00,0x01,0x00,0x03,0x00,0x6C,0xF8,0x2F,0x00,0x00,0x00,0x00,0x09,
263 /* 1600x1200 */
264 0x0B,0xE0,0x40,0x06,0xB0,0x04,0x70,0x08,0xE2,0x04,0x40,0x00,0xC0,
265 0x00,0x01,0x00,0x03,0x00,0xA2,0x70,0x24,0x00,0x00,0x00,0x00,0x0A,
266 /* 1280x768 (_2) */
267 0x0A,0xE0,0x00,0x05,0x00,0x03,0x7C,0x06,0x26,0x03,0x30,0x00,0x70,
268 0x00,0x03,0x00,0x06,0x00,0x4D,0xC8,0x48,0x00,0x00,0x00,0x00,0x06,
269 /* 1280x720 */
270 0x0E,0xE0,0x00,0x05,0xD0,0x02,0x80,0x05,0x26,0x03,0x10,0x00,0x20,
271 0x00,0x01,0x00,0x06,0x00,0x45,0x9C,0x62,0x00,0x00,0x00,0x00,0x05,
272 /* 1280x800 (_2) */
273 0x0C,0xE0,0x00,0x05,0x20,0x03,0x10,0x06,0x2C,0x03,0x30,0x00,0x70,
274 0x00,0x04,0x00,0x03,0x00,0x49,0xCE,0x1E,0x00,0x00,0x00,0x00,0x09,
275 /* 1680x1050 */
276 0x0D,0xE0,0x90,0x06,0x1A,0x04,0x6C,0x07,0x2A,0x04,0x1A,0x00,0x4C,
277 0x00,0x03,0x00,0x06,0x00,0x79,0xBE,0x44,0x00,0x00,0x00,0x00,0x06,
278 /* 1280x800_3 */
279 0x0C,0xE0,0x00,0x05,0x20,0x03,0xAA,0x05,0x2E,0x03,0x30,0x00,0x50,
280 0x00,0x04,0x00,0x03,0x00,0x47,0xA9,0x10,0x00,0x00,0x00,0x00,0x07,
281 /* 800x600 */
282 0x01,0xC0,0x20,0x03,0x58,0x02,0x20,0x04,0x74,0x02,0x2A,0x00,0x80,
283 0x00,0x06,0x00,0x04,0x00,0x28,0x63,0x4B,0x00,0x00,0x00,0x00,0x00,
284 /* 1280x854 */
285 0x08,0xE0,0x00,0x05,0x56,0x03,0x80,0x06,0x5d,0x03,0x10,0x00,0x70,
286 0x00,0x01,0x00,0x03,0x00,0x54,0x75,0x13,0x00,0x00,0x00,0x00,0x08
287};
288#endif
289
290#ifdef CONFIG_FB_SIS_300
291static unsigned char SiS300_TrumpionData[14][80] = {
292 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
293 0x20,0x03,0x0B,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x10,0x00,0x00,0x04,0x23,
294 0x00,0x00,0x03,0x28,0x03,0x10,0x05,0x08,0x40,0x10,0x00,0x10,0x04,0x23,0x00,0x23,
295 0x03,0x11,0x60,0xBC,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x09,0x04,0x04,0x05,
296 0x04,0x0C,0x09,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5A,0x01,0xBE,0x01,0x00 },
297 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x27,0x00,0x80,0x02,
298 0x20,0x03,0x07,0x00,0x5E,0x01,0x0D,0x02,0x60,0x0C,0x30,0x11,0x00,0x00,0x04,0x23,
299 0x00,0x00,0x03,0x80,0x03,0x28,0x06,0x08,0x40,0x11,0x00,0x11,0x04,0x23,0x00,0x23,
300 0x03,0x11,0x60,0x90,0x01,0xFF,0x0F,0xF4,0x19,0x01,0x00,0x05,0x01,0x00,0x04,0x05,
301 0x04,0x0C,0x02,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEC,0x57,0x01,0xBE,0x01,0x00 },
302 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x8A,0x00,0xD8,0x02,
303 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
304 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
305 0x03,0x11,0x60,0xD9,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
306 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x59,0x01,0xBE,0x01,0x00 },
307 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x72,0x00,0xD8,0x02,
308 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
309 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
310 0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
311 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
312 { 0x02,0x0A,0x02,0x00,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
313 0x20,0x03,0x16,0x00,0xE0,0x01,0x0D,0x02,0x60,0x0C,0x30,0x98,0x00,0x00,0x04,0x23,
314 0x00,0x01,0x03,0x45,0x03,0x48,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x23,0x00,0x23,
315 0x03,0x11,0x60,0xF4,0x01,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x05,0x01,0x00,0x05,0x05,
316 0x04,0x0C,0x08,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 },
317 { 0x02,0x0A,0x02,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0xBF,0x00,0x20,0x03,
318 0x20,0x04,0x0D,0x00,0x58,0x02,0x71,0x02,0x80,0x0C,0x30,0x9A,0x00,0xFA,0x03,0x1D,
319 0x00,0x01,0x03,0x22,0x03,0x28,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x1D,0x00,0x1D,
320 0x03,0x11,0x60,0x39,0x03,0x40,0x05,0xF4,0x18,0x07,0x02,0x06,0x04,0x01,0x06,0x0B,
321 0x02,0x0A,0x20,0x19,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 },
322 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0xEF,0x00,0x00,0x04,
323 0x40,0x05,0x13,0x00,0x00,0x03,0x26,0x03,0x88,0x0C,0x30,0x90,0x00,0x00,0x04,0x23,
324 0x00,0x01,0x03,0x24,0x03,0x28,0x06,0x08,0x40,0x90,0x00,0x90,0x04,0x23,0x00,0x23,
325 0x03,0x11,0x60,0x40,0x05,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x08,0x01,0x00,0x08,0x01,
326 0x00,0x08,0x01,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 },
327 /* variant 2 */
328 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
329 0x20,0x03,0x15,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x18,0x00,0x00,0x04,0x23,
330 0x00,0x01,0x03,0x44,0x03,0x28,0x06,0x08,0x40,0x18,0x00,0x18,0x04,0x23,0x00,0x23,
331 0x03,0x11,0x60,0xA6,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x13,0x04,0x04,0x05,
332 0x04,0x0C,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
333 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
334 0x20,0x03,0x15,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x18,0x00,0x00,0x04,0x23,
335 0x00,0x01,0x03,0x44,0x03,0x28,0x06,0x08,0x40,0x18,0x00,0x18,0x04,0x23,0x00,0x23,
336 0x03,0x11,0x60,0xA6,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x13,0x04,0x04,0x05,
337 0x04,0x0C,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
338 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x8A,0x00,0xD8,0x02,
339 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
340 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
341 0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
342 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
343 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x72,0x00,0xD8,0x02,
344 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
345 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
346 0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
347 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
348 { 0x02,0x0A,0x02,0x00,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
349 0x20,0x03,0x16,0x00,0xE0,0x01,0x0D,0x02,0x60,0x0C,0x30,0x98,0x00,0x00,0x04,0x23,
350 0x00,0x01,0x03,0x45,0x03,0x48,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x23,0x00,0x23,
351 0x03,0x11,0x60,0xF4,0x01,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x05,0x01,0x00,0x05,0x05,
352 0x04,0x0C,0x08,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 },
353 { 0x02,0x0A,0x02,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0xBF,0x00,0x20,0x03,
354 0x20,0x04,0x0D,0x00,0x58,0x02,0x71,0x02,0x80,0x0C,0x30,0x9A,0x00,0xFA,0x03,0x1D,
355 0x00,0x01,0x03,0x22,0x03,0x28,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x1D,0x00,0x1D,
356 0x03,0x11,0x60,0x39,0x03,0x40,0x05,0xF4,0x18,0x07,0x02,0x06,0x04,0x01,0x06,0x0B,
357 0x02,0x0A,0x20,0x19,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 },
358 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0xEF,0x00,0x00,0x04,
359 0x40,0x05,0x13,0x00,0x00,0x03,0x26,0x03,0x88,0x0C,0x30,0x90,0x00,0x00,0x04,0x23,
360 0x00,0x01,0x03,0x24,0x03,0x28,0x06,0x08,0x40,0x90,0x00,0x90,0x04,0x23,0x00,0x23,
361 0x03,0x11,0x60,0x40,0x05,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x08,0x01,0x00,0x08,0x01,
362 0x00,0x08,0x01,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 }
363};
364#endif
365
366#ifdef CONFIG_FB_SIS_315
367static void SiS_Chrontel701xOn(struct SiS_Private *SiS_Pr);
368static void SiS_Chrontel701xOff(struct SiS_Private *SiS_Pr);
369static void SiS_ChrontelInitTVVSync(struct SiS_Private *SiS_Pr);
370static void SiS_ChrontelDoSomething1(struct SiS_Private *SiS_Pr);
371#endif /* 315 */
372
373#ifdef CONFIG_FB_SIS_300
374static bool SiS_SetTrumpionBlock(struct SiS_Private *SiS_Pr, unsigned char *dataptr);
375#endif
376
377static unsigned short SiS_InitDDCRegs(struct SiS_Private *SiS_Pr, unsigned int VBFlags,
378 int VGAEngine, unsigned short adaptnum, unsigned short DDCdatatype,
379 bool checkcr32, unsigned int VBFlags2);
380static unsigned short SiS_ProbeDDC(struct SiS_Private *SiS_Pr);
381static unsigned short SiS_ReadDDC(struct SiS_Private *SiS_Pr, unsigned short DDCdatatype,
382 unsigned char *buffer);
383static void SiS_SetSwitchDDC2(struct SiS_Private *SiS_Pr);
384static unsigned short SiS_SetStart(struct SiS_Private *SiS_Pr);
385static unsigned short SiS_SetStop(struct SiS_Private *SiS_Pr);
386static unsigned short SiS_SetSCLKLow(struct SiS_Private *SiS_Pr);
387static unsigned short SiS_SetSCLKHigh(struct SiS_Private *SiS_Pr);
388static unsigned short SiS_ReadDDC2Data(struct SiS_Private *SiS_Pr);
389static unsigned short SiS_WriteDDC2Data(struct SiS_Private *SiS_Pr, unsigned short tempax);
390static unsigned short SiS_CheckACK(struct SiS_Private *SiS_Pr);
391static unsigned short SiS_WriteDABDDC(struct SiS_Private *SiS_Pr);
392static unsigned short SiS_PrepareReadDDC(struct SiS_Private *SiS_Pr);
393static unsigned short SiS_PrepareDDC(struct SiS_Private *SiS_Pr);
394static void SiS_SendACK(struct SiS_Private *SiS_Pr, unsigned short yesno);
395static unsigned short SiS_DoProbeDDC(struct SiS_Private *SiS_Pr);
396
397#ifdef CONFIG_FB_SIS_300
398static void SiS_OEM300Setting(struct SiS_Private *SiS_Pr,
399 unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefTabindex);
400static void SetOEMLCDData2(struct SiS_Private *SiS_Pr,
401 unsigned short ModeNo, unsigned short ModeIdIndex,unsigned short RefTableIndex);
402#endif
403#ifdef CONFIG_FB_SIS_315
404static void SiS_OEM310Setting(struct SiS_Private *SiS_Pr,
405 unsigned short ModeNo,unsigned short ModeIdIndex, unsigned short RRTI);
406static void SiS_OEM661Setting(struct SiS_Private *SiS_Pr,
407 unsigned short ModeNo,unsigned short ModeIdIndex, unsigned short RRTI);
408static void SiS_FinalizeLCD(struct SiS_Private *, unsigned short, unsigned short);
409#endif
410
85static unsigned short SiS_GetBIOSLCDResInfo(struct SiS_Private *SiS_Pr); 411static unsigned short SiS_GetBIOSLCDResInfo(struct SiS_Private *SiS_Pr);
86static void SiS_SetCH70xx(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val); 412static void SiS_SetCH70xx(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val);
87 413
diff --git a/drivers/video/fbdev/sis/init301.h b/drivers/video/fbdev/sis/init301.h
index 2112d6d7feda..6e5cf14c4ce4 100644
--- a/drivers/video/fbdev/sis/init301.h
+++ b/drivers/video/fbdev/sis/init301.h
@@ -66,287 +66,6 @@
66#include "sis.h" 66#include "sis.h"
67#include <video/sisfb.h> 67#include <video/sisfb.h>
68 68
69static const unsigned char SiS_YPbPrTable[3][64] = {
70 {
71 0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c,
72 0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a,
73 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b,
74 0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17,
75 0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02,
76 0x03,0x0a,0x65,0x9d /*0x8d*/,0x08,0x92,0x8f,0x40,
77 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x53 /*0x50*/,
78 0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00
79 },
80 {
81 0x33,0x06,0x06,0x09,0x0b,0x0c,0x0c,0x0c,
82 0x98,0x0a,0x01,0x0d,0x06,0x0d,0x04,0x0a,
83 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
84 0x0c,0x50,0xb2,0x9f,0x16,0x59,0x4f,0x13,
85 0xad,0x11,0xad,0x1d,0x40,0x8a,0x3d,0xb8,
86 0x51,0x5e,0x60,0x49,0x7d,0x92,0x0f,0x40,
87 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x4e,
88 0x43,0x41,0x11,0x00,0xfc,0xff,0x32,0x00
89 },
90 {
91#if 0 /* OK, but sticks to left edge */
92 0x13,0x1d,0xe8,0x09,0x09,0xed,0x0c,0x0c,
93 0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a,
94 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
95 0xed,0x50,0x70,0x9f,0x16,0x59,0x21 /*0x2b*/,0x13,
96 0x27,0x0b,0x27,0xfc,0x30,0x27,0x1c,0xb0,
97 0x4b,0x4b,0x65 /*0x6f*/,0x2f,0x63,0x92,0x0f,0x40,
98 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x27,
99 0x00,0x40,0x11,0x00,0xfc,0xff,0x32,0x00
100#endif
101#if 1 /* Perfect */
102 0x23,0x2d,0xe8,0x09,0x09,0xed,0x0c,0x0c,
103 0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a,
104 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
105 0xed,0x50,0x70,0x9f,0x16,0x59,0x60,0x13,
106 0x27,0x0b,0x27,0xfc,0x30,0x27,0x1c,0xb0,
107 0x4b,0x4b,0x6f,0x2f,0x63,0x92,0x0f,0x40,
108 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x73,
109 0x00,0x40,0x11,0x00,0xfc,0xff,0x32,0x00
110#endif
111 }
112};
113
114static const unsigned char SiS_TVPhase[] =
115{
116 0x21,0xED,0xBA,0x08, /* 0x00 SiS_NTSCPhase */
117 0x2A,0x05,0xE3,0x00, /* 0x01 SiS_PALPhase */
118 0x21,0xE4,0x2E,0x9B, /* 0x02 SiS_PALMPhase */
119 0x21,0xF4,0x3E,0xBA, /* 0x03 SiS_PALNPhase */
120 0x1E,0x8B,0xA2,0xA7,
121 0x1E,0x83,0x0A,0xE0, /* 0x05 SiS_SpecialPhaseM */
122 0x00,0x00,0x00,0x00,
123 0x00,0x00,0x00,0x00,
124 0x21,0xF0,0x7B,0xD6, /* 0x08 SiS_NTSCPhase2 */
125 0x2A,0x09,0x86,0xE9, /* 0x09 SiS_PALPhase2 */
126 0x21,0xE6,0xEF,0xA4, /* 0x0a SiS_PALMPhase2 */
127 0x21,0xF6,0x94,0x46, /* 0x0b SiS_PALNPhase2 */
128 0x1E,0x8B,0xA2,0xA7,
129 0x1E,0x83,0x0A,0xE0, /* 0x0d SiS_SpecialPhaseM */
130 0x00,0x00,0x00,0x00,
131 0x00,0x00,0x00,0x00,
132 0x1e,0x8c,0x5c,0x7a, /* 0x10 SiS_SpecialPhase */
133 0x25,0xd4,0xfd,0x5e /* 0x11 SiS_SpecialPhaseJ */
134};
135
136static const unsigned char SiS_HiTVGroup3_1[] = {
137 0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x13,
138 0xb1, 0x41, 0x62, 0x62, 0xff, 0xf4, 0x45, 0xa6,
139 0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20,
140 0xac, 0xda, 0x60, 0xfe, 0x6a, 0x9a, 0x06, 0x10,
141 0xd1, 0x04, 0x18, 0x0a, 0xff, 0x80, 0x00, 0x80,
142 0x3b, 0x77, 0x00, 0xef, 0xe0, 0x10, 0xb0, 0xe0,
143 0x10, 0x4f, 0x0f, 0x0f, 0x05, 0x0f, 0x08, 0x6e,
144 0x1a, 0x1f, 0x25, 0x2a, 0x4c, 0xaa, 0x01
145};
146
147static const unsigned char SiS_HiTVGroup3_2[] = {
148 0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x7a,
149 0x54, 0x41, 0xe7, 0xe7, 0xff, 0xf4, 0x45, 0xa6,
150 0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20,
151 0xac, 0x6a, 0x60, 0x2b, 0x52, 0xcd, 0x61, 0x10,
152 0x51, 0x04, 0x18, 0x0a, 0x1f, 0x80, 0x00, 0x80,
153 0xff, 0xa4, 0x04, 0x2b, 0x94, 0x21, 0x72, 0x94,
154 0x26, 0x05, 0x01, 0x0f, 0xed, 0x0f, 0x0a, 0x64,
155 0x18, 0x1d, 0x23, 0x28, 0x4c, 0xaa, 0x01
156};
157
158/* 301C / 302ELV extended Part2 TV registers (4 tap scaler) */
159
160static const unsigned char SiS_Part2CLVX_1[] = {
161 0x00,0x00,
162 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
163 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C,
164 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C,
165 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E
166};
167
168static const unsigned char SiS_Part2CLVX_2[] = {
169 0x00,0x00,
170 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
171 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C,
172 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C,
173 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E
174};
175
176static const unsigned char SiS_Part2CLVX_3[] = { /* NTSC, 525i, 525p */
177 0xE0,0x01,
178 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D,
179 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C,
180 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E,
181 0x7D,0x0C,0x19,0x7E,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02,
182 0x58,0x02,
183 0x07,0x14,0x07,0x7E,0x06,0x14,0x09,0x7D,0x05,0x14,0x0A,0x7D,0x04,0x13,0x0B,0x7E,
184 0x03,0x13,0x0C,0x7E,0x02,0x12,0x0D,0x7F,0x01,0x12,0x0E,0x7F,0x01,0x11,0x0F,0x7F,
185 0x00,0x10,0x10,0x00,0x7F,0x0F,0x11,0x01,0x7F,0x0E,0x12,0x01,0x7E,0x0D,0x12,0x03,
186 0x7E,0x0C,0x13,0x03,0x7E,0x0B,0x13,0x04,0x7E,0x0A,0x14,0x04,0x7D,0x09,0x14,0x06,
187 0x00,0x03,
188 0x09,0x0F,0x09,0x7F,0x08,0x0F,0x09,0x00,0x07,0x0F,0x0A,0x00,0x06,0x0F,0x0A,0x01,
189 0x06,0x0E,0x0B,0x01,0x05,0x0E,0x0B,0x02,0x04,0x0E,0x0C,0x02,0x04,0x0D,0x0C,0x03,
190 0x03,0x0D,0x0D,0x03,0x02,0x0C,0x0D,0x05,0x02,0x0C,0x0E,0x04,0x01,0x0B,0x0E,0x06,
191 0x01,0x0B,0x0E,0x06,0x00,0x0A,0x0F,0x07,0x00,0x0A,0x0F,0x07,0x00,0x09,0x0F,0x08,
192 0xFF,0xFF
193};
194
195static const unsigned char SiS_Part2CLVX_4[] = { /* PAL */
196 0x58,0x02,
197 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D,
198 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
199 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E,
200 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04,
201 0x00,0x03,
202 0x08,0x12,0x08,0x7E,0x07,0x12,0x09,0x7E,0x06,0x12,0x0A,0x7E,0x05,0x11,0x0B,0x7F,
203 0x04,0x11,0x0C,0x7F,0x03,0x11,0x0C,0x00,0x03,0x10,0x0D,0x00,0x02,0x0F,0x0E,0x01,
204 0x01,0x0F,0x0F,0x01,0x01,0x0E,0x0F,0x02,0x00,0x0D,0x10,0x03,0x7F,0x0C,0x11,0x04,
205 0x7F,0x0C,0x11,0x04,0x7F,0x0B,0x11,0x05,0x7E,0x0A,0x12,0x06,0x7E,0x09,0x12,0x07,
206 0x40,0x02,
207 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D,
208 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C,
209 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F,
210 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02,
211 0xFF,0xFF
212};
213
214static const unsigned char SiS_Part2CLVX_5[] = { /* 750p */
215 0x00,0x03,
216 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D,
217 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D,
218 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E,
219 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04,
220 0xFF,0xFF
221};
222
223static const unsigned char SiS_Part2CLVX_6[] = { /* 1080i */
224 0x00,0x04,
225 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D,
226 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C,
227 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F,
228 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02,
229 0xFF,0xFF,
230};
231
232#ifdef CONFIG_FB_SIS_315
233/* 661 et al LCD data structure (2.03.00) */
234static const unsigned char SiS_LCDStruct661[] = {
235 /* 1024x768 */
236/* type|CR37| HDE | VDE | HT | VT | hss | hse */
237 0x02,0xC0,0x00,0x04,0x00,0x03,0x40,0x05,0x26,0x03,0x10,0x00,0x88,
238 0x00,0x02,0x00,0x06,0x00,0x41,0x5A,0x64,0x00,0x00,0x00,0x00,0x04,
239 /* | vss | vse |clck| clock |CRT2DataP|CRT2DataP|idx */
240 /* VESA non-VESA noscale */
241 /* 1280x1024 */
242 0x03,0xC0,0x00,0x05,0x00,0x04,0x98,0x06,0x2A,0x04,0x30,0x00,0x70,
243 0x00,0x01,0x00,0x03,0x00,0x6C,0xF8,0x2F,0x00,0x00,0x00,0x00,0x08,
244 /* 1400x1050 */
245 0x09,0x20,0x78,0x05,0x1A,0x04,0x98,0x06,0x2A,0x04,0x18,0x00,0x38,
246 0x00,0x01,0x00,0x03,0x00,0x6C,0xF8,0x2F,0x00,0x00,0x00,0x00,0x09,
247 /* 1600x1200 */
248 0x0B,0xE0,0x40,0x06,0xB0,0x04,0x70,0x08,0xE2,0x04,0x40,0x00,0xC0,
249 0x00,0x01,0x00,0x03,0x00,0xA2,0x70,0x24,0x00,0x00,0x00,0x00,0x0A,
250 /* 1280x768 (_2) */
251 0x0A,0xE0,0x00,0x05,0x00,0x03,0x7C,0x06,0x26,0x03,0x30,0x00,0x70,
252 0x00,0x03,0x00,0x06,0x00,0x4D,0xC8,0x48,0x00,0x00,0x00,0x00,0x06,
253 /* 1280x720 */
254 0x0E,0xE0,0x00,0x05,0xD0,0x02,0x80,0x05,0x26,0x03,0x10,0x00,0x20,
255 0x00,0x01,0x00,0x06,0x00,0x45,0x9C,0x62,0x00,0x00,0x00,0x00,0x05,
256 /* 1280x800 (_2) */
257 0x0C,0xE0,0x00,0x05,0x20,0x03,0x10,0x06,0x2C,0x03,0x30,0x00,0x70,
258 0x00,0x04,0x00,0x03,0x00,0x49,0xCE,0x1E,0x00,0x00,0x00,0x00,0x09,
259 /* 1680x1050 */
260 0x0D,0xE0,0x90,0x06,0x1A,0x04,0x6C,0x07,0x2A,0x04,0x1A,0x00,0x4C,
261 0x00,0x03,0x00,0x06,0x00,0x79,0xBE,0x44,0x00,0x00,0x00,0x00,0x06,
262 /* 1280x800_3 */
263 0x0C,0xE0,0x00,0x05,0x20,0x03,0xAA,0x05,0x2E,0x03,0x30,0x00,0x50,
264 0x00,0x04,0x00,0x03,0x00,0x47,0xA9,0x10,0x00,0x00,0x00,0x00,0x07,
265 /* 800x600 */
266 0x01,0xC0,0x20,0x03,0x58,0x02,0x20,0x04,0x74,0x02,0x2A,0x00,0x80,
267 0x00,0x06,0x00,0x04,0x00,0x28,0x63,0x4B,0x00,0x00,0x00,0x00,0x00,
268 /* 1280x854 */
269 0x08,0xE0,0x00,0x05,0x56,0x03,0x80,0x06,0x5d,0x03,0x10,0x00,0x70,
270 0x00,0x01,0x00,0x03,0x00,0x54,0x75,0x13,0x00,0x00,0x00,0x00,0x08
271};
272#endif
273
274#ifdef CONFIG_FB_SIS_300
275static unsigned char SiS300_TrumpionData[14][80] = {
276 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
277 0x20,0x03,0x0B,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x10,0x00,0x00,0x04,0x23,
278 0x00,0x00,0x03,0x28,0x03,0x10,0x05,0x08,0x40,0x10,0x00,0x10,0x04,0x23,0x00,0x23,
279 0x03,0x11,0x60,0xBC,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x09,0x04,0x04,0x05,
280 0x04,0x0C,0x09,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5A,0x01,0xBE,0x01,0x00 },
281 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x27,0x00,0x80,0x02,
282 0x20,0x03,0x07,0x00,0x5E,0x01,0x0D,0x02,0x60,0x0C,0x30,0x11,0x00,0x00,0x04,0x23,
283 0x00,0x00,0x03,0x80,0x03,0x28,0x06,0x08,0x40,0x11,0x00,0x11,0x04,0x23,0x00,0x23,
284 0x03,0x11,0x60,0x90,0x01,0xFF,0x0F,0xF4,0x19,0x01,0x00,0x05,0x01,0x00,0x04,0x05,
285 0x04,0x0C,0x02,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEC,0x57,0x01,0xBE,0x01,0x00 },
286 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x8A,0x00,0xD8,0x02,
287 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
288 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
289 0x03,0x11,0x60,0xD9,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
290 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x59,0x01,0xBE,0x01,0x00 },
291 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x72,0x00,0xD8,0x02,
292 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
293 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
294 0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
295 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
296 { 0x02,0x0A,0x02,0x00,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
297 0x20,0x03,0x16,0x00,0xE0,0x01,0x0D,0x02,0x60,0x0C,0x30,0x98,0x00,0x00,0x04,0x23,
298 0x00,0x01,0x03,0x45,0x03,0x48,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x23,0x00,0x23,
299 0x03,0x11,0x60,0xF4,0x01,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x05,0x01,0x00,0x05,0x05,
300 0x04,0x0C,0x08,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 },
301 { 0x02,0x0A,0x02,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0xBF,0x00,0x20,0x03,
302 0x20,0x04,0x0D,0x00,0x58,0x02,0x71,0x02,0x80,0x0C,0x30,0x9A,0x00,0xFA,0x03,0x1D,
303 0x00,0x01,0x03,0x22,0x03,0x28,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x1D,0x00,0x1D,
304 0x03,0x11,0x60,0x39,0x03,0x40,0x05,0xF4,0x18,0x07,0x02,0x06,0x04,0x01,0x06,0x0B,
305 0x02,0x0A,0x20,0x19,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 },
306 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0xEF,0x00,0x00,0x04,
307 0x40,0x05,0x13,0x00,0x00,0x03,0x26,0x03,0x88,0x0C,0x30,0x90,0x00,0x00,0x04,0x23,
308 0x00,0x01,0x03,0x24,0x03,0x28,0x06,0x08,0x40,0x90,0x00,0x90,0x04,0x23,0x00,0x23,
309 0x03,0x11,0x60,0x40,0x05,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x08,0x01,0x00,0x08,0x01,
310 0x00,0x08,0x01,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 },
311 /* variant 2 */
312 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
313 0x20,0x03,0x15,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x18,0x00,0x00,0x04,0x23,
314 0x00,0x01,0x03,0x44,0x03,0x28,0x06,0x08,0x40,0x18,0x00,0x18,0x04,0x23,0x00,0x23,
315 0x03,0x11,0x60,0xA6,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x13,0x04,0x04,0x05,
316 0x04,0x0C,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
317 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
318 0x20,0x03,0x15,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x18,0x00,0x00,0x04,0x23,
319 0x00,0x01,0x03,0x44,0x03,0x28,0x06,0x08,0x40,0x18,0x00,0x18,0x04,0x23,0x00,0x23,
320 0x03,0x11,0x60,0xA6,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x13,0x04,0x04,0x05,
321 0x04,0x0C,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
322 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x8A,0x00,0xD8,0x02,
323 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
324 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
325 0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
326 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
327 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x72,0x00,0xD8,0x02,
328 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
329 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
330 0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
331 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
332 { 0x02,0x0A,0x02,0x00,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
333 0x20,0x03,0x16,0x00,0xE0,0x01,0x0D,0x02,0x60,0x0C,0x30,0x98,0x00,0x00,0x04,0x23,
334 0x00,0x01,0x03,0x45,0x03,0x48,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x23,0x00,0x23,
335 0x03,0x11,0x60,0xF4,0x01,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x05,0x01,0x00,0x05,0x05,
336 0x04,0x0C,0x08,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 },
337 { 0x02,0x0A,0x02,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0xBF,0x00,0x20,0x03,
338 0x20,0x04,0x0D,0x00,0x58,0x02,0x71,0x02,0x80,0x0C,0x30,0x9A,0x00,0xFA,0x03,0x1D,
339 0x00,0x01,0x03,0x22,0x03,0x28,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x1D,0x00,0x1D,
340 0x03,0x11,0x60,0x39,0x03,0x40,0x05,0xF4,0x18,0x07,0x02,0x06,0x04,0x01,0x06,0x0B,
341 0x02,0x0A,0x20,0x19,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 },
342 { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0xEF,0x00,0x00,0x04,
343 0x40,0x05,0x13,0x00,0x00,0x03,0x26,0x03,0x88,0x0C,0x30,0x90,0x00,0x00,0x04,0x23,
344 0x00,0x01,0x03,0x24,0x03,0x28,0x06,0x08,0x40,0x90,0x00,0x90,0x04,0x23,0x00,0x23,
345 0x03,0x11,0x60,0x40,0x05,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x08,0x01,0x00,0x08,0x01,
346 0x00,0x08,0x01,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 }
347};
348#endif
349
350void SiS_UnLockCRT2(struct SiS_Private *SiS_Pr); 69void SiS_UnLockCRT2(struct SiS_Private *SiS_Pr);
351void SiS_EnableCRT2(struct SiS_Private *SiS_Pr); 70void SiS_EnableCRT2(struct SiS_Private *SiS_Pr);
352unsigned short SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex); 71unsigned short SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex);
@@ -375,16 +94,11 @@ unsigned short SiS_GetCH701x(struct SiS_Private *SiS_Pr, unsigned short tempax);
375void SiS_SetCH70xxANDOR(struct SiS_Private *SiS_Pr, unsigned short reg, 94void SiS_SetCH70xxANDOR(struct SiS_Private *SiS_Pr, unsigned short reg,
376 unsigned char orval,unsigned short andval); 95 unsigned char orval,unsigned short andval);
377#ifdef CONFIG_FB_SIS_315 96#ifdef CONFIG_FB_SIS_315
378static void SiS_Chrontel701xOn(struct SiS_Private *SiS_Pr);
379static void SiS_Chrontel701xOff(struct SiS_Private *SiS_Pr);
380static void SiS_ChrontelInitTVVSync(struct SiS_Private *SiS_Pr);
381static void SiS_ChrontelDoSomething1(struct SiS_Private *SiS_Pr);
382void SiS_Chrontel701xBLOn(struct SiS_Private *SiS_Pr); 97void SiS_Chrontel701xBLOn(struct SiS_Private *SiS_Pr);
383void SiS_Chrontel701xBLOff(struct SiS_Private *SiS_Pr); 98void SiS_Chrontel701xBLOff(struct SiS_Private *SiS_Pr);
384#endif /* 315 */ 99#endif /* 315 */
385 100
386#ifdef CONFIG_FB_SIS_300 101#ifdef CONFIG_FB_SIS_300
387static bool SiS_SetTrumpionBlock(struct SiS_Private *SiS_Pr, unsigned char *dataptr);
388void SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo); 102void SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo);
389#endif 103#endif
390 104
@@ -394,40 +108,6 @@ unsigned short SiS_HandleDDC(struct SiS_Private *SiS_Pr, unsigned int VBFlags, i
394 unsigned short adaptnum, unsigned short DDCdatatype, 108 unsigned short adaptnum, unsigned short DDCdatatype,
395 unsigned char *buffer, unsigned int VBFlags2); 109 unsigned char *buffer, unsigned int VBFlags2);
396 110
397static unsigned short SiS_InitDDCRegs(struct SiS_Private *SiS_Pr, unsigned int VBFlags,
398 int VGAEngine, unsigned short adaptnum, unsigned short DDCdatatype,
399 bool checkcr32, unsigned int VBFlags2);
400static unsigned short SiS_ProbeDDC(struct SiS_Private *SiS_Pr);
401static unsigned short SiS_ReadDDC(struct SiS_Private *SiS_Pr, unsigned short DDCdatatype,
402 unsigned char *buffer);
403static void SiS_SetSwitchDDC2(struct SiS_Private *SiS_Pr);
404static unsigned short SiS_SetStart(struct SiS_Private *SiS_Pr);
405static unsigned short SiS_SetStop(struct SiS_Private *SiS_Pr);
406static unsigned short SiS_SetSCLKLow(struct SiS_Private *SiS_Pr);
407static unsigned short SiS_SetSCLKHigh(struct SiS_Private *SiS_Pr);
408static unsigned short SiS_ReadDDC2Data(struct SiS_Private *SiS_Pr);
409static unsigned short SiS_WriteDDC2Data(struct SiS_Private *SiS_Pr, unsigned short tempax);
410static unsigned short SiS_CheckACK(struct SiS_Private *SiS_Pr);
411static unsigned short SiS_WriteDABDDC(struct SiS_Private *SiS_Pr);
412static unsigned short SiS_PrepareReadDDC(struct SiS_Private *SiS_Pr);
413static unsigned short SiS_PrepareDDC(struct SiS_Private *SiS_Pr);
414static void SiS_SendACK(struct SiS_Private *SiS_Pr, unsigned short yesno);
415static unsigned short SiS_DoProbeDDC(struct SiS_Private *SiS_Pr);
416
417#ifdef CONFIG_FB_SIS_300
418static void SiS_OEM300Setting(struct SiS_Private *SiS_Pr,
419 unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefTabindex);
420static void SetOEMLCDData2(struct SiS_Private *SiS_Pr,
421 unsigned short ModeNo, unsigned short ModeIdIndex,unsigned short RefTableIndex);
422#endif
423#ifdef CONFIG_FB_SIS_315
424static void SiS_OEM310Setting(struct SiS_Private *SiS_Pr,
425 unsigned short ModeNo,unsigned short ModeIdIndex, unsigned short RRTI);
426static void SiS_OEM661Setting(struct SiS_Private *SiS_Pr,
427 unsigned short ModeNo,unsigned short ModeIdIndex, unsigned short RRTI);
428static void SiS_FinalizeLCD(struct SiS_Private *, unsigned short, unsigned short);
429#endif
430
431extern void SiS_DisplayOff(struct SiS_Private *SiS_Pr); 111extern void SiS_DisplayOff(struct SiS_Private *SiS_Pr);
432extern void SiS_DisplayOn(struct SiS_Private *SiS_Pr); 112extern void SiS_DisplayOn(struct SiS_Private *SiS_Pr);
433extern bool SiS_SearchModeID(struct SiS_Private *, unsigned short *, unsigned short *); 113extern bool SiS_SearchModeID(struct SiS_Private *, unsigned short *, unsigned short *);
diff --git a/drivers/video/fbdev/sis/sis.h b/drivers/video/fbdev/sis/sis.h
index ea1d1c9640bf..d04982b0cd6f 100644
--- a/drivers/video/fbdev/sis/sis.h
+++ b/drivers/video/fbdev/sis/sis.h
@@ -28,6 +28,7 @@
28 28
29#include "vgatypes.h" 29#include "vgatypes.h"
30#include "vstruct.h" 30#include "vstruct.h"
31#include "init.h"
31 32
32#define VER_MAJOR 1 33#define VER_MAJOR 1
33#define VER_MINOR 8 34#define VER_MINOR 8
@@ -321,6 +322,85 @@ u8 SiS_GetRegByte(SISIOADDRESS);
321u16 SiS_GetRegShort(SISIOADDRESS); 322u16 SiS_GetRegShort(SISIOADDRESS);
322u32 SiS_GetRegLong(SISIOADDRESS); 323u32 SiS_GetRegLong(SISIOADDRESS);
323 324
325/* Chrontel TV, DDC and DPMS functions */
326/* from init.c */
327bool SiSInitPtr(struct SiS_Private *SiS_Pr);
328unsigned short SiS_GetModeID_LCD(int VGAEngine, unsigned int VBFlags, int HDisplay,
329 int VDisplay, int Depth, bool FSTN,
330 unsigned short CustomT, int LCDwith, int LCDheight,
331 unsigned int VBFlags2);
332unsigned short SiS_GetModeID_TV(int VGAEngine, unsigned int VBFlags, int HDisplay,
333 int VDisplay, int Depth, unsigned int VBFlags2);
334unsigned short SiS_GetModeID_VGA2(int VGAEngine, unsigned int VBFlags, int HDisplay,
335 int VDisplay, int Depth, unsigned int VBFlags2);
336
337void SiS_DisplayOn(struct SiS_Private *SiS_Pr);
338void SiS_DisplayOff(struct SiS_Private *SiS_Pr);
339void SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr);
340void SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable);
341void SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable);
342unsigned short SiS_GetModeFlag(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
343 unsigned short ModeIdIndex);
344bool SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr);
345
346bool SiS_SearchModeID(struct SiS_Private *SiS_Pr, unsigned short *ModeNo,
347 unsigned short *ModeIdIndex);
348unsigned short SiS_GetModePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
349 unsigned short ModeIdIndex);
350unsigned short SiS_GetRefCRTVCLK(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide);
351unsigned short SiS_GetRefCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide);
352unsigned short SiS_GetColorDepth(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
353 unsigned short ModeIdIndex);
354unsigned short SiS_GetOffset(struct SiS_Private *SiS_Pr,unsigned short ModeNo,
355 unsigned short ModeIdIndex, unsigned short RRTI);
356#ifdef CONFIG_FB_SIS_300
357void SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *idx1,
358 unsigned short *idx2);
359unsigned short SiS_GetFIFOThresholdB300(unsigned short idx1, unsigned short idx2);
360unsigned short SiS_GetLatencyFactor630(struct SiS_Private *SiS_Pr, unsigned short index);
361#endif
362void SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex);
363bool SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
364void SiS_CalcCRRegisters(struct SiS_Private *SiS_Pr, int depth);
365void SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
366 unsigned short ModeIdIndex);
367void SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, int xres,
368 int yres, struct fb_var_screeninfo *var, bool writeres);
369
370/* From init301.c: */
371extern void SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
372 unsigned short ModeIdIndex, int chkcrt2mode);
373extern void SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
374 unsigned short ModeIdIndex);
375extern void SiS_SetYPbPr(struct SiS_Private *SiS_Pr);
376extern void SiS_SetTVMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
377 unsigned short ModeIdIndex);
378extern void SiS_UnLockCRT2(struct SiS_Private *SiS_Pr);
379extern void SiS_DisableBridge(struct SiS_Private *);
380extern bool SiS_SetCRT2Group(struct SiS_Private *, unsigned short);
381extern unsigned short SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
382 unsigned short ModeIdIndex);
383extern void SiS_WaitRetrace1(struct SiS_Private *SiS_Pr);
384extern unsigned short SiS_GetResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
385 unsigned short ModeIdIndex);
386extern unsigned short SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short tempax);
387extern unsigned short SiS_GetVCLK2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
388 unsigned short ModeIdIndex, unsigned short RRTI);
389extern bool SiS_IsVAMode(struct SiS_Private *);
390extern bool SiS_IsDualEdge(struct SiS_Private *);
391
392#ifdef CONFIG_FB_SIS_300
393extern unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg);
394extern void sisfb_write_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg,
395 unsigned int val);
396#endif
397#ifdef CONFIG_FB_SIS_315
398extern void sisfb_write_nbridge_pci_byte(struct SiS_Private *SiS_Pr, int reg,
399 unsigned char val);
400extern unsigned int sisfb_read_mio_pci_word(struct SiS_Private *SiS_Pr, int reg);
401#endif
402
403
324/* MMIO access macros */ 404/* MMIO access macros */
325#define MMIO_IN8(base, offset) readb((base+offset)) 405#define MMIO_IN8(base, offset) readb((base+offset))
326#define MMIO_IN16(base, offset) readw((base+offset)) 406#define MMIO_IN16(base, offset) readw((base+offset))
@@ -583,4 +663,55 @@ struct sis_video_info {
583 struct sis_video_info *next; 663 struct sis_video_info *next;
584}; 664};
585 665
666/* from sis_accel.c */
667extern void fbcon_sis_fillrect(struct fb_info *info,
668 const struct fb_fillrect *rect);
669extern void fbcon_sis_copyarea(struct fb_info *info,
670 const struct fb_copyarea *area);
671extern int fbcon_sis_sync(struct fb_info *info);
672
673/* Internal 2D accelerator functions */
674extern int sisfb_initaccel(struct sis_video_info *ivideo);
675extern void sisfb_syncaccel(struct sis_video_info *ivideo);
676
677/* Internal general routines */
678#ifdef CONFIG_FB_SIS_300
679unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg);
680void sisfb_write_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg, unsigned int val);
681unsigned int sisfb_read_lpc_pci_dword(struct SiS_Private *SiS_Pr, int reg);
682#endif
683#ifdef CONFIG_FB_SIS_315
684void sisfb_write_nbridge_pci_byte(struct SiS_Private *SiS_Pr, int reg, unsigned char val);
685unsigned int sisfb_read_mio_pci_word(struct SiS_Private *SiS_Pr, int reg);
686#endif
687
688/* SiS-specific exported functions */
689void sis_malloc(struct sis_memreq *req);
690void sis_malloc_new(struct pci_dev *pdev, struct sis_memreq *req);
691void sis_free(u32 base);
692void sis_free_new(struct pci_dev *pdev, u32 base);
693
694/* Routines from init.c/init301.c */
695extern unsigned short SiS_GetModeID_LCD(int VGAEngine, unsigned int VBFlags, int HDisplay,
696 int VDisplay, int Depth, bool FSTN, unsigned short CustomT,
697 int LCDwith, int LCDheight, unsigned int VBFlags2);
698extern unsigned short SiS_GetModeID_TV(int VGAEngine, unsigned int VBFlags, int HDisplay,
699 int VDisplay, int Depth, unsigned int VBFlags2);
700extern unsigned short SiS_GetModeID_VGA2(int VGAEngine, unsigned int VBFlags, int HDisplay,
701 int VDisplay, int Depth, unsigned int VBFlags2);
702extern void SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr);
703extern bool SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
704extern void SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable);
705extern void SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable);
706
707extern bool SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr);
708
709extern bool sisfb_gettotalfrommode(struct SiS_Private *SiS_Pr, unsigned char modeno,
710 int *htotal, int *vtotal, unsigned char rateindex);
711extern int sisfb_mode_rate_to_dclock(struct SiS_Private *SiS_Pr,
712 unsigned char modeno, unsigned char rateindex);
713extern int sisfb_mode_rate_to_ddata(struct SiS_Private *SiS_Pr, unsigned char modeno,
714 unsigned char rateindex, struct fb_var_screeninfo *var);
715
716
586#endif 717#endif
diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c
index ecdd054d8951..20aff9005978 100644
--- a/drivers/video/fbdev/sis/sis_main.c
+++ b/drivers/video/fbdev/sis/sis_main.c
@@ -56,15 +56,66 @@
56 56
57#include "sis.h" 57#include "sis.h"
58#include "sis_main.h" 58#include "sis_main.h"
59#include "init301.h"
59 60
60#if !defined(CONFIG_FB_SIS_300) && !defined(CONFIG_FB_SIS_315) 61#if !defined(CONFIG_FB_SIS_300) && !defined(CONFIG_FB_SIS_315)
61#warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set 62#warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set
62#warning sisfb will not work! 63#warning sisfb will not work!
63#endif 64#endif
64 65
66/* ---------------------- Prototypes ------------------------- */
67
68/* Interface used by the world */
69#ifndef MODULE
70static int sisfb_setup(char *options);
71#endif
72
73/* Interface to the low level console driver */
74static int sisfb_init(void);
75
76/* fbdev routines */
77static int sisfb_get_fix(struct fb_fix_screeninfo *fix, int con,
78 struct fb_info *info);
79
80static int sisfb_ioctl(struct fb_info *info, unsigned int cmd,
81 unsigned long arg);
82static int sisfb_set_par(struct fb_info *info);
83static int sisfb_blank(int blank,
84 struct fb_info *info);
85
65static void sisfb_handle_command(struct sis_video_info *ivideo, 86static void sisfb_handle_command(struct sis_video_info *ivideo,
66 struct sisfb_cmd *sisfb_command); 87 struct sisfb_cmd *sisfb_command);
67 88
89static void sisfb_search_mode(char *name, bool quiet);
90static int sisfb_validate_mode(struct sis_video_info *ivideo, int modeindex, u32 vbflags);
91static u8 sisfb_search_refresh_rate(struct sis_video_info *ivideo, unsigned int rate,
92 int index);
93static int sisfb_setcolreg(unsigned regno, unsigned red, unsigned green,
94 unsigned blue, unsigned transp,
95 struct fb_info *fb_info);
96static int sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
97 struct fb_info *info);
98static void sisfb_pre_setmode(struct sis_video_info *ivideo);
99static void sisfb_post_setmode(struct sis_video_info *ivideo);
100static bool sisfb_CheckVBRetrace(struct sis_video_info *ivideo);
101static bool sisfbcheckvretracecrt2(struct sis_video_info *ivideo);
102static bool sisfbcheckvretracecrt1(struct sis_video_info *ivideo);
103static bool sisfb_bridgeisslave(struct sis_video_info *ivideo);
104static void sisfb_detect_VB_connect(struct sis_video_info *ivideo);
105static void sisfb_get_VB_type(struct sis_video_info *ivideo);
106static void sisfb_set_TVxposoffset(struct sis_video_info *ivideo, int val);
107static void sisfb_set_TVyposoffset(struct sis_video_info *ivideo, int val);
108
109/* Internal heap routines */
110static int sisfb_heap_init(struct sis_video_info *ivideo);
111static struct SIS_OH * sisfb_poh_new_node(struct SIS_HEAP *memheap);
112static struct SIS_OH * sisfb_poh_allocate(struct SIS_HEAP *memheap, u32 size);
113static void sisfb_delete_node(struct SIS_OH *poh);
114static void sisfb_insert_node(struct SIS_OH *pohList, struct SIS_OH *poh);
115static struct SIS_OH * sisfb_poh_free(struct SIS_HEAP *memheap, u32 base);
116static void sisfb_free_node(struct SIS_HEAP *memheap, struct SIS_OH *poh);
117
118
68/* ------------------ Internal helper routines ----------------- */ 119/* ------------------ Internal helper routines ----------------- */
69 120
70static void __init 121static void __init
diff --git a/drivers/video/fbdev/sis/sis_main.h b/drivers/video/fbdev/sis/sis_main.h
index 32e23c209430..d8ba07061f1e 100644
--- a/drivers/video/fbdev/sis/sis_main.h
+++ b/drivers/video/fbdev/sis/sis_main.h
@@ -661,121 +661,4 @@ static struct _customttable {
661 } 661 }
662}; 662};
663 663
664/* ---------------------- Prototypes ------------------------- */
665
666/* Interface used by the world */
667#ifndef MODULE
668static int sisfb_setup(char *options);
669#endif 664#endif
670
671/* Interface to the low level console driver */
672static int sisfb_init(void);
673
674/* fbdev routines */
675static int sisfb_get_fix(struct fb_fix_screeninfo *fix, int con,
676 struct fb_info *info);
677
678static int sisfb_ioctl(struct fb_info *info, unsigned int cmd,
679 unsigned long arg);
680static int sisfb_set_par(struct fb_info *info);
681static int sisfb_blank(int blank,
682 struct fb_info *info);
683extern void fbcon_sis_fillrect(struct fb_info *info,
684 const struct fb_fillrect *rect);
685extern void fbcon_sis_copyarea(struct fb_info *info,
686 const struct fb_copyarea *area);
687extern int fbcon_sis_sync(struct fb_info *info);
688
689/* Internal 2D accelerator functions */
690extern int sisfb_initaccel(struct sis_video_info *ivideo);
691extern void sisfb_syncaccel(struct sis_video_info *ivideo);
692
693/* Internal general routines */
694static void sisfb_search_mode(char *name, bool quiet);
695static int sisfb_validate_mode(struct sis_video_info *ivideo, int modeindex, u32 vbflags);
696static u8 sisfb_search_refresh_rate(struct sis_video_info *ivideo, unsigned int rate,
697 int index);
698static int sisfb_setcolreg(unsigned regno, unsigned red, unsigned green,
699 unsigned blue, unsigned transp,
700 struct fb_info *fb_info);
701static int sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
702 struct fb_info *info);
703static void sisfb_pre_setmode(struct sis_video_info *ivideo);
704static void sisfb_post_setmode(struct sis_video_info *ivideo);
705static bool sisfb_CheckVBRetrace(struct sis_video_info *ivideo);
706static bool sisfbcheckvretracecrt2(struct sis_video_info *ivideo);
707static bool sisfbcheckvretracecrt1(struct sis_video_info *ivideo);
708static bool sisfb_bridgeisslave(struct sis_video_info *ivideo);
709static void sisfb_detect_VB_connect(struct sis_video_info *ivideo);
710static void sisfb_get_VB_type(struct sis_video_info *ivideo);
711static void sisfb_set_TVxposoffset(struct sis_video_info *ivideo, int val);
712static void sisfb_set_TVyposoffset(struct sis_video_info *ivideo, int val);
713#ifdef CONFIG_FB_SIS_300
714unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg);
715void sisfb_write_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg, unsigned int val);
716unsigned int sisfb_read_lpc_pci_dword(struct SiS_Private *SiS_Pr, int reg);
717#endif
718#ifdef CONFIG_FB_SIS_315
719void sisfb_write_nbridge_pci_byte(struct SiS_Private *SiS_Pr, int reg, unsigned char val);
720unsigned int sisfb_read_mio_pci_word(struct SiS_Private *SiS_Pr, int reg);
721#endif
722
723/* SiS-specific exported functions */
724void sis_malloc(struct sis_memreq *req);
725void sis_malloc_new(struct pci_dev *pdev, struct sis_memreq *req);
726void sis_free(u32 base);
727void sis_free_new(struct pci_dev *pdev, u32 base);
728
729/* Internal heap routines */
730static int sisfb_heap_init(struct sis_video_info *ivideo);
731static struct SIS_OH * sisfb_poh_new_node(struct SIS_HEAP *memheap);
732static struct SIS_OH * sisfb_poh_allocate(struct SIS_HEAP *memheap, u32 size);
733static void sisfb_delete_node(struct SIS_OH *poh);
734static void sisfb_insert_node(struct SIS_OH *pohList, struct SIS_OH *poh);
735static struct SIS_OH * sisfb_poh_free(struct SIS_HEAP *memheap, u32 base);
736static void sisfb_free_node(struct SIS_HEAP *memheap, struct SIS_OH *poh);
737
738/* Routines from init.c/init301.c */
739extern unsigned short SiS_GetModeID_LCD(int VGAEngine, unsigned int VBFlags, int HDisplay,
740 int VDisplay, int Depth, bool FSTN, unsigned short CustomT,
741 int LCDwith, int LCDheight, unsigned int VBFlags2);
742extern unsigned short SiS_GetModeID_TV(int VGAEngine, unsigned int VBFlags, int HDisplay,
743 int VDisplay, int Depth, unsigned int VBFlags2);
744extern unsigned short SiS_GetModeID_VGA2(int VGAEngine, unsigned int VBFlags, int HDisplay,
745 int VDisplay, int Depth, unsigned int VBFlags2);
746extern void SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr);
747extern bool SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
748extern void SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable);
749extern void SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable);
750
751extern bool SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr);
752
753extern bool sisfb_gettotalfrommode(struct SiS_Private *SiS_Pr, unsigned char modeno,
754 int *htotal, int *vtotal, unsigned char rateindex);
755extern int sisfb_mode_rate_to_dclock(struct SiS_Private *SiS_Pr,
756 unsigned char modeno, unsigned char rateindex);
757extern int sisfb_mode_rate_to_ddata(struct SiS_Private *SiS_Pr, unsigned char modeno,
758 unsigned char rateindex, struct fb_var_screeninfo *var);
759
760/* Chrontel TV, DDC and DPMS functions */
761extern unsigned short SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short reg);
762extern void SiS_SetCH700x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val);
763extern unsigned short SiS_GetCH701x(struct SiS_Private *SiS_Pr, unsigned short reg);
764extern void SiS_SetCH701x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val);
765extern void SiS_SetCH70xxANDOR(struct SiS_Private *SiS_Pr, unsigned short reg,
766 unsigned char myor, unsigned char myand);
767extern void SiS_DDC2Delay(struct SiS_Private *SiS_Pr, unsigned int delaytime);
768extern void SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo);
769extern unsigned short SiS_HandleDDC(struct SiS_Private *SiS_Pr, unsigned int VBFlags, int VGAEngine,
770 unsigned short adaptnum, unsigned short DDCdatatype, unsigned char *buffer,
771 unsigned int VBFlags2);
772extern unsigned short SiS_ReadDDC1Bit(struct SiS_Private *SiS_Pr);
773#ifdef CONFIG_FB_SIS_315
774extern void SiS_Chrontel701xBLOn(struct SiS_Private *SiS_Pr);
775extern void SiS_Chrontel701xBLOff(struct SiS_Private *SiS_Pr);
776#endif
777extern void SiS_SiS30xBLOn(struct SiS_Private *SiS_Pr);
778extern void SiS_SiS30xBLOff(struct SiS_Private *SiS_Pr);
779#endif
780
781
diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c
index 8db7085e5d1a..22b606af0a87 100644
--- a/drivers/video/fbdev/smscufx.c
+++ b/drivers/video/fbdev/smscufx.c
@@ -1293,7 +1293,6 @@ static struct fb_ops ufx_ops = {
1293 * Assumes no active clients have framebuffer open */ 1293 * Assumes no active clients have framebuffer open */
1294static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info) 1294static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info)
1295{ 1295{
1296 int retval = -ENOMEM;
1297 int old_len = info->fix.smem_len; 1296 int old_len = info->fix.smem_len;
1298 int new_len; 1297 int new_len;
1299 unsigned char *old_fb = info->screen_base; 1298 unsigned char *old_fb = info->screen_base;
@@ -1308,10 +1307,8 @@ static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info)
1308 * Alloc system memory for virtual framebuffer 1307 * Alloc system memory for virtual framebuffer
1309 */ 1308 */
1310 new_fb = vmalloc(new_len); 1309 new_fb = vmalloc(new_len);
1311 if (!new_fb) { 1310 if (!new_fb)
1312 pr_err("Virtual framebuffer alloc failed"); 1311 return -ENOMEM;
1313 goto error;
1314 }
1315 1312
1316 if (info->screen_base) { 1313 if (info->screen_base) {
1317 memcpy(new_fb, old_fb, old_len); 1314 memcpy(new_fb, old_fb, old_len);
@@ -1323,11 +1320,7 @@ static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info)
1323 info->fix.smem_start = (unsigned long) new_fb; 1320 info->fix.smem_start = (unsigned long) new_fb;
1324 info->flags = smscufx_info_flags; 1321 info->flags = smscufx_info_flags;
1325 } 1322 }
1326 1323 return 0;
1327 retval = 0;
1328
1329error:
1330 return retval;
1331} 1324}
1332 1325
1333/* sets up I2C Controller for 100 Kbps, std. speed, 7-bit addr, master, 1326/* sets up I2C Controller for 100 Kbps, std. speed, 7-bit addr, master,
@@ -1620,8 +1613,8 @@ static int ufx_usb_probe(struct usb_interface *interface,
1620{ 1613{
1621 struct usb_device *usbdev; 1614 struct usb_device *usbdev;
1622 struct ufx_data *dev; 1615 struct ufx_data *dev;
1623 struct fb_info *info = NULL; 1616 struct fb_info *info;
1624 int retval = -ENOMEM; 1617 int retval;
1625 u32 id_rev, fpga_rev; 1618 u32 id_rev, fpga_rev;
1626 1619
1627 /* usb initialization */ 1620 /* usb initialization */
@@ -1631,7 +1624,7 @@ static int ufx_usb_probe(struct usb_interface *interface,
1631 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 1624 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
1632 if (dev == NULL) { 1625 if (dev == NULL) {
1633 dev_err(&usbdev->dev, "ufx_usb_probe: failed alloc of dev struct\n"); 1626 dev_err(&usbdev->dev, "ufx_usb_probe: failed alloc of dev struct\n");
1634 goto error; 1627 return -ENOMEM;
1635 } 1628 }
1636 1629
1637 /* we need to wait for both usb and fbdev to spin down on disconnect */ 1630 /* we need to wait for both usb and fbdev to spin down on disconnect */
@@ -1652,9 +1645,8 @@ static int ufx_usb_probe(struct usb_interface *interface,
1652 dev_dbg(dev->gdev, "fb_defio enable=%d\n", fb_defio); 1645 dev_dbg(dev->gdev, "fb_defio enable=%d\n", fb_defio);
1653 1646
1654 if (!ufx_alloc_urb_list(dev, WRITES_IN_FLIGHT, MAX_TRANSFER)) { 1647 if (!ufx_alloc_urb_list(dev, WRITES_IN_FLIGHT, MAX_TRANSFER)) {
1655 retval = -ENOMEM;
1656 dev_err(dev->gdev, "ufx_alloc_urb_list failed\n"); 1648 dev_err(dev->gdev, "ufx_alloc_urb_list failed\n");
1657 goto error; 1649 goto e_nomem;
1658 } 1650 }
1659 1651
1660 /* We don't register a new USB class. Our client interface is fbdev */ 1652 /* We don't register a new USB class. Our client interface is fbdev */
@@ -1662,9 +1654,8 @@ static int ufx_usb_probe(struct usb_interface *interface,
1662 /* allocates framebuffer driver structure, not framebuffer memory */ 1654 /* allocates framebuffer driver structure, not framebuffer memory */
1663 info = framebuffer_alloc(0, &usbdev->dev); 1655 info = framebuffer_alloc(0, &usbdev->dev);
1664 if (!info) { 1656 if (!info) {
1665 retval = -ENOMEM;
1666 dev_err(dev->gdev, "framebuffer_alloc failed\n"); 1657 dev_err(dev->gdev, "framebuffer_alloc failed\n");
1667 goto error; 1658 goto e_nomem;
1668 } 1659 }
1669 1660
1670 dev->info = info; 1661 dev->info = info;
@@ -1675,7 +1666,7 @@ static int ufx_usb_probe(struct usb_interface *interface,
1675 retval = fb_alloc_cmap(&info->cmap, 256, 0); 1666 retval = fb_alloc_cmap(&info->cmap, 256, 0);
1676 if (retval < 0) { 1667 if (retval < 0) {
1677 dev_err(dev->gdev, "fb_alloc_cmap failed %x\n", retval); 1668 dev_err(dev->gdev, "fb_alloc_cmap failed %x\n", retval);
1678 goto error; 1669 goto destroy_modedb;
1679 } 1670 }
1680 1671
1681 INIT_DELAYED_WORK(&dev->free_framebuffer_work, 1672 INIT_DELAYED_WORK(&dev->free_framebuffer_work,
@@ -1736,26 +1727,20 @@ static int ufx_usb_probe(struct usb_interface *interface,
1736 return 0; 1727 return 0;
1737 1728
1738error: 1729error:
1739 if (dev) { 1730 fb_dealloc_cmap(&info->cmap);
1740 if (info) { 1731destroy_modedb:
1741 if (info->cmap.len != 0) 1732 fb_destroy_modedb(info->monspecs.modedb);
1742 fb_dealloc_cmap(&info->cmap); 1733 vfree(info->screen_base);
1743 if (info->monspecs.modedb) 1734 fb_destroy_modelist(&info->modelist);
1744 fb_destroy_modedb(info->monspecs.modedb); 1735 framebuffer_release(info);
1745 vfree(info->screen_base); 1736put_ref:
1746 1737 kref_put(&dev->kref, ufx_free); /* ref for framebuffer */
1747 fb_destroy_modelist(&info->modelist); 1738 kref_put(&dev->kref, ufx_free); /* last ref from kref_init */
1748
1749 framebuffer_release(info);
1750 }
1751
1752 kref_put(&dev->kref, ufx_free); /* ref for framebuffer */
1753 kref_put(&dev->kref, ufx_free); /* last ref from kref_init */
1754
1755 /* dev has been deallocated. Do not dereference */
1756 }
1757
1758 return retval; 1739 return retval;
1740
1741e_nomem:
1742 retval = -ENOMEM;
1743 goto put_ref;
1759} 1744}
1760 1745
1761static void ufx_usb_disconnect(struct usb_interface *interface) 1746static void ufx_usb_disconnect(struct usb_interface *interface)
diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index f599520374dd..6439231f2db2 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -628,7 +628,8 @@ static int ssd1307fb_probe(struct i2c_client *client,
628 goto fb_alloc_error; 628 goto fb_alloc_error;
629 } 629 }
630 630
631 ssd1307fb_defio = devm_kzalloc(&client->dev, sizeof(struct fb_deferred_io), GFP_KERNEL); 631 ssd1307fb_defio = devm_kzalloc(&client->dev, sizeof(*ssd1307fb_defio),
632 GFP_KERNEL);
632 if (!ssd1307fb_defio) { 633 if (!ssd1307fb_defio) {
633 dev_err(&client->dev, "Couldn't allocate deferred io.\n"); 634 dev_err(&client->dev, "Couldn't allocate deferred io.\n");
634 ret = -ENOMEM; 635 ret = -ENOMEM;
diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c
index 3c2e4cabc08f..045e8afe398b 100644
--- a/drivers/video/fbdev/stifb.c
+++ b/drivers/video/fbdev/stifb.c
@@ -1126,10 +1126,8 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
1126 int bpp, xres, yres; 1126 int bpp, xres, yres;
1127 1127
1128 fb = kzalloc(sizeof(*fb), GFP_ATOMIC); 1128 fb = kzalloc(sizeof(*fb), GFP_ATOMIC);
1129 if (!fb) { 1129 if (!fb)
1130 printk(KERN_ERR "stifb: Could not allocate stifb structure\n"); 1130 return -ENOMEM;
1131 return -ENODEV;
1132 }
1133 1131
1134 info = &fb->info; 1132 info = &fb->info;
1135 1133
diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c
index 452a4207ac1b..f365d4862015 100644
--- a/drivers/video/fbdev/udlfb.c
+++ b/drivers/video/fbdev/udlfb.c
@@ -428,7 +428,6 @@ static void dlfb_compress_hline(
428 const uint16_t *pixel = *pixel_start_ptr; 428 const uint16_t *pixel = *pixel_start_ptr;
429 uint32_t dev_addr = *device_address_ptr; 429 uint32_t dev_addr = *device_address_ptr;
430 uint8_t *cmd = *command_buffer_ptr; 430 uint8_t *cmd = *command_buffer_ptr;
431 const int bpp = 2;
432 431
433 while ((pixel_end > pixel) && 432 while ((pixel_end > pixel) &&
434 (cmd_buffer_end - MIN_RLX_CMD_BYTES > cmd)) { 433 (cmd_buffer_end - MIN_RLX_CMD_BYTES > cmd)) {
@@ -441,9 +440,9 @@ static void dlfb_compress_hline(
441 440
442 *cmd++ = 0xAF; 441 *cmd++ = 0xAF;
443 *cmd++ = 0x6B; 442 *cmd++ = 0x6B;
444 *cmd++ = (uint8_t) ((dev_addr >> 16) & 0xFF); 443 *cmd++ = dev_addr >> 16;
445 *cmd++ = (uint8_t) ((dev_addr >> 8) & 0xFF); 444 *cmd++ = dev_addr >> 8;
446 *cmd++ = (uint8_t) ((dev_addr) & 0xFF); 445 *cmd++ = dev_addr;
447 446
448 cmd_pixels_count_byte = cmd++; /* we'll know this later */ 447 cmd_pixels_count_byte = cmd++; /* we'll know this later */
449 cmd_pixel_start = pixel; 448 cmd_pixel_start = pixel;
@@ -453,15 +452,15 @@ static void dlfb_compress_hline(
453 452
454 cmd_pixel_end = pixel + min(MAX_CMD_PIXELS + 1, 453 cmd_pixel_end = pixel + min(MAX_CMD_PIXELS + 1,
455 min((int)(pixel_end - pixel), 454 min((int)(pixel_end - pixel),
456 (int)(cmd_buffer_end - cmd) / bpp)); 455 (int)(cmd_buffer_end - cmd) / BPP));
457 456
458 prefetch_range((void *) pixel, (cmd_pixel_end - pixel) * bpp); 457 prefetch_range((void *) pixel, (cmd_pixel_end - pixel) * BPP);
459 458
460 while (pixel < cmd_pixel_end) { 459 while (pixel < cmd_pixel_end) {
461 const uint16_t * const repeating_pixel = pixel; 460 const uint16_t * const repeating_pixel = pixel;
462 461
463 *(uint16_t *)cmd = cpu_to_be16p(pixel); 462 *cmd++ = *pixel >> 8;
464 cmd += 2; 463 *cmd++ = *pixel;
465 pixel++; 464 pixel++;
466 465
467 if (unlikely((pixel < cmd_pixel_end) && 466 if (unlikely((pixel < cmd_pixel_end) &&
@@ -490,7 +489,7 @@ static void dlfb_compress_hline(
490 } 489 }
491 490
492 *cmd_pixels_count_byte = (pixel - cmd_pixel_start) & 0xFF; 491 *cmd_pixels_count_byte = (pixel - cmd_pixel_start) & 0xFF;
493 dev_addr += (pixel - cmd_pixel_start) * bpp; 492 dev_addr += (pixel - cmd_pixel_start) * BPP;
494 } 493 }
495 494
496 if (cmd_buffer_end <= MIN_RLX_CMD_BYTES + cmd) { 495 if (cmd_buffer_end <= MIN_RLX_CMD_BYTES + cmd) {
@@ -1136,7 +1135,6 @@ static struct fb_ops dlfb_ops = {
1136 */ 1135 */
1137static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info) 1136static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info)
1138{ 1137{
1139 int retval = -ENOMEM;
1140 int old_len = info->fix.smem_len; 1138 int old_len = info->fix.smem_len;
1141 int new_len; 1139 int new_len;
1142 unsigned char *old_fb = info->screen_base; 1140 unsigned char *old_fb = info->screen_base;
@@ -1152,7 +1150,7 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info
1152 new_fb = vmalloc(new_len); 1150 new_fb = vmalloc(new_len);
1153 if (!new_fb) { 1151 if (!new_fb) {
1154 dev_err(info->dev, "Virtual framebuffer alloc failed\n"); 1152 dev_err(info->dev, "Virtual framebuffer alloc failed\n");
1155 goto error; 1153 return -ENOMEM;
1156 } 1154 }
1157 1155
1158 if (info->screen_base) { 1156 if (info->screen_base) {
@@ -1181,11 +1179,7 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info
1181 dlfb->backing_buffer = new_back; 1179 dlfb->backing_buffer = new_back;
1182 } 1180 }
1183 } 1181 }
1184 1182 return 0;
1185 retval = 0;
1186
1187error:
1188 return retval;
1189} 1183}
1190 1184
1191/* 1185/*
@@ -1531,15 +1525,16 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dlfb,
1531 u8 length; 1525 u8 length;
1532 u16 key; 1526 u16 key;
1533 1527
1534 key = le16_to_cpu(*((u16 *) desc)); 1528 key = *desc++;
1535 desc += sizeof(u16); 1529 key |= (u16)*desc++ << 8;
1536 length = *desc; 1530 length = *desc++;
1537 desc++;
1538 1531
1539 switch (key) { 1532 switch (key) {
1540 case 0x0200: { /* max_area */ 1533 case 0x0200: { /* max_area */
1541 u32 max_area; 1534 u32 max_area = *desc++;
1542 max_area = le32_to_cpu(*((u32 *)desc)); 1535 max_area |= (u32)*desc++ << 8;
1536 max_area |= (u32)*desc++ << 16;
1537 max_area |= (u32)*desc++ << 24;
1543 dev_warn(&intf->dev, 1538 dev_warn(&intf->dev,
1544 "DL chip limited to %d pixel modes\n", 1539 "DL chip limited to %d pixel modes\n",
1545 max_area); 1540 max_area);
diff --git a/drivers/video/fbdev/vermilion/vermilion.c b/drivers/video/fbdev/vermilion/vermilion.c
index 6f8d444eb0e3..5172fa581147 100644
--- a/drivers/video/fbdev/vermilion/vermilion.c
+++ b/drivers/video/fbdev/vermilion/vermilion.c
@@ -651,7 +651,7 @@ static int vmlfb_check_var_locked(struct fb_var_screeninfo *var,
651 } 651 }
652 652
653 pitch = ALIGN((var->xres * var->bits_per_pixel) >> 3, 0x40); 653 pitch = ALIGN((var->xres * var->bits_per_pixel) >> 3, 0x40);
654 mem = pitch * var->yres_virtual; 654 mem = (u64)pitch * var->yres_virtual;
655 if (mem > vinfo->vram_contig_size) { 655 if (mem > vinfo->vram_contig_size) {
656 return -ENOMEM; 656 return -ENOMEM;
657 } 657 }
diff --git a/drivers/video/fbdev/via/via_aux_sii164.c b/drivers/video/fbdev/via/via_aux_sii164.c
index ca1b35f033b1..c27f62c2c75a 100644
--- a/drivers/video/fbdev/via/via_aux_sii164.c
+++ b/drivers/video/fbdev/via/via_aux_sii164.c
@@ -36,7 +36,7 @@ static void probe(struct via_aux_bus *bus, u8 addr)
36 .name = name}; 36 .name = name};
37 /* check vendor id and device id */ 37 /* check vendor id and device id */
38 const u8 id[] = {0x01, 0x00, 0x06, 0x00}, len = ARRAY_SIZE(id); 38 const u8 id[] = {0x01, 0x00, 0x06, 0x00}, len = ARRAY_SIZE(id);
39 u8 tmp[len]; 39 u8 tmp[ARRAY_SIZE(id)];
40 40
41 if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len)) 41 if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
42 return; 42 return;
diff --git a/drivers/video/fbdev/via/via_aux_vt1631.c b/drivers/video/fbdev/via/via_aux_vt1631.c
index 06e742f1f723..32978a0ccfd7 100644
--- a/drivers/video/fbdev/via/via_aux_vt1631.c
+++ b/drivers/video/fbdev/via/via_aux_vt1631.c
@@ -36,7 +36,7 @@ void via_aux_vt1631_probe(struct via_aux_bus *bus)
36 .name = name}; 36 .name = name};
37 /* check vendor id and device id */ 37 /* check vendor id and device id */
38 const u8 id[] = {0x06, 0x11, 0x91, 0x31}, len = ARRAY_SIZE(id); 38 const u8 id[] = {0x06, 0x11, 0x91, 0x31}, len = ARRAY_SIZE(id);
39 u8 tmp[len]; 39 u8 tmp[ARRAY_SIZE(id)];
40 40
41 if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len)) 41 if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
42 return; 42 return;
diff --git a/drivers/video/fbdev/via/via_aux_vt1632.c b/drivers/video/fbdev/via/via_aux_vt1632.c
index d24f4cd97401..cec8cc43d524 100644
--- a/drivers/video/fbdev/via/via_aux_vt1632.c
+++ b/drivers/video/fbdev/via/via_aux_vt1632.c
@@ -36,7 +36,7 @@ static void probe(struct via_aux_bus *bus, u8 addr)
36 .name = name}; 36 .name = name};
37 /* check vendor id and device id */ 37 /* check vendor id and device id */
38 const u8 id[] = {0x06, 0x11, 0x92, 0x31}, len = ARRAY_SIZE(id); 38 const u8 id[] = {0x06, 0x11, 0x92, 0x31}, len = ARRAY_SIZE(id);
39 u8 tmp[len]; 39 u8 tmp[ARRAY_SIZE(id)];
40 40
41 if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len)) 41 if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
42 return; 42 return;
diff --git a/drivers/video/fbdev/via/via_aux_vt1636.c b/drivers/video/fbdev/via/via_aux_vt1636.c
index 9e015c101d4d..2b10bc21ab79 100644
--- a/drivers/video/fbdev/via/via_aux_vt1636.c
+++ b/drivers/video/fbdev/via/via_aux_vt1636.c
@@ -36,7 +36,7 @@ void via_aux_vt1636_probe(struct via_aux_bus *bus)
36 .name = name}; 36 .name = name};
37 /* check vendor id and device id */ 37 /* check vendor id and device id */
38 const u8 id[] = {0x06, 0x11, 0x45, 0x33}, len = ARRAY_SIZE(id); 38 const u8 id[] = {0x06, 0x11, 0x45, 0x33}, len = ARRAY_SIZE(id);
39 u8 tmp[len]; 39 u8 tmp[ARRAY_SIZE(id)];
40 40
41 if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len)) 41 if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
42 return; 42 return;
diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c
index 8ce0a99bf17c..83b8963c9657 100644
--- a/drivers/video/of_display_timing.c
+++ b/drivers/video/of_display_timing.c
@@ -244,23 +244,3 @@ dispfail:
244 return NULL; 244 return NULL;
245} 245}
246EXPORT_SYMBOL_GPL(of_get_display_timings); 246EXPORT_SYMBOL_GPL(of_get_display_timings);
247
248/**
249 * of_display_timings_exist - check if a display-timings node is provided
250 * @np: device_node with the timing
251 **/
252int of_display_timings_exist(const struct device_node *np)
253{
254 struct device_node *timings_np;
255
256 if (!np)
257 return -EINVAL;
258
259 timings_np = of_parse_phandle(np, "display-timings", 0);
260 if (!timings_np)
261 return -EINVAL;
262
263 of_node_put(timings_np);
264 return 1;
265}
266EXPORT_SYMBOL_GPL(of_display_timings_exist);
diff --git a/include/video/of_display_timing.h b/include/video/of_display_timing.h
index 956455fc9f9a..bb29e5954000 100644
--- a/include/video/of_display_timing.h
+++ b/include/video/of_display_timing.h
@@ -19,7 +19,6 @@ struct display_timings;
19int of_get_display_timing(const struct device_node *np, const char *name, 19int of_get_display_timing(const struct device_node *np, const char *name,
20 struct display_timing *dt); 20 struct display_timing *dt);
21struct display_timings *of_get_display_timings(const struct device_node *np); 21struct display_timings *of_get_display_timings(const struct device_node *np);
22int of_display_timings_exist(const struct device_node *np);
23#else 22#else
24static inline int of_get_display_timing(const struct device_node *np, 23static inline int of_get_display_timing(const struct device_node *np,
25 const char *name, struct display_timing *dt) 24 const char *name, struct display_timing *dt)
@@ -31,10 +30,6 @@ of_get_display_timings(const struct device_node *np)
31{ 30{
32 return NULL; 31 return NULL;
33} 32}
34static inline int of_display_timings_exist(const struct device_node *np)
35{
36 return -ENOSYS;
37}
38#endif 33#endif
39 34
40#endif 35#endif