From patchwork Mon Jan 13 14:21:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 3475481 Return-Path: X-Original-To: patchwork-dri-devel@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 A31A6C02DC for ; Mon, 13 Jan 2014 14:21:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 50169200DF for ; Mon, 13 Jan 2014 14:21:55 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id F365720034 for ; Mon, 13 Jan 2014 14:21:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E3AA811E847; Mon, 13 Jan 2014 06:21:51 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by gabe.freedesktop.org (Postfix) with ESMTP id CC78211E845 for ; Mon, 13 Jan 2014 06:21:41 -0800 (PST) Received: by mail-bk0-f54.google.com with SMTP id u14so801419bkz.27 for ; Mon, 13 Jan 2014 06:21:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wrno/loHimKiQNwxDvOklWquAG8RqVXvXx+Cl7IakH8=; b=oVnHTgUTZFgFcogtVCeSA64uu9IEzS5630+on5pEMi71IaKC0bY+qS7LMfaXlVNnfx cPQlcrwV+TpP8p4iDq+UpRwkyY63TRVWPZ8at9P8Q8AP07b0mqaatIlkwon2Bci1E8cL daGPuBgRQqn/Cbl2gB1t1Nsw57lH14btUmgvTrPvMBSJaTNVsbL6cYQ8Sq+hagKL1AdY jJVZ2yQB+UZ0ZhEbvJC5xrdYdrKWz3t29pIG1g7m/amjEyQMjkfCQnZFQnjKhSJnkJgC PeY1eACo7AX1OTVB817EGtBIChiK9xrso4pHszzFlBD2m3/FtYWBpmlNFaXGdx0LdDDn M+Kw== X-Received: by 10.204.173.8 with SMTP id n8mr470588bkz.12.1389622900971; Mon, 13 Jan 2014 06:21:40 -0800 (PST) Received: from localhost (port-52867.pppoe.wtnet.de. [46.59.207.43]) by mx.google.com with ESMTPSA id d5sm15892371bkc.9.2014.01.13.06.21.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jan 2014 06:21:39 -0800 (PST) From: Thierry Reding To: Stephen Warren , David Airlie , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala Subject: [PATCH 2/2] drm/tegra: Obtain head number from DT Date: Mon, 13 Jan 2014 15:21:34 +0100 Message-Id: <1389622894-9574-3-git-send-email-treding@nvidia.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1389622894-9574-1-git-send-email-treding@nvidia.com> References: <1389622894-9574-1-git-send-email-treding@nvidia.com> Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 The head number of a given display controller is fixed in hardware and required to program outputs appropriately. Relying on the driver probe order to determine this number will not work, since that could yield a situation where the second head was probed first and would be assigned head number 0 instead of 1. Signed-off-by: Thierry Reding --- .../bindings/gpu/nvidia,tegra20-host1x.txt | 3 +++ drivers/gpu/drm/tegra/dc.c | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt b/Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt index 9e9008f8fa32..efaeec8961b6 100644 --- a/Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt +++ b/Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt @@ -118,6 +118,9 @@ of the following host1x client modules: See ../reset/reset.txt for details. - reset-names: Must include the following entries: - dc + - nvidia,head: The number of the display controller head. This is used to + setup the various types of output to receive video data from the given + head. Each display controller node has a child node, named "rgb", that represents the RGB output associated with the controller. It can take the following diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 386f3b4b0094..ce0d2c2c7aac 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -1100,8 +1100,6 @@ static int tegra_dc_init(struct host1x_client *client) struct tegra_dc *dc = host1x_client_to_dc(client); int err; - dc->pipe = tegra->drm->mode_config.num_crtc; - drm_crtc_init(tegra->drm, &dc->base, &tegra_crtc_funcs); drm_mode_crtc_set_gamma_size(&dc->base, 256); drm_crtc_helper_add(&dc->base, &tegra_crtc_helper_funcs); @@ -1160,6 +1158,20 @@ static const struct host1x_client_ops dc_client_ops = { .exit = tegra_dc_exit, }; +static int tegra_dc_parse_dt(struct tegra_dc *dc) +{ + u32 value; + int err; + + err = of_property_read_u32(dc->dev->of_node, "nvidia,head", &value); + if (err < 0) + return err; + + dc->pipe = value; + + return 0; +} + static const struct tegra_dc_soc_info tegra20_dc_soc_info = { .supports_interlacing = false, }; @@ -1207,6 +1219,10 @@ static int tegra_dc_probe(struct platform_device *pdev) dc->dev = &pdev->dev; dc->soc = id->data; + err = tegra_dc_parse_dt(dc); + if (err < 0) + return err; + dc->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(dc->clk)) { dev_err(&pdev->dev, "failed to get clock\n");