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: 2842374 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 179C7BF546 for ; Sat, 10 Aug 2013 07:36:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3E04A201DC for ; Sat, 10 Aug 2013 07:36:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 55C1D201CE for ; Sat, 10 Aug 2013 07:36:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932323Ab3HJHgl (ORCPT ); Sat, 10 Aug 2013 03:36:41 -0400 Received: from fallback8.mail.ru ([94.100.176.136]:37007 "EHLO fallback8.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932175Ab3HJHgl (ORCPT ); Sat, 10 Aug 2013 03:36:41 -0400 Received: from smtp21.mail.ru (smtp21.mail.ru [94.100.176.174]) by fallback8.mail.ru (mPOP.Fallback_MX) with ESMTP id 6DF48382F7EF for ; Sat, 10 Aug 2013 11:36:38 +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=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 Cc: linux-fbdev@vger.kernel.org, Sascha Hauer , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Alexander Shiyan 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-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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.