mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-19 05:51:36 -04:00
efi: sysfb_efi: Convert swap width and height quirk to a callback
Convert the swapping of width and height quirk to a callback. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Suggested-by: Ard Biesheuvel <ardb@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: Melissa Wen <mwen@igalia.com> Cc: linux-efi@vger.kernel.org Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Tested-by: Melissa Wen <mwen@igalia.com> # v3 [ardb: use local var to refer to screen_info] Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
committed by
Ard Biesheuvel
parent
449b87e81f
commit
7f2f1fd6fc
@@ -231,6 +231,17 @@ static const struct dmi_system_id efifb_dmi_system_table[] __initconst = {
|
||||
{},
|
||||
};
|
||||
|
||||
static int __init efifb_swap_width_height(const struct dmi_system_id *id)
|
||||
{
|
||||
struct screen_info *si = &screen_info;
|
||||
u32 bpp = __screen_info_lfb_bits_per_pixel(si);
|
||||
|
||||
swap(si->lfb_width, si->lfb_height);
|
||||
si->lfb_linelength = bpp * si->lfb_width / BITS_PER_BYTE;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
@@ -248,6 +259,7 @@ static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
|
||||
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 */
|
||||
@@ -256,6 +268,7 @@ static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
|
||||
"Lenovo MIIX 320-10ICR"),
|
||||
},
|
||||
.callback = efifb_swap_width_height,
|
||||
},
|
||||
{
|
||||
/* Lenovo D330 with 800x1280 or 1200x1920 portrait screen */
|
||||
@@ -264,6 +277,7 @@ static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
|
||||
"Lenovo ideapad D330-10IGM"),
|
||||
},
|
||||
.callback = efifb_swap_width_height,
|
||||
},
|
||||
{
|
||||
/* Lenovo IdeaPad Duet 3 10IGL5 with 1200x1920 portrait screen */
|
||||
@@ -272,6 +286,7 @@ static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
|
||||
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
|
||||
"IdeaPad Duet 3 10IGL5"),
|
||||
},
|
||||
.callback = efifb_swap_width_height,
|
||||
},
|
||||
{
|
||||
/* Lenovo Yoga Book X91F / X91L */
|
||||
@@ -280,6 +295,7 @@ static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
|
||||
/* Non exact match to match F + L versions */
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X91"),
|
||||
},
|
||||
.callback = efifb_swap_width_height,
|
||||
},
|
||||
{},
|
||||
};
|
||||
@@ -355,14 +371,8 @@ __init void sysfb_apply_efi_quirks(void)
|
||||
!(screen_info.capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS))
|
||||
dmi_check_system(efifb_dmi_system_table);
|
||||
|
||||
if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI &&
|
||||
dmi_check_system(efifb_dmi_swap_width_height)) {
|
||||
u32 bpp = __screen_info_lfb_bits_per_pixel(&screen_info);
|
||||
|
||||
swap(screen_info.lfb_width, screen_info.lfb_height);
|
||||
screen_info.lfb_linelength = bpp * screen_info.lfb_width /
|
||||
BITS_PER_BYTE;
|
||||
}
|
||||
if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI)
|
||||
dmi_check_system(efifb_dmi_swap_width_height);
|
||||
}
|
||||
|
||||
__init void sysfb_set_efifb_fwnode(struct platform_device *pd)
|
||||
|
||||
Reference in New Issue
Block a user