From patchwork Sat Aug 10 07:33:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 2842371 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 4E7739F271 for ; Sat, 10 Aug 2013 07:34:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BBA95201B5 for ; Sat, 10 Aug 2013 07:34:49 +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 46C5920189 for ; Sat, 10 Aug 2013 07:34:48 +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 1V83h7-0000z8-A2; Sat, 10 Aug 2013 07:34:37 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V83h5-0000pZ-5e; Sat, 10 Aug 2013 07:34:35 +0000 Received: from smtp21.mail.ru ([94.100.176.174]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V83h0-0000oi-Qz for linux-arm-kernel@lists.infradead.org; Sat, 10 Aug 2013 07:34:32 +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=Up1Xm6NPRXDzlBU98CchFM4EOwYiRuvhHu93Hiw515nvEI+w/FACg7Cji+PzgZZrr9im/hY5aprRJ0AnTxFKKwacmqEVMO/29ZvMhP7lu8dKRTe2wykrJjt8eMv/mMA6xuGwuYVEmKXGyJQgbggms2OxIKNVc4B2TAVzsGu7M8Y=; Received: from [188.134.40.128] (port=22735 helo=shc.zet) by smtp21.mail.ru with esmtpa (envelope-from ) id 1V83gd-0005RM-Ld; Sat, 10 Aug 2013 11:34:07 +0400 From: Alexander Shiyan To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2] video: imxfb: Fix retrieve values from DT Date: Sat, 10 Aug 2013 11:33:57 +0400 Message-Id: <1376120037-23777-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-20130810_033431_291913_4FEF9C2C X-CRM114-Status: GOOD ( 10.58 ) X-Spam-Score: -2.0 (--) Cc: linux-fbdev@vger.kernel.org, Tomi Valkeinen , Jean-Christophe Plagniol-Villard , 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=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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.