Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1084249ybi; Fri, 2 Aug 2019 09:05:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfkN5eDJKlQ/heHI32l0yLS4WsXjyUDzLvht2GYD2USD6VjI7mQFp4ZDk/8Q+k3DrMpTnE X-Received: by 2002:a17:90a:2648:: with SMTP id l66mr4957480pje.65.1564761915456; Fri, 02 Aug 2019 09:05:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564761915; cv=none; d=google.com; s=arc-20160816; b=THGVOYiLTgTQrRpfWm+VW5gNF23+c60TUHYG+W/55GdSgFNt+dpMTHxp9trVdKt5sL Wlho5jaBc4mclu2dpWXyrgti5A5LXBKIYg7nUjKl5B5ai5LKy4FIruucBnCFT/mzGB1x AF0tMjqZtuLE36fMaINpEt7XjIhHSaKqml4xQ6mARJfX7MjCAMkQs2iLN4GUew86eR29 LYXcmKvYUB9rIbxzRo2TFOLHLr/g7wnxTEzdWirEU+/1sfZW01T/UngryR2aBgEx65mY owTX2ENOmR+tUOHZENMjdf3zQB5cdfQfEhVRFNku8mGFcnd8P8sLXK60d3aPY9v47Lj1 rrUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xcs8ZFxykwLJ22+Xs+8gzxmpE2aq9jZnaR6Qyx/h/qE=; b=QeUY/KEPM3fAF5yybryhjY+k/HMzhMRB7NFTFrbsHLSkDdWtP4h7TgqSKIikO6XCwP p2cdN4i55veIUo8ETdABI2DTevFwWOLYGMiM+yk2bEWB8fOBfzBSqb6/9qhfRwOgRZvU YgopHlKs55dB015wYAg0STLJpGPVAtGk5cQ94o86MT8bTROilUuAmgE57J6eJYM6VLuu eZrmY5LNtxytVSH/vpQYDs0juiVzTycsY1AaGB/5rp5O+E3ZumaP0Oekeipy4W/CxqZG Tk/p2S17jezVZtA21uBVjFMxCWAP+syh0xSVaJBhJtsJ6xJcG4WswuQtPPFFXeqw9cH8 G56Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=N3fdV+gZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l186si38980000pgd.455.2019.08.02.09.04.59; Fri, 02 Aug 2019 09:05:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=N3fdV+gZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732047AbfHBJhr (ORCPT + 99 others); Fri, 2 Aug 2019 05:37:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:36124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390619AbfHBJfd (ORCPT ); Fri, 2 Aug 2019 05:35:33 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1D9E4217D7; Fri, 2 Aug 2019 09:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564738532; bh=4fG8yaWw5FIGbVIq1QA9djVCt5H8cR/5qPXur/6lfmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N3fdV+gZI40TeTZnQHspC8R6DuMS0FlSWQGe6O4o63PXzBvwR4exKLMBwWd0dCwdz bzzdrRFpROGMo8Mw8R0dPq1Pp18fWrW1EbsBoc6xpff3lNo7Gqw4OEB9MoS5ttOVO6 7ggypVkPpihMKnddYyx5Uar2Df7tBV6B/m5nqyyo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Thomas Gleixner Subject: [PATCH 4.4 141/158] x86/sysfb_efi: Add quirks for some devices with swapped width and height Date: Fri, 2 Aug 2019 11:29:22 +0200 Message-Id: <20190802092231.448155130@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092203.671944552@linuxfoundation.org> References: <20190802092203.671944552@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede commit d02f1aa39189e0619c3525d5cd03254e61bf606a upstream. 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 Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20190721152418.11644-1-hdegoede@redhat.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/sysfb_efi.c | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) --- a/arch/x86/kernel/sysfb_efi.c +++ b/arch/x86/kernel/sysfb_efi.c @@ -216,9 +216,55 @@ static const struct dmi_system_id efifb_ {}, }; +/* + * 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"), + }, + }, + { + /* 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"), + }, + }, + { + /* 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"), + }, + }, + {}, +}; + __init void sysfb_apply_efi_quirks(void) { if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI || !(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)) { + u16 temp = screen_info.lfb_width; + + screen_info.lfb_width = screen_info.lfb_height; + screen_info.lfb_height = temp; + screen_info.lfb_linelength = 4 * screen_info.lfb_width; + } }