From patchwork Wed Jun 15 16:09:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 12882635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D8E4BC43334 for ; Wed, 15 Jun 2022 16:10:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=11RtTFTc5qbajf52JXlPUIUClWZS5M7UQZ+6AADPLGg=; b=aTH6xw8d2pZEvf PngQSSXlMN+wGJ4DReIfeizI7rvpjg0flh9yvChrJj+I88bSCjY8QP+wBcYjIcMdV5PnTE4q4P9/s wjcbgM+AD+O7Ndoexzd57695KOuW7ITSrG9QmsnhbO7AyPAglinNt7rnAVOdisIhhCQ54+HJIgRMs yEK3Y5pERpuwRPQ1BRayS+eVanXSYvQREI/BZE2c8BLoHx9yz3CIo2FI5MEhv/kEZT2EK11qi2b8I g08+uceb56+D2cdycTycBAiJ1A8r5ymbqeaYQRg5uL7vZfAxNb6Ew8qUfHXm8Ac/oghGx4Sxgw4xC sUfkdICfXQ5aGi5EFlgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1Va8-00FIZd-NC; Wed, 15 Jun 2022 16:09:24 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1Va5-00FIYk-Qh for linux-arm-kernel@lists.infradead.org; Wed, 15 Jun 2022 16:09:23 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D7841153B; Wed, 15 Jun 2022 09:09:19 -0700 (PDT) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DAB243F7F5; Wed, 15 Jun 2022 09:09:18 -0700 (PDT) From: Robin Murphy To: liviu.dudau@arm.com Cc: brian.starkey@arm.com, javierm@redhat.com, tzimmermann@suse.de, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2] drm/arm/hdlcd: Take over EFI framebuffer properly Date: Wed, 15 Jun 2022 17:09:15 +0100 Message-Id: <31acd57f4aa8a4d02877026fa3a8c8d035e15a0d.1655309004.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.36.1.dirty MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220615_090922_004634_16606BC9 X-CRM114-Status: GOOD ( 12.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The Arm Juno board EDK2 port has provided an EFI GOP display via HDLCD0 for some time now, which works nicely as an early framebuffer. However, once the HDLCD driver probes and takes over the hardware, it should take over the logical framebuffer as well, otherwise the now-defunct GOP device hangs about and virtual console output inevitably disappears into the wrong place most of the time. We'll do this after binding the HDMI encoder, since that's the most likely thing to fail, and the EFI console is still better than nothing when that happens. However, the two HDLCD controllers on Juno are independent, and many users will still be using older firmware without any display support, so we'll only bother if we find that the HDLCD we're probing is already enabled. And if it is, then we'll also stop it, since otherwise the display can end up shifted if it's still scanning out while the rest of the registers are subsequently reconfigured. Signed-off-by: Robin Murphy Acked-by: Liviu Dudau Reviewed-by: Javier Martinez Canillas --- Since I ended up adding (relatively) a lot here, I didn't want to second-guess Javier's opinion so left off the R-b tag from v1. drivers/gpu/drm/arm/hdlcd_drv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index e89ae0ec60eb..1f1171f2f16a 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -314,6 +315,12 @@ static int hdlcd_drm_bind(struct device *dev) goto err_vblank; } + /* If EFI left us running, take over from efifb/sysfb */ + if (hdlcd_read(hdlcd, HDLCD_REG_COMMAND)) { + hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 0); + drm_aperture_remove_framebuffers(false, &hdlcd_driver); + } + drm_mode_config_reset(drm); drm_kms_helper_poll_init(drm);