Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3837682imu; Mon, 12 Nov 2018 01:03:58 -0800 (PST) X-Google-Smtp-Source: AJdET5eWsRdBZCHxnD36JvBRIJmu9h4unBoKM53oo+jwP7rHXEksUAJPms8AVVo5hofN8HCAXEBN X-Received: by 2002:a17:902:6a8b:: with SMTP id n11-v6mr101786plk.311.1542013438280; Mon, 12 Nov 2018 01:03:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542013438; cv=none; d=google.com; s=arc-20160816; b=qFgVT8JCzdBsl6Sj1mX9Ef8klpmmVwL4FycT4m9SKPM/wXb4xMswzRUwABu67E2kdu 6GLVjCOtETLaDKWy46U45LWu/kfKQwfROGxcxqzy9/3/Jxjf5MxrAg81mislbZLInY7p 9QPsY5q6c8d3gy5l3SV/qBrQsg4aZv4S4YhzbVBNa0jBQyjGK61Sj5nVZDppMQ9UE9iv 177ZCNNrfeJPOOmcltWC6Zh6WLfrxZnFC3kZS6kvdqDO/ojQdisJDPpyc8STTMLjr+sR HbwUWtPtjYFb/H6CUf1TJuvWvqj16x2fWby8xKG0yqtAaHQ+SSOMiaYMhOvn/hvJcDAx R8QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=RQtS7I+hZjPCLPSPlQ3MjYnk2fyCtDrnPkfeiBYK6nQ=; b=XeCL94gvKTZ4AcFFA6zvNf0RKLpcAph1HHenqF90yLSqJEVWmBYE9grkKsU5NFkoR2 VoNmmwxwOY/A5mJsfIuu4YcViqVOaS8e08nuWrZEo5gw+WY3oIh1iZHaXcQIg9KAKchr DgKC154tTm/aN1qzhLedylbvimIZF7EZC7gsHSfTYHZuEeFypmHbJUDcLmyMXTKYN51I Z/SdaEsF/tGs1NyhRKZ0f91Du7DoDgFDfQDzGCgnZZ2/+5UBWp8FwHtxB7/W33wMLIxL ZEjqyEI0y/xF/1VmT7ubjMzWaQIjSVKud67XR3P0sITn+eYRw5YerA2YUFIRg7pnjgXS FcDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v23-v6si16971952pff.103.2018.11.12.01.03.42; Mon, 12 Nov 2018 01:03:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729142AbeKLSzW (ORCPT + 99 others); Mon, 12 Nov 2018 13:55:22 -0500 Received: from gloria.sntech.de ([185.11.138.130]:47108 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727208AbeKLSzW (ORCPT ); Mon, 12 Nov 2018 13:55:22 -0500 Received: from wd0239.dip.tu-dresden.de ([141.76.108.239] helo=phil.dip.tu-dresden.de) by gloria.sntech.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1gM87d-0003ps-4p; Mon, 12 Nov 2018 10:03:05 +0100 From: Heiko Stuebner To: lee.jones@linaro.org, daniel.thompson@linaro.org, jingoohan1@gmail.com Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, enric.balletbo@collabora.com, heiko@sntech.de, Heiko Stuebner Subject: [PATCH] backlight: pwm_bl: fix devicetree parsing with auto-generated brightness tables Date: Mon, 12 Nov 2018 10:02:57 +0100 Message-Id: <20181112090257.7084-1-heiko@sntech.de> X-Mailer: git-send-email 2.18.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heiko Stuebner Commit 88ba95bedb79 ("backlight: pwm_bl: Compute brightness of LED linearly to human eye") made the parse-dt function return early when using an auto- generated brightness-table, but didn't take into account that some more settings were handled below the brightness handling, like power-on-delays and also setting the pdata enable-gpio to -EINVAL. This surfaces for example in the case of a backlight without any enable-gpio which then tries to use gpio-0 in error. Fix this by simply moving the trailing settings above the brightness handling. Fixes: 88ba95bedb79 ("backlight: pwm_bl: Compute brightness of LED linearly to human eye") Signed-off-by: Heiko Stuebner --- drivers/video/backlight/pwm_bl.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index bcd08b41765d..b7b5b31f3824 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -272,6 +272,16 @@ static int pwm_backlight_parse_dt(struct device *dev, memset(data, 0, sizeof(*data)); + /* + * These values are optional and set as 0 by default, the out values + * are modified only if a valid u32 value can be decoded. + */ + of_property_read_u32(node, "post-pwm-on-delay-ms", + &data->post_pwm_on_delay); + of_property_read_u32(node, "pwm-off-delay-ms", &data->pwm_off_delay); + + data->enable_gpio = -EINVAL; + /* * Determine the number of brightness levels, if this property is not * set a default table of brightness levels will be used. @@ -384,15 +394,6 @@ static int pwm_backlight_parse_dt(struct device *dev, data->max_brightness--; } - /* - * These values are optional and set as 0 by default, the out values - * are modified only if a valid u32 value can be decoded. - */ - of_property_read_u32(node, "post-pwm-on-delay-ms", - &data->post_pwm_on_delay); - of_property_read_u32(node, "pwm-off-delay-ms", &data->pwm_off_delay); - - data->enable_gpio = -EINVAL; return 0; } -- 2.18.0