drivers/firmware/efi/sysfb_efi.c

Source file repositories/reference/linux-study-clean/drivers/firmware/efi/sysfb_efi.c

File Facts

System
Linux kernel
Corpus path
drivers/firmware/efi/sysfb_efi.c
Extension
.c
Size
14400 bytes
Lines
441
Domain
Driver Families
Bucket
drivers/firmware
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct efifb_mode_fixup {
	unsigned int width;
	unsigned int height;
	unsigned int linelength;
};

static int __init
efifb_check_and_swap_width_height(const struct dmi_system_id *id)
{
	const struct efifb_mode_fixup *data = id->driver_data;
	struct screen_info *si = &sysfb_primary_display.screen;

	if (data->width == si->lfb_width && data->height == si->lfb_height) {
		swap(si->lfb_width, si->lfb_height);
		si->lfb_linelength = data->linelength;
		si->lfb_size = data->linelength * data->width;
	}

	return 1;
}

static const struct efifb_mode_fixup efifb_steamdeck_mode_fixup __initconst = {
	.width = 1280,
	.height = 800,
	.linelength = 3328,
};

/*
 * Some devices have a portrait LCD but advertise a landscape resolution (and
 * pitch). We simply swap width and height for these devices so that we can
 * correctly deal with some of them coming with multiple resolutions.
 */
static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
	{
		/*
		 * Lenovo MIIX310-10ICR, only some batches have the troublesome
		 * 800x1280 portrait screen. Luckily the portrait version has
		 * its own BIOS version, so we match on that.
		 */
		.matches = {
			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
			DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "MIIX 310-10ICR"),
			DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1HCN44WW"),
		},
		.callback = efifb_swap_width_height,
	},
	{
		/* Lenovo MIIX 320-10ICR with 800x1280 portrait screen */
		.matches = {
			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
			DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
					"Lenovo MIIX 320-10ICR"),
		},
		.callback = efifb_swap_width_height,
	},
	{
		/* Lenovo D330 with 800x1280 or 1200x1920 portrait screen */
		.matches = {
			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
			DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
					"Lenovo ideapad D330-10IGM"),
		},
		.callback = efifb_swap_width_height,
	},
	{
		/*
		 * Lenovo IdeaPad Duet 3 10IGL5 and 10IGL5-LTE with
		 * 1200x1920 portrait screen
		 */
		.matches = {
			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
			/* Non exact match to also match the LTE version */
			DMI_MATCH(DMI_PRODUCT_VERSION, "IdeaPad Duet 3 10IGL5"),
		},
		.callback = efifb_swap_width_height,
	},
	{
		/* Lenovo Yoga Book X91F / X91L */
		.matches = {
			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
			/* Non exact match to match F + L versions */
			DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X91"),
		},
		.callback = efifb_swap_width_height,
	},
	{
		/* Valve Steam Deck (Jupiter) */
		.matches = {
			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Valve"),
			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Jupiter"),

Annotation

Implementation Notes