Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5827034ybi; Wed, 12 Jun 2019 09:07:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyO2uzEV+am4Bzl/JJH7fMLcWgfvcGUSS3VU+YwhIyIVQg4VKkr5DN+fah5Df3A/kZwI6JF X-Received: by 2002:a17:90a:3225:: with SMTP id k34mr7161064pjb.31.1560355642793; Wed, 12 Jun 2019 09:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560355642; cv=none; d=google.com; s=arc-20160816; b=xu9Tu637S064huWRv1VedTWAq+0Uf2fb8RWFYur92AMuNEafrSP6oECZbSOp8xshJ2 mGqCvX+dy7ZZ9Ys9rYyytUIOHe0AgBpICb5TDCpQwAZ5p97vwb4LHXpZ7f9tRzKbLkIT tGHqwvW/EbQKB1ZiBK9a+uyUl+lsITVrn4XlgbfdNwwAC5pEnn/nGTWNB5j4049h1CNX fJpAm1m/fjX52/WC7hEPeL/6s0nzS1l2Jt+X9QODhuZQwwZJQzNuUkpzs4309aIl3G2g 8ze1fkH16nncpSv5qqAtI6KTIW9k0hk+FJ7o/V+v+9o6ZemTYUMqhnWa3xNG8q1q5qKu S2dA== 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=fKEuXpKhwW6QYirKkEZUMz7KKtRy+gRE2kTuvjwe5Og=; b=uNUXt0RV0UROGd570xCkbdywJ/dC99ivEsVc6kNSEhIj+5ktsZ+n444TT1SrNg7mUN 2ztvURJ6urLXbGgJ/Tr2nIu1HMinbzTZRwxfopTTWeRJSMrj5C5axpMIqIrjgVL4Ido5 Y+rGiTDcJUluNXx+GCVkjxnobJKhXQ+RxMjE59f/fTkkr1X//XSaHIp330WqNoBJLwLy xtW1mf3GzsP2us9b/rPNCl/9rgJQPaCa3Ulr3YiRaCZvIEt/eDO2FMmARKI+nkbW8owi QuSIuTLzTM0QyKEVfHCWlglE4vZQpNJtKtkUyM9yZ/Lfga/OyQ52cKzeCYyJQyE6EM4F 7Aaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RDAvMiYL; 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 t32si235639pjb.36.2019.06.12.09.07.06; Wed, 12 Jun 2019 09:07:22 -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=@linaro.org header.s=google header.b=RDAvMiYL; 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 S2408908AbfFLLDf (ORCPT + 99 others); Wed, 12 Jun 2019 07:03:35 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:39518 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406640AbfFLLDf (ORCPT ); Wed, 12 Jun 2019 07:03:35 -0400 Received: by mail-wr1-f66.google.com with SMTP id x4so13761333wrt.6 for ; Wed, 12 Jun 2019 04:03:33 -0700 (PDT) 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=fKEuXpKhwW6QYirKkEZUMz7KKtRy+gRE2kTuvjwe5Og=; b=RDAvMiYL1/E12jVZRrvjScX/Ri1mztuZtwe0YjXLDoQGwJ9hsU9dFZTKzXhD6yrfAF +vEPWD7W9C5F6bo8JKZBpBtEEDDsNrJ9BVvdiyOwNe+1OHwDE7+ylO2qqSI7KbSbM9bx jdVCxvg4AKjGJ/Fjr53LH24cus/xugKFsCWba7KrOcHFzBhgwOhCWINDQ1wbVrY7OQyU u/UBe878vavY48j4914n3YRLR28cDacRENJaFiMgeEIpJz5lpyZp9gAfovlXUsyR5wjr MWMd4r+tDMlwHQ73jQuuohiLcBUV1aIw655M30SX/uocU5kw5+1XTSlofcoBzjy3TvBp ry1Q== 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=fKEuXpKhwW6QYirKkEZUMz7KKtRy+gRE2kTuvjwe5Og=; b=albIqXR3p9CaU/zUGyJ1f4Q4KCq2biC1L+ajIan1qAS9pPzjXHR5Zx+WPe78oY2tDT U6NcwSEoK5qCS7c/hT+jzxgodUbv0df4yINM7VCvCecDBSdAepuAtyRqOx206yXn/Eho 6HxIi0bo40Ae99Mjj9diT9kNnm3HvF60fwMZ5yyBvAOVY25vP5HyTkFxwDpoKvoUufkV 2YJ5u+iAxbbF+3moFSNNoh94KaXlg0qgOuxS2xu4lkG7FiOLvT6gjk6V5ETdz0oFWy4D omEdVqQl+1aISSZKIHfN4QyFzuM/OEiUKItOIZzkTnpnFlD0TdPIMmm+/QN1Y0XyEXuZ TdmA== X-Gm-Message-State: APjAAAW3GPDP3wwqU3C3Tpvo0swthSITaiEY0EYLoSJ2JfZOd8sJ23z4 6KhUQXvw+EgbISWLuQjIXpXJbg== X-Received: by 2002:a5d:53ca:: with SMTP id a10mr41666584wrw.131.1560337412723; Wed, 12 Jun 2019 04:03:32 -0700 (PDT) Received: from holly.lan ([185.80.132.160]) by smtp.gmail.com with ESMTPSA id j132sm7583807wmj.21.2019.06.12.04.03.31 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 12 Jun 2019 04:03:31 -0700 (PDT) Date: Wed, 12 Jun 2019 12:03:25 +0100 From: Daniel Thompson To: Matthias Kaehlcke Cc: Brian Norris , Pavel Machek , Enric Balletbo i Serra , Doug Anderson , Rob Herring , Jingoo Han , Richard Purdie , Jacek Anaszewski , Guenter Roeck , Lee Jones , Alexandru Stan , linux-leds@vger.kernel.org, devicetree , Linux Kernel , kernel@collabora.com Subject: Re: [PATCH v3 3/4] backlight: pwm_bl: compute brightness of LED linearly to human eye. Message-ID: <20190612110325.xdn3q2aod52oalge@holly.lan> References: <20180208113032.27810-1-enric.balletbo@collabora.com> <20180208113032.27810-4-enric.balletbo@collabora.com> <20190607220947.GR40515@google.com> <20190608210226.GB2359@xo-6d-61-c0.localdomain> <20190610205233.GB137143@google.com> <20190611104913.egsbwcedshjdy3m5@holly.lan> <20190611223019.GH137143@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190611223019.GH137143@google.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 11, 2019 at 03:30:19PM -0700, Matthias Kaehlcke wrote: > On Tue, Jun 11, 2019 at 09:55:30AM -0700, Brian Norris wrote: > > On Tue, Jun 11, 2019 at 3:49 AM Daniel Thompson > > wrote: > > > This is a long standing flaw in the backlight interfaces. AFAIK generic > > > userspaces end up with a (flawed) heuristic. > > > > Bingo! Would be nice if we could start to fix this long-standing flaw. > > Agreed! > > How could a fix look like, a sysfs attribute? Would a boolean value > like 'logarithmic_scale' or 'linear_scale' be enough or could more > granularity be needed? Certainly "linear" (this device will work more or less correctly if the userspace applies perceptual curves). Not sure about logarithmic since what is actually useful is something that is "perceptually linear" (logarithmic is merely a way to approximate that). I do wonder about a compatible string like most-detailed to least-detailed description. This for a PWM with the auto-generated tables we'd see something like: cie-1991,perceptual,non-linear For something that is non-linear but we are not sure what its tables are we can offer just "non-linear". > > The new attribute could be optional (it only exists if explicitly > specified by the driver) or be set to a default based on a heuristic > if not specified and be 'fixed' on a case by case basis. The latter > might violate "don't break userspace" though, so I'm not sure it's a > good idea. I think we should avoid any heuristic! There are several drivers and we may not be able to work through all of them and make the correct decision. Instead one valid value for the sysfs should be "unknown" and this be the default for drivers we have not analysed (this also makes it easy to introduce change here). We should only set the property to something else for drivers that have been reviewed. There could be a special case for pwm_bl.c in that I'm prepared to assume that the hardware components downstream of the PWM have a roughly linear response and that if the user provided tables that their function is to provide a perceptually comfortable response. Daniel.