Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp296169imu; Fri, 16 Nov 2018 02:42:26 -0800 (PST) X-Google-Smtp-Source: AJdET5dBv7w+TBnIVoiM3vhbzSY7C6+9iCKG0Cc53aNFsxDVXD8ugCTPnQNHLroSN9LlvXjfZ/2l X-Received: by 2002:a17:902:bc8c:: with SMTP id bb12-v6mr9778913plb.275.1542364946461; Fri, 16 Nov 2018 02:42:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542364946; cv=none; d=google.com; s=arc-20160816; b=MSVPm1XNhHHf5+hlMiOf5kWwk7KK75O5Du0w5JMPDfUsmB8+06FBzCo0TcRBI1zqco scCfcoUU7clln0a1UcZpa4/PVvZXilOuHNcVS7fuwbg67oTqTkar27irUb7oXYby17Zz gF0FzCIEovOmAPCxZr6KGIr7oqUIkHNvUwp5OMg3dZk3Yt9mLzhkcLfNcr/0Dijzoel5 rzk0GtFInHmTq0LSF59WBbszEfWIqwWu++YLebrDPIa5BzmpE43O19s7DHOOIXVdbsrQ nxx53lLqbEsJj2erEVSWsgjuv5d+UfyApZNGcNDEyukMv5mHXEw++xjqqCqis8Eelds+ nwqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=4RKp13BXaAR2TDE0/4UZD1H1UciAcXbRM613Uvjpyj0=; b=QKB0TTZrfUZz4juVWDjHqJ9C1UMmg8LL0CYIdCaraEHNwl7ib6xyfwa1pMMqGj7nk9 nW1NBky0nbtLbuuaJWwXyd61BXCQIAWVvSzLCZblhRBfxSvQC7ga+i2bR1gSy6U1PtAL edWl3hNNlKJ6nz5wZ2kFoiY2BxRim2kN0reZCKkUXgIpNdiUD5MqTp5EVYjJe2TbMCn0 G/Z2Z357skqOemxL3qpnddExKwSzZ7uvqEkFwTkuTuuJ3yy41ysvImKxtOejso94v1jG W+szOFvb9v8Xexh1iniyOaA4wDiYYqM3in18ryvuvdtaRvR1ac6S0xFXRoNLr3c1QEwX hk1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="aHQ/KSj2"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay4-v6si30494334plb.410.2018.11.16.02.42.11; Fri, 16 Nov 2018 02:42:26 -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; dkim=pass header.i=@linaro.org header.s=google header.b="aHQ/KSj2"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389548AbeKPUvo (ORCPT + 99 others); Fri, 16 Nov 2018 15:51:44 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:37035 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727630AbeKPUvo (ORCPT ); Fri, 16 Nov 2018 15:51:44 -0500 Received: by mail-wm1-f66.google.com with SMTP id p2-v6so20550031wmc.2 for ; Fri, 16 Nov 2018 02:39:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=4RKp13BXaAR2TDE0/4UZD1H1UciAcXbRM613Uvjpyj0=; b=aHQ/KSj2XVgEExJxqTaG/d8HXWMzbOhxKGH9yraS9aqrWN9noKCD23puBBUyV2Hebp ipTKN978bI8mvbynlGEiXjzYSUJkwtShTh0DOstlCBwxhJQqVAtYOhXrEG3uhefE3bm8 2Ae40bvK93hXVJYEvKpQ+pM7rULuOXNrzXlUs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=4RKp13BXaAR2TDE0/4UZD1H1UciAcXbRM613Uvjpyj0=; b=a3vvt4fjbWDVtfTsA6HKeoE2B7QjlFn66k+Qa1jY1VLSUFtbklbIri5qOxNrmNGQhV y6Vhm8rxU+x9/szLKG9N9sns+FXrqzN5cfzqCaApVFz/4K4PVrhN5PAj3egiTOmId/YI rhCjv3p13yWS9pDqwmAbAXIrYcU7YzPwkkgzIAMB0O7nouCLrQJ3wBdRcQbE1EjX2rV/ FujGkmadZlsVrsAQpZo4415L8mCn0EewH5IHPPsrnDHwi/yo3kEqBfk/VnZlJ7uu0JOl NmSnIgl6jgww3CpVsj0XGciD+rBSvcK20vTDJGKy/QzAEZkx4NqD7rBL+aVj13CdB0ZH KsAw== X-Gm-Message-State: AA+aEWZqVDQ+a1WRCc9iIHYbXFNit+T3GMfnqef8Uj/PPCfa9GfXbNsP HU+cfWbQfHxymh6qr/w3V4pClg== X-Received: by 2002:a1c:8089:: with SMTP id b131mr7565wmd.141.1542364796996; Fri, 16 Nov 2018 02:39:56 -0800 (PST) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id f68sm13960771wmd.15.2018.11.16.02.39.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Nov 2018 02:39:56 -0800 (PST) Date: Fri, 16 Nov 2018 10:39:53 +0000 From: Daniel Thompson To: Heiko Stuebner Cc: lee.jones@linaro.org, jingoohan1@gmail.com, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, enric.balletbo@collabora.com, Heiko Stuebner Subject: Re: [PATCH] backlight: pwm_bl: fix devicetree parsing with auto-generated brightness tables Message-ID: <20181116103953.xcrsbn6gh366yxcp@holly.lan> References: <20181112090257.7084-1-heiko@sntech.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181112090257.7084-1-heiko@sntech.de> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 12, 2018 at 10:02:57AM +0100, Heiko Stuebner wrote: > 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 Acked-by: Daniel Thompson > --- > 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 >