From patchwork Mon Dec 16 14:56:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 3354391 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4500CC0D4A for ; Mon, 16 Dec 2013 14:58:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15B9A2021C for ; Mon, 16 Dec 2013 14:58:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E28032021A for ; Mon, 16 Dec 2013 14:58:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754268Ab3LPO6I (ORCPT ); Mon, 16 Dec 2013 09:58:08 -0500 Received: from comal.ext.ti.com ([198.47.26.152]:33041 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754225Ab3LPO6G (ORCPT ); Mon, 16 Dec 2013 09:58:06 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id rBGEw6mO002671; Mon, 16 Dec 2013 08:58:06 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id rBGEw5lo025199; Mon, 16 Dec 2013 08:58:06 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Mon, 16 Dec 2013 08:58:05 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id rBGEvr17024216; Mon, 16 Dec 2013 08:58:04 -0600 From: Tomi Valkeinen To: , , CC: Tomi Valkeinen Subject: [PATCHv2 05/27] OMAPDSS: get dssdev->alias from DT alias Date: Mon, 16 Dec 2013 16:56:12 +0200 Message-ID: <1387205794-32246-6-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1387205794-32246-1-git-send-email-tomi.valkeinen@ti.com> References: <1387205794-32246-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 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.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 We currently create a "displayX" style alias name for all displays, using a number that is incremented for each registered display. With the new DSS device model there is no clear order in which the displays are registered, and thus the numbering is somewhat random. This patch improves the behavior for DT case so that if the displays have been assigned DT aliases, those aliases will be used as DSS aliases. This means that "display0" is always the one specified in the DT alias, and thus display0 can be used as default display in case the user didn't specify a default display. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/display.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index 012ada38a29d..21080f9dae87 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c @@ -134,9 +134,24 @@ static int disp_num_counter; int omapdss_register_display(struct omap_dss_device *dssdev) { struct omap_dss_driver *drv = dssdev->driver; + int id; - snprintf(dssdev->alias, sizeof(dssdev->alias), - "display%d", disp_num_counter++); + /* + * Note: this presumes all the displays are either using DT or non-DT, + * which normally should be the case. This also presumes that all + * displays either have an DT alias, or none has. + */ + + if (dssdev->dev->of_node) { + id = of_alias_get_id(dssdev->dev->of_node, "display"); + + if (id < 0) + id = disp_num_counter++; + } else { + id = disp_num_counter++; + } + + snprintf(dssdev->alias, sizeof(dssdev->alias), "display%d", id); /* Use 'label' property for name, if it exists */ if (dssdev->dev->of_node)