Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp565682imm; Wed, 26 Sep 2018 03:25:17 -0700 (PDT) X-Google-Smtp-Source: ACcGV63b9x7v7Wkw0ARUTClXpJGb1qi5MmcSBCcOLtU/6hbK37OgYEanxb8AKeixhzMm8QWnn2O6 X-Received: by 2002:a17:902:aa8f:: with SMTP id d15-v6mr5483352plr.64.1537957517048; Wed, 26 Sep 2018 03:25:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537957517; cv=none; d=google.com; s=arc-20160816; b=fkcp1zWGDe8Z2ZOVwYPbdmC4yT+sYh0MA9115MohP+u8ZQrCWf2JoqzqDB4PXyeS1D AiUvgt/GViCZlhtlS9zsxVl43wu5zGWEt3L+ePZxdUo4NYQVDyIbOlGJ7rT4c7hpT4/k s1Hzhp7SIkVQ7dIGnk46zPGgJJ9Nm5iR97tmNPmMeqHbInBWUbwzHY42LSdiKHnhLCjT UxZmIAXy15iNZNISCstOD11pLwtJ73uq90VEpCLT5f04sl6Xw73w00fhUa9zuQ4D2DQD y9bOrwqgLHXM/IX/O/7hllqqhCFBjmnHcyIkS2CCyacn3xOuLYuQHJNVNOUfWGJkkDCH fO0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=x6XFqD5p4e4clCNru816FSciA/vyqqXsmOyBE8bEoNI=; b=YIW20+puyg5kT5Fe1s57jd4bl6OwDnR2GZQ/zGm8J365ZX4B8iO1G8vQlLdHwqMZ0e nUM0Ow8xubPcdvaDuCNXOy0DEYpdp7NLmnIzKvWrxizEDz7bHUHmh9EbbA3id/CO6SHJ Hiyc9FmeOREdGHmd0gNEnMP+ey61iUd4LFrQEX2gdOQcyX4sDjUx3nD3P5G3UEG2arLf sv9vyBf0754lrD++2VoBjv5O/x284uEGNHXNLeZx2ZSWhohjqb9MS5yGykQLD0FSAaQu /DwyLNzI+AdDmZIdakSKr9w8ho0/zU8Z9f+lkcFvI7vLGclvYvEzza3V0BmmxHB3+WGQ 6PXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=qwXn1UEQ; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p4-v6si5079160pls.53.2018.09.26.03.25.02; Wed, 26 Sep 2018 03:25:16 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=qwXn1UEQ; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727292AbeIZQgx (ORCPT + 99 others); Wed, 26 Sep 2018 12:36:53 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:50030 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726602AbeIZQgx (ORCPT ); Wed, 26 Sep 2018 12:36:53 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id w8QAOZ44018067; Wed, 26 Sep 2018 05:24:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1537957475; bh=x6XFqD5p4e4clCNru816FSciA/vyqqXsmOyBE8bEoNI=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=qwXn1UEQSrD6GEMx5NinDBy7U7xiCqRBpHBh7zLqVqjNTcvduEVVLZELMmVHRkfdI B9QX7n3GHrJy6JVYc5+0xZ3aO+lv9XBfD/VQMCmxnLZxA7Ig+5OvekoW49lPT7XPgW GWlKmvMBdOObmaG3vU1zJqxg1MMoc/Rtkmyk397Y= Received: from DFLE107.ent.ti.com (dfle107.ent.ti.com [10.64.6.28]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8QAOZlC001093; Wed, 26 Sep 2018 05:24:35 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Wed, 26 Sep 2018 05:24:34 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Wed, 26 Sep 2018 05:24:34 -0500 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8QAOWN7022919; Wed, 26 Sep 2018 05:24:33 -0500 Subject: Re: [PATCH RESEND] backlight: gpio-backlight: Correct initial power state handling To: Daniel Thompson , , CC: , , References: <20180508070426.32211-1-peter.ujfalusi@ti.com> From: Peter Ujfalusi Message-ID: <94685994-98ff-2a1d-901c-6d3cce71db16@ti.com> Date: Wed, 26 Sep 2018 13:25:19 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Daniel, On 2018-06-13 18:11, Daniel Thompson wrote: > On 08/05/18 08:04, Peter Ujfalusi wrote: >> The default-on property - or the def_value via legacy pdata) should be >> handled as: >> if it is 1, the backlight must be enabled (kept enabled) >> if it is 0, the backlight must be disabled (kept disabled) >> >> This only works for the case when default-on is set. If it is not set >> then >> the brightness of the backlight is set to 0. Now if the backlight is >> enabled by external driver (graphics) the backlight will stay disabled >> since >> the brightness is configured as 0. The backlight will not turn on. >> >> The correct action at probe time is to configure the props.power to >> FB_BLANK_UNBLANK if we want the backlight on by default or to >> FB_BLANK_POWERDOWN if the backlight should be off by default. >> >> The initial brightness should be set to 1. > > Hmnn... I guess this comes down to the definition of "on" for a binary > > Actually I'm a little worried that backlight already has too many > different behaviors and that this patch introduces another way for them > to be different! > > Is there any mileage in adopting the same approach as PWM backlight for > blank/unblank management as a way to get a flicker free boot? This patch is merely fixing a bug in the driver. > For PWM the default property controls the initial brightness and the > initial power state is unblanked *unless* there is a phandle link to the > node, in which case we inherit whatever the power state the bootloader > had configured before the driver probed. > > Put another way, what happens is we implement > gpio_backlight_initial_power_state() to perform a similar task to > pwm_backlight_initial_power_state(). I agree, but what should we do with the default-on parameter? non DT boot or DT boot, no phandle link: default-on ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN DT boot and phandle link: if the GPIO was enabled by the bootloader: FB_BLANK_UNBLANK if the GIOP was not enabled by the bootloader: FB_BLANK_POWERDOWN I think this will mimic closely what the pwm_backlight_initial_power_state() does. - Péter > > > Daniel. > > >> >> Signed-off-by: Peter Ujfalusi >> --- >> Hi, >> >> for some reason the original patch got lost: >> https://patchwork.kernel.org/patch/9445539/ >> >> But it is still valid, so I'm resending it. >> >> Regards, >> Peter >> >>   drivers/video/backlight/gpio_backlight.c | 4 +++- >>   1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/video/backlight/gpio_backlight.c >> b/drivers/video/backlight/gpio_backlight.c >> index e470da95d806..904a4462cefe 100644 >> --- a/drivers/video/backlight/gpio_backlight.c >> +++ b/drivers/video/backlight/gpio_backlight.c >> @@ -142,7 +142,9 @@ static int gpio_backlight_probe(struct >> platform_device *pdev) >>           return PTR_ERR(bl); >>       } >>   -    bl->props.brightness = gbl->def_value; >> +    bl->props.power = gbl->def_value ? FB_BLANK_UNBLANK : >> FB_BLANK_POWERDOWN; >> +    bl->props.brightness = 1; >> + >>       backlight_update_status(bl); >>         platform_set_drvdata(pdev, bl); >> > Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki