Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp283082imu; Wed, 19 Dec 2018 18:35:53 -0800 (PST) X-Google-Smtp-Source: AFSGD/U4w6c8I+x1B+GztSRINkkHRCcG785eeAksL4Um+MMVgOFMGGhO7EsTK/56ygSy+lLMEKsL X-Received: by 2002:a17:902:6848:: with SMTP id f8mr21898376pln.300.1545273353759; Wed, 19 Dec 2018 18:35:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545273353; cv=none; d=google.com; s=arc-20160816; b=oDWqt6IzqXonXecsCmZxZhxbvMmB6JUMHOUKuygJrTm03aRwNmzwg26/7zfbJpSCnE XIrMdUc7T8vdiKnkPbIWKXeUmuQrOAK3fv44TIIDP40pTvCSL8FpowGzvXdTZpJEgNb9 uPeQZzTsyl8Hqg0VmAHGNMUvjz3wxjWjUrYw06p/tkQF4oTeN9bw+mLpy2JKfRWb6SxH 6X+GIKduwOKy+HIkLgPCeHz8MYWg99N69gHJrl+A53mOtPtG61xtuUXhDs6fC5dJUCP5 ObKjU/Wvass/sNeUsW3/WeNqSwIUElpVkHdmabon9gg5DcZqHiiX7iXLRMYFmUwEtYuc qgvA== 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=eIoAdc2+j0ZvbhRFjG7o37kjUwjN68GNoeTCcqQ43mg=; b=BIggYdqJUqRtPx7ZIcYLJVDfmn4C4b/oFzx3M0qAwNEWfRpaDO5c5DWYRkTPeAMfH1 FppMe0VM3oaKHkGZD7qjFb9hxuy8VPW58Fb0u34y9NpZprqFdC2c2NU3bHDcl4lPnus/ UtEqhv0C2NbBPS8s+TmpU5IjZxFTXBShTbU3MJoWEPiD7LH6JPtHscP+OYupfXEFjS4I dLf0kYXi0WbZFtp4Ho+nGnHdgcW6zELkafoH5YY3xqinLBUgpQtwuOybpFQLDQOvNL61 BfJ0W2jQIPTBDeqvqqF72NvHxhDxC8l9odFE0sraAvhPHS9Pltudd9QRe394hNvKm2v3 FcWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=gKBZskZA; 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 x6si3279308pln.425.2018.12.19.18.35.38; Wed, 19 Dec 2018 18:35:53 -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=gKBZskZA; 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 S1728749AbeLTBb5 (ORCPT + 99 others); Wed, 19 Dec 2018 20:31:57 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:42404 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726716AbeLTBb5 (ORCPT ); Wed, 19 Dec 2018 20:31:57 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id wBK1VqTc062216; Wed, 19 Dec 2018 19:31:52 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1545269512; bh=eIoAdc2+j0ZvbhRFjG7o37kjUwjN68GNoeTCcqQ43mg=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=gKBZskZAW9aoivT/+FwVzWH+ZnzpctRl+K27XIXv8DizihDiSJ/gGZSP+Dpa7qmQd ijlv9X95ddmOTVYFEf1X3nM0fKIA/82OY81dpSMIPq7AwcaXp0r2E49EFPIkr6FRQt Ilkov6LTmEgnqBCSj2B/8Rf4Uf3mNczMFgqiZdb0= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wBK1VqXD060120 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 19 Dec 2018 19:31:52 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Wed, 19 Dec 2018 19:31:52 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Wed, 19 Dec 2018 19:31:52 -0600 Received: from [172.22.106.233] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id wBK1Vp9F003357; Wed, 19 Dec 2018 19:31:51 -0600 Subject: Re: [PATCH 2/2] leds: lp5024: Add the LP5024/18 RGB LED driver To: Pavel Machek CC: , , kernel list 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> <20181219220326.GA28244@amd> <20181219222737.GB30496@amd> From: Dan Murphy Message-ID: Date: Wed, 19 Dec 2018 19:31:51 -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: <20181219222737.GB30496@amd> Content-Type: text/plain; charset="windows-1252" 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 Pavel Thanks for trimming. On 12/19/2018 04:27 PM, Pavel Machek wrote: > Hi! > > [cc list trimmed] > >>>>> I don't think a user needs nor would want to have 24 different LED nodes with 24 different brightness files. >>>>> Or with the LP5036 that would have 36 LED nodes. >>>>> >>>>> Table 1 in the data sheet shows how the outputs map to the control banks to the LED registers. >>>> >>>> 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. >>>> >>>> Please refer to [0] for the details. >>>> >>>> [0] https://lkml.org/lkml/2018/11/9/938 >>> >>> Yes, plus I also have the set of HSV patches somewhere... and they >>> work, but I found out that HSV->RGB conversion results in loss of precision. >>> >>> We may want to do something like that. >>> >>> But we need to do it once, in a driver core. We obviously don't want >>> each driver having different version of RGB support. >> >> True. But the RGB driver really should not be defining the color palette. >> >> Maybe a "color capability" reported to user space so that the user space can make the decision. >> >> It can report >> >> For GPIO or constant current situations >> static red >> static blue >> static green >> >> For adjustable configurations it can report: >> variable red >> variable blue >> variable green >> >> or even simpler "static" or "dynamic" as a return to report the RGB configuration. >> The LED driver would just need to set the variable. > > I'm not sure what static/variable is. My suggestion is really based in opinion. It is my opinion that the user space sets the policy of the RGB. The DT nor the driver should limit the capability of what the user would want to do. But instead should let the user know what the driver and HW can do. It seems that the suggestion made in the email thread [0] https://lkml.org/lkml/2018/11/9/938 limits that capability via the DT by defining a specific color. If I have a configurable current RGB combo then the palette is endless. But in a GPIO fixed current situation the palette is limited. So I don't think I agree with the DT side of it. There needs to be a way that the kernel can indicate to the user space "heres what I can do you need to let me know". As each kernel driver just needs to interact with the HW and not set policy. > > I have RGB leds here that can set any channel to 0-255, at > runtime. They seem to be quite common at phones. Yes I agree. Android specifically likes to set these values in the lighting HAL. But alternatively once the color is set the brightness can be controlled by PWM or an ALS. > > Anyway, if your 36 channels can be set independently, I believe you > just want them to export as 36 LEDs. I am not sure that is what the "customers" would want to have to set 36 different nodes or even declare those 36 nodes. That is 36 independent user space to kernel space calls that are very expensive just to set a LED color and brightness. Now that is very unrealistic that there would be 36 calls happening. But for this part it would cut the calls to set the brightness to the kernel in runtime after init to 1/3. Set the color and then only one call for the brightness. Dan > > Thanks, > Pavel > -- ------------------ Dan Murphy