// SPDX-License-Identifier: GPL-2.0-or-later /* * Generic System Framebuffers * Copyright (c) 2012-2013 David Herrmann <[email protected]> */ /* * Simple-Framebuffer support * Create a platform-device for any available boot framebuffer. The * simple-framebuffer platform device is already available on DT systems, so * this module parses the global "screen_info" object and creates a suitable * platform device compatible with the "simple-framebuffer" DT object. If * the framebuffer is incompatible, we instead create a legacy * "vesa-framebuffer", "efi-framebuffer" or "platform-framebuffer" device and * pass the screen_info as platform_data. This allows legacy drivers * to pick these devices up without messing with simple-framebuffer drivers. * The global "screen_info" is still valid at all times. * * If CONFIG_SYSFB_SIMPLEFB is not selected, never register "simple-framebuffer" * platform devices, but only use legacy framebuffer devices for * backwards compatibility. * * TODO: We set the dev_id field of all platform-devices to 0. This allows * other OF/DT parsers to create such devices, too. However, they must * start at offset 1 for this to work. */ #include <linux/err.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/pci.h> #include <linux/platform_data/simplefb.h> #include <linux/platform_device.h> #include <linux/screen_info.h> #include <linux/sysfb.h> static struct platform_device *pd; static DEFINE_MUTEX(disable_lock); static bool disabled; static bool sysfb_unregister(void) { … } /** * sysfb_disable() - disable the Generic System Framebuffers support * * This disables the registration of system framebuffer devices that match the * generic drivers that make use of the system framebuffer set up by firmware. * * It also unregisters a device if this was already registered by sysfb_init(). * * Context: The function can sleep. A @disable_lock mutex is acquired to serialize * against sysfb_init(), that registers a system framebuffer device. */ void sysfb_disable(void) { … } EXPORT_SYMBOL_GPL(…); #if defined(CONFIG_PCI) static __init bool sysfb_pci_dev_is_enabled(struct pci_dev *pdev) { … } #else static __init bool sysfb_pci_dev_is_enabled(struct pci_dev *pdev) { return false; } #endif static __init struct device *sysfb_parent_dev(const struct screen_info *si) { … } static __init int sysfb_init(void) { … } /* must execute after PCI subsystem for EFI quirks */ device_initcall(sysfb_init);