Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2518190imu; Thu, 17 Jan 2019 16:06:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN63eljshTEqjq39qq3uzm2wtM/ZMA21PT9stzdsS6unM8cUGpgTXsKPGcc811J6rUM/Mwxy X-Received: by 2002:a63:cd4c:: with SMTP id a12mr15715437pgj.252.1547769961171; Thu, 17 Jan 2019 16:06:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547769961; cv=none; d=google.com; s=arc-20160816; b=Weg4dz7q3ieFcmYfQ9KXwidAa9ZQWv3YvjGabTks/6mbzZN1DocPLGMxuIhnt4iobw 9B1neb4oV2ea2M/3xskkDDPfmim34M3X9/lxcWEIuNyIZz5uBUvlXMc/yMtSeziDLOVV vi6XN/CSZ4lzN7/hGMRCgvI+ooDTm2EdCfBzQSz/71jKI/0bF8vr2Eo/OWgE503wfAXJ 014fdlTJkC/+LjIBz13REcMySIKa+Dkz8j6Z/IZtAXdUT+9kCSFycndytqIzDHlldP+l IBsnpohY/Dxnjtfe6dP3zZpX/PJldL/dCIehhH7ICQ7XfX3Iv9XRGLqgVAw/v06f2+G7 BQ4g== 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; bh=XfnmXlWenzCbMrFUU3JK0urkCmNlTI0fseQwx2t3koI=; b=yuP1AUuSNHTirtw1GhKNoYOKLLAJAj0RBh7RXgUjiw03ix25LLhf0oQhe3s14fRn/m LJiDib0xoUUfUDSUtm6wd7Fq8LFGhk36VDZMort3uoB1y9czDPRrF/dv9MsuC/uDkKCD K9YF0xdDqiknF00/7woWLrCcQh4ULu7i+pLZlK0Cnq3HOKfRXINRtVjMfsDYar6fWMnB lFMEE86VjdJjOpYpgGomagZ6j2CHR3ocCLTHe2beKQLNEINxyT020ZrnGTE0amZgKS4B gipkxK4jPAb7t+tRbg3XKP737rIDpzVS6seXzSqRjr8b73QX3Ed9etjfE9VGzHVp8l// XoRQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h20si2816091pgm.366.2019.01.17.16.05.45; Thu, 17 Jan 2019 16:06:01 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726366AbfARACj (ORCPT + 99 others); Thu, 17 Jan 2019 19:02:39 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:58938 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725889AbfARACj (ORCPT ); Thu, 17 Jan 2019 19:02:39 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 316B680789; Fri, 18 Jan 2019 01:02:30 +0100 (CET) Date: Fri, 18 Jan 2019 01:02:35 +0100 From: Pavel Machek To: Jacek Anaszewski Cc: Dan Murphy , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, dachaac@gmail.com, robh+dt@kernel.org Subject: RGB LED class Re: [PATCH v2 2/2] leds: lp50xx: Add the LP50XX family of the RGB LED driver Message-ID: <20190118000235.GB27661@amd> References: <20190114211723.11186-1-dmurphy@ti.com> <20190114211723.11186-2-dmurphy@ti.com> <20190115222223.GA17363@amd> <79394d17-3124-75b2-ccac-dc1046499d14@ti.com> <20190116105537.GA1803@amd> <86299268-3202-814a-134b-04bd2170faab@ti.com> <8dfa2854-2814-6874-ab8e-1858e9a18acf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tjCHc7DPkfUGtrlw" Content-Disposition: inline In-Reply-To: <8dfa2854-2814-6874-ab8e-1858e9a18acf@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --tjCHc7DPkfUGtrlw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > >I am willing to work with you on the HSV and adapting the LP50xx part to= this framework. > >Or any RGB framework for that matter. I still don't agree with the kern= el needing to declare colors > > maybe color capabilities but not specific colors. >=20 > Dan, if you have a bandwidth for LED RGB class implementation > then please go ahead. It would be good to compare colors produced > by software HSV->RGB algorithm to what can be achieved with > LEDn_BRIGHTNESS feature. Don't get me wrong, I'd like to see LED RGB class implementation. But it will delay merge of this driver. If we want to do that, we should first discuss the requirements, and then come up with interface.. and only then we can talk about the driver code. That's why I believe preferable way would be to merge the driver using the existing interface. Of course, first designing RGB LED class and then merging the driver.. is okay with me. But lets not rush the class because there's driver waiting for it. > The requirements for LED RGB class as I would see it: >=20 > sysfs interface: >=20 > brightness-model: space separated list of available options: > - rgb (default): > - creates color file with "red green blue" decimal values > - creates brightness file > a) for devices with hardware support for adjusting color > intensity it maps to corresponding register > b) for the rest writing any value greater than 0 will result > in setting all color registers to max > - hsv: > - creates color file with "h s v" values - it shall > use software HSV->RGB algorithm for setting color registers >=20 > - any other custom color ranges defined in DT, but it can be covered > later > - other options? First, I think we want to decide if RGB LED should be presented as 3 LEDs or as 1 LED... and what to do with existing RGB leds being presented as 3 LEDs. I don't think we want to support both RGB and HSV in the kernel. It is math, and not a nice one. Yes, both have advantages and disadvantages, but having _both_ in kernel has disadvantages of both. One way I could imagine the interface: RGB LED presented as one LED. brightness -- controls brightness of whole RGB module. pwm_channels -- "1000 240 300" -- "red part should be full on, green should be pwm controlled to 240/1000, blue should be 300/1000" pwm_white -- "1000 500 400" -- tells userspace what to write to PWM channels to get approximately white color. This would assume that RGB LEDs are always pwm controlled. That seems to be true for hardware I seen. + no complex math in kernel + userspace knows enough to display arbitrary colors + userspace can use full range of available PWM intensities + existing triggers will work nicely - userland needs to do non-trivial math to get colors it wants - not sure how to migrate existing devices Thoughts? Other possible interfaces? Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --tjCHc7DPkfUGtrlw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlxBF5sACgkQMOfwapXb+vLk7ACggrnpo4GT4crCmLiKiC8Lan/F m2YAn2pa5S/YMpk7b2XpOyHfzqRZiJws =Rwmp -----END PGP SIGNATURE----- --tjCHc7DPkfUGtrlw--