Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758131AbdLRKlD (ORCPT ); Mon, 18 Dec 2017 05:41:03 -0500 Received: from mail-qk0-f193.google.com ([209.85.220.193]:36619 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750813AbdLRKlB (ORCPT ); Mon, 18 Dec 2017 05:41:01 -0500 X-Google-Smtp-Source: ACJfBouAkSmB37/9w3AQ95zTLQTEK0jKDlzLSU3ks6YqU5uAgoV+ATJvWb6DQZwPaHVGinHsQC75V9eIOPW9M8s886k= MIME-Version: 1.0 In-Reply-To: <20171215205735.GB19442@amd> References: <20171116141151.21171-1-enric.balletbo@collabora.com> <20171116141151.21171-3-enric.balletbo@collabora.com> <20171215205735.GB19442@amd> From: Enric Balletbo Serra Date: Mon, 18 Dec 2017 11:40:59 +0100 Message-ID: Subject: Re: [RFC v2 2/2] backlight: pwm_bl: compute brightness of LED linearly to human eye. To: Pavel Machek Cc: Daniel Thompson , Doug Anderson , Enric Balletbo i Serra , Jingoo Han , Richard Purdie , Jacek Anaszewski , 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1294 Lines: 41 Hi Pavel, 2017-12-15 21:57 GMT+01:00 Pavel Machek : > Hi! > >> Yes, I think that how you describe luminance and lightness is right, >> and sounds good improve the doc. >> >> To be clear the correction table for PWM values can be calculated with >> this code. >> >> OUTPUT_SIZE = 65535 # Output integer size >> INPUT_SIZE = 2047 >> >> def cie1931(L): >> L = L*100.0 >> if L <= 8: >> return (L/902.3) >> else: >> return ((L+16.0)/116.0)**3 >> >> x = range(0,int(INPUT_SIZE+1)) >> y = [int(round(cie1931(float(L)/INPUT_SIZE)*(OUTPUT_SIZE))) for L in x] > > Can we just generate the table on the fly? Should not be hard to do in > fixed point, right? This was discussed a bit in previous RFC which had the code to generate the table on the fly, see [1]. The use of a fixed table or an on the fly table is something that I'll let the maintainers to decide. I've no strong opinion on use the on the fly table if someone takes care to review deeply the fixed point maths :) [1] https://lkml.org/lkml/2017/9/4/335 Regards, Enric > Pavel > -- > (english) http://www.livejournal.com/~pavelmachek > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html