diff options
Diffstat (limited to 'drivers/video/via/viafbdev.c')
-rw-r--r-- | drivers/video/via/viafbdev.c | 54 |
1 files changed, 23 insertions, 31 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index 17a874f6ea1c..70ed71facd87 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/stat.h> | 24 | #include <linux/stat.h> |
25 | #define _MASTER_FILE | 25 | #define _MASTER_FILE |
26 | 26 | ||
27 | #include "via-core.h" | ||
27 | #include "global.h" | 28 | #include "global.h" |
28 | 29 | ||
29 | static char *viafb_name = "Via"; | 30 | static char *viafb_name = "Via"; |
@@ -220,7 +221,7 @@ static int viafb_check_var(struct fb_var_screeninfo *var, | |||
220 | /* Adjust var according to our driver's own table */ | 221 | /* Adjust var according to our driver's own table */ |
221 | viafb_fill_var_timing_info(var, viafb_refresh, vmode_entry); | 222 | viafb_fill_var_timing_info(var, viafb_refresh, vmode_entry); |
222 | if (info->var.accel_flags & FB_ACCELF_TEXT && | 223 | if (info->var.accel_flags & FB_ACCELF_TEXT && |
223 | !ppar->shared->engine_mmio) | 224 | !ppar->shared->vdev->engine_mmio) |
224 | info->var.accel_flags = 0; | 225 | info->var.accel_flags = 0; |
225 | 226 | ||
226 | return 0; | 227 | return 0; |
@@ -695,7 +696,7 @@ static void viafb_fillrect(struct fb_info *info, | |||
695 | rop = 0xF0; | 696 | rop = 0xF0; |
696 | 697 | ||
697 | DEBUG_MSG(KERN_DEBUG "viafb 2D engine: fillrect\n"); | 698 | DEBUG_MSG(KERN_DEBUG "viafb 2D engine: fillrect\n"); |
698 | if (shared->hw_bitblt(shared->engine_mmio, VIA_BITBLT_FILL, | 699 | if (shared->hw_bitblt(shared->vdev->engine_mmio, VIA_BITBLT_FILL, |
699 | rect->width, rect->height, info->var.bits_per_pixel, | 700 | rect->width, rect->height, info->var.bits_per_pixel, |
700 | viapar->vram_addr, info->fix.line_length, rect->dx, rect->dy, | 701 | viapar->vram_addr, info->fix.line_length, rect->dx, rect->dy, |
701 | NULL, 0, 0, 0, 0, fg_color, 0, rop)) | 702 | NULL, 0, 0, 0, 0, fg_color, 0, rop)) |
@@ -717,7 +718,7 @@ static void viafb_copyarea(struct fb_info *info, | |||
717 | return; | 718 | return; |
718 | 719 | ||
719 | DEBUG_MSG(KERN_DEBUG "viafb 2D engine: copyarea\n"); | 720 | DEBUG_MSG(KERN_DEBUG "viafb 2D engine: copyarea\n"); |
720 | if (shared->hw_bitblt(shared->engine_mmio, VIA_BITBLT_COLOR, | 721 | if (shared->hw_bitblt(shared->vdev->engine_mmio, VIA_BITBLT_COLOR, |
721 | area->width, area->height, info->var.bits_per_pixel, | 722 | area->width, area->height, info->var.bits_per_pixel, |
722 | viapar->vram_addr, info->fix.line_length, area->dx, area->dy, | 723 | viapar->vram_addr, info->fix.line_length, area->dx, area->dy, |
723 | NULL, viapar->vram_addr, info->fix.line_length, | 724 | NULL, viapar->vram_addr, info->fix.line_length, |
@@ -754,7 +755,7 @@ static void viafb_imageblit(struct fb_info *info, | |||
754 | op = VIA_BITBLT_COLOR; | 755 | op = VIA_BITBLT_COLOR; |
755 | 756 | ||
756 | DEBUG_MSG(KERN_DEBUG "viafb 2D engine: imageblit\n"); | 757 | DEBUG_MSG(KERN_DEBUG "viafb 2D engine: imageblit\n"); |
757 | if (shared->hw_bitblt(shared->engine_mmio, op, | 758 | if (shared->hw_bitblt(shared->vdev->engine_mmio, op, |
758 | image->width, image->height, info->var.bits_per_pixel, | 759 | image->width, image->height, info->var.bits_per_pixel, |
759 | viapar->vram_addr, info->fix.line_length, image->dx, image->dy, | 760 | viapar->vram_addr, info->fix.line_length, image->dx, image->dy, |
760 | (u32 *)image->data, 0, 0, 0, 0, fg_color, bg_color, 0)) | 761 | (u32 *)image->data, 0, 0, 0, 0, fg_color, bg_color, 0)) |
@@ -764,7 +765,7 @@ static void viafb_imageblit(struct fb_info *info, | |||
764 | static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor) | 765 | static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor) |
765 | { | 766 | { |
766 | struct viafb_par *viapar = info->par; | 767 | struct viafb_par *viapar = info->par; |
767 | void __iomem *engine = viapar->shared->engine_mmio; | 768 | void __iomem *engine = viapar->shared->vdev->engine_mmio; |
768 | u32 temp, xx, yy, bg_color = 0, fg_color = 0, | 769 | u32 temp, xx, yy, bg_color = 0, fg_color = 0, |
769 | chip_name = viapar->shared->chip_info.gfx_chip_name; | 770 | chip_name = viapar->shared->chip_info.gfx_chip_name; |
770 | int i, j = 0, cur_size = 64; | 771 | int i, j = 0, cur_size = 64; |
@@ -1732,8 +1733,7 @@ static int parse_mode(const char *str, u32 *xres, u32 *yres) | |||
1732 | } | 1733 | } |
1733 | 1734 | ||
1734 | 1735 | ||
1735 | int __devinit via_fb_pci_probe(struct pci_dev *pdev, | 1736 | int __devinit via_fb_pci_probe(struct viafb_dev *vdev) |
1736 | const struct pci_device_id *ent) | ||
1737 | { | 1737 | { |
1738 | u32 default_xres, default_yres; | 1738 | u32 default_xres, default_yres; |
1739 | struct VideoModeTable *vmode_entry; | 1739 | struct VideoModeTable *vmode_entry; |
@@ -1750,7 +1750,7 @@ int __devinit via_fb_pci_probe(struct pci_dev *pdev, | |||
1750 | */ | 1750 | */ |
1751 | viafbinfo = framebuffer_alloc(viafb_par_length + | 1751 | viafbinfo = framebuffer_alloc(viafb_par_length + |
1752 | ALIGN(sizeof(struct viafb_shared), BITS_PER_LONG/8), | 1752 | ALIGN(sizeof(struct viafb_shared), BITS_PER_LONG/8), |
1753 | &pdev->dev); | 1753 | &vdev->pdev->dev); |
1754 | if (!viafbinfo) { | 1754 | if (!viafbinfo) { |
1755 | printk(KERN_ERR"Could not allocate memory for viafb_info.\n"); | 1755 | printk(KERN_ERR"Could not allocate memory for viafb_info.\n"); |
1756 | return -ENOMEM; | 1756 | return -ENOMEM; |
@@ -1758,6 +1758,7 @@ int __devinit via_fb_pci_probe(struct pci_dev *pdev, | |||
1758 | 1758 | ||
1759 | viaparinfo = (struct viafb_par *)viafbinfo->par; | 1759 | viaparinfo = (struct viafb_par *)viafbinfo->par; |
1760 | viaparinfo->shared = viafbinfo->par + viafb_par_length; | 1760 | viaparinfo->shared = viafbinfo->par + viafb_par_length; |
1761 | viaparinfo->shared->vdev = vdev; | ||
1761 | viaparinfo->vram_addr = 0; | 1762 | viaparinfo->vram_addr = 0; |
1762 | viaparinfo->tmds_setting_info = &viaparinfo->shared->tmds_setting_info; | 1763 | viaparinfo->tmds_setting_info = &viaparinfo->shared->tmds_setting_info; |
1763 | viaparinfo->lvds_setting_info = &viaparinfo->shared->lvds_setting_info; | 1764 | viaparinfo->lvds_setting_info = &viaparinfo->shared->lvds_setting_info; |
@@ -1765,7 +1766,6 @@ int __devinit via_fb_pci_probe(struct pci_dev *pdev, | |||
1765 | &viaparinfo->shared->lvds_setting_info2; | 1766 | &viaparinfo->shared->lvds_setting_info2; |
1766 | viaparinfo->crt_setting_info = &viaparinfo->shared->crt_setting_info; | 1767 | viaparinfo->crt_setting_info = &viaparinfo->shared->crt_setting_info; |
1767 | viaparinfo->chip_info = &viaparinfo->shared->chip_info; | 1768 | viaparinfo->chip_info = &viaparinfo->shared->chip_info; |
1768 | spin_lock_init(&viaparinfo->reg_lock); | ||
1769 | 1769 | ||
1770 | if (viafb_dual_fb) | 1770 | if (viafb_dual_fb) |
1771 | viafb_SAMM_ON = 1; | 1771 | viafb_SAMM_ON = 1; |
@@ -1776,25 +1776,20 @@ int __devinit via_fb_pci_probe(struct pci_dev *pdev, | |||
1776 | if (!viafb_SAMM_ON) | 1776 | if (!viafb_SAMM_ON) |
1777 | viafb_dual_fb = 0; | 1777 | viafb_dual_fb = 0; |
1778 | 1778 | ||
1779 | viafb_init_chip_info(pdev, ent); | 1779 | viafb_init_chip_info(vdev->chip_type); |
1780 | viaparinfo->fbmem = pci_resource_start(pdev, 0); | 1780 | /* |
1781 | viaparinfo->memsize = viafb_get_fb_size_from_pci(); | 1781 | * The framebuffer will have been successfully mapped by |
1782 | if (viaparinfo->memsize < 0) { | 1782 | * the core (or we'd not be here), but we still need to |
1783 | rc = viaparinfo->memsize; | 1783 | * set up our own accounting. |
1784 | goto out_fb_release; | 1784 | */ |
1785 | } | 1785 | viaparinfo->fbmem = vdev->fbmem_start; |
1786 | viaparinfo->memsize = vdev->fbmem_len; | ||
1786 | viaparinfo->fbmem_free = viaparinfo->memsize; | 1787 | viaparinfo->fbmem_free = viaparinfo->memsize; |
1787 | viaparinfo->fbmem_used = 0; | 1788 | viaparinfo->fbmem_used = 0; |
1788 | viafbinfo->screen_base = ioremap_nocache(viaparinfo->fbmem, | 1789 | viafbinfo->screen_base = vdev->fbmem; |
1789 | viaparinfo->memsize); | ||
1790 | if (!viafbinfo->screen_base) { | ||
1791 | printk(KERN_ERR "ioremap of fbmem failed\n"); | ||
1792 | rc = -ENOMEM; | ||
1793 | goto out_fb_release; | ||
1794 | } | ||
1795 | 1790 | ||
1796 | viafbinfo->fix.mmio_start = pci_resource_start(pdev, 1); | 1791 | viafbinfo->fix.mmio_start = vdev->engine_start; |
1797 | viafbinfo->fix.mmio_len = pci_resource_len(pdev, 1); | 1792 | viafbinfo->fix.mmio_len = vdev->engine_len; |
1798 | viafbinfo->node = 0; | 1793 | viafbinfo->node = 0; |
1799 | viafbinfo->fbops = &viafb_ops; | 1794 | viafbinfo->fbops = &viafb_ops; |
1800 | viafbinfo->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; | 1795 | viafbinfo->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; |
@@ -1862,12 +1857,13 @@ int __devinit via_fb_pci_probe(struct pci_dev *pdev, | |||
1862 | viafbinfo->var = default_var; | 1857 | viafbinfo->var = default_var; |
1863 | 1858 | ||
1864 | if (viafb_dual_fb) { | 1859 | if (viafb_dual_fb) { |
1865 | viafbinfo1 = framebuffer_alloc(viafb_par_length, &pdev->dev); | 1860 | viafbinfo1 = framebuffer_alloc(viafb_par_length, |
1861 | &vdev->pdev->dev); | ||
1866 | if (!viafbinfo1) { | 1862 | if (!viafbinfo1) { |
1867 | printk(KERN_ERR | 1863 | printk(KERN_ERR |
1868 | "allocate the second framebuffer struct error\n"); | 1864 | "allocate the second framebuffer struct error\n"); |
1869 | rc = -ENOMEM; | 1865 | rc = -ENOMEM; |
1870 | goto out_unmap_screen; | 1866 | goto out_fb_release; |
1871 | } | 1867 | } |
1872 | viaparinfo1 = viafbinfo1->par; | 1868 | viaparinfo1 = viafbinfo1->par; |
1873 | memcpy(viaparinfo1, viaparinfo, viafb_par_length); | 1869 | memcpy(viaparinfo1, viaparinfo, viafb_par_length); |
@@ -1958,8 +1954,6 @@ out_dealloc_cmap: | |||
1958 | out_fb1_release: | 1954 | out_fb1_release: |
1959 | if (viafbinfo1) | 1955 | if (viafbinfo1) |
1960 | framebuffer_release(viafbinfo1); | 1956 | framebuffer_release(viafbinfo1); |
1961 | out_unmap_screen: | ||
1962 | iounmap(viafbinfo->screen_base); | ||
1963 | out_fb_release: | 1957 | out_fb_release: |
1964 | framebuffer_release(viafbinfo); | 1958 | framebuffer_release(viafbinfo); |
1965 | return rc; | 1959 | return rc; |
@@ -1972,8 +1966,6 @@ void __devexit via_fb_pci_remove(struct pci_dev *pdev) | |||
1972 | unregister_framebuffer(viafbinfo); | 1966 | unregister_framebuffer(viafbinfo); |
1973 | if (viafb_dual_fb) | 1967 | if (viafb_dual_fb) |
1974 | unregister_framebuffer(viafbinfo1); | 1968 | unregister_framebuffer(viafbinfo1); |
1975 | iounmap((void *)viafbinfo->screen_base); | ||
1976 | iounmap(viaparinfo->shared->engine_mmio); | ||
1977 | 1969 | ||
1978 | framebuffer_release(viafbinfo); | 1970 | framebuffer_release(viafbinfo); |
1979 | if (viafb_dual_fb) | 1971 | if (viafb_dual_fb) |