diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-10 10:20:00 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-10 10:20:00 -0700 |
commit | 5e630afdcb82779f5bf03fd4a5e86adc56fe7c8a (patch) | |
tree | ebf4fa7abd547f96ea631b6034f49f635a50ec9d /drivers/video | |
parent | 7aa1cf254ca66bc9602bc5adef5bf1d611869a69 (diff) | |
parent | 7c9b845e79eadd074820e36d426502a9c54cafcf (diff) |
Merge tag 'fbdev-v4.17' of git://github.com/bzolnier/linux
Pull fbdev updates from Bartlomiej Zolnierkiewicz:
"There is nothing really major here, just a couple of small bugfixes,
improvements and cleanups:
- make it possible to load radeonfb driver when offb driver is loaded
first (Mathieu Malaterre)
- fix memory leak in offb driver (Mathieu Malaterre)
- fix unaligned access in udlfb driver (Ladislav Michl)
- convert atmel_lcdfb driver to use GPIO descriptors (Ludovic
Desroches)
- avoid mismatched prototypes in sisfb driver (Arnd Bergmann)
- remove VLA usage from viafb driver (Gustavo A. R. Silva)
- add missing help text to FB_I810_I2 config option (Ulf Magnusson)
- misc fixes (Gustavo A. R. Silva, Colin Ian King, Markus Elfring)
- remove dead code from s3c-fb driver for Exynos and S5PV210
platforms
- misc cleanups (Corentin Labbe, Ladislav Michl, Ulf Magnusson,
Vladimir Zapolskiy, Markus Elfring)"
* tag 'fbdev-v4.17' of git://github.com/bzolnier/linux: (32 commits)
video: fbdev: s3c-fb: remove dead platform code for Exynos and S5PV210 platforms
video: au1100fb: Delete an unnecessary variable initialisation in au1100fb_drv_probe()
video: au1100fb: Improve a size determination in au1100fb_drv_probe()
video: au1100fb: Delete an error message for a failed memory allocation in au1100fb_drv_probe()
video/console/sticore: Delete an error message for a failed memory allocation in sti_try_rom_generic()
video: ARM CLCD: Improve a size determination in clcdfb_probe()
video: ARM CLCD: Delete an error message for a failed memory allocation in clcdfb_probe()
video: matroxfb: Delete an error message for a failed memory allocation in matroxfb_crtc2_probe()
video: s3c-fb: Improve a size determination in s3c_fb_probe()
video: s3c-fb: Delete an error message for a failed memory allocation in s3c_fb_probe()
video: fsl-diu-fb: Delete an error message for a failed memory allocation in fsl_diu_init()
video: ssd1307fb: Improve a size determination in ssd1307fb_probe()
video: smscufx: Delete an error message for a failed memory allocation in ufx_realloc_framebuffer()
video: smscufx: Return an error code only as a constant in ufx_realloc_framebuffer()
video: smscufx: Less checks in ufx_usb_probe() after error detection
video: udlfb: Return an error code only as a constant in dlfb_realloc_framebuffer()
video/fbdev/stifb: Delete an error message for a failed memory allocation in stifb_init_fb()
video/fbdev/stifb: Return -ENOMEM after a failed kzalloc() in stifb_init_fb()
video: fbdev: aty128fb: use true and false for boolean values
fbdev: aty: fix missing indentation in if statement
...
Diffstat (limited to 'drivers/video')
29 files changed, 609 insertions, 813 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 config HAVE_FB_ATMEL bool -config SH_LCD_MIPI_DSI - bool - source "drivers/char/agp/Kconfig" source "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, } sti = kzalloc(sizeof(*sti), GFP_KERNEL); - if (!sti) { - printk(KERN_ERR "Not enough memory !\n"); + if (!sti) return NULL; - } spin_lock_init(&sti->lock); 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 bool "Enable DDC Support" depends on FB_I810 && FB_I810_GTF select FB_DDC + help + Add DDC/I2C support for i810fb. This will allow the driver to get + display information, especially for monitors with fickle timings. + + If unsure, say Y. config FB_LE80578 tristate "Intel LE80578 (Vermilion) support" @@ -1917,8 +1922,7 @@ config FB_TMIO_ACCELL config FB_S3C tristate "Samsung S3C framebuffer support" - depends on FB && (CPU_S3C2416 || ARCH_S3C64XX || \ - ARCH_S5PV210 || ARCH_EXYNOS) + depends on FB && (CPU_S3C2416 || ARCH_S3C64XX) select FB_CFB_FILLRECT select FB_CFB_COPYAREA 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) goto out; } - fb = kzalloc(sizeof(struct clcd_fb), GFP_KERNEL); + fb = kzalloc(sizeof(*fb), GFP_KERNEL); if (!fb) { - printk(KERN_INFO "CLCD: could not allocate new clcd_fb struct\n"); ret = -ENOMEM; goto free_region; } 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 @@ #include <linux/delay.h> #include <linux/backlight.h> #include <linux/gfp.h> +#include <linux/gpio/consumer.h> #include <linux/module.h> #include <linux/of.h> #include <linux/of_device.h> -#include <linux/of_gpio.h> #include <video/of_display_timing.h> #include <linux/regulator/consumer.h> #include <video/videomode.h> @@ -61,8 +61,7 @@ struct atmel_lcdfb_info { }; struct atmel_lcdfb_power_ctrl_gpio { - int gpio; - int active_low; + struct gpio_desc *gpiod; struct list_head list; }; @@ -1018,7 +1017,7 @@ static void atmel_lcdfb_power_control_gpio(struct atmel_lcdfb_pdata *pdata, int struct atmel_lcdfb_power_ctrl_gpio *og; list_for_each_entry(og, &pdata->pwr_gpios, list) - gpio_set_value(og->gpio, on); + gpiod_set_value(og->gpiod, on); } static 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) struct device_node *display_np; struct device_node *timings_np; struct display_timings *timings; - enum of_gpio_flags flags; struct atmel_lcdfb_power_ctrl_gpio *og; bool is_gpio_power = false; + struct gpio_desc *gpiod; int ret = -ENOENT; - int i, gpio; + int i; sinfo->config = (struct atmel_lcdfb_config*) of_match_device(atmel_lcdfb_dt_ids, dev)->data; @@ -1072,28 +1071,22 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) INIT_LIST_HEAD(&pdata->pwr_gpios); ret = -ENOMEM; - for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) { - gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio", - i, &flags); - if (gpio < 0) + for (i = 0; i < gpiod_count(dev, "atmel,power-control"); i++) { + gpiod = devm_gpiod_get_index(dev, "atmel,power-control", + i, GPIOD_ASIS); + if (IS_ERR(gpiod)) continue; og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL); if (!og) goto put_display_node; - og->gpio = gpio; - og->active_low = flags & OF_GPIO_ACTIVE_LOW; + og->gpiod = gpiod; is_gpio_power = true; - ret = devm_gpio_request(dev, gpio, "lcd-power-control-gpio"); - if (ret) { - dev_err(dev, "request gpio %d failed\n", gpio); - goto put_display_node; - } - ret = gpio_direction_output(gpio, og->active_low); + ret = gpiod_direction_output(gpiod, gpiod_is_active_low(gpiod)); if (ret) { - dev_err(dev, "set direction output gpio %d failed\n", gpio); + dev_err(dev, "set direction output gpio atmel,power-control[%d] failed\n", i); goto put_display_node; } 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) continue; } if(!strncmp(this_opt, "nomtrr", 6)) { - mtrr = 0; + mtrr = false; continue; } #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) dsp_on = ((multiplier << vshift) + divider) / divider; tmp = ((ras_multiplier << xshift) + ras_divider) / ras_divider; if (dsp_on < tmp) - dsp_on = tmp; + dsp_on = tmp; dsp_on = dsp_on + (tmp * 2) + (pll->xclkpagefaultdelay << xshift); } 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 = { .read = radeon_show_edid2, }; +static int radeon_kick_out_firmware_fb(struct pci_dev *pdev) +{ + struct apertures_struct *ap; + + ap = alloc_apertures(1); + if (!ap) + return -ENOMEM; + + ap->ranges[0].base = pci_resource_start(pdev, 0); + ap->ranges[0].size = pci_resource_len(pdev, 0); + + remove_conflicting_framebuffers(ap, KBUILD_MODNAME, false); + + kfree(ap); + + return 0; +} static int radeonfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) @@ -2308,6 +2325,10 @@ static int radeonfb_pci_register(struct pci_dev *pdev, rinfo->fb_base_phys = pci_resource_start (pdev, 0); rinfo->mmio_base_phys = pci_resource_start (pdev, 2); + ret = radeon_kick_out_firmware_fb(pdev); + if (ret) + return ret; + /* request the mem regions */ ret = pci_request_region(pdev, 0, "radeonfb framebuffer"); 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) static int au1100fb_drv_probe(struct platform_device *dev) { - struct au1100fb_device *fbdev = NULL; + struct au1100fb_device *fbdev; struct resource *regs_res; unsigned long page; struct clk *c; /* Allocate new device private */ - fbdev = devm_kzalloc(&dev->dev, sizeof(struct au1100fb_device), - GFP_KERNEL); - if (!fbdev) { - print_err("fail to allocate device private record"); + fbdev = devm_kzalloc(&dev->dev, sizeof(*fbdev), GFP_KERNEL); + if (!fbdev) return -ENOMEM; - } if (au1100fb_setup(fbdev)) 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) of_node_put(np); coherence_data = vmalloc(coherence_data_size); - if (!coherence_data) { - pr_err("fsl-diu-fb: could not allocate coherence data " - "(size=%zu)\n", coherence_data_size); + if (!coherence_data) return -ENOMEM; - } - #endif 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) { if (!minfo->devflags.crtc2) return NULL; m2info = kzalloc(sizeof(*m2info), GFP_KERNEL); - if (!m2info) { - printk(KERN_ERR "matroxfb_crtc2: Not enough memory for CRTC2 control structs\n"); + if (!m2info) return NULL; - } + m2info->primary_dev = minfo; if (matroxfb_dh_registerfb(m2info)) { 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) if (info->screen_base) iounmap(info->screen_base); release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); + fb_dealloc_cmap(&info->cmap); framebuffer_release(info); } @@ -518,6 +519,7 @@ static void __init offb_init_fb(const char *name, return; out_err: + fb_dealloc_cmap(&info->cmap); iounmap(info->screen_base); out_aper: 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) return -EINVAL; } - sfb = devm_kzalloc(dev, sizeof(struct s3c_fb), GFP_KERNEL); - if (!sfb) { - dev_err(dev, "no memory for framebuffers\n"); + sfb = devm_kzalloc(dev, sizeof(*sfb), GFP_KERNEL); + if (!sfb) return -ENOMEM; - } dev_dbg(dev, "allocate new framebuffer %p\n", sfb); @@ -1716,63 +1714,6 @@ static struct s3c_fb_win_variant s3c_fb_data_64xx_wins[] = { }, }; -static struct s3c_fb_win_variant s3c_fb_data_s5p_wins[] = { - [0] = { - .has_osd_c = 1, - .osd_size_off = 0x8, - .palette_sz = 256, - .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) | - VALID_BPP(15) | VALID_BPP(16) | - VALID_BPP(18) | VALID_BPP(19) | - VALID_BPP(24) | VALID_BPP(25) | - VALID_BPP(32)), - }, - [1] = { - .has_osd_c = 1, - .has_osd_d = 1, - .osd_size_off = 0xc, - .has_osd_alpha = 1, - .palette_sz = 256, - .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) | - VALID_BPP(15) | VALID_BPP(16) | - VALID_BPP(18) | VALID_BPP(19) | - VALID_BPP(24) | VALID_BPP(25) | - VALID_BPP(32)), - }, - [2] = { - .has_osd_c = 1, - .has_osd_d = 1, - .osd_size_off = 0xc, - .has_osd_alpha = 1, - .palette_sz = 256, - .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) | - VALID_BPP(15) | VALID_BPP(16) | - VALID_BPP(18) | VALID_BPP(19) | - VALID_BPP(24) | VALID_BPP(25) | - VALID_BPP(32)), - }, - [3] = { - .has_osd_c = 1, - .has_osd_alpha = 1, - .palette_sz = 256, - .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) | - VALID_BPP(15) | VALID_BPP(16) | - VALID_BPP(18) | VALID_BPP(19) | - VALID_BPP(24) | VALID_BPP(25) | - VALID_BPP(32)), - }, - [4] = { - .has_osd_c = 1, - .has_osd_alpha = 1, - .palette_sz = 256, - .valid_bpp = (VALID_BPP1248 | VALID_BPP(13) | - VALID_BPP(15) | VALID_BPP(16) | - VALID_BPP(18) | VALID_BPP(19) | - VALID_BPP(24) | VALID_BPP(25) | - VALID_BPP(32)), - }, -}; - static struct s3c_fb_driverdata s3c_fb_data_64xx = { .variant = { .nr_windows = 5, @@ -1804,102 +1745,6 @@ static struct s3c_fb_driverdata s3c_fb_data_64xx = { .win[4] = &s3c_fb_data_64xx_wins[4], }; -static struct s3c_fb_driverdata s3c_fb_data_s5pv210 = { - .variant = { - .nr_windows = 5, - .vidtcon = VIDTCON0, - .wincon = WINCON(0), - .winmap = WINxMAP(0), - .keycon = WKEYCON, - .osd = VIDOSD_BASE, - .osd_stride = 16, - .buf_start = VIDW_BUF_START(0), - .buf_size = VIDW_BUF_SIZE(0), - .buf_end = VIDW_BUF_END(0), - - .palette = { - [0] = 0x2400, - [1] = 0x2800, - [2] = 0x2c00, - [3] = 0x3000, - [4] = 0x3400, - }, - - .has_shadowcon = 1, - .has_blendcon = 1, - .has_clksel = 1, - .has_fixvclk = 1, - }, - .win[0] = &s3c_fb_data_s5p_wins[0], - .win[1] = &s3c_fb_data_s5p_wins[1], - .win[2] = &s3c_fb_data_s5p_wins[2], - .win[3] = &s3c_fb_data_s5p_wins[3], - .win[4] = &s3c_fb_data_s5p_wins[4], -}; - -static struct s3c_fb_driverdata s3c_fb_data_exynos4 = { - .variant = { - .nr_windows = 5, - .vidtcon = VIDTCON0, - .wincon = WINCON(0), - .winmap = WINxMAP(0), - .keycon = WKEYCON, - .osd = VIDOSD_BASE, - .osd_stride = 16, - .buf_start = VIDW_BUF_START(0), - .buf_size = VIDW_BUF_SIZE(0), - .buf_end = VIDW_BUF_END(0), - - .palette = { - [0] = 0x2400, - [1] = 0x2800, - [2] = 0x2c00, - [3] = 0x3000, - [4] = 0x3400, - }, - - .has_shadowcon = 1, - .has_blendcon = 1, - .has_fixvclk = 1, - }, - .win[0] = &s3c_fb_data_s5p_wins[0], - .win[1] = &s3c_fb_data_s5p_wins[1], - .win[2] = &s3c_fb_data_s5p_wins[2], - .win[3] = &s3c_fb_data_s5p_wins[3], - .win[4] = &s3c_fb_data_s5p_wins[4], -}; - -static struct s3c_fb_driverdata s3c_fb_data_exynos5 = { - .variant = { - .nr_windows = 5, - .vidtcon = FIMD_V8_VIDTCON0, - .wincon = WINCON(0), - .winmap = WINxMAP(0), - .keycon = WKEYCON, - .osd = VIDOSD_BASE, - .osd_stride = 16, - .buf_start = VIDW_BUF_START(0), - .buf_size = VIDW_BUF_SIZE(0), - .buf_end = VIDW_BUF_END(0), - - .palette = { - [0] = 0x2400, - [1] = 0x2800, - [2] = 0x2c00, - [3] = 0x3000, - [4] = 0x3400, - }, - .has_shadowcon = 1, - .has_blendcon = 1, - .has_fixvclk = 1, - }, - .win[0] = &s3c_fb_data_s5p_wins[0], - .win[1] = &s3c_fb_data_s5p_wins[1], - .win[2] = &s3c_fb_data_s5p_wins[2], - .win[3] = &s3c_fb_data_s5p_wins[3], - .win[4] = &s3c_fb_data_s5p_wins[4], -}; - /* S3C2443/S3C2416 style hardware */ static struct s3c_fb_driverdata s3c_fb_data_s3c2443 = { .variant = { @@ -1942,15 +1787,6 @@ static const struct platform_device_id s3c_fb_driver_ids[] = { .name = "s3c-fb", .driver_data = (unsigned long)&s3c_fb_data_64xx, }, { - .name = "s5pv210-fb", - .driver_data = (unsigned long)&s3c_fb_data_s5pv210, - }, { - .name = "exynos4-fb", - .driver_data = (unsigned long)&s3c_fb_data_exynos4, - }, { - .name = "exynos5-fb", - .driver_data = (unsigned long)&s3c_fb_data_exynos5, - }, { .name = "s3c2443-fb", .driver_data = (unsigned long)&s3c_fb_data_s3c2443, }, 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[] = 0x00}} }; -bool SiSInitPtr(struct SiS_Private *SiS_Pr); -unsigned short SiS_GetModeID_LCD(int VGAEngine, unsigned int VBFlags, int HDisplay, - int VDisplay, int Depth, bool FSTN, - unsigned short CustomT, int LCDwith, int LCDheight, - unsigned int VBFlags2); -unsigned short SiS_GetModeID_TV(int VGAEngine, unsigned int VBFlags, int HDisplay, - int VDisplay, int Depth, unsigned int VBFlags2); -unsigned short SiS_GetModeID_VGA2(int VGAEngine, unsigned int VBFlags, int HDisplay, - int VDisplay, int Depth, unsigned int VBFlags2); - -void SiS_DisplayOn(struct SiS_Private *SiS_Pr); -void SiS_DisplayOff(struct SiS_Private *SiS_Pr); -void SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr); -void SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable); -void SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable); -unsigned short SiS_GetModeFlag(struct SiS_Private *SiS_Pr, unsigned short ModeNo, - unsigned short ModeIdIndex); -bool SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr); - -bool SiS_SearchModeID(struct SiS_Private *SiS_Pr, unsigned short *ModeNo, - unsigned short *ModeIdIndex); -unsigned short SiS_GetModePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, - unsigned short ModeIdIndex); -unsigned short SiS_GetRefCRTVCLK(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide); -unsigned short SiS_GetRefCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide); -unsigned short SiS_GetColorDepth(struct SiS_Private *SiS_Pr, unsigned short ModeNo, - unsigned short ModeIdIndex); -unsigned short SiS_GetOffset(struct SiS_Private *SiS_Pr,unsigned short ModeNo, - unsigned short ModeIdIndex, unsigned short RRTI); -#ifdef CONFIG_FB_SIS_300 -void SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *idx1, - unsigned short *idx2); -unsigned short SiS_GetFIFOThresholdB300(unsigned short idx1, unsigned short idx2); -unsigned short SiS_GetLatencyFactor630(struct SiS_Private *SiS_Pr, unsigned short index); -#endif -void SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex); -bool SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); -void SiS_CalcCRRegisters(struct SiS_Private *SiS_Pr, int depth); -void SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo, - unsigned short ModeIdIndex); -void SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, int xres, - int yres, struct fb_var_screeninfo *var, bool writeres); - -/* From init301.c: */ -extern void SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, - unsigned short ModeIdIndex, int chkcrt2mode); -extern void SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, - unsigned short ModeIdIndex); -extern void SiS_SetYPbPr(struct SiS_Private *SiS_Pr); -extern void SiS_SetTVMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo, - unsigned short ModeIdIndex); -extern void SiS_UnLockCRT2(struct SiS_Private *SiS_Pr); -extern void SiS_DisableBridge(struct SiS_Private *); -extern bool SiS_SetCRT2Group(struct SiS_Private *, unsigned short); -extern unsigned short SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, - unsigned short ModeIdIndex); -extern void SiS_WaitRetrace1(struct SiS_Private *SiS_Pr); -extern unsigned short SiS_GetResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, - unsigned short ModeIdIndex); -extern unsigned short SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short tempax); -extern unsigned short SiS_GetVCLK2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, - unsigned short ModeIdIndex, unsigned short RRTI); -extern bool SiS_IsVAMode(struct SiS_Private *); -extern bool SiS_IsDualEdge(struct SiS_Private *); - -#ifdef CONFIG_FB_SIS_300 -extern unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg); -extern void sisfb_write_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg, - unsigned int val); -#endif -#ifdef CONFIG_FB_SIS_315 -extern void sisfb_write_nbridge_pci_byte(struct SiS_Private *SiS_Pr, int reg, - unsigned char val); -extern unsigned int sisfb_read_mio_pci_word(struct SiS_Private *SiS_Pr, int reg); -#endif - #endif 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 @@ #define SiS_I2CDELAY 1000 #define SiS_I2CDELAYSHORT 150 +static const unsigned char SiS_YPbPrTable[3][64] = { + { + 0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c, + 0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a, + 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b, + 0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17, + 0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02, + 0x03,0x0a,0x65,0x9d /*0x8d*/,0x08,0x92,0x8f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x53 /*0x50*/, + 0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00 + }, + { + 0x33,0x06,0x06,0x09,0x0b,0x0c,0x0c,0x0c, + 0x98,0x0a,0x01,0x0d,0x06,0x0d,0x04,0x0a, + 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f, + 0x0c,0x50,0xb2,0x9f,0x16,0x59,0x4f,0x13, + 0xad,0x11,0xad,0x1d,0x40,0x8a,0x3d,0xb8, + 0x51,0x5e,0x60,0x49,0x7d,0x92,0x0f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x4e, + 0x43,0x41,0x11,0x00,0xfc,0xff,0x32,0x00 + }, + { +#if 0 /* OK, but sticks to left edge */ + 0x13,0x1d,0xe8,0x09,0x09,0xed,0x0c,0x0c, + 0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a, + 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f, + 0xed,0x50,0x70,0x9f,0x16,0x59,0x21 /*0x2b*/,0x13, + 0x27,0x0b,0x27,0xfc,0x30,0x27,0x1c,0xb0, + 0x4b,0x4b,0x65 /*0x6f*/,0x2f,0x63,0x92,0x0f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x27, + 0x00,0x40,0x11,0x00,0xfc,0xff,0x32,0x00 +#endif +#if 1 /* Perfect */ + 0x23,0x2d,0xe8,0x09,0x09,0xed,0x0c,0x0c, + 0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a, + 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f, + 0xed,0x50,0x70,0x9f,0x16,0x59,0x60,0x13, + 0x27,0x0b,0x27,0xfc,0x30,0x27,0x1c,0xb0, + 0x4b,0x4b,0x6f,0x2f,0x63,0x92,0x0f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x73, + 0x00,0x40,0x11,0x00,0xfc,0xff,0x32,0x00 +#endif + } +}; + +static const unsigned char SiS_TVPhase[] = +{ + 0x21,0xED,0xBA,0x08, /* 0x00 SiS_NTSCPhase */ + 0x2A,0x05,0xE3,0x00, /* 0x01 SiS_PALPhase */ + 0x21,0xE4,0x2E,0x9B, /* 0x02 SiS_PALMPhase */ + 0x21,0xF4,0x3E,0xBA, /* 0x03 SiS_PALNPhase */ + 0x1E,0x8B,0xA2,0xA7, + 0x1E,0x83,0x0A,0xE0, /* 0x05 SiS_SpecialPhaseM */ + 0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00, + 0x21,0xF0,0x7B,0xD6, /* 0x08 SiS_NTSCPhase2 */ + 0x2A,0x09,0x86,0xE9, /* 0x09 SiS_PALPhase2 */ + 0x21,0xE6,0xEF,0xA4, /* 0x0a SiS_PALMPhase2 */ + 0x21,0xF6,0x94,0x46, /* 0x0b SiS_PALNPhase2 */ + 0x1E,0x8B,0xA2,0xA7, + 0x1E,0x83,0x0A,0xE0, /* 0x0d SiS_SpecialPhaseM */ + 0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00, + 0x1e,0x8c,0x5c,0x7a, /* 0x10 SiS_SpecialPhase */ + 0x25,0xd4,0xfd,0x5e /* 0x11 SiS_SpecialPhaseJ */ +}; + +static const unsigned char SiS_HiTVGroup3_1[] = { + 0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x13, + 0xb1, 0x41, 0x62, 0x62, 0xff, 0xf4, 0x45, 0xa6, + 0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20, + 0xac, 0xda, 0x60, 0xfe, 0x6a, 0x9a, 0x06, 0x10, + 0xd1, 0x04, 0x18, 0x0a, 0xff, 0x80, 0x00, 0x80, + 0x3b, 0x77, 0x00, 0xef, 0xe0, 0x10, 0xb0, 0xe0, + 0x10, 0x4f, 0x0f, 0x0f, 0x05, 0x0f, 0x08, 0x6e, + 0x1a, 0x1f, 0x25, 0x2a, 0x4c, 0xaa, 0x01 +}; + +static const unsigned char SiS_HiTVGroup3_2[] = { + 0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x7a, + 0x54, 0x41, 0xe7, 0xe7, 0xff, 0xf4, 0x45, 0xa6, + 0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20, + 0xac, 0x6a, 0x60, 0x2b, 0x52, 0xcd, 0x61, 0x10, + 0x51, 0x04, 0x18, 0x0a, 0x1f, 0x80, 0x00, 0x80, + 0xff, 0xa4, 0x04, 0x2b, 0x94, 0x21, 0x72, 0x94, + 0x26, 0x05, 0x01, 0x0f, 0xed, 0x0f, 0x0a, 0x64, + 0x18, 0x1d, 0x23, 0x28, 0x4c, 0xaa, 0x01 +}; + +/* 301C / 302ELV extended Part2 TV registers (4 tap scaler) */ + +static const unsigned char SiS_Part2CLVX_1[] = { + 0x00,0x00, + 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, + 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, + 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E +}; + +static const unsigned char SiS_Part2CLVX_2[] = { + 0x00,0x00, + 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, + 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, + 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E +}; + +static const unsigned char SiS_Part2CLVX_3[] = { /* NTSC, 525i, 525p */ + 0xE0,0x01, + 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D, + 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C, + 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E, + 0x7D,0x0C,0x19,0x7E,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02, + 0x58,0x02, + 0x07,0x14,0x07,0x7E,0x06,0x14,0x09,0x7D,0x05,0x14,0x0A,0x7D,0x04,0x13,0x0B,0x7E, + 0x03,0x13,0x0C,0x7E,0x02,0x12,0x0D,0x7F,0x01,0x12,0x0E,0x7F,0x01,0x11,0x0F,0x7F, + 0x00,0x10,0x10,0x00,0x7F,0x0F,0x11,0x01,0x7F,0x0E,0x12,0x01,0x7E,0x0D,0x12,0x03, + 0x7E,0x0C,0x13,0x03,0x7E,0x0B,0x13,0x04,0x7E,0x0A,0x14,0x04,0x7D,0x09,0x14,0x06, + 0x00,0x03, + 0x09,0x0F,0x09,0x7F,0x08,0x0F,0x09,0x00,0x07,0x0F,0x0A,0x00,0x06,0x0F,0x0A,0x01, + 0x06,0x0E,0x0B,0x01,0x05,0x0E,0x0B,0x02,0x04,0x0E,0x0C,0x02,0x04,0x0D,0x0C,0x03, + 0x03,0x0D,0x0D,0x03,0x02,0x0C,0x0D,0x05,0x02,0x0C,0x0E,0x04,0x01,0x0B,0x0E,0x06, + 0x01,0x0B,0x0E,0x06,0x00,0x0A,0x0F,0x07,0x00,0x0A,0x0F,0x07,0x00,0x09,0x0F,0x08, + 0xFF,0xFF +}; + +static const unsigned char SiS_Part2CLVX_4[] = { /* PAL */ + 0x58,0x02, + 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D, + 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D, + 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E, + 0x7D,0x0C,0x18,0x7F,0x |