From patchwork Tue Sep 2 12:51:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 4825061 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 5DBCFC0338 for ; Tue, 2 Sep 2014 12:54:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10FAD201C0 for ; Tue, 2 Sep 2014 12:54:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 43B0F20170 for ; Tue, 2 Sep 2014 12:54:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 599576E472; Tue, 2 Sep 2014 05:54:26 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by gabe.freedesktop.org (Postfix) with ESMTP id CCA456E472 for ; Tue, 2 Sep 2014 05:54:24 -0700 (PDT) Received: by mail-vc0-f169.google.com with SMTP id hq11so6919751vcb.14 for ; Tue, 02 Sep 2014 05:54:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MGxjrijGhEuLIxfMY+4QFy3iHOEscQ/9PY+677F/bxE=; b=MOqkpZgupSsgfTtnA0PSssbuk4sJGQlstqrrSApcWE9vJW4ZY2fxIL6QDyH6sDCynG Ml5EK1Q3ecwiLCUNoMWSqKwD+ZK6Fr/1uf9GeH3+iSwGtsUkCn/GRvRhL0CJb/bIddNK 1AlaEQOmet9m5ff3WmRJTUXtbH+SctPfZFNezybksBwOJNKwxAdDC+lx/Roi50056flK Es5fhEHAFksYhRYgudSRGNCwEGNfteTsyuiLRd1DLFJFjsjaKdoWfKCJJQVyU+ysUUBP G/BjYdZ9oyQXswCS+jmKKVhDhDI6pIyqQww9ySzXY6+VnBYdezDKUq+GLCmGZXfkuowI Osig== X-Gm-Message-State: ALoCoQkyrnUEXOKOAUZecDYdkspEzlcRtBVJY09a4qOynioZ6UvhzjrEkJTx9WP/Tz92piqQopCD X-Received: by 10.220.69.18 with SMTP id x18mr95440vci.58.1409662464433; Tue, 02 Sep 2014 05:54:24 -0700 (PDT) Received: from arch.hh.imgtec.org ([190.2.108.102]) by mx.google.com with ESMTPSA id vm20sm9912017vdb.21.2014.09.02.05.54.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Sep 2014 05:54:23 -0700 (PDT) From: Ezequiel Garcia To: , Dave Airlie Subject: [PATCH/RESEND 6/8] drm/tilcdc: panel: Fix backlight devicetree support Date: Tue, 2 Sep 2014 09:51:20 -0300 Message-Id: <1409662282-7945-7-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailer: git-send-email 2.0.1 In-Reply-To: <1409662282-7945-1-git-send-email-ezequiel@vanguardiasur.com.ar> References: <1409662282-7945-1-git-send-email-ezequiel@vanguardiasur.com.ar> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 The current backlight support is broken; the driver expects a backlight-class in the panel devicetree node. Fix this by implementing it properly, getting an optional backlight from a phandle. This shouldn't cause any backward-compatibility DT issue because the current implementation doesn't work and is not even documented. Tested-by: Darren Etheridge Signed-off-by: Ezequiel Garcia --- .../devicetree/bindings/drm/tilcdc/panel.txt | 5 +++++ drivers/gpu/drm/tilcdc/tilcdc_panel.c | 23 +++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/drm/tilcdc/panel.txt b/Documentation/devicetree/bindings/drm/tilcdc/panel.txt index 9301c33..10a06e8 100644 --- a/Documentation/devicetree/bindings/drm/tilcdc/panel.txt +++ b/Documentation/devicetree/bindings/drm/tilcdc/panel.txt @@ -18,6 +18,9 @@ Required properties: Documentation/devicetree/bindings/video/display-timing.txt for display timing binding details. +Optional properties: +- backlight: phandle of the backlight device attached to the panel + Recommended properties: - pinctrl-names, pinctrl-0: the pincontrol settings to configure muxing properly for pins that connect to TFP410 device @@ -29,6 +32,8 @@ Example: compatible = "ti,tilcdc,panel"; pinctrl-names = "default"; pinctrl-0 = <&bone_lcd3_cape_lcd_pins>; + backlight = <&backlight>; + panel-info { ac-bias = <255>; ac-bias-intrpt = <0>; diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c index c716c12..3dcf08e 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c @@ -342,7 +342,7 @@ static struct tilcdc_panel_info *of_get_panel_info(struct device_node *np) static int panel_probe(struct platform_device *pdev) { - struct device_node *node = pdev->dev.of_node; + struct device_node *bl_node, *node = pdev->dev.of_node; struct panel_module *panel_mod; struct tilcdc_module *mod; struct pinctrl *pinctrl; @@ -358,6 +358,17 @@ static int panel_probe(struct platform_device *pdev) if (!panel_mod) return -ENOMEM; + bl_node = of_parse_phandle(node, "backlight", 0); + if (bl_node) { + panel_mod->backlight = of_find_backlight_by_node(bl_node); + of_node_put(bl_node); + + if (!panel_mod->backlight) + return -EPROBE_DEFER; + + dev_info(&pdev->dev, "found backlight\n"); + } + mod = &panel_mod->base; pdev->dev.platform_data = mod; @@ -381,10 +392,6 @@ static int panel_probe(struct platform_device *pdev) mod->preferred_bpp = panel_mod->info->bpp; - panel_mod->backlight = of_find_backlight_by_node(node); - if (panel_mod->backlight) - dev_info(&pdev->dev, "found backlight\n"); - return 0; fail_timings: @@ -392,6 +399,8 @@ fail_timings: fail_free: tilcdc_module_cleanup(mod); + if (panel_mod->backlight) + put_device(&panel_mod->backlight->dev); return ret; } @@ -399,6 +408,10 @@ static int panel_remove(struct platform_device *pdev) { struct tilcdc_module *mod = dev_get_platdata(&pdev->dev); struct panel_module *panel_mod = to_panel_module(mod); + struct backlight_device *backlight = panel_mod->backlight; + + if (backlight) + put_device(&backlight->dev); display_timings_release(panel_mod->timings);