aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/efifb.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-08-02 08:05:26 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2013-08-02 19:17:50 -0400
commite6816a8d85549444feb3838920b1f4efba73d1da (patch)
tree850a9c7749d3e3320f7b6e03c739b56f94ee4e8a /drivers/video/efifb.c
parent2e5155ecbb729d3a2e7d1cea7c18493516fec55a (diff)
fbdev: efifb: bind to efi-framebuffer
Instead of creating a dummy device, we now bind to the efi-fb device which is provided by x86 initialization code. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Link: http://lkml.kernel.org/r/1375445127-15480-8-git-send-email-dh.herrmann@gmail.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'drivers/video/efifb.c')
-rw-r--r--drivers/video/efifb.c68
1 files changed, 22 insertions, 46 deletions
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
index e493bcb44f05..2a8286ef2645 100644
--- a/drivers/video/efifb.c
+++ b/drivers/video/efifb.c
@@ -96,7 +96,7 @@ void vga_set_default_device(struct pci_dev *pdev)
96 default_vga = pdev; 96 default_vga = pdev;
97} 97}
98 98
99static int __init efifb_setup(char *options) 99static int efifb_setup(char *options)
100{ 100{
101 char *this_opt; 101 char *this_opt;
102 int i; 102 int i;
@@ -153,13 +153,28 @@ static int __init efifb_setup(char *options)
153 return 0; 153 return 0;
154} 154}
155 155
156static int __init efifb_probe(struct platform_device *dev) 156static int efifb_probe(struct platform_device *dev)
157{ 157{
158 struct fb_info *info; 158 struct fb_info *info;
159 int err; 159 int err;
160 unsigned int size_vmode; 160 unsigned int size_vmode;
161 unsigned int size_remap; 161 unsigned int size_remap;
162 unsigned int size_total; 162 unsigned int size_total;
163 char *option = NULL;
164
165 if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
166 return -ENODEV;
167
168 if (fb_get_options("efifb", &option))
169 return -ENODEV;
170 efifb_setup(option);
171
172 /* We don't get linelength from UGA Draw Protocol, only from
173 * EFI Graphics Protocol. So if it's not in DMI, and it's not
174 * passed in from the user, we really can't use the framebuffer.
175 */
176 if (!screen_info.lfb_linelength)
177 return -ENODEV;
163 178
164 if (!screen_info.lfb_depth) 179 if (!screen_info.lfb_depth)
165 screen_info.lfb_depth = 32; 180 screen_info.lfb_depth = 32;
@@ -323,51 +338,12 @@ err_release_mem:
323} 338}
324 339
325static struct platform_driver efifb_driver = { 340static struct platform_driver efifb_driver = {
326 .driver = { 341 .driver = {
327 .name = "efifb", 342 .name = "efi-framebuffer",
343 .owner = THIS_MODULE,
328 }, 344 },
345 .probe = efifb_probe,
329}; 346};
330 347
331static struct platform_device efifb_device = { 348module_platform_driver(efifb_driver);
332 .name = "efifb",
333};
334
335static int __init efifb_init(void)
336{
337 int ret;
338 char *option = NULL;
339
340 if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
341 return -ENODEV;
342
343 if (fb_get_options("efifb", &option))
344 return -ENODEV;
345 efifb_setup(option);
346
347 /* We don't get linelength from UGA Draw Protocol, only from
348 * EFI Graphics Protocol. So if it's not in DMI, and it's not
349 * passed in from the user, we really can't use the framebuffer.
350 */
351 if (!screen_info.lfb_linelength)
352 return -ENODEV;
353
354 ret = platform_device_register(&efifb_device);
355 if (ret)
356 return ret;
357
358 /*
359 * This is not just an optimization. We will interfere
360 * with a real driver if we get reprobed, so don't allow
361 * it.
362 */
363 ret = platform_driver_probe(&efifb_driver, efifb_probe);
364 if (ret) {
365 platform_device_unregister(&efifb_device);
366 return ret;
367 }
368
369 return ret;
370}
371module_init(efifb_init);
372
373MODULE_LICENSE("GPL"); 349MODULE_LICENSE("GPL");