Commit 5e630afd authored by Linus Torvalds's avatar Linus Torvalds

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
  ...
parents 7aa1cf25 7c9b845e
...@@ -9,9 +9,6 @@ if HAS_IOMEM ...@@ -9,9 +9,6 @@ if HAS_IOMEM
config HAVE_FB_ATMEL config HAVE_FB_ATMEL
bool bool
config SH_LCD_MIPI_DSI
bool
source "drivers/char/agp/Kconfig" source "drivers/char/agp/Kconfig"
source "drivers/gpu/vga/Kconfig" source "drivers/gpu/vga/Kconfig"
......
...@@ -827,10 +827,8 @@ static struct sti_struct *sti_try_rom_generic(unsigned long address, ...@@ -827,10 +827,8 @@ static struct sti_struct *sti_try_rom_generic(unsigned long address,
} }
sti = kzalloc(sizeof(*sti), GFP_KERNEL); sti = kzalloc(sizeof(*sti), GFP_KERNEL);
if (!sti) { if (!sti)
printk(KERN_ERR "Not enough memory !\n");
return NULL; return NULL;
}
spin_lock_init(&sti->lock); spin_lock_init(&sti->lock);
......
...@@ -1053,6 +1053,11 @@ config FB_I810_I2C ...@@ -1053,6 +1053,11 @@ config FB_I810_I2C
bool "Enable DDC Support" bool "Enable DDC Support"
depends on FB_I810 && FB_I810_GTF depends on FB_I810 && FB_I810_GTF
select FB_DDC 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 config FB_LE80578
tristate "Intel LE80578 (Vermilion) support" tristate "Intel LE80578 (Vermilion) support"
...@@ -1917,8 +1922,7 @@ config FB_TMIO_ACCELL ...@@ -1917,8 +1922,7 @@ config FB_TMIO_ACCELL
config FB_S3C config FB_S3C
tristate "Samsung S3C framebuffer support" tristate "Samsung S3C framebuffer support"
depends on FB && (CPU_S3C2416 || ARCH_S3C64XX || \ depends on FB && (CPU_S3C2416 || ARCH_S3C64XX)
ARCH_S5PV210 || ARCH_EXYNOS)
select FB_CFB_FILLRECT select FB_CFB_FILLRECT
select FB_CFB_COPYAREA select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT select FB_CFB_IMAGEBLIT
......
...@@ -967,9 +967,8 @@ static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id) ...@@ -967,9 +967,8 @@ static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id)
goto out; goto out;
} }
fb = kzalloc(sizeof(struct clcd_fb), GFP_KERNEL); fb = kzalloc(sizeof(*fb), GFP_KERNEL);
if (!fb) { if (!fb) {
printk(KERN_INFO "CLCD: could not allocate new clcd_fb struct\n");
ret = -ENOMEM; ret = -ENOMEM;
goto free_region; goto free_region;
} }
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/backlight.h> #include <linux/backlight.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <video/of_display_timing.h> #include <video/of_display_timing.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <video/videomode.h> #include <video/videomode.h>
...@@ -61,8 +61,7 @@ struct atmel_lcdfb_info { ...@@ -61,8 +61,7 @@ struct atmel_lcdfb_info {
}; };
struct atmel_lcdfb_power_ctrl_gpio { struct atmel_lcdfb_power_ctrl_gpio {
int gpio; struct gpio_desc *gpiod;
int active_low;
struct list_head list; struct list_head list;
}; };
...@@ -1018,7 +1017,7 @@ static void atmel_lcdfb_power_control_gpio(struct atmel_lcdfb_pdata *pdata, int ...@@ -1018,7 +1017,7 @@ static void atmel_lcdfb_power_control_gpio(struct atmel_lcdfb_pdata *pdata, int
struct atmel_lcdfb_power_ctrl_gpio *og; struct atmel_lcdfb_power_ctrl_gpio *og;
list_for_each_entry(og, &pdata->pwr_gpios, list) 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) 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) ...@@ -1031,11 +1030,11 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
struct device_node *display_np; struct device_node *display_np;
struct device_node *timings_np; struct device_node *timings_np;
struct display_timings *timings; struct display_timings *timings;
enum of_gpio_flags flags;
struct atmel_lcdfb_power_ctrl_gpio *og; struct atmel_lcdfb_power_ctrl_gpio *og;
bool is_gpio_power = false; bool is_gpio_power = false;
struct gpio_desc *gpiod;
int ret = -ENOENT; int ret = -ENOENT;
int i, gpio; int i;
sinfo->config = (struct atmel_lcdfb_config*) sinfo->config = (struct atmel_lcdfb_config*)
of_match_device(atmel_lcdfb_dt_ids, dev)->data; 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,28 +1071,22 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
INIT_LIST_HEAD(&pdata->pwr_gpios); INIT_LIST_HEAD(&pdata->pwr_gpios);
ret = -ENOMEM; ret = -ENOMEM;
for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) { for (i = 0; i < gpiod_count(dev, "atmel,power-control"); i++) {
gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio", gpiod = devm_gpiod_get_index(dev, "atmel,power-control",
i, &flags); i, GPIOD_ASIS);
if (gpio < 0) if (IS_ERR(gpiod))
continue; continue;
og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL); og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL);
if (!og) if (!og)
goto put_display_node; goto put_display_node;
og->gpio = gpio; og->gpiod = gpiod;
og->active_low = flags & OF_GPIO_ACTIVE_LOW;
is_gpio_power = true; 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) { 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; goto put_display_node;
} }
list_add(&og->list, &pdata->pwr_gpios); list_add(&og->list, &pdata->pwr_gpios);
......
...@@ -1716,7 +1716,7 @@ static int aty128fb_setup(char *options) ...@@ -1716,7 +1716,7 @@ static int aty128fb_setup(char *options)
continue; continue;
} }
if(!strncmp(this_opt, "nomtrr", 6)) { if(!strncmp(this_opt, "nomtrr", 6)) {
mtrr = 0; mtrr = false;
continue; continue;
} }
#ifdef CONFIG_PPC_PMAC #ifdef CONFIG_PPC_PMAC
......
...@@ -2255,6 +2255,23 @@ static const struct bin_attribute edid2_attr = { ...@@ -2255,6 +2255,23 @@ static const struct bin_attribute edid2_attr = {
.read = radeon_show_edid2, .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, static int radeonfb_pci_register(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
...@@ -2308,6 +2325,10 @@ static int radeonfb_pci_register(struct pci_dev *pdev, ...@@ -2308,6 +2325,10 @@ static int radeonfb_pci_register(struct pci_dev *pdev,
rinfo->fb_base_phys = pci_resource_start (pdev, 0); rinfo->fb_base_phys = pci_resource_start (pdev, 0);
rinfo->mmio_base_phys = pci_resource_start (pdev, 2); rinfo->mmio_base_phys = pci_resource_start (pdev, 2);
ret = radeon_kick_out_firmware_fb(pdev);
if (ret)
return ret;
/* request the mem regions */ /* request the mem regions */
ret = pci_request_region(pdev, 0, "radeonfb framebuffer"); ret = pci_request_region(pdev, 0, "radeonfb framebuffer");
if (ret < 0) { if (ret < 0) {
......
...@@ -410,18 +410,15 @@ static int au1100fb_setup(struct au1100fb_device *fbdev) ...@@ -410,18 +410,15 @@ static int au1100fb_setup(struct au1100fb_device *fbdev)
static int au1100fb_drv_probe(struct platform_device *dev) static int au1100fb_drv_probe(struct platform_device *dev)
{ {
struct au1100fb_device *fbdev = NULL; struct au1100fb_device *fbdev;
struct resource *regs_res; struct resource *regs_res;
unsigned long page; unsigned long page;
struct clk *c; struct clk *c;
/* Allocate new device private */ /* Allocate new device private */
fbdev = devm_kzalloc(&dev->dev, sizeof(struct au1100fb_device), fbdev = devm_kzalloc(&dev->dev, sizeof(*fbdev), GFP_KERNEL);
GFP_KERNEL); if (!fbdev)
if (!fbdev) {
print_err("fail to allocate device private record");
return -ENOMEM; return -ENOMEM;
}
if (au1100fb_setup(fbdev)) if (au1100fb_setup(fbdev))
goto failed; goto failed;
......
...@@ -1960,12 +1960,8 @@ static int __init fsl_diu_init(void) ...@@ -1960,12 +1960,8 @@ static int __init fsl_diu_init(void)
of_node_put(np); of_node_put(np);
coherence_data = vmalloc(coherence_data_size); coherence_data = vmalloc(coherence_data_size);
if (!coherence_data) { if (!coherence_data)
pr_err("fsl-diu-fb: could not allocate coherence data "
"(size=%zu)\n", coherence_data_size);
return -ENOMEM; return -ENOMEM;
}
#endif #endif
ret = platform_driver_register(&fsl_diu_driver); ret = platform_driver_register(&fsl_diu_driver);
......
...@@ -696,10 +696,9 @@ static void* matroxfb_crtc2_probe(struct matrox_fb_info* minfo) { ...@@ -696,10 +696,9 @@ static void* matroxfb_crtc2_probe(struct matrox_fb_info* minfo) {
if (!minfo->devflags.crtc2) if (!minfo->devflags.crtc2)
return NULL; return NULL;
m2info = kzalloc(sizeof(*m2info), GFP_KERNEL); m2info = kzalloc(sizeof(*m2info), GFP_KERNEL);
if (!m2info) { if (!m2info)
printk(KERN_ERR "matroxfb_crtc2: Not enough memory for CRTC2 control structs\n");
return NULL; return NULL;
}
m2info->primary_dev = minfo; m2info->primary_dev = minfo;
if (matroxfb_dh_registerfb(m2info)) { if (matroxfb_dh_registerfb(m2info)) {
kfree(m2info); kfree(m2info);
......
...@@ -280,6 +280,7 @@ static void offb_destroy(struct fb_info *info) ...@@ -280,6 +280,7 @@ static void offb_destroy(struct fb_info *info)
if (info->screen_base) if (info->screen_base)
iounmap(info->screen_base); iounmap(info->screen_base);
release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size);
fb_dealloc_cmap(&info->cmap);
framebuffer_release(info); framebuffer_release(info);
} }
...@@ -518,6 +519,7 @@ static void __init offb_init_fb(const char *name, ...@@ -518,6 +519,7 @@ static void __init offb_init_fb(const char *name,
return; return;
out_err: out_err:
fb_dealloc_cmap(&info->cmap);
iounmap(info->screen_base); iounmap(info->screen_base);
out_aper: out_aper:
iounmap(par->cmap_adr); iounmap(par->cmap_adr);
......
...@@ -1383,11 +1383,9 @@ static int s3c_fb_probe(struct platform_device *pdev) ...@@ -1383,11 +1383,9 @@ static int s3c_fb_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
sfb = devm_kzalloc(dev, sizeof(struct s3c_fb), GFP_KERNEL); sfb = devm_kzalloc(dev, sizeof(*sfb), GFP_KERNEL);
if (!sfb) { if (!sfb)
dev_err(dev, "no memory for framebuffers\n");
return -ENOMEM; return -ENOMEM;
}
dev_dbg(dev, "allocate new framebuffer %p\n", sfb); dev_dbg(dev, "allocate new framebuffer %p\n", sfb);
...@@ -1716,63 +1714,6 @@ static struct s3c_fb_win_variant s3c_fb_data_64xx_wins[] = { ...@@ -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 = { static struct s3c_fb_driverdata s3c_fb_data_64xx = {
.variant = { .variant = {
.nr_windows = 5, .nr_windows = 5,
...@@ -1804,102 +1745,6 @@ static struct s3c_fb_driverdata s3c_fb_data_64xx = { ...@@ -1804,102 +1745,6 @@ static struct s3c_fb_driverdata s3c_fb_data_64xx = {
.win[4] = &s3c_fb_data_64xx_wins[4], .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 */ /* S3C2443/S3C2416 style hardware */
static struct s3c_fb_driverdata s3c_fb_data_s3c2443 = { static struct s3c_fb_driverdata s3c_fb_data_s3c2443 = {
.variant = { .variant = {
...@@ -1941,15 +1786,6 @@ static const struct platform_device_id s3c_fb_driver_ids[] = { ...@@ -1941,15 +1786,6 @@ static const struct platform_device_id s3c_fb_driver_ids[] = {
{ {
.name = "s3c-fb", .name = "s3c-fb",
.driver_data = (unsigned long)&s3c_fb_data_64xx, .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", .name = "s3c2443-fb",
.driver_data = (unsigned long)&s3c_fb_data_s3c2443, .driver_data = (unsigned long)&s3c_fb_data_s3c2443,
......
...@@ -1461,81 +1461,5 @@ static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1640x480_1_H[] = ...@@ -1461,81 +1461,5 @@ static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1640x480_1_H[] =
0x00}} 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 #endif
This diff is collapsed.
This diff is collapsed.
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "vgatypes.h" #include "vgatypes.h"
#include "vstruct.h" #include "vstruct.h"
#include "init.h"
#define VER_MAJOR 1 #define VER_MAJOR 1
#define VER_MINOR 8 #define VER_MINOR 8
...@@ -321,6 +322,85 @@ u8 SiS_GetRegByte(SISIOADDRESS); ...@@ -321,6 +322,85 @@ u8 SiS_GetRegByte(SISIOADDRESS);
u16 SiS_GetRegShort(SISIOADDRESS); u16 SiS_GetRegShort(SISIOADDRESS);
u32 SiS_GetRegLong(SISIOADDRESS); u32 SiS_GetRegLong(SISIOADDRESS);
/* Chrontel TV, DDC and DPMS functions */
/* from init.c */
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
/* MMIO access macros */ /* MMIO access macros */
#define MMIO_IN8(base, offset) readb((base+offset)) #define MMIO_IN8(base, offset) readb((base+offset))
#define MMIO_IN16(base, offset) readw((base+offset)) #define MMIO_IN16(base, offset) readw((base+offset))
...@@ -583,4 +663,55 @@ struct sis_video_info { ...@@ -583,4 +663,55 @@ struct sis_video_info {
struct sis_video_info *next; struct sis_video_info *next;
}; };
/* from sis_accel.c */
extern void fbcon_sis_fillrect(struct fb_info *info,
const struct fb_fillrect *rect);
extern void fbcon_sis_copyarea(struct fb_info *info,
const struct fb_copyarea *area);
extern int fbcon_sis_sync(struct fb_info *info);
/* Internal 2D accelerator functions */
extern int sisfb_initaccel(struct sis_video_info *ivideo);
extern void sisfb_syncaccel(struct sis_video_info *ivideo);
/* Internal general routines */
#ifdef CONFIG_FB_SIS_300
unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg);
void sisfb_write_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg, unsigned int val);
unsigned int sisfb_read_lpc_pci_dword(struct SiS_Private *SiS_Pr, int reg);
#endif
#ifdef CONFIG_FB_SIS_315
void sisfb_write_nbridge_pci_byte(struct SiS_Private *SiS_Pr, int reg, unsigned char val);
unsigned int sisfb_read_mio_pci_word(struct SiS_Private *SiS_Pr, int reg);
#endif
/* SiS-specific exported functions */
void sis_malloc(struct sis_memreq *req);
void sis_malloc_new(struct pci_dev *pdev, struct sis_memreq *req);
void sis_free(u32 base);
void sis_free_new(struct pci_dev *pdev, u32 base);
/* Routines from init.c/init301.c */
extern 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);
extern unsigned short SiS_GetModeID_TV(int VGAEngine, unsigned int VBFlags, int HDisplay,
int VDisplay, int Depth, unsigned int VBFlags2);
extern unsigned short SiS_GetModeID_VGA2(int VGAEngine, unsigned int VBFlags, int HDisplay,
int VDisplay, int Depth, unsigned int VBFlags2);
extern void SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr);
extern bool SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
extern void SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable);
extern void SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable);
extern bool SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr);
extern bool sisfb_gettotalfrommode(struct SiS_Private *SiS_Pr, unsigned char modeno,
int *htotal, int *vtotal, unsigned char rateindex);
extern int sisfb_mode_rate_to_dclock(struct SiS_Private *SiS_Pr,
unsigned char modeno, unsigned char rateindex);
extern int sisfb_mode_rate_to_ddata(struct SiS_Private *SiS_Pr, unsigned char modeno,
unsigned char rateindex, struct fb_var_screeninfo *var);
#endif #endif
...@@ -56,15 +56,66 @@ ...@@ -56,15 +56,66 @@
#include "sis.h" #include "sis.h"
#include "sis_main.h" #include "sis_main.h"
#include "init301.h"
#if !defined(CONFIG_FB_SIS_300) && !defined(CONFIG_FB_SIS_315) #if !defined(CONFIG_FB_SIS_300) && !defined(CONFIG_FB_SIS_315)
#warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set #warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set
#warning sisfb will not work! #warning sisfb will not work!
#endif #endif
/* ---------------------- Prototypes ------------------------- */
/* Interface used by the world */
#ifndef MODULE
static int sisfb_setup(char *options);
#endif
/* Interface to the low level console driver */
static int sisfb_init(void);
/* fbdev routines */
static int sisfb_get_fix(struct fb_fix_screeninfo *fix, int con,
struct fb_info *info);
static int sisfb_ioctl(struct fb_info *info, unsigned int cmd,
unsigned long arg);
static int sisfb_set_par(struct fb_info *info);
static int sisfb_blank(int blank,
struct fb_info *info);
static void sisfb_handle_command(struct sis_video_info *ivideo, static void sisfb_handle_command(struct sis_video_info *ivideo,
struct sisfb_cmd *sisfb_command); struct sisfb_cmd *sisfb_command);
static void sisfb_search_mode(char *name, bool quiet);
static int sisfb_validate_mode(struct sis_video_info *ivideo, int modeindex, u32 vbflags);
static u8 sisfb_search_refresh_rate(struct sis_video_info *ivideo, unsigned int rate,
int index);
static int sisfb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp,
struct fb_info *fb_info);
static int sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
struct fb_info *info);
static void sisfb_pre_setmode(struct sis_video_info *ivideo);
static void sisfb_post_setmode(struct sis_video_info *ivideo);
static bool sisfb_CheckVBRetrace(struct sis_video_info *ivideo);
static bool sisfbcheckvretracecrt2(struct sis_video_info *ivideo);
static bool sisfbcheckvretracecrt1(struct sis_video_info *ivideo);
static bool sisfb_bridgeisslave(struct sis_video_info *ivideo);
static void sisfb_detect_VB_connect(struct sis_video_info *ivideo);
static void sisfb_get_VB_type(struct sis_video_info *ivideo);
static void sisfb_set_TVxposoffset(struct sis_video_info *ivideo, int val);
static void sisfb_set_TVyposoffset(struct sis_video_info *ivideo, int val);
/* Internal heap routines */
static int sisfb_heap_init(struct sis_video_info *ivideo);
static struct SIS_OH * sisfb_poh_new_node(struct SIS_HEAP *memheap);
static struct SIS_OH * sisfb_poh_allocate(struct SIS_HEAP *memheap, u32 size);
static void sisfb_delete_node(struct SIS_OH *poh);
static void sisfb_insert_node(struct SIS_OH *pohList, struct SIS_OH *poh);
static struct SIS_OH * sisfb_poh_free(struct SIS_HEAP *memheap, u32 base);
static void sisfb_free_node(struct SIS_HEAP *memheap, struct SIS_OH *poh);
/* ------------------ Internal helper routines ----------------- */ /* ------------------ Internal helper routines ----------------- */
static void __init static void __init
......
...@@ -661,121 +661,4 @@ static struct _customttable { ...@@ -661,121 +661,4 @@ static struct _customttable {
} }
}; };
/* ---------------------- Prototypes ------------------------- */
/* Interface used by the world */
#ifndef MODULE
static int sisfb_setup(char *options);
#endif #endif
/* Interface to the low level console driver */
static int sisfb_init(void);
/* fbdev routines */
static int sisfb_get_fix(struct fb_fix_screeninfo *fix, int con,
struct fb_info *info);
static int sisfb_ioctl(struct fb_info *info, unsigned int cmd,
unsigned long arg);
static int sisfb_set_par(struct fb_info *info);
static int sisfb_blank(int blank,
struct fb_info *info);
extern void fbcon_sis_fillrect(struct fb_info *info,
const struct fb_fillrect *rect);
extern void fbcon_sis_copyarea(struct fb_info *info,
const struct fb_copyarea *area);
extern int fbcon_sis_sync(struct fb_info *info);
/* Internal 2D accelerator functions */
extern int sisfb_initaccel(struct sis_video_info *ivideo);
extern void sisfb_syncaccel(struct sis_video_info *ivideo);
/* Internal general routines */
static void sisfb_search_mode(char *name, bool quiet);
static int sisfb_validate_mode(struct sis_video_info *ivideo, int modeindex, u32 vbflags);
static u8 sisfb_search_refresh_rate(struct sis_video_info *ivideo, unsigned int rate,
int index);
static int sisfb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp,
struct fb_info *fb_info);
static int sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
struct fb_info *info);
static void sisfb_pre_setmode(struct sis_video_info *ivideo);
static void sisfb_post_setmode(struct sis_video_info *ivideo);
static bool sisfb_CheckVBRetrace(struct sis_video_info *ivideo);
static bool sisfbcheckvretracecrt2(struct sis_video_info *ivideo);
static bool sisfbcheckvretracecrt1(struct sis_video_info *ivideo);
static bool sisfb_bridgeisslave(struct sis_video_info *ivideo);
static void sisfb_detect_VB_connect(struct sis_video_info *ivideo);
static void sisfb_get_VB_type(struct sis_video_info *ivideo);
static void sisfb_set_TVxposoffset(struct sis_video_info *ivideo, int val);
static void sisfb_set_TVyposoffset(struct sis_video_info *ivideo, int val);
#ifdef CONFIG_FB_SIS_300
unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg);
void sisfb_write_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg, unsigned int val);
unsigned int sisfb_read_lpc_pci_dword(struct SiS_Private *SiS_Pr, int reg);
#endif
#ifdef CONFIG_FB_SIS_315
void sisfb_write_nbridge_pci_byte(struct SiS_Private *SiS_Pr, int reg, unsigned char val);
unsigned int sisfb_read_mio_pci_word(struct SiS_Private *SiS_Pr, int reg);
#endif
/* SiS-specific exported functions */
void sis_malloc(struct sis_memreq *req);
void sis_malloc_new(struct pci_dev *pdev, struct sis_memreq *req);
void sis_free(u32 base);
void sis_free_new(struct pci_dev *pdev, u32 base);
/* Internal heap routines */
static int sisfb_heap_init(struct sis_video_info *ivideo);
static struct SIS_OH * sisfb_poh_new_node(struct SIS_HEAP *memheap);
static struct SIS_OH * sisfb_poh_allocate(struct SIS_HEAP *memheap, u32 size);
static void sisfb_delete_node(struct SIS_OH *poh);
static void sisfb_insert_node(struct SIS_OH *pohList, struct SIS_OH *poh);
static struct SIS_OH * sisfb_poh_free(struct SIS_HEAP *memheap, u32 base);
static void sisfb_free_node(struct SIS_HEAP *memheap, struct SIS_OH *poh);
/* Routines from init.c/init301.c */
extern 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);
extern unsigned short SiS_GetModeID_TV(int VGAEngine, unsigned int VBFlags, int HDisplay,
int VDisplay, int Depth, unsigned int VBFlags2);
extern unsigned short SiS_GetModeID_VGA2(int VGAEngine, unsigned int VBFlags, int HDisplay,
int VDisplay, int Depth, unsigned int VBFlags2);
extern void SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr);
extern bool SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
extern void SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable);
extern void SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable);
extern bool SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr);
extern bool sisfb_gettotalfrommode(struct SiS_Private *SiS_Pr, unsigned char modeno,
int *htotal, int *vtotal, unsigned char rateindex);
extern int sisfb_mode_rate_to_dclock(struct SiS_Private *SiS_Pr,
unsigned char modeno, unsigned char rateindex);
extern int sisfb_mode_rate_to_ddata(struct SiS_Private *SiS_Pr, unsigned char modeno,
unsigned char rateindex, struct fb_var_screeninfo *var);
/* Chrontel TV, DDC and DPMS functions */
extern unsigned short SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short reg);
extern void SiS_SetCH700x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val);
extern unsigned short SiS_GetCH701x(struct SiS_Private *SiS_Pr, unsigned short reg);
extern void SiS_SetCH701x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val);
extern void SiS_SetCH70xxANDOR(struct SiS_Private *SiS_Pr, unsigned short reg,
unsigned char myor, unsigned char myand);
extern void SiS_DDC2Delay(struct SiS_Private *SiS_Pr, unsigned int delaytime);
extern void SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo);
extern unsigned short SiS_HandleDDC(struct SiS_Private *SiS_Pr, unsigned int VBFlags, int VGAEngine,
unsigned short adaptnum, unsigned short DDCdatatype, unsigned char *buffer,
unsigned int VBFlags2);
extern unsigned short SiS_ReadDDC1Bit(struct SiS_Private *SiS_Pr);
#ifdef CONFIG_FB_SIS_315
extern void SiS_Chrontel701xBLOn(struct SiS_Private *SiS_Pr);
extern void SiS_Chrontel701xBLOff(struct SiS_Private *SiS_Pr);
#endif
extern void SiS_SiS30xBLOn(struct SiS_Private *SiS_Pr);
extern void SiS_SiS30xBLOff(struct SiS_Private *SiS_Pr);
#endif
...@@ -1293,7 +1293,6 @@ static struct fb_ops ufx_ops = { ...@@ -1293,7 +1293,6 @@ static struct fb_ops ufx_ops = {
* Assumes no active clients have framebuffer open */ * Assumes no active clients have framebuffer open */
static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info) static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info)
{ {
int retval = -ENOMEM;
int old_len = info->fix.smem_len; int old_len = info->fix.smem_len;
int new_len; int new_len;
unsigned char *old_fb = info->screen_base; 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,10 +1307,8 @@ static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info)
* Alloc system memory for virtual framebuffer * Alloc system memory for virtual framebuffer
*/ */
new_fb = vmalloc(new_len); new_fb = vmalloc(new_len);
if (!new_fb) { if (!new_fb)
pr_err("Virtual framebuffer alloc failed"); return -ENOMEM;
goto error;
}
if (info->screen_base) { if (info->screen_base) {
memcpy(new_fb, old_fb, old_len); 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,11 +1320,7 @@ static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info)
info->fix.smem_start = (unsigned long) new_fb; info->fix.smem_start = (unsigned long) new_fb;
info->flags = smscufx_info_flags; info->flags = smscufx_info_flags;
} }
return 0;
retval = 0;
error:
return retval;
} }
/* sets up I2C Controller for 100 Kbps, std. speed, 7-bit addr, master, /* 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,8 +1613,8 @@ static int ufx_usb_probe(struct usb_interface *interface,
{ {
struct usb_device *usbdev; struct usb_device *usbdev;
struct ufx_data *dev; struct ufx_data *dev;
struct fb_info *info = NULL; struct fb_info *info;
int retval = -ENOMEM; int retval;
u32 id_rev, fpga_rev; u32 id_rev, fpga_rev;
/* usb initialization */ /* usb initialization */
...@@ -1631,7 +1624,7 @@ static int ufx_usb_probe(struct usb_interface *interface, ...@@ -1631,7 +1624,7 @@ static int ufx_usb_probe(struct usb_interface *interface,
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (dev == NULL) { if (dev == NULL) {
dev_err(&usbdev->dev, "ufx_usb_probe: failed alloc of dev struct\n"); dev_err(&usbdev->dev, "ufx_usb_probe: failed alloc of dev struct\n");
goto error; return -ENOMEM;
} }
/* we need to wait for both usb and fbdev to spin down on disconnect */ /* 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,9 +1645,8 @@ static int ufx_usb_probe(struct usb_interface *interface,
dev_dbg(dev->gdev, "fb_defio enable=%d\n", fb_defio); dev_dbg(dev->gdev, "fb_defio enable=%d\n", fb_defio);
if (!ufx_alloc_urb_list(dev, WRITES_IN_FLIGHT, MAX_TRANSFER)) { if (!ufx_alloc_urb_list(dev, WRITES_IN_FLIGHT, MAX_TRANSFER)) {
retval = -ENOMEM;
dev_err(dev->gdev, "ufx_alloc_urb_list failed\n"); dev_err(dev->gdev, "ufx_alloc_urb_list failed\n");
goto error; goto e_nomem;
} }
/* We don't register a new USB class. Our client interface is fbdev */ /* 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,9 +1654,8 @@ static int ufx_usb_probe(struct usb_interface *interface,
/* allocates framebuffer driver structure, not framebuffer memory */ /* allocates framebuffer driver structure, not framebuffer memory */
info = framebuffer_alloc(0, &usbdev->dev); info = framebuffer_alloc(0, &usbdev->dev);
if (!info) { if (!info) {
retval = -ENOMEM;
dev_err(dev->gdev, "framebuffer_alloc failed\n"); dev_err(dev->gdev, "framebuffer_alloc failed\n");
goto error; goto e_nomem;
} }
dev->info = info; dev->info = info;
...@@ -1675,7 +1666,7 @@ static int ufx_usb_probe(struct usb_interface *interface, ...@@ -1675,7 +1666,7 @@ static int ufx_usb_probe(struct usb_interface *interface,
retval = fb_alloc_cmap(&info->cmap, 256, 0); retval = fb_alloc_cmap(&info->cmap, 256, 0);
if (retval < 0) { if (retval < 0) {
dev_err(dev->gdev, "fb_alloc_cmap failed %x\n", retval); dev_err(dev->gdev, "fb_alloc_cmap failed %x\n", retval);
goto error; goto destroy_modedb;
} }
INIT_DELAYED_WORK(&dev->free_framebuffer_work, INIT_DELAYED_WORK(&dev->free_framebuffer_work,
...@@ -1736,26 +1727,20 @@ static int ufx_usb_probe(struct usb_interface *interface, ...@@ -1736,26 +1727,20 @@ static int ufx_usb_probe(struct usb_interface *interface,
return 0; return 0;
error: error:
if (dev) {
if (info) {
if (info->cmap.len != 0)
fb_dealloc_cmap(&info->cmap); fb_dealloc_cmap(&info->cmap);
if (info->monspecs.modedb) destroy_modedb:
fb_destroy_modedb(info->monspecs.modedb); fb_destroy_modedb(info->monspecs.modedb);
vfree(info->screen_base); vfree(info->screen_base);
fb_destroy_modelist(&info->modelist); fb_destroy_modelist(&info->modelist);
framebuffer_release(info); framebuffer_release(info);
} put_ref:
kref_put(&dev->kref, ufx_free); /* ref for framebuffer */ kref_put(&dev->kref, ufx_free); /* ref for framebuffer */
kref_put(&dev->kref, ufx_free); /* last ref from kref_init */ kref_put(&dev->kref, ufx_free); /* last ref from kref_init */
/* dev has been deallocated. Do not dereference */
}
return retval; return retval;
e_nomem:
retval = -ENOMEM;
goto put_ref;
} }
static void ufx_usb_disconnect(struct usb_interface *interface) static void ufx_usb_disconnect(struct usb_interface *interface)
......
...@@ -628,7 +628,8 @@ static int ssd1307fb_probe(struct i2c_client *client, ...@@ -628,7 +628,8 @@ static int ssd1307fb_probe(struct i2c_client *client,
goto fb_alloc_error; goto fb_alloc_error;
} }
ssd1307fb_defio = devm_kzalloc(&client->dev, sizeof(struct fb_deferred_io), GFP_KERNEL); ssd1307fb_defio = devm_kzalloc(&client->dev, sizeof(*ssd1307fb_defio),
GFP_KERNEL);
if (!ssd1307fb_defio) { if (!ssd1307fb_defio) {
dev_err(&client->dev, "Couldn't allocate deferred io.\n"); dev_err(&client->dev, "Couldn't allocate deferred io.\n");
ret = -ENOMEM; ret = -ENOMEM;
......
...@@ -1126,10 +1126,8 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) ...@@ -1126,10 +1126,8 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
int bpp, xres, yres; int bpp, xres, yres;
fb = kzalloc(sizeof(*fb), GFP_ATOMIC); fb = kzalloc(sizeof(*fb), GFP_ATOMIC);
if (!fb) { if (!fb)
printk(KERN_ERR "stifb: Could not allocate stifb structure\n"); return -ENOMEM;
return -ENODEV;
}
info = &fb->info; info = &fb->info;
......
...@@ -428,7 +428,6 @@ static void dlfb_compress_hline( ...@@ -428,7 +428,6 @@ static void dlfb_compress_hline(
const uint16_t *pixel = *pixel_start_ptr; const uint16_t *pixel = *pixel_start_ptr;
uint32_t dev_addr = *device_address_ptr; uint32_t dev_addr = *device_address_ptr;
uint8_t *cmd = *command_buffer_ptr; uint8_t *cmd = *command_buffer_ptr;
const int bpp = 2;
while ((pixel_end > pixel) && while ((pixel_end > pixel) &&
(cmd_buffer_end - MIN_RLX_CMD_BYTES > cmd)) { (cmd_buffer_end - MIN_RLX_CMD_BYTES > cmd)) {
...@@ -441,9 +440,9 @@ static void dlfb_compress_hline( ...@@ -441,9 +440,9 @@ static void dlfb_compress_hline(
*cmd++ = 0xAF; *cmd++ = 0xAF;
*cmd++ = 0x6B; *cmd++ = 0x6B;
*cmd++ = (uint8_t) ((dev_addr >> 16) & 0xFF); *cmd++ = dev_addr >> 16;
*cmd++ = (uint8_t) ((dev_addr >> 8) & 0xFF); *cmd++ = dev_addr >> 8;
*cmd++ = (uint8_t) ((dev_addr) & 0xFF); *cmd++ = dev_addr;
cmd_pixels_count_byte = cmd++; /* we'll know this later */ cmd_pixels_count_byte = cmd++; /* we'll know this later */
cmd_pixel_start = pixel; cmd_pixel_start = pixel;
...@@ -453,15 +452,15 @@ static void dlfb_compress_hline( ...@@ -453,15 +452,15 @@ static void dlfb_compress_hline(
cmd_pixel_end = pixel + min(MAX_CMD_PIXELS + 1, cmd_pixel_end = pixel + min(MAX_CMD_PIXELS + 1,
min((int)(pixel_end - pixel), min((int)(pixel_end - pixel),
(int)(cmd_buffer_end - cmd) / bpp)); (int)(cmd_buffer_end - cmd) / BPP));
prefetch_range((void *) pixel, (cmd_pixel_end - pixel) * bpp); prefetch_range((void *) pixel, (cmd_pixel_end - pixel) * BPP);
while (pixel < cmd_pixel_end) { while (pixel < cmd_pixel_end) {
const uint16_t * const repeating_pixel = pixel; const uint16_t * const repeating_pixel = pixel;
*(uint16_t *)cmd = cpu_to_be16p(pixel); *cmd++ = *pixel >> 8;
cmd += 2; *cmd++ = *pixel;
pixel++; pixel++;
if (unlikely((pixel < cmd_pixel_end) && if (unlikely((pixel < cmd_pixel_end) &&
...@@ -490,7 +489,7 @@ static void dlfb_compress_hline( ...@@ -490,7 +489,7 @@ static void dlfb_compress_hline(
} }
*cmd_pixels_count_byte = (pixel - cmd_pixel_start) & 0xFF; *cmd_pixels_count_byte = (pixel - cmd_pixel_start) & 0xFF;
dev_addr += (pixel - cmd_pixel_start) * bpp; dev_addr += (pixel - cmd_pixel_start) * BPP;
} }
if (cmd_buffer_end <= MIN_RLX_CMD_BYTES + cmd) { if (cmd_buffer_end <= MIN_RLX_CMD_BYTES + cmd) {
...@@ -1136,7 +1135,6 @@ static struct fb_ops dlfb_ops = { ...@@ -1136,7 +1135,6 @@ static struct fb_ops dlfb_ops = {
*/ */
static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info) static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info)
{ {
int retval = -ENOMEM;
int old_len = info->fix.smem_len; int old_len = info->fix.smem_len;
int new_len; int new_len;
unsigned char *old_fb = info->screen_base; 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,7 +1150,7 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info
new_fb = vmalloc(new_len); new_fb = vmalloc(new_len);
if (!new_fb) { if (!new_fb) {
dev_err(info->dev, "Virtual framebuffer alloc failed\n"); dev_err(info->dev, "Virtual framebuffer alloc failed\n");
goto error; return -ENOMEM;
} }
if (info->screen_base) { if (info->screen_base) {
...@@ -1181,11 +1179,7 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info ...@@ -1181,11 +1179,7 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dlfb, struct fb_info *info
dlfb->backing_buffer = new_back; dlfb->backing_buffer = new_back;
} }
} }
return 0;
retval = 0;
error:
return retval;
} }
/* /*
...@@ -1531,15 +1525,16 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dlfb, ...@@ -1531,15 +1525,16 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dlfb,
u8 length; u8 length;
u16 key; u16 key;
key = le16_to_cpu(*((u16 *) desc)); key = *desc++;
desc += sizeof(u16); key |= (u16)*desc++ << 8;
length = *desc; length = *desc++;
desc++;
switch (key) { switch (key) {
case 0x0200: { /* max_area */ case 0x0200: { /* max_area */
u32 max_area; u32 max_area = *desc++;
max_area = le32_to_cpu(*((u32 *)desc)); max_area |= (u32)*desc++ << 8;
max_area |= (u32)*desc++ << 16;
max_area |= (u32)*desc++ << 24;
dev_warn(&intf->dev, dev_warn(&intf->dev,
"DL chip limited to %d pixel modes\n", "DL chip limited to %d pixel modes\n",
max_area); max_area);
......
...@@ -651,7 +651,7 @@ static int vmlfb_check_var_locked(struct fb_var_screeninfo *var, ...@@ -651,7 +651,7 @@ static int vmlfb_check_var_locked(struct fb_var_screeninfo *var,
} }
pitch = ALIGN((var->xres * var->bits_per_pixel) >> 3, 0x40); pitch = ALIGN((var->xres * var->bits_per_pixel) >> 3, 0x40);
mem = pitch * var->yres_virtual; mem = (u64)pitch * var->yres_virtual;
if (mem > vinfo->vram_contig_size) { if (mem > vinfo->vram_contig_size) {
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -36,7 +36,7 @@ static void probe(struct via_aux_bus *bus, u8 addr) ...@@ -36,7 +36,7 @@ static void probe(struct via_aux_bus *bus, u8 addr)
.name = name}; .name = name};
/* check vendor id and device id */ /* check vendor id and device id */
const u8 id[] = {0x01, 0x00, 0x06, 0x00}, len = ARRAY_SIZE(id); const u8 id[] = {0x01, 0x00, 0x06, 0x00}, len = ARRAY_SIZE(id);
u8 tmp[len]; u8 tmp[ARRAY_SIZE(id)];
if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len)) if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
return; return;
......
...@@ -36,7 +36,7 @@ void via_aux_vt1631_probe(struct via_aux_bus *bus) ...@@ -36,7 +36,7 @@ void via_aux_vt1631_probe(struct via_aux_bus *bus)
.name = name}; .name = name};
/* check vendor id and device id */ /* check vendor id and device id */
const u8 id[] = {0x06, 0x11, 0x91, 0x31}, len = ARRAY_SIZE(id); const u8 id[] = {0x06, 0x11, 0x91, 0x31}, len = ARRAY_SIZE(id);
u8 tmp[len]; u8 tmp[ARRAY_SIZE(id)];
if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len)) if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
return; return;
......
...@@ -36,7 +36,7 @@ static void probe(struct via_aux_bus *bus, u8 addr) ...@@ -36,7 +36,7 @@ static void probe(struct via_aux_bus *bus, u8 addr)
.name = name}; .name = name};
/* check vendor id and device id */ /* check vendor id and device id */
const u8 id[] = {0x06, 0x11, 0x92, 0x31}, len = ARRAY_SIZE(id); const u8 id[] = {0x06, 0x11, 0x92, 0x31}, len = ARRAY_SIZE(id);
u8 tmp[len]; u8 tmp[ARRAY_SIZE(id)];
if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len)) if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
return; return;
......
...@@ -36,7 +36,7 @@ void via_aux_vt1636_probe(struct via_aux_bus *bus) ...@@ -36,7 +36,7 @@ void via_aux_vt1636_probe(struct via_aux_bus *bus)
.name = name}; .name = name};
/* check vendor id and device id */ /* check vendor id and device id */
const u8 id[] = {0x06, 0x11, 0x45, 0x33}, len = ARRAY_SIZE(id); const u8 id[] = {0x06, 0x11, 0x45, 0x33}, len = ARRAY_SIZE(id);
u8 tmp[len]; u8 tmp[ARRAY_SIZE(id)];
if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len)) if (!via_aux_read(&drv, 0x00, tmp, len) || memcmp(id, tmp, len))
return; return;
......
...@@ -244,23 +244,3 @@ struct display_timings *of_get_display_timings(const struct device_node *np) ...@@ -244,23 +244,3 @@ struct display_timings *of_get_display_timings(const struct device_node *np)
return NULL; return NULL;
} }
EXPORT_SYMBOL_GPL(of_get_display_timings); EXPORT_SYMBOL_GPL(of_get_display_timings);
/**
* of_display_timings_exist - check if a display-timings node is provided
* @np: device_node with the timing
**/
int of_display_timings_exist(const struct device_node *np)
{
struct device_node *timings_np;
if (!np)
return -EINVAL;
timings_np = of_parse_phandle(np, "display-timings", 0);
if (!timings_np)
return -EINVAL;
of_node_put(timings_np);
return 1;
}
EXPORT_SYMBOL_GPL(of_display_timings_exist);
...@@ -19,7 +19,6 @@ struct display_timings; ...@@ -19,7 +19,6 @@ struct display_timings;
int of_get_display_timing(const struct device_node *np, const char *name, int of_get_display_timing(const struct device_node *np, const char *name,
struct display_timing *dt); struct display_timing *dt);
struct display_timings *of_get_display_timings(const struct device_node *np); struct display_timings *of_get_display_timings(const struct device_node *np);
int of_display_timings_exist(const struct device_node *np);
#else #else
static inline int of_get_display_timing(const struct device_node *np, static inline int of_get_display_timing(const struct device_node *np,
const char *name, struct display_timing *dt) const char *name, struct display_timing *dt)
...@@ -31,10 +30,6 @@ of_get_display_timings(const struct device_node *np) ...@@ -31,10 +30,6 @@ of_get_display_timings(const struct device_node *np)
{ {
return NULL; return NULL;
} }
static inline int of_display_timings_exist(const struct device_node *np)
{
return -ENOSYS;
}
#endif #endif
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment