From patchwork Mon Feb 12 09:44:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127960 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040323ljc; Mon, 12 Feb 2018 01:45:53 -0800 (PST) X-Google-Smtp-Source: AH8x225XKrUmtzJT9glmrKReOjq6aHkDgyg4DKCRGrIflP8J60fXy7qUlTgr90X/H2mg7IKweR9P X-Received: by 10.101.64.193 with SMTP id u1mr9082351pgp.24.1518428752919; Mon, 12 Feb 2018 01:45:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428752; cv=none; d=google.com; s=arc-20160816; b=YS1RRDWQEMl+cr+p1L9Kc3F9evFONUOZk0Fct/czIrpcAFjw0VdBLaz/G4h29MRyK/ 4TLulYUso5S/PUxZPfIURW8Z+3krOZD/borPlbRG+E5IWhj+ykz2VOGSmESxn9uyV2pA qqGSttXF4ykN8rl+CoXkn/3isn2djEjIbOHUc+01td/8kXnm0Fbq4WJEaP+ao5RRXTT5 n9onDmdSIEaDPytGYtBCtWma2acrYblh04EydEvTx7vBrXBWzI4apVF0XfA//pqN2W7A x9+TAFaIXE9x++WgAWMtTX2iMpse1tfIkaRYk9luFkh25kx14opeRsiiFOpoyxgaPQ/H 9S5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=yaFlqxCr52R3IC5Re1Am7q2zeMEim2MFCiTv0+ipOro=; b=CprZ3Tb0eh5m8OUVT7uz6wCZBeGu/8O7pF2okfQJll1doK0xmbxES5xmTAO7ky3glL 581374ly7MzU80ObXnQRK0mt2VJfmeoL6RJBxzXhLQg24q/kIOFpsfiVGliZt8N5bs76 SNOVDCKoltKO7gcY8zTBHwPi3H+iAe3DL+jpHnO0mKNJtW6ehRiigPaf922OSO6pju49 YPCSBb+4QUIbKGWNA3zgvsSScHhDrmc+Hl6SOAub/vZXObzPgqJzWtFTvgHUcC0nzCy2 bz+FwJ45cZh5IaSaIfnamSuKSolt9xGDatCNQJoAFYFTVFfaYcSli9WmWBdfcKkeCW0X N0/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=bwel7eAx; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 9-v6si2149520ple.367.2018.02.12.01.45.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:45:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=bwel7eAx; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EDDD76E199; Mon, 12 Feb 2018 09:45:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id C94096E17D for ; Mon, 12 Feb 2018 09:45:21 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jJ7J018963; Mon, 12 Feb 2018 03:45:19 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428719; bh=Y6Tge/E0SFONnOXbZYqLXRk3Au5QaRDRYdJ1cSHluZE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=bwel7eAxTx9iqb5QqfyOhaTL6tpv/mjSzoZ6EyGbBrHSQ8FX5MJtXU5yciiC0VsLs TstKNPFh6KybJx1k3DQ31eVsTT+zenKzyqlPFrOMIS/LIEsI8gb4IU+NLJJQvRruQv VrNE4mO6yZXkm6jth5X0/zN7lYTc+VEQHJU9tRAs= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jJpC019788; Mon, 12 Feb 2018 03:45:19 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:19 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:19 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0N6003439; Mon, 12 Feb 2018 03:45:17 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 09/24] drm/omap: Do dss_device (display) ordering in omap_drv.c Date: Mon, 12 Feb 2018 11:44:39 +0200 Message-ID: <1518428694-18018-10-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Peter Ujfalusi Sort the dssdev array based on DT aliases. With this change we can remove the panel ordering from dss/display.c and have all sorting related to dssdevs in one place. Signed-off-by: Peter Ujfalusi Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/dss/display.c | 2 ++ drivers/gpu/drm/omapdrm/dss/omapdss.h | 1 + drivers/gpu/drm/omapdrm/omap_drv.c | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c index 424143128cd4..3ef99f344bd3 100644 --- a/drivers/gpu/drm/omapdrm/dss/display.c +++ b/drivers/gpu/drm/omapdrm/dss/display.c @@ -52,6 +52,8 @@ int omapdss_register_display(struct omap_dss_device *dssdev) if (id < 0) id = disp_num_counter++; + dssdev->alias_id = id; + snprintf(dssdev->alias, sizeof(dssdev->alias), "display%d", id); /* Use 'label' property for name, if it exists */ diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 4222661d4c88..bd5f174a3c56 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -478,6 +478,7 @@ struct omap_dss_device { /* alias in the form of "display%d" */ char alias[16]; + int alias_id; enum omap_display_type type; enum omap_display_type output_type; diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index b5061fc7241a..877c3749f69b 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -15,6 +15,8 @@ * this program. If not, see . */ +#include +#include #include #include @@ -165,6 +167,18 @@ static void omap_disconnect_dssdevs(struct drm_device *ddev) priv->num_dssdevs = 0; } +static int omap_compare_dssdevs(const void *a, const void *b) +{ + const struct omap_dss_device *dssdev1 = *(struct omap_dss_device **)a; + const struct omap_dss_device *dssdev2 = *(struct omap_dss_device **)b; + + if (dssdev1->alias_id > dssdev2->alias_id) + return 1; + else if (dssdev1->alias_id < dssdev2->alias_id) + return -1; + return 0; +} + static void omap_collect_dssdevs(struct drm_device *ddev) { struct omap_drm_private *priv = ddev->dev_private; @@ -179,6 +193,10 @@ static void omap_collect_dssdevs(struct drm_device *ddev) break; } } + + /* Sort the list by DT aliases */ + sort(priv->dssdevs, priv->num_dssdevs, sizeof(priv->dssdevs[0]), + omap_compare_dssdevs, NULL); } static int omap_connect_dssdevs(struct drm_device *ddev)