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: 2830909 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5753C9F4D4 for ; Sun, 21 Jul 2013 08:36:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7CEEB2015D for ; Sun, 21 Jul 2013 08:36:57 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 77F9F20154 for ; Sun, 21 Jul 2013 08:36:56 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V0p7e-0003yz-5A; Sun, 21 Jul 2013 08:36:06 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V0p7W-0007jc-0W; Sun, 21 Jul 2013 08:35:58 +0000 Received: from smtp4.mail.ru ([94.100.176.44]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V0p7J-0007iW-TY for linux-arm-kernel@lists.infradead.org; Sun, 21 Jul 2013 08:35:47 +0000 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 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-Mras: Ok X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130721_043546_491202_035A8323 X-CRM114-Status: GOOD ( 11.26 ) X-Spam-Score: -2.0 (--) Cc: Markus Pargmann , linux-fbdev@vger.kernel.org, Tomi Valkeinen , Alexander Shiyan , Sascha Hauer X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,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 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.