From patchwork Sun Jul 21 08:35:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 2830905 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 7A227C0319 for ; Sun, 21 Jul 2013 08:36:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A270A20154 for ; Sun, 21 Jul 2013 08:35:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 157AE2015D for ; Sun, 21 Jul 2013 08:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753842Ab3GUIfz (ORCPT ); Sun, 21 Jul 2013 04:35:55 -0400 Received: from fallback4.mail.ru ([94.100.176.42]:59739 "EHLO fallback4.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753618Ab3GUIfu (ORCPT ); Sun, 21 Jul 2013 04:35:50 -0400 Received: from smtp4.mail.ru (smtp4.mail.ru [94.100.176.44]) by fallback4.mail.ru (mPOP.Fallback_MX) with ESMTP id EA491140CBA for ; Sun, 21 Jul 2013 12:35:47 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Message-Id:Date:Subject:Cc:To:From; bh=HGD8dOeTfNY1ULFcKf2NABP/vuHfRuHPr5ksxRZXXTo=; b=aUq8vsmQmfjS/yeHlctCJ34dpth7AjpOTteGqbTmJeRPc46f9unhjniHXb9QwveyJIdTzB9sBA/YZmIyooFljeLGunJz28kMeaRqJXGVvcnOHqMtt2/kJCWQu474JYsQyg5WQIZMd12ZshXrbdws4v/IOnTQl5vz+f2EbiaTsw4=; Received: from [188.134.40.128] (port=49726 helo=shc.zet) by smtp4.mail.ru with esmtpa (envelope-from ) id 1V0p6u-0002KV-91; Sun, 21 Jul 2013 12:35:20 +0400 From: Alexander Shiyan To: linux-arm-kernel@lists.infradead.org Cc: linux-fbdev@vger.kernel.org, Sascha Hauer , Tomi Valkeinen , Markus Pargmann , Alexander Shiyan Subject: [PATCH 1/2] video: imxfb: Fix retrieve values from DT Date: Sun, 21 Jul 2013 12:35:08 +0400 Message-Id: <1374395709-20898-1-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.1.5 X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Mras: Ok Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RDNS_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no 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 Display settings should be retrieved from "display" node, not from root fb node. This patch fix this bug. Signed-off-by: Alexander Shiyan --- drivers/video/imxfb.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 38733ac..8e104c4 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c @@ -753,12 +753,12 @@ static int imxfb_resume(struct platform_device *dev) #define imxfb_resume NULL #endif -static int imxfb_init_fbinfo(struct platform_device *pdev) +static int imxfb_init_fbinfo(struct platform_device *pdev, + struct device_node *np) { struct imx_fb_platform_data *pdata = pdev->dev.platform_data; struct fb_info *info = dev_get_drvdata(&pdev->dev); struct imxfb_info *fbi = info->par; - struct device_node *np; pr_debug("%s\n",__func__); @@ -799,7 +799,6 @@ static int imxfb_init_fbinfo(struct platform_device *pdev) fbi->lcd_power = pdata->lcd_power; fbi->backlight_power = pdata->backlight_power; } else { - np = pdev->dev.of_node; info->var.grayscale = of_property_read_bool(np, "cmap-greyscale"); fbi->cmap_inverse = of_property_read_bool(np, "cmap-inverse"); @@ -858,6 +857,7 @@ static int imxfb_of_read_mode(struct device *dev, struct device_node *np, static int imxfb_probe(struct platform_device *pdev) { + struct device_node *display_np = NULL; struct imxfb_info *fbi; struct fb_info *info; struct imx_fb_platform_data *pdata; @@ -887,7 +887,17 @@ static int imxfb_probe(struct platform_device *pdev) platform_set_drvdata(pdev, info); - ret = imxfb_init_fbinfo(pdev); + if (pdev->dev.of_node) { + display_np = of_parse_phandle(pdev->dev.of_node, "display", 0); + if (!display_np) { + dev_err(&pdev->dev, + "No display defined in devicetree\n"); + ret = -EINVAL; + goto failed_init; + } + } + + ret = imxfb_init_fbinfo(pdev, display_np); if (ret < 0) goto failed_init; @@ -898,16 +908,8 @@ static int imxfb_probe(struct platform_device *pdev) fbi->mode = pdata->mode; fbi->num_modes = pdata->num_modes; } else { - struct device_node *display_np; fb_mode = NULL; - display_np = of_parse_phandle(pdev->dev.of_node, "display", 0); - if (!display_np) { - dev_err(&pdev->dev, "No display defined in devicetree\n"); - ret = -EINVAL; - goto failed_of_parse; - } - /* * imxfb does not support more modes, we choose only the native * mode.