From patchwork Wed Dec 9 15:38:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 7809401 Return-Path: X-Original-To: patchwork-dri-devel@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 1055A9F350 for ; Wed, 9 Dec 2015 15:38:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41FAA204AE for ; Wed, 9 Dec 2015 15:38:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7212E204AF for ; Wed, 9 Dec 2015 15:38:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 51CC76E1ED; Wed, 9 Dec 2015 07:38:19 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0B1476E054 for ; Wed, 9 Dec 2015 07:38:17 -0800 (PST) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id tB9FcE9m004098; Wed, 9 Dec 2015 09:38:14 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id tB9FcED8028496; Wed, 9 Dec 2015 09:38:14 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Wed, 9 Dec 2015 09:38:14 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id tB9FcBgL002692; Wed, 9 Dec 2015 09:38:13 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCH 1/7] drm/omap: ensure all displays have been probed Date: Wed, 9 Dec 2015 17:38:05 +0200 Message-ID: <1449675491-9184-2-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1449675491-9184-1-git-send-email-tomi.valkeinen@ti.com> References: <1449675491-9184-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 Cc: Tomi Valkeinen X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 DRM offers no ways to add new displays after the DRM driver has been loaded. This causes issues on boards that have multiple displays, and omapdrm is loaded when some of them are loaded but not all. The result is that omapdrm starts with the displays that were loaded at that time, ignoring the displays loaded later. This patch changes the behavior so that omapdrm ensures all display are loaded which have an alias in the .dts file. The downside is that this prevents omapdrm from loading if, say, the user has not compiled a kernel module for one of the displays, or there's some kind of failure in one of the displays. Thus, after this patch, all the displays have to work, or none does. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_drv.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 5c6609cbb6a2..c93c13e2c22d 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -242,11 +242,38 @@ static void omap_disconnect_dssdevs(void) dssdev->driver->disconnect(dssdev); } +static bool dssdev_with_alias_exists(const char *alias) +{ + struct omap_dss_device *dssdev = NULL; + + for_each_dss_dev(dssdev) { + if (strcmp(alias, dssdev->alias) == 0) { + omap_dss_put_device(dssdev); + return true; + } + } + + return false; +} + static int omap_connect_dssdevs(void) { int r; struct omap_dss_device *dssdev = NULL; bool no_displays = true; + struct device_node *aliases; + struct property *pp; + + aliases = of_find_node_by_path("/aliases"); + if (aliases) { + for_each_property_of_node(aliases, pp) { + if (strncmp(pp->name, "display", 7) != 0) + continue; + + if (dssdev_with_alias_exists(pp->name) == false) + return -EPROBE_DEFER; + } + } for_each_dss_dev(dssdev) { r = dssdev->driver->connect(dssdev);