Skip to content

Commit d02f1aa

Browse files
jwrdegoedeKAGA-KOKO
authored andcommitted
x86/sysfb_efi: Add quirks for some devices with swapped width and height
Some Lenovo 2-in-1s with a detachable keyboard have a portrait screen but advertise a landscape resolution and pitch, resulting in a messed up display if the kernel tries to show anything on the efifb (because of the wrong pitch). Fix this by adding a new DMI match table for devices which need to have their width and height swapped. At first it was tried to use the existing table for overriding some of the efifb parameters, but some of the affected devices have variants with different LCD resolutions which will not work with hardcoded override values. Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1730783 Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent 2af7c85 commit d02f1aa

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

arch/x86/kernel/sysfb_efi.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,55 @@ static const struct dmi_system_id efifb_dmi_system_table[] __initconst = {
230230
{},
231231
};
232232

233+
/*
234+
* Some devices have a portrait LCD but advertise a landscape resolution (and
235+
* pitch). We simply swap width and height for these devices so that we can
236+
* correctly deal with some of them coming with multiple resolutions.
237+
*/
238+
static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
239+
{
240+
/*
241+
* Lenovo MIIX310-10ICR, only some batches have the troublesome
242+
* 800x1280 portrait screen. Luckily the portrait version has
243+
* its own BIOS version, so we match on that.
244+
*/
245+
.matches = {
246+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
247+
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "MIIX 310-10ICR"),
248+
DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1HCN44WW"),
249+
},
250+
},
251+
{
252+
/* Lenovo MIIX 320-10ICR with 800x1280 portrait screen */
253+
.matches = {
254+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
255+
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
256+
"Lenovo MIIX 320-10ICR"),
257+
},
258+
},
259+
{
260+
/* Lenovo D330 with 800x1280 or 1200x1920 portrait screen */
261+
.matches = {
262+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
263+
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
264+
"Lenovo ideapad D330-10IGM"),
265+
},
266+
},
267+
{},
268+
};
269+
233270
__init void sysfb_apply_efi_quirks(void)
234271
{
235272
if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI ||
236273
!(screen_info.capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS))
237274
dmi_check_system(efifb_dmi_system_table);
275+
276+
if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI &&
277+
dmi_check_system(efifb_dmi_swap_width_height)) {
278+
u16 temp = screen_info.lfb_width;
279+
280+
screen_info.lfb_width = screen_info.lfb_height;
281+
screen_info.lfb_height = temp;
282+
screen_info.lfb_linelength = 4 * screen_info.lfb_width;
283+
}
238284
}

0 commit comments

Comments
 (0)