Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp463540pxk; Wed, 9 Sep 2020 09:49:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMYkh/Uz5xkpZFAhhrxsyE4wLmDFnMaR2YhB4O4nK2NOFUNlQcTa9QbO8aZS7KUHq6jYLi X-Received: by 2002:a05:6402:3050:: with SMTP id bu16mr5124748edb.343.1599670181396; Wed, 09 Sep 2020 09:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599670181; cv=none; d=google.com; s=arc-20160816; b=QUKYFHsdLMnm0gcJxumnidLlA0xV+jf3IAihiyOjjZ9DtjMlkEPhfcN9TT9QOBnlWz siSWQbEFSP6OZX0+pZ7VEc9Bpldy6tohl8ZlLG//1q3tu2YUBrgHnRI4zPKh+Mj8NKK/ TqvowJHILk0xk9T22GQ19/53zsqZY1WZBrcWTR7l5UXaIp9K7F1cBLh+dKOBkS8DUHRl 0vwhBAHv6kUA3soXX6Mw4CuQblEBQapRLOxfrGW5kwS4M4IfhrG/E1T7mS0IdZb7Rjjv Sp+4I1DAOYxINKRsdP5NSbp9RmtWRjG1u5xecyLDi132+wV+Ty88KFHz0CVnuckIrn7J tOhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature; bh=5VKePPT3rsU28wXCAu1Xs2KBd1A5X4Nlem8vFp45sFs=; b=ZIWXN7m1/6CizRU9lPqG6PTYk1bEjBlitbESpKbnJVeh281dNbUdKlg6pV4RzVEhnu KW8q8cxT4ISHUzKCssg/qmpXoue0CHycdHs5hxvbJjy1cWuo8Myc71AxtqsEb3yPSQoU txXeit8/C72DMwvue4e/ZD8nrKqRIBnqUcrLwYq2v1g+BOFWNdsYFfnNBLAZJL82Gkuu yMGzpVGFV2G8is7gdGVVlPs3M74qPhHJiOPYbgC3pfrA8UIk0yejeE4dNW19oyzVuJT+ kM+tK20UpFq9BZ2h+KEftoFbUhXR8ioz7U+2DjhDxJuBQxiH4Pk1k4chWpM2CCXc8qTT eFXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N+MbeIjr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id f11si1784713edq.528.2020.09.09.09.49.18; Wed, 09 Sep 2020 09:49:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N+MbeIjr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1730882AbgIIQsm (ORCPT + 99 others); Wed, 9 Sep 2020 12:48:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730927AbgIIQHj (ORCPT ); Wed, 9 Sep 2020 12:07:39 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D86AC061234 for ; Wed, 9 Sep 2020 07:45:42 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id x23so2544355wmi.3 for ; Wed, 09 Sep 2020 07:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=5VKePPT3rsU28wXCAu1Xs2KBd1A5X4Nlem8vFp45sFs=; b=N+MbeIjrkaWZSL1rnQBBMQ3t8EgtJ5pPqrCari+s74htlzysCeT43xiaa6jOYcy32h 4CDd9PSLQ49+GE9aRevle7XYa++OWOquZVftThJ4b3J3mk7MOdGIvX/YVJ4/atzSziBT QHOhNZJHMYRC2WOAByxQXcbJ/TxQLqB4Sr3+9q2HGHmYaySmzrk2sQUUz+Kpl7Ek4wAU cKekwJ1cvRmuB3pCyekrgNUPB9OXHj9eOSQD19+VXVp1lZB1x9oVUJJXVhHAbiYN+eAf kA4jU0llu01THgYWYLbkq9qRnuFNG/4WMZXx0YeYtEuuVct/E2BvPHB6tDgTCXe1CJoG BVVQ== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=5VKePPT3rsU28wXCAu1Xs2KBd1A5X4Nlem8vFp45sFs=; b=opx6Lo100TdSFAJwSEzgWKMI0qx9XQKEdQpjNKf2DjZ8a9EXsIKsU3mdWBr3dPoDQX P1VXRvI03SpOq7t6VHj6jG/0zUkRcQQmKexwtJxckD07h27EsDdzng881uhSq/iFWOFl x8p9bN2SqSG9wvihBTrBQr3gebRA7CPJQW4Euk+VZ0J0oCTkeL0HssP4VCEyYS05HVjn aHBWoexpu30ehYe4MBGl0M7euotB1pUliesCYSWtDwSQkKyl4PQFv28Hlnx4ctAOjQUO EeynOI/W2rrpGMsfEubbglBE3/PjrHa5HeyfVVkXy+aF5e0sYcf/eiLTYYHHTDvbY63E CobQ== X-Gm-Message-State: AOAM532c14gjNP6F/Bs74WR8CE6bkraSJ/+xZbqRtdeLqfKMhzl5vzrc C/0gv1jkL75hpieAO2Ug3UUGCg== X-Received: by 2002:a1c:1904:: with SMTP id 4mr3865768wmz.119.1599662741033; Wed, 09 Sep 2020 07:45:41 -0700 (PDT) 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 v2sm4773397wrm.16.2020.09.09.07.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 07:45:39 -0700 (PDT) Date: Wed, 9 Sep 2020 15:45:37 +0100 From: Daniel Thompson To: Alexandru Stan , linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, Bartlomiej Zolnierkiewicz , Jingoo Han , Douglas Anderson , Rob Herring , linux-kernel@vger.kernel.org, Thierry Reding , dri-devel@lists.freedesktop.org, Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Enric Balletbo i Serra , Lee Jones , Matthias Kaehlcke Subject: Re: [PATCH 2/3] backlight: pwm_bl: Artificially add 0% during interpolation Message-ID: <20200909144537.daq2exfihhxm6bai@holly.lan> References: <20200721042522.2403410-1-amstan@chromium.org> <20200720212502.2.Iab4d2192e4cf50226e0a58d58df7d90ef92713ce@changeid> <20200904113822.xoyt4w5x7vwvh7cr@holly.lan> <20200907075018.GM2352366@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200907075018.GM2352366@phenom.ffwll.local> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 07, 2020 at 09:50:18AM +0200, Daniel Vetter wrote: > On Fri, Sep 04, 2020 at 12:38:22PM +0100, Daniel Thompson wrote: > > On Mon, Jul 20, 2020 at 09:25:21PM -0700, Alexandru Stan wrote: > > > Some displays need the low end of the curve cropped in order to make > > > them happy. In that case we still want to have the 0% point, even though > > > anything between 0% and 5%(example) would be skipped. > > > > For backlights it is not defined that 0 means off and, to be honest, 0 > > means off is actually rather weird for anything except transflexive > > or front lit reflective displays[1]. There is a problem on several > > systems that when the backlight slider is reduced to zero you can't > > see the screen properly to turn it back up. This patch looks like it > > would make that problem worse by hurting systems with will written > > device trees. > > > > There is some nasty legacy here: some backlight displays that are off > > at zero and that sucks because userspace doesn't know whether zero is > > off or lowest possible setting. > > > > Nevertheless perhaps a better way to handle this case is for 0 to map to > > 5% power and for the userspace to turn the backlight on/off as final > > step in an animated backlight fade out (and one again for a fade in). > > Afaik chromeos encodes "0 means off" somewhere in there stack. We've > gotten similar patches for the i915 backlight driver when we started > obeying the panel's lower limit in our pwm backlight driver thing that's > sometimes used instead of acpi. Out of interest... were they accepted? I did took a quick look at intel_panel.c and didn't see anything that appeared to be special casing zero but I thought I might double check. Daniel. > There's also the problem that with fancy panels with protocol (dsi, edp, > ...) shutting of the backlight completely out of the proper power sequence > hangs the panel (for some panels at least), so providing a backlight off > that doesn't go through the drm modeset sequence isn't always possible. > > It's a bit a mess indeed :-/ > -Daniel > > > > > > > Daniel. > > > > > > > > Signed-off-by: Alexandru Stan > > > --- > > > > > > drivers/video/backlight/pwm_bl.c | 8 ++++++++ > > > 1 file changed, 8 insertions(+) > > > > > > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c > > > index 5193a72305a2..b24711ddf504 100644 > > > --- a/drivers/video/backlight/pwm_bl.c > > > +++ b/drivers/video/backlight/pwm_bl.c > > > @@ -349,6 +349,14 @@ static int pwm_backlight_parse_dt(struct device *dev, > > > /* Fill in the last point, since no line starts here. */ > > > table[x2] = y2; > > > > > > + /* > > > + * If we don't start at 0 yet we're increasing, assume > > > + * the dts wanted to crop the low end of the range, so > > > + * insert a 0 to provide a display off mode. > > > + */ > > > + if (table[0] > 0 && table[0] < table[num_levels - 1]) > > > + table[0] = 0; > > > + > > > /* > > > * As we use interpolation lets remove current > > > * brightness levels table and replace for the > > > -- > > > 2.27.0 > > _______________________________________________ > > dri-devel mailing list > > dri-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/dri-devel > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch