Skip to content
Snippets Groups Projects
Commit a4e2f522 authored by Thomas Zimmermann's avatar Thomas Zimmermann
Browse files

staging/tgui: Update tridentfb driver code to work with DRM

parent 18388f97
No related branches found
No related merge requests found
......@@ -6,6 +6,11 @@ config DRM_TGUI
select DRM_FBCONV_HELPER
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
select FB_CFB_COPYAREA
select FB_CFB_FILLRECT
select FB_CFB_IMAGEBLIT
select FB_DDC
select FB_MODE_HELPERS
help
This is the frame buffer device driver for Trident PCI/AGP chipsets.
Supported chipset families are TGUI 9440/96XX, 3DImage, Blade3D
......
......@@ -2,4 +2,8 @@
tgui-y := tgui_drv.o
# Old tridentfb driver code. Keep this separate and
# remove it after conversion.
tgui-y += tridentfb.o
obj-$(CONFIG_DRM_TGUI) += tgui.o
......@@ -29,6 +29,8 @@
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include "tgui_drv.h"
struct tridentfb_par {
void __iomem *io_virt; /* iospace virtual memory address */
u32 pseudo_pal[16];
......@@ -1456,6 +1458,16 @@ static struct fb_ops tridentfb_ops = {
.fb_sync = tridentfb_sync,
};
struct tgui_pci_data {
struct tridentfb_par par; /* keep this field at beginning */
struct tgui_device *tdev;
};
static struct tgui_pci_data* tgui_pci_data_of_par(struct tridentfb_par *par)
{
return container_of(par, struct tgui_pci_data, par);
}
static int trident_pci_probe(struct pci_dev *dev,
const struct pci_device_id *id)
{
......@@ -1466,12 +1478,14 @@ static int trident_pci_probe(struct pci_dev *dev,
int chip3D;
int chip_id;
bool found = false;
struct tgui_pci_data *pdata;
struct tgui_device *tdev;
err = pci_enable_device(dev);
if (err)
return err;
info = framebuffer_alloc(sizeof(struct tridentfb_par), &dev->dev);
info = framebuffer_alloc(sizeof(struct tgui_pci_data), &dev->dev);
if (!info)
return -ENOMEM;
default_par = info->par;
......@@ -1688,12 +1702,16 @@ static int trident_pci_probe(struct pci_dev *dev,
info->var.activate |= FB_ACTIVATE_NOW;
info->device = &dev->dev;
if (register_framebuffer(info) < 0) {
tdev = tgui_register_framebuffer(info, dev);
if (IS_ERR(tdev)) {
printk(KERN_ERR "tridentfb: could not register framebuffer\n");
fb_dealloc_cmap(&info->cmap);
err = -EINVAL;
goto out_unmap2;
}
pdata = tgui_pci_data_of_par(info->par);
pdata->tdev = tdev;
output("fb%d: %s frame buffer device %dx%d-%dbpp\n",
info->node, info->fix.id, info->var.xres,
info->var.yres, info->var.bits_per_pixel);
......@@ -1721,8 +1739,10 @@ static void trident_pci_remove(struct pci_dev *dev)
{
struct fb_info *info = pci_get_drvdata(dev);
struct tridentfb_par *par = info->par;
struct tgui_pci_data *pdata = tgui_pci_data_of_par(par);
struct tgui_device *tdev = pdata->tdev;
unregister_framebuffer(info);
tgui_unregister_framebuffer(tdev);
if (par->ddc_registered)
i2c_del_adapter(&par->ddc_adapter);
iounmap(par->io_virt);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment