From patchwork Fri Jul 11 14:18:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 4535411 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 4900BBEECB for ; Fri, 11 Jul 2014 15:35:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D37582026C for ; Fri, 11 Jul 2014 15:35:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id EDD2F20158 for ; Fri, 11 Jul 2014 15:35:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 121936E095; Fri, 11 Jul 2014 08:35:53 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yh0-f52.google.com (mail-yh0-f52.google.com [209.85.213.52]) by gabe.freedesktop.org (Postfix) with ESMTP id 147EC6E846 for ; Fri, 11 Jul 2014 07:23:30 -0700 (PDT) Received: by mail-yh0-f52.google.com with SMTP id a41so432599yho.11 for ; Fri, 11 Jul 2014 07:23:29 -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=yyyUqIksTA41vjv8qRlHYtNSHf2qv8k5V9Dwyyqd9F8=; b=PKaIlqoQeZwTIzP5IMuUK5cx33XJ9O9o16Ht5CBMjkINVEEDmU7dhVbkeB54gW3uF/ UfCwkXKVbuGxML+RKHk1dRzGveP1H+o8rjWOA7+lSVgrqRjK6G4XzAOljsLpbZGy3Efb jdbYvp7BTvq9pxBNQg252Pf/n5qgofYH8WeKL5Kt69tjtGUtkfmN0E8Dcdys/zW1Np70 KO0G6Ds0IyqJtsCIo6MrzlpchyYnu7aElteNo7uoPwo+tgcnky8Gsbnb2f7GToXgDQm0 ywsBVJVjViQxWDRSm3vWAwF3tvSeh+DCrnhRVlqA14E765yvMiDNqpBmugclt05gGDaE ENZA== X-Gm-Message-State: ALoCoQlSMGVll83/Qx4tiq6aBJVyYGwyHkJNwfFGkEbO9D566raNjxI7ZAoQUdbIAnWglA3RxmnY X-Received: by 10.236.149.72 with SMTP id w48mr46642554yhj.101.1405088609678; Fri, 11 Jul 2014 07:23:29 -0700 (PDT) Received: from localhost.localdomain ([190.2.108.113]) by mx.google.com with ESMTPSA id f63sm5309293yhf.1.2014.07.11.07.23.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Jul 2014 07:23:29 -0700 (PDT) From: Ezequiel Garcia To: , , Dave Airlie Subject: [PATCH 6/8] drm/tilcdc: panel: Fix backlight devicetree support Date: Fri, 11 Jul 2014 11:18:52 -0300 Message-Id: <1405088334-11215-7-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1405088334-11215-1-git-send-email-ezequiel@vanguardiasur.com.ar> References: <1405088334-11215-1-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailman-Approved-At: Fri, 11 Jul 2014 08:35:47 -0700 Cc: daniel.vetter@ffwll.ch, Russell King , Ezequiel Garcia 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=-4.8 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. 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);