@@ -205,6 +205,72 @@ void sysfb_taint(struct sysfb_device *sdev, bool set)
}
EXPORT_SYMBOL(sysfb_taint);
+static void sysfb_dev_release(struct device *dev)
+{
+ struct sysfb_device *sdev = to_sysfb_device(dev);
+
+ kfree(sdev);
+}
+
+static struct sysfb_device *sysfb_dev_new(struct device *parent)
+{
+ struct sysfb_device *sdev;
+
+ sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
+ if (!sdev)
+ return NULL;
+
+ device_initialize(&sdev->dev);
+ sdev->dev.release = sysfb_dev_release;
+ sdev->dev.bus = &sysfb_bus_type;
+ sdev->dev.parent = parent;
+
+ return sdev;
+}
+
+static int sysfb_vbe_probe(struct platform_device *pdev)
+{
+ int ret;
+ struct sysfb_device *sdev;
+
+ sdev = sysfb_dev_new(&pdev->dev);
+ if (!sdev)
+ return -ENOMEM;
+
+ dev_set_name(&sdev->dev, "vbefb");
+ sdev->type = SYSFB_VBE;
+ sdev->screen = pdev->dev.platform_data;
+
+ ret = device_add(&sdev->dev);
+ if (ret)
+ goto err_free;
+
+ platform_set_drvdata(pdev, sdev);
+ return 0;
+
+err_free:
+ put_device(&sdev->dev);
+ return ret;
+}
+
+static int sysfb_vbe_remove(struct platform_device *pdev)
+{
+ struct sysfb_device *sdev = platform_get_drvdata(pdev);
+
+ device_del(&sdev->dev);
+ put_device(&sdev->dev);
+ return 0;
+}
+
+static struct platform_driver sysfb_vbe_driver = {
+ .driver = {
+ .name = "vbefb",
+ .owner = THIS_MODULE,
+ },
+ .probe = sysfb_vbe_probe,
+ .remove = sysfb_vbe_remove,
+};
+
static int __init sysfb_init(void)
{
int ret;
@@ -215,11 +281,22 @@ static int __init sysfb_init(void)
return ret;
}
+ ret = platform_driver_register(&sysfb_vbe_driver);
+ if (ret) {
+ pr_err("cannot register VBE framebuffer driver\n");
+ goto err_bus;
+ }
+
return 0;
+
+err_bus:
+ bus_unregister(&sysfb_bus_type);
+ return ret;
}
static void __exit sysfb_exit(void)
{
+ platform_driver_unregister(&sysfb_vbe_driver);
bus_unregister(&sysfb_bus_type);
}
@@ -20,6 +20,7 @@
/**
* sysfb_type
+ * @SYSFB_VBE: VESA BIOS Extension compatible device (includes VGA devices)
*
* Different types of available framebuffer devices. Only one device of each
* type can be available at a time. In most systems there even is only one
@@ -29,7 +30,9 @@
* devices.
*/
enum sysfb_type {
- SYSFB_TYPES = 0,
+ SYSFB_VBE = 0x01,
+
+ SYSFB_TYPES = SYSFB_VBE,
};
/**