Received: by 10.223.164.202 with SMTP id h10csp2344623wrb; Mon, 27 Nov 2017 15:53:53 -0800 (PST) X-Google-Smtp-Source: AGs4zMYhHiWuLkmTLQ3PwlBKLGh3oudVZ4uSQJ+9cC+4PKT+KxNpPOCw3/BwJ6GLJVd+YdodcMPc X-Received: by 10.98.163.73 with SMTP id s70mr38132541pfe.64.1511826833133; Mon, 27 Nov 2017 15:53:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511826833; cv=none; d=google.com; s=arc-20160816; b=RGbmSbfb7EcOrdOnE3Kt0lA21J5WzC+iJYyP5IFGA19F8lhYihr0GNU22DB/OZsBEF 90lQlq2AxiD8TBFWBXP4E1SkK/jzQFlHGDSfxwHUXAeXKXFiofiY8WGPJfQpQ8/LdRIz Vo12bgVanQGZdi1GGfmq3JkDYiRZXbE1AdcCH6n1TPG+zW6Dq9os9X6A1r7RvC2wRSMb iEGo/i+8bQ3SbsRJA4rWG+Dnob/akyqSRoMgL78GO/mhBXznxGtfukoYrNnvqr3A44V6 S2JgUGnvohkr52ORozm10E/INqdNUTEs1Qg5sjiZ/yDpgclEjcreSdjIWEN549ImrcmE 10fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=nd+7GsYipO7DJ0dKIhXleWzScDb0hBe6RjariXrlnzo=; b=FFj78JGGOw/rt7K9uFK8Cj64HQg2Tsch6UuNLqziyrhqzWiRHdYsIO2qFu4xnBJjpY aSUQCaafS8bod9VS3NbaPq2HkgJaHdqGnvrocHVQv1TeMGNDBSH+TqmfH4XALztndDfl t1vZlKw1ofXtJyculaFFPwL08v1uA6SZwuJhrmkWS+vXrfC+3zQVZFVBoQcNv8NRta8C qQpbgleWDC/Pbf2utLyh8JuV+PYtYI5khm4AtauNcRBMqj1LO2SSENwEH5lnRBlinkjq B03saRUd2sK3RAX3iW22qCsEtHmN75NvdM0CFvCMBjlNQa/tj1LDyvXXXzdpd220DH0l R7Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PQT0BMMO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 8si15937465pfj.82.2017.11.27.15.53.41; Mon, 27 Nov 2017 15:53:53 -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=@google.com header.s=20161025 header.b=PQT0BMMO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753299AbdK0Xwm (ORCPT + 78 others); Mon, 27 Nov 2017 18:52:42 -0500 Received: from mail-vk0-f67.google.com ([209.85.213.67]:37494 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753246AbdK0Xwj (ORCPT ); Mon, 27 Nov 2017 18:52:39 -0500 Received: by mail-vk0-f67.google.com with SMTP id 22so18600422vkq.4 for ; Mon, 27 Nov 2017 15:52:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nd+7GsYipO7DJ0dKIhXleWzScDb0hBe6RjariXrlnzo=; b=PQT0BMMOZM40QKfLKMSz0dTh4SUU4qvLjtc3aXpnXHV429N3tyjeNfLJwZBJGnf9YH Vut1Egx1jmqlT3+y6ogcvRBSQYSs8vHXNysDzHH7bF49W479cchDzF5Y81UMW1WyJo2K wtu5Ug4I5LpoAKcorfg+J/uzjDVAXBtBz1jUrFEX2at8i9QjM8GukNM6a/0SL19F0xai X3hgBgyXUtbceQ0Tg6qUz7+qwD9XF7kMr0ORlTUFlIOKsefU+zKWNA9TIDRpEYpqaGFO u7JYdnaEMSX7okRpnIZa81lfcw1TqX8OwaYfvg8bVEW2Ey+GkGFGHUON2lIFgKfYiFJM QMsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=nd+7GsYipO7DJ0dKIhXleWzScDb0hBe6RjariXrlnzo=; b=LxWQGthMyKYVeWjdZOzx3NFKBkWVhvo2F8cmrCjUF3DIDfgIuPlSHERFwcaENBc7Co w2oy2aqt5hEQYAE8kg4x6e23vB/MqbZRmEJV8vM/rr3Po+Z3k9nrF4X72+KydgeZonok n6ZBls2L6IpSRdNP8VNEhyxvTDKqCp4WgDXorPeR2Hq/0O5Np/qKS5giNeDMyYM7G6No H5tujb8SS4DSJjRcl7FWj027dA6RmSvdkJjILCJoTqchoa3Uc+DK/Lxq+ZO0HKP+dKNP 6ohZHk1LcwD7fzgE11RRyTSQ115jgbTYzMUe3sH8rllFjMgss6Xnnmi3Z6IqqkeotiG2 hiIw== X-Gm-Message-State: AJaThX7N08JLLVXCNbGMHX2rBG+Ztqs6B2krjKax+5zj0u5dBYsqurMa MRf2kEfcTX6FC8xibDX4Dx0+1KYn2JTUHtJBC2RpPw== X-Received: by 10.31.131.143 with SMTP id f137mr6781963vkd.102.1511826758210; Mon, 27 Nov 2017 15:52:38 -0800 (PST) MIME-Version: 1.0 Received: by 10.31.146.68 with HTTP; Mon, 27 Nov 2017 15:52:37 -0800 (PST) In-Reply-To: <20171116141151.21171-2-enric.balletbo@collabora.com> References: <20171116141151.21171-1-enric.balletbo@collabora.com> <20171116141151.21171-2-enric.balletbo@collabora.com> From: Doug Anderson Date: Mon, 27 Nov 2017 15:52:37 -0800 Message-ID: Subject: Re: [RFC v2 1/2] backlight: pwm_bl: linear interpolation between values of brightness-levels To: Enric Balletbo i Serra Cc: Daniel Thompson , Jingoo Han , Richard Purdie , Jacek Anaszewski , Pavel Machek , Rob Herring , Brian Norris , Guenter Roeck , Lee Jones , Alexandru Stan , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Thu, Nov 16, 2017 at 6:11 AM, Enric Balletbo i Serra wrote: > Setting use-linear-interpolation in the dts will allow you to have linear > interpolation between values of brightness-levels. > > There are now 256 between each of the values of brightness-levels. If > something is requested halfway between 2 values, we'll use linear > interpolation. > > This way a high resolution pwm duty cycle can be used without having to > list out every possible value in the dts. This system also allows for > gamma corrected values (eg: "brightness-levels = <0 2 4 8 16 32>;"). > > Patch based on the Alexandru M Stan work done for ChromeOS kernels. > > Signed-off-by: Enric Balletbo i Serra > --- > .../bindings/leds/backlight/pwm-backlight.txt | 2 + > drivers/video/backlight/pwm_bl.c | 55 +++++++++++++++++----- > include/linux/pwm_backlight.h | 2 + > 3 files changed, 47 insertions(+), 12 deletions(-) > > diff --git a/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt b/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt > index 764db86..7c48f20 100644 > --- a/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt > +++ b/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt > @@ -17,6 +17,8 @@ Optional properties: > "pwms" property (see PWM binding[0]) > - enable-gpios: contains a single GPIO specifier for the GPIO which enables > and disables the backlight (see GPIO binding[1]) > + - use-linear-interpolation: set this propriety to enable linear interpolation > + between each of the values of brightness-levels. > > [0]: Documentation/devicetree/bindings/pwm/pwm.txt > [1]: Documentation/devicetree/bindings/gpio/gpio.txt > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c > index 9bd1768..59b1bfb 100644 > --- a/drivers/video/backlight/pwm_bl.c > +++ b/drivers/video/backlight/pwm_bl.c > @@ -24,6 +24,8 @@ > #include > #include > > +#define NSTEPS 256 I'm not sure this is quite the ideal way to specify it. I could sorta imagine wanting to specify just: brightness-levels = <0 65535> ...and in such a case you'll only give 256 steps in between. 256 isn't quite granular enough and the human eye can notice each step. I could fake it by putting this in the device tree: brightness-levels = <0 4095 8191 ... ... 61439 65535> ...but that's kinda silly. I'd rather just say that when we're using interpolation we just say that there will be a certain number of steps (like 32768). Is there really a huge advantage of picking 256 steps between each specified value instead of just picking a fixed number of brightness levels? From 1585218065916176995@xxx Mon Nov 27 11:22:35 +0000 2017 X-GM-THRID: 1584248888204777660 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread