From patchwork Tue Apr 19 19:19:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 8882891 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 04B1F9F1C1 for ; Tue, 19 Apr 2016 19:19:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA07B20115 for ; Tue, 19 Apr 2016 19:19:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3295B202D1 for ; Tue, 19 Apr 2016 19:19:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754995AbcDSTT2 (ORCPT ); Tue, 19 Apr 2016 15:19:28 -0400 Received: from anholt.net ([50.246.234.109]:34333 "EHLO anholt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753553AbcDSTT2 (ORCPT ); Tue, 19 Apr 2016 15:19:28 -0400 Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 26ECB2C9C06F; Tue, 19 Apr 2016 12:19:27 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id cHaF5f6s_KD2; Tue, 19 Apr 2016 12:19:26 -0700 (PDT) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 23E892C9C06B; Tue, 19 Apr 2016 12:19:26 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id D4BADF00C1A; Tue, 19 Apr 2016 12:19:25 -0700 (PDT) From: Eric Anholt To: Hans de Goede Cc: linux-fbdev@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, Stephen Warren , Eric Anholt , javier@osg.samsung.com Subject: [PATCH] simplefb: Disable at runtime when a native driver (vc4) is present. Date: Tue, 19 Apr 2016 12:19:25 -0700 Message-Id: <1461093565-18631-1-git-send-email-eric@anholt.net> X-Mailer: git-send-email 2.8.0.rc3 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With simplefb and vc4 both enabled, simplefb would probe first and be fb0, displaying for a moment before vc4 probed fb1 and reconfigured the graphics hardware so that only its fbdev worked. Cc: javier@osg.samsung.com Signed-off-by: Eric Anholt --- Ccing Javier, since it looks like Exynos has also had this trouble, and may want to get some compatible string in the list. drivers/video/fbdev/simplefb.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index e9cf19977285..a2971aa686f5 100644 --- a/drivers/video/fbdev/simplefb.c +++ b/drivers/video/fbdev/simplefb.c @@ -512,11 +512,44 @@ static struct platform_driver simplefb_driver = { .remove = simplefb_remove, }; +/* Returns true if a simplefb node that's present should be ignored. + * + * The U-Boot bootloader, and possibly others, may add a simplefb + * device node to the existing device tree based on the video + * configuration initialized by the firmware. If we have a native + * driver for graphics, then simplefb would just be writing into + * memory that's no longer being scanned out. + */ +static bool +simplefb_superseded(void) +{ + static const char *compats[] __initconst = { +#ifdef CONFIG_DRM_VC4 + "brcm,bcm2835-vc4", +#endif + }; + struct device_node *node; + int i; + + for (i = 0; i < ARRAY_SIZE(compats); i++) { + node = of_find_compatible_node(NULL, NULL, compats[i]); + if (node) { + of_node_put(node); + return true; + } + } + + return false; +} + static int __init simplefb_init(void) { int ret; struct device_node *np; + if (simplefb_superseded()) + return 0; + ret = platform_driver_register(&simplefb_driver); if (ret) return ret;