Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3036051pxk; Mon, 7 Sep 2020 00:52:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKodygQ+7YMTZqt4ZGlJiRJJIXbd0bPEgk6+boreH5qdgwy8OQ3yUmV6kX+Pf3J3sceSwV X-Received: by 2002:aa7:dc05:: with SMTP id b5mr21147103edu.137.1599465122416; Mon, 07 Sep 2020 00:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599465122; cv=none; d=google.com; s=arc-20160816; b=JSXCM3KLQfKqWaKoCrRFKer0EVETmqYNZBJPnKiQjF8xB8E+ThXallG4LGaYERWVRd sT/AJ7RVfOIDVGmhejpjsNhJa6SeG4z7Ectb9ubqG3Uz9bQUY2PMFGtjGG6Lhfi1Up3X nwG8VVRbwoen2uYzqkggmON0kYZTqDcU/1S/lUPCKmWFUByfgjzY45QxAHxId1MRBZLK xYb3ntJlP8zPtSrLTFNDxtOzev9hIwq3T5E6t1KWlV4PZjxuut2Ra21i3HPSFqDOs4N0 DAQ2uxVQTPFA39e3lyeM7MQqkV4I+8Gul1WEu1I/rw8SHanf2HWB1Vw/Iy8iJZiaV+qw eQqg== 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:mail-followup-to:message-id:subject:cc:to :from:date:dkim-signature; bh=lgdO+wcLjjr5/DOIRw2FqQVZyOMD3aT5rG4YxEdLkHI=; b=R5763jHzQmCTYsA7Uqvu0qedD+u+HUzdSoWel1f5QjHu0MBwHGQnw6+g6P5+P1Z2NI Pb2fK9Pq8ymzQIzm8JW8/CIlz5jxXuI9j8IFEJKrN4w+kRmErlYPjyyYutdg8l+YbD/M b4YFrRDtwGHt1DZyd2Sw5wiZ0040zJJGMoFYWKg5E9mvYs72s8AdeZgwlsJQcaEWstub BkuIb7kco8LT90Tn056X/17jlf2+ho8knSpvyMi33gg4Yo+1Exh73JWrmvJ1t9/1Bgz8 Jfm59IFIZnZAbSFOj4EoSQjvT7VmYBaf6uyYfh+AdcW0efVTkelRyiXy9wKRGDloZLpO Iikw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=GkPf9CMa; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i11si11839435edb.127.2020.09.07.00.51.38; Mon, 07 Sep 2020 00:52:02 -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=@ffwll.ch header.s=google header.b=GkPf9CMa; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727796AbgIGHuj (ORCPT + 99 others); Mon, 7 Sep 2020 03:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727081AbgIGHuY (ORCPT ); Mon, 7 Sep 2020 03:50:24 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64C17C061574 for ; Mon, 7 Sep 2020 00:50:22 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id w5so14698067wrp.8 for ; Mon, 07 Sep 2020 00:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=lgdO+wcLjjr5/DOIRw2FqQVZyOMD3aT5rG4YxEdLkHI=; b=GkPf9CMa12TsOMNNJBhObX69nm4V7Y0Xa2p/7XNbxitfct8Q1DryNblIAOzMbOxw6Y jcADz/kmPW8+B5VhR/JqxzVB1RSEADWmflOJPo4Tccb7Tmo5ZpoXPvUNtijUtv9TPuD/ +vMwTwyBQWCEbnbF69nTs4adshQcK3+J52FkQ= 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 :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=lgdO+wcLjjr5/DOIRw2FqQVZyOMD3aT5rG4YxEdLkHI=; b=BU5iSKsYqFby5H9i7H3E0CBi4jLOcGBPLJY/NnjVqKyUiYgdbNX5YeSLjR23a0chmu Kxm9rLkKWRPTGjOC1yi5363PaOe/sqIYT6uJPddqSaldSfG2SKlQGdRDTdgSeliwS9xV wRL0vmaWKbR7q++HROjtCv4sicT9OTtCVlUjn2KpS2OQZI80ln8rKxlSDplhcZ2TwxIK suAPLoM4W6iquBhvK4BEPNiMheuyDI2Wq6a6ydLtDf8b4kmMJ3kz63+3XpN6cgs4ibAw zK54BsLte/zLDVZFOdY81YDsKyPTVfjzkxHwb4kPIcqrI2YLw5xj6RKc2Esn5R4H8SKL 3MbQ== X-Gm-Message-State: AOAM5306CkOQkqys7ooBp8maf1ZkSm+snplZT3hr2rjhr7rW7k2kHfn/ 6iB534omifiovPOIiK6MXFffKQ== X-Received: by 2002:a5d:5111:: with SMTP id s17mr20057301wrt.70.1599465021254; Mon, 07 Sep 2020 00:50:21 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id 70sm27928097wme.15.2020.09.07.00.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 00:50:20 -0700 (PDT) Date: Mon, 7 Sep 2020 09:50:18 +0200 From: Daniel Vetter To: Daniel Thompson Cc: 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 =?iso-8859-1?Q?Kleine-K=F6nig?= , Enric Balletbo i Serra , Lee Jones , Matthias Kaehlcke Subject: Re: [PATCH 2/3] backlight: pwm_bl: Artificially add 0% during interpolation Message-ID: <20200907075018.GM2352366@phenom.ffwll.local> Mail-Followup-To: Daniel Thompson , 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 =?iso-8859-1?Q?Kleine-K=F6nig?= , Enric Balletbo i Serra , Lee Jones , Matthias Kaehlcke References: <20200721042522.2403410-1-amstan@chromium.org> <20200720212502.2.Iab4d2192e4cf50226e0a58d58df7d90ef92713ce@changeid> <20200904113822.xoyt4w5x7vwvh7cr@holly.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200904113822.xoyt4w5x7vwvh7cr@holly.lan> X-Operating-System: Linux phenom 5.7.0-1-amd64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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