From patchwork Sun May 16 07:48:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 12260183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E735C433ED for ; Sun, 16 May 2021 07:50:42 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 15D7E60E0B for ; Sun, 16 May 2021 07:50:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 15D7E60E0B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=ZaId3Tp0KdPB1+pdB8pnRyFrzRerIXQcBBQy5wvSLZg=; b=nFxSjtRa9e1n3V2sKreDDw9jHV x177CINRRac1JZ+CZLS2YIZEt/C24436FPVzeEHqtG+H3/LWPmx6mR+JMtgHmxesxicf+MqSmYP2c /DMCAarGwY1jVEJSbg7HIWuXI2O9GYrzYEwBdrmzWBcmH3WPRP7g3kYqfT/gwunqIarEfadK8TWrm 3X03eRuv+CFgDlPx6YqTClzcXaTJ7m0ynifUYGdsDHw1c+l7XIGuUjvyurKsj0kOzpTcceOXmRr7g gb4qMjdc3FmKbwYjct7GAJx5BzUy73pwNvdX810lAvKTKer1wglGFl8D/HLMNFNPcRuRrZ9Da/6bq 3IqK1IAw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liBWL-00BoqV-DE; Sun, 16 May 2021 07:49:05 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liBWD-00Bopd-QN for linux-arm-kernel@desiato.infradead.org; Sun, 16 May 2021 07:48:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type: Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description:In-Reply-To:References; bh=xMEHr3txinobPMiklkheMH3hCxm7Pua65lCR30BLejs=; b=bYU+1b+s58iOuJFIkwJ/TrIKKv SM4mUWHc1wy3I01A2KdUehO6sQkAbiFR9tvqV/Dp/G0gNDbNzYpXK9FzS308otxJl9Oq0bOUGJKTH 1nBsw+fB+wEIF0DWHfNzOilK6sndQraWhbBp/ghxkn3D3THdSXoLuCFdqMJTAe0a7I/zSAHOqw9R+ 1tyC+5QbWqhFN3b6wpanikkunDXuJGjYaOPnV3uJtmSxoVzh+KLbON6xFJD57nZ8aUnB+uQxHAt8P Xrh4SHks7OHu0n5PdJW+eeCRUBGr6YuT7UGY2AYxQo933kjEJ4+lWXQvth1sFA5HGRWRqnrF/VaaT jk+26ccA==; Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liBWA-00CoOv-4n for linux-arm-kernel@lists.infradead.org; Sun, 16 May 2021 07:48:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621151332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xMEHr3txinobPMiklkheMH3hCxm7Pua65lCR30BLejs=; b=AyesmoFzr2LaYYYNR8JgRUokFV5qYp29RoUDInokEMnRFtlP0D+T6bqufqF6k6nE3jGvup OqrLAhSSb9gJS3dtwMXXAwvRuaQLCkvcsK7mkgi4RtNR5atL5rE7AMBgwYyfBhEET5GHbE 8oZjFkfIhlRKqJeM2PT73dPrfJnOlE8= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-275-uhNxIFb8N7OQqY_Sb9Jivg-1; Sun, 16 May 2021 03:48:49 -0400 X-MC-Unique: uhNxIFb8N7OQqY_Sb9Jivg-1 Received: by mail-wr1-f71.google.com with SMTP id 2-20020adf94020000b0290110481f75ddso2056595wrq.21 for ; Sun, 16 May 2021 00:48:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xMEHr3txinobPMiklkheMH3hCxm7Pua65lCR30BLejs=; b=b92dY4a/DEzyg9VNS0Tcs6S5MpgTPpHBk+DVHa4r+6yKth2lkvZjqlAB+8MVFUoa5V mT0ZUuUA/waV3UCTYOPyAka+526WgvRA8vjCqeKlbJhln0Oe5Sm+ulloTTLwiHdtvW5d FBEf+RuvhNzItKz/yrscCJyyGlS4tiO41TzfyYbnGcycekOH8HXzp6BJe3MH4iall2T7 TquB9dM94JLJtVXcocRnViJMnG3CJ6kYzEXbhpO5zLtmP9deTzt5AIuiTG92rXvNBwyt sWoFZWSgilwaaWY9qEOSt2Tkbd2Qs3QZpR8U/4NbZiRTwLpZMeamTK8k5LPqnLxldwGS 52vQ== X-Gm-Message-State: AOAM530Zc52Mfzvp1oRVVMkTalXYK2bB/xBoXtGH4NL/ODDWmenFqF59 KcYzkL9BSarFwkj8RmcuNG/DbmBi2p5zVOXzk4lcr8unLYRvTKo9kOEgfkkHW1QqTcAnZQG0YMU oK+d6L/FNcP4g5OH9dj6g80giF+oMB/tppdI= X-Received: by 2002:a7b:c14e:: with SMTP id z14mr57335888wmi.104.1621151328866; Sun, 16 May 2021 00:48:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRkzwXMjfjJhlzuX9LLoPTb6ClHg5TLaCME19q70w8+F6ekQW/0awjb4A7BinEgHO2w+/92g== X-Received: by 2002:a7b:c14e:: with SMTP id z14mr57335881wmi.104.1621151328701; Sun, 16 May 2021 00:48:48 -0700 (PDT) Received: from minerva.home ([92.176.231.106]) by smtp.gmail.com with ESMTPSA id o129sm16643610wmo.22.2021.05.16.00.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 May 2021 00:48:48 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Peter Robinson , Thomas Zimmermann , Javier Martinez Canillas , Daniel Vetter , David Airlie , =?utf-8?q?Heiko_St=C3=BCbner?= , Sandy Huang , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device Date: Sun, 16 May 2021 09:48:33 +0200 Message-Id: <20210516074833.451643-1-javierm@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=javierm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210516_004854_459980_40883E5A X-CRM114-Status: GOOD ( 14.66 ) 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 There are drivers that register framebuffer devices very early in the boot process and make use of the existing framebuffer as setup by the firmware. If one of those drivers has registered a fbdev, then the fallback fbdev of the DRM driver won't be bound to the framebuffer console. To avoid that, remove any existing generic driver and take over the graphics device. By doing that, the fb mapped to the console is switched correctly from the early fbdev to the one registered by the rockchip DRM driver: [ 40.752420] fb0: switching to rockchip-drm-fb from EFI VGA Signed-off-by: Javier Martinez Canillas Acked-by: Thomas Zimmermann Tested-by: Peter Robinson Acked-by: Heiko Stuebner --- Changes in v2: - Move drm_aperture_remove_framebuffers() call to .bind callback (tzimmermann). - Adapt subject line, commit message, etc accordingly. drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 212bd87c0c4..b730b8d5d94 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -114,6 +115,15 @@ static int rockchip_drm_bind(struct device *dev) struct rockchip_drm_private *private; int ret; + /* Remove existing drivers that may own the framebuffer memory. */ + ret = drm_aperture_remove_framebuffers(false, "rockchip-drm-fb"); + if (ret) { + DRM_DEV_ERROR(dev, + "Failed to remove existing framebuffers - %d.\n", + ret); + return ret; + } + drm_dev = drm_dev_alloc(&rockchip_drm_driver, dev); if (IS_ERR(drm_dev)) return PTR_ERR(drm_dev);