Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6019117ybi; Wed, 12 Jun 2019 12:30:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJdY7ut0VSYBy5qZVCU+h+PR2fc+dhWYgtMfj+gHgOMTjsp2bgY77bHgpPh/tpbnoBu92b X-Received: by 2002:a63:1119:: with SMTP id g25mr26090071pgl.380.1560367830501; Wed, 12 Jun 2019 12:30:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560367830; cv=none; d=google.com; s=arc-20160816; b=ZhBqwAcAc253Q9uETK5EF6hudnXb0rSO2Ul37KCGJU6qU669LNW8jymBRaom2MU2yW +XMzLUEVjVJqDsI8IVOu/0aY74tW83Mg0Z9IytqfjU8T/UtJk8z1LwGcHiKISo4eL6S0 sVIVzF1TsrQM8Cw2AiJxR2SqGVACENVqT6qTEeFy7z5skEyqUfXNycoRdHSn3XAxOJ8Q bLAMRp+RL5ZiArdxGeR2e4BRGH1depNrbSO3+7ASZsG0Lu7XrNAN8bZK80+2SVpQBt4c o0J0HAVfljuVGc2aEEEIHd7MVAzYhH9QID+DEDRJWhurT6xhhWTQjJXej058zHjmXfUD MDAw== 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=JGTJNpxtoSxf9cQjifYgXwRhQ7ZHC2LuIfFDHnbUz+Q=; b=Ohwz5jOhXfEhndjv85UYRuvQQfwkVavFhTmvGzGnALQRlWAgZEWr8k2hTTzCSdxp/z lHT6YByIWf/GAxsAoXEwm6MLOYaKtNgjZh9n4tXMoxVPgAhy5kzC9kxayF0/yzt97Hf8 djwLzi23RfCzrumXyciOv63fmiglM3Hpk9ahGsZIKiUDjfGTddaxeHQEkQwCSPggYsS6 sBK2cE5g6qXmuDWbAqIn/GyBCvOXBQIXVXWsQpLFh0NnQvA+T4K5yedMLqaXYb3+Je6n ATNJ0YXMynn0VxB8FZ6BNxs9ShRwa1m40S2yOxpq+v4Jh6r9/gCyluteFLkx3IDOOSWz 3SyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jkCOi89f; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15si564113pgf.303.2019.06.12.12.30.15; Wed, 12 Jun 2019 12:30:30 -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=@chromium.org header.s=google header.b=jkCOi89f; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728643AbfFLT2V (ORCPT + 99 others); Wed, 12 Jun 2019 15:28:21 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35473 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728575AbfFLT0q (ORCPT ); Wed, 12 Jun 2019 15:26:46 -0400 Received: by mail-pf1-f194.google.com with SMTP id d126so10259109pfd.2 for ; Wed, 12 Jun 2019 12:26:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JGTJNpxtoSxf9cQjifYgXwRhQ7ZHC2LuIfFDHnbUz+Q=; b=jkCOi89f8z4k6wMOAeyYKznf4Y62pis19MeQNmtA7Jh53MHFibTLDJ9TYgKVn+f5kD fLUDfVGDMuu4aWcnxDzxbp07lL+Lz51Iy00qrEIJCzXdYG49TZOl7ZAvAbf9jiUmmh/V ih3U2U6lZeAoQ/pfzf5gNEqmoDoWlcBOwlo+E= 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=JGTJNpxtoSxf9cQjifYgXwRhQ7ZHC2LuIfFDHnbUz+Q=; b=QdF+c3YYecpf5ps+1otKW4uHtRIlmWsmtrbplz6OVmepczxmjfTLOvDtG0EFrIZAe4 VjQFn/EoUyaK0+nv0o1HdqrtodU38YT5sgS7hsu92HkVat4DleIpfV/Io3qxTf6WDTHD Our0BZKOCh7ooNh5c+2d4VlKWhvRzFtqCCFcejYiEHAL7DRaRemIFvFbYoogm5fL6LB0 BpAhMFO1KqWfiCoSV/Rpn/1ZhodumnQGaf+ck2A0nilQJqc0Qf/dybYDuQhyYIyefBQk OTQ6skTPPnVXuMmYE68FKQHeHP+hpLFa3uHBM6jDGQO/5achRowKmIobygXk8bMPD/HT G9mw== X-Gm-Message-State: APjAAAWmWiY2o7oT/F14OSedUOgLnOCBX7ld1C/MyHYY1tj3EVerynN7 GV21uEjezrDd2lN543j3+ZgHBQ== X-Received: by 2002:a62:5306:: with SMTP id h6mr89297716pfb.29.1560367605628; Wed, 12 Jun 2019 12:26:45 -0700 (PDT) Received: from localhost ([2620:15c:202:1:75a:3f6e:21d:9374]) by smtp.gmail.com with ESMTPSA id e26sm326416pfn.94.2019.06.12.12.26.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jun 2019 12:26:44 -0700 (PDT) Date: Wed, 12 Jun 2019 12:26:42 -0700 From: Matthias Kaehlcke To: Daniel Thompson 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: <20190612192642.GK137143@google.com> 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> <20190612110325.xdn3q2aod52oalge@holly.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190612110325.xdn3q2aod52oalge@holly.lan> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, On Wed, Jun 12, 2019 at 12:03:25PM +0100, Daniel Thompson wrote: > 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". Thanks for the feedback! It seems clear that we want a string for the added flexibility. I can work on a patch with the compatible string like description you suggested and we can discuss in the review if we want to go with that or prefer something else. > > 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. Agreed > 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). An "unknown" value sounds good, it allows userspace to just do what it did/would hace done before this attribute existed. > 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. Unfortunately this isn't universally true :( At least several Chrome OS devices use a linear brightness scale and userspace does the transformation in the animated slider. A quick 'git grep -A10 brightness-levels arch' suggests that there are multiple other devices/platforms using a linear scale. We could treat devices with a predefined brightness table as "unknown", unless there is a (new optional) DT property that indicates the type of the scale. Cheers Matthias