Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1124706imu; Thu, 20 Dec 2018 10:30:21 -0800 (PST) X-Google-Smtp-Source: AFSGD/XSvMhrg04PthizyqWy3OLAMbhT3vpQEcq09/e7NlbmLegzG5PdQ2+39pSGdPqRuhmYgu5Z X-Received: by 2002:a62:1484:: with SMTP id 126mr10801481pfu.257.1545330621506; Thu, 20 Dec 2018 10:30:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545330621; cv=none; d=google.com; s=arc-20160816; b=APsBinnW/Xc8N28z4S9vdf8PFfr1GICB5nikwcCdfu1TEe0N7vtOZQsyXgfvC4Nu7b cyjfGobSDDm6p3YMaC0xgcVc+Vc7RurQutaOEpYwVkpI1sawX5XbFz989pKdZvPrz2/0 aJxTUEqaoW2QHO/A0ybBNsuV+95kaP1czG771MhDX2fS1eUoqFCP75ijTzLZTOsXJ7Rw jbB2FUiMrDNuT8Y4hWxFMQq+I12z17vRwgo//QgZudRTRgBnHEWBihrIPURGrwQzcmSU QU9DsXpj8PstKRHLfbBccJDHYThr/PlI0ITXbUEGZR9pQn0AXAY17NUVhCEjwM8+b9G1 f2nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=yD6AFayeEc4vrT8frBD2q5iA5krkiVtL6hZUamAhHR0=; b=qh3HfPMv24+DJiBSwtdn7k7cc/zjC2Q0i8bRJAkpHUiYC1ERthtwoFJuxE0zWLAU+n D5IPsn2Y4+rURfo+f3hfaV/GbXgvvq7Oaba3pyyZ1oTbdGEzq8N8nWe/88O/XhBlVyWT mTFP+hFpZUm5XvxtaVS2yDg82e/Ltmw8SYTql0ks5lW9bDVVRfdctNt3Q8PzfYoE6Nwa FhBx7yQgcBb9V5ZfSjbjfrkv2mq5v8+ai4RydEvK4JVPzOCVTz0hK5wsEFY+MH5EylEs IAL2A2/TZ8ziB4BxfSaWqJB9hJP4JWJLXdxdgYCzrgNCbhDsTANO78UBDcSuJzobpjU3 3u5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=w1LhwOqS; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si14250349pgo.356.2018.12.20.10.29.58; Thu, 20 Dec 2018 10:30:21 -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=@ti.com header.s=ti-com-17Q1 header.b=w1LhwOqS; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732827AbeLTN4R (ORCPT + 99 others); Thu, 20 Dec 2018 08:56:17 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:54430 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728803AbeLTN4Q (ORCPT ); Thu, 20 Dec 2018 08:56:16 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id wBKDu9An046283; Thu, 20 Dec 2018 07:56:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1545314169; bh=yD6AFayeEc4vrT8frBD2q5iA5krkiVtL6hZUamAhHR0=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=w1LhwOqStppM1xrDJou9wMxjuArQi5RqftvmJjcqmHXISIn4BWKK2Ox+ggMmfD0DS SGs6FS8dmL3Gz11OFjJWXSr34CcL2gzL4CwDQr3lz4eXa8nqWOspxvwptO0siHL+ca 9Ff31Aoy1OgoUX1dC856bhxfJ1PApLJx+LVC4JbY= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wBKDu9q3059158 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 20 Dec 2018 07:56:09 -0600 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Thu, 20 Dec 2018 07:56:09 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Thu, 20 Dec 2018 07:56:09 -0600 Received: from [172.22.89.160] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id wBKDu8O2022016; Thu, 20 Dec 2018 07:56:08 -0600 Subject: Re: [PATCH 2/2] leds: lp5024: Add the LP5024/18 RGB LED driver To: =?UTF-8?B?VmVzYSBKw6TDpHNrZWzDpGluZW4=?= , Jacek Anaszewski , Pavel Machek CC: , , , References: <20181219162626.12297-1-dmurphy@ti.com> <20181219162626.12297-3-dmurphy@ti.com> <20181219193455.GA21159@amd> <8740cfd6-a6b5-ad27-313b-984a9febf18a@ti.com> <20181219201047.GA23448@amd> <54f28115-0a7d-8e9c-3bec-6e91fb3981ec@gmail.com> From: Dan Murphy Message-ID: <74cc0ef0-20f8-c422-9a15-af74d0fc0fba@ti.com> Date: Thu, 20 Dec 2018 07:56:07 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Vesa On 12/20/2018 06:40 AM, Vesa Jääskeläinen wrote: > Hi All, > > On 19/12/2018 23.50, Dan Murphy wrote: >> On 12/19/2018 03:36 PM, Jacek Anaszewski wrote: >>> Hi Dan and Pavel, >>> Some time ago we had discussion with Vesa Jääskeläinen about possible >>> approaches to RGB LEDs [0]. What seemed to be the most suitable >>> variation of the discussed out-of-tree approach was the "color" property >>> and array of color triplets defined in Device Tree per each color. >>> >> >> Why does Device tree define the color? >> >> Rob indicated that Device tree is supposed to define the hardware. >> This thread seems to be defining the operation. >> >> Shouldn't the color be done via user space and not dt? >> >> Especially if they want to change the color real time? >> >> Dan >> >>> Please refer to [0] for the details. >>> >>> [0] https://lkml.org/lkml/2018/11/9/938 >>> > > Idea was to define preset colors in device tree as an example when you are dealing with multi-color LEDs without PWM. In that case you only have GPIOs to control and then have a problem what does those GPIO's mean. > > With preset definitions one can use color names to act as a shortcut to configure GPIO's to proper state for that particular color. > > For more flexible setups where you have PWM or such control you have larger space of available colors. In this case you need to somehow define also meaning of those controls. > > Also we may not have LED with only red, green and blue elements. There might in example be amber, ultraviolet, white elements. > > This is where device tree is concerned. It helps us craft the logical definition for LED so that we can control it from user space in common way. > > Now the next problem then is how does user space work then. > > For multi-color LEDs it it important to change the color atomically so that no wrong colors are being shown as user space got interrupted when controlling it. > > Also we have brightness setting that would be useful for PWM controlled LEDs. > > Setting color is easy when you use preset names then you only need to deal with brightness value (eg. RGB -> HSV * brightness -> RGB). Of course here additional problem is other color elements are they then scaled according to brightness value?. > > Setting color as "raw" values is then next problem. In order to do it atomically it needs to be one atomic activation and could be eg. one write to "color" sysfs entry with combination of all color elements and perhaps additionally also brightness value. Next question is then what is the format for such entry then? What are the value ranges? In here we can utilize device tree definition to help define what kind of LED we do have and what kind of capabilities it does have. > > Additional problem risen also in discussion was non-linearity of some control mechanisms vs. perceived color. So there might be a need for curve mapping similarly what is with backlight control and that would be defined either in device tree and possibly in user space if there is a need for that. I suppose golden curve definition in device tree should be good enough. > > Then there was additional discussion about possible animation support but I would leave that for future design as that would then be utilizing the same framework. > > I suppose color space handling and that kind of stuff should be in some led core functionality and then raw control should be part of physical led driver. > > I was planning to play with it during holiday season but lets see how it goes. Feel free to also experiment with the idea. > Again I don't think device tree should be used to set color policy. This is to restricting it may be good for GPIO fixed current RGB LEDs but for variable RGB LEDs it would be very restricting. I believe this needs to be part of the LED framework and leave the device tree to define the HW and not define the product. Maybe a new devm_rgb_register call that exposes the color palette and can consolidate the 3 LEDs into a single sysfs node. Dan > Thanks, > Vesa Jääskeläinen -- ------------------ Dan Murphy