Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2399848ybk; Mon, 11 May 2020 21:12:53 -0700 (PDT) X-Google-Smtp-Source: APiQypJUZZTFpMaYMyhCk3nebmcTVm5YKOFaieGwyZqs4/Jjy7CnW7Oq3ODtgIgW+RytDKn7vFGS X-Received: by 2002:aa7:d481:: with SMTP id b1mr16910392edr.226.1589256773535; Mon, 11 May 2020 21:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589256773; cv=none; d=google.com; s=arc-20160816; b=OHHEgTEifSE535XaaT0yONqxESNdmXE8TiUui6+IUnefpyTSd+pQO+u589lswuKreZ u4geXX0dBTCuzD6HtUxMek/pgvsvGyusfjpmOIXp6D6EdoXGP1JHnD59jgAVyYhMyJw9 3F+OapOxSHKcqXu4u7n1bIV4EzrFfb9u/Pr7N1wLE7bHhmBWug71YQVCnVOTLE6nbZny Zjjzm9LZjL6qa/We9TB5UBmQQMte11G4r0nNzND3/3wTaRRLcBsRCUh37O144rCZQLLP uCOapjMuh6nuLHqFsMB1RKG6wbTKQWEeWAcE8lA8hO6irwPBbRlwO+EEr6zOMiZRUbF0 p6bg== 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 :in-reply-to:references:mime-version:dkim-signature; bh=oE00sNcmDR9xC5H1fz45Er0w3JgojCtUdrgoXbvLCok=; b=WTTJrFgp0mo7I3x3NKCzp8ZYOeyKnGobOo9f+1vtYVXfiaLhm9+GIrDP6L8fo/A5qc Qt+M3SOWzsxcaHgFjLh1Er0aXmBEmlJ7qNZf7earv3CWD0olVY5IP9YAFsnPQGMui8ig zGVhR9hyJCJEysLx9yX2679z/0dQC7PvuK+pWKQJDcRuGrJDN0BXqUMrWrUGrT0gv7aZ nWSrN1evDAPQbvIOVsczWSAHlxb623RZGqIjwBilbPHar8VVUuAQAtw7cNlkRLuPLi1p Q6FqPA4RAIuoYICKc9SOfn6Ai6lJ4ZYxO4t6z5b+/2e7trG4IJ7Vuv/XyspFg8uO3E54 zd+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="DvZFFp2/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jx4si271478ejb.216.2020.05.11.21.12.30; Mon, 11 May 2020 21:12:53 -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=@chromium.org header.s=google header.b="DvZFFp2/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726301AbgELEKy (ORCPT + 99 others); Tue, 12 May 2020 00:10:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725814AbgELEKy (ORCPT ); Tue, 12 May 2020 00:10:54 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A320BC061A0E for ; Mon, 11 May 2020 21:10:52 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id k18so3348867ion.0 for ; Mon, 11 May 2020 21:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oE00sNcmDR9xC5H1fz45Er0w3JgojCtUdrgoXbvLCok=; b=DvZFFp2/FFHUGDdhblKHegReeE5SaNHK0MmgkYtoFA1ZzelJeQK2TmlaEy7lN6sHpo nKKZnsgzR689jYvWw2L83enoUgXQ7jGQ1engWE5dGkPrYHrZVb8eB5hz4qo7FKFQe927 WsXI/6Fc18GArAIVkzYvSqX0kZp8CaOaAkgOE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oE00sNcmDR9xC5H1fz45Er0w3JgojCtUdrgoXbvLCok=; b=KacXaKqLI6qlJ016/TpmNySAMPIgeHxmIokUdZNrK5KVaGYyB8g5ofuIOyZ4zDgE++ 566O5Ti9QoI0UqG35FBbKlRLvMI3auNAGWHacVHoGN6KAWVksJWACch884fRPeoDhjx3 8Bsx3BC63SL+ps8HWJwZ/NrdjMQ7ildYjxpzkH4YG81OpXXqulYcCKOrOZUsj8RMnYEw OckGYSl0eyR0vNaCjq35oy3KlL/FrprW3PGnObby2eRLuHu/jL2qE10BcPzcKgsXHZMt 01vU3r766D5W3Oqqk6KDwFlK0q8epBI9n+bK12eYpbQGyCDqBU048CVNA49gyrhGUjEz 3I/w== X-Gm-Message-State: AGi0PuYVYJurVVlDJlwnt7e4+i3zxX37g/lxfT5PS77wXSQLqPhRjphG KeaLovDyR/ISMPPYWU4IzrmZO4ecsWMq4BtczLqm3Q== X-Received: by 2002:a05:6638:11d4:: with SMTP id g20mr4264460jas.19.1589256651855; Mon, 11 May 2020 21:10:51 -0700 (PDT) MIME-Version: 1.0 References: <20200506230324.139241-1-gwendal@chromium.org> <20200506230324.139241-2-gwendal@chromium.org> <20200508161635.00006cd2@Huawei.com> In-Reply-To: <20200508161635.00006cd2@Huawei.com> From: Gwendal Grignou Date: Mon, 11 May 2020 21:10:40 -0700 Message-ID: Subject: Re: [PATCH v2 1/3] iio: Add in_illumincance vectors in different color spaces To: Jonathan Cameron Cc: Enric Balletbo i Serra , Jonathan Cameron , Benson Leung , Guenter Roeck , linux-kernel , linux-iio 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 On Fri, May 8, 2020 at 8:16 AM Jonathan Cameron wrote: > > On Wed, 6 May 2020 16:03:22 -0700 > Gwendal Grignou wrote: > > Illuminance in the title. Plus I'm still arguing these > aren't illuminance values. > > The Y value is illuminance but X and Z definitely aren't. > RGB needs to stick to intensity - like the other existing > RGB sensors. > > Gah. XYZ and IIO is a mess. > > I suppose we could introduce a new type and have > in_illumiance_raw > in_chromacity_x_raw > in_chromacity_z_raw but chances of anyone understanding what we > are on about without reading wikipedia is low... > > Sigh. Unless someone else chips in, I'm inclined to be lazy and rely > on documentation to let in_illuminance_x,y,z be defined as being > cie xyz color space measurements. > > It seems slighlty preferable to defining another type for these, > though I suspect I'll regret this comment when some adds > cie lab which was always my favourite colour space :) > > > > > Define 2 spaces for defining color coming from color sensors: > > RGB and XYZ: Both are in lux. > > RGB is the raw output from sensors (Red, Green and Blue channels), in > > addition to the existing clear channel (C). > > > The RGBC vector goes through a matrix transformation to produce the XYZ > > vector. Y is illumincance, and XY caries the chromaticity information. > > The matrix is model specific, as the color sensor can be behing a glass > > that can filter some wavelengths. > > > > Signed-off-by: Gwendal Grignou > > --- > > New in v2. > > > > Documentation/ABI/testing/sysfs-bus-iio | 27 +++++++++++++++++++++++++ > > 1 file changed, 27 insertions(+) > > > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio > > index d3e53a6d8331b..256db6e63a25e 100644 > > --- a/Documentation/ABI/testing/sysfs-bus-iio > > +++ b/Documentation/ABI/testing/sysfs-bus-iio > > @@ -1309,6 +1309,33 @@ Description: > > Illuminance measurement, units after application of scale > > and offset are lux. > > > > +What: /sys/.../iio:deviceX/in_illuminance_red_raw > > +What: /sys/.../iio:deviceX/in_illuminance_green_raw > > +What: /sys/.../iio:deviceX/in_illuminance_blue_raw > > +KernelVersion: 5.7 > > +Contact: linux-iio@vger.kernel.org > > +Description: > > + Illuminance measuremed in red, green or blue channels, units > > + after application of scale and offset are lux. > > No they aren't. Units are some magic intensity at some magic wavelength. > > > + > > +What: /sys/.../iio:deviceX/in_illuminance_x_raw > > +What: /sys/.../iio:deviceX/in_illuminance_y_raw > > +What: /sys/.../iio:deviceX/in_illuminance_z_raw > > +KernelVersion: 5.7 > > +Contact: linux-iio@vger.kernel.org > > +Description: > > + lluminance measured in the CIE 1931 color space (XYZ). > > + in_illuminance_y_raw is a measure of the brightness, and is > > + identical in_illuminance_raw. > > That is fair enough. > > > + in_illuminance_x_raw and in_illuminance_z_raw carry chromacity > > + information. > > + in_illuminance_x,y,z_raw are be obtained from the sensor color > > + channels using color matching functions that may be device > > + specific. > > + Units after application of scale and offset are lux. > > True for Y, not for X and Z which don't have 'units' as such. Indeed,I have difficulty mapping what comes from the sensor after adapting to an acceptable universal entity. The goal of the sensor is to measure the ambient correlated color temperature (CCT), based on the x and y of the CIE xyY color space. Given x and y are defined as x = X / (X + Y +Z) and y = X / (X + Y + Z), X, Y and Z must have the same units. CCT(x,y) is computed in user space, for example using this approximation (https://en.wikipedia.org/wiki/Color_temperature#Approximation). Gwendal. > > > + The measurments can be used to represent colors in the CIE > > + xyY color space > > XYZ > > > + > > What: /sys/.../iio:deviceX/in_intensityY_raw > > What: /sys/.../iio:deviceX/in_intensityY_ir_raw > > What: /sys/.../iio:deviceX/in_intensityY_both_raw > >