From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Machek Subject: Generic RGB LED support was Re: [PATCH 2/2] leds: lp5024: Add the LP5024/18 RGB LED driver Date: Sat, 5 Jan 2019 23:12:54 +0100 Message-ID: <20190105221254.GA22322@amd> References: <986b5105-2fdb-bd25-7c8a-ca8fd1ade821@gmail.com> <7f205102-e854-f1cb-cc03-1307d1cddc87@gmail.com> <20190104201256.GA2931@amd> <20190104220726.GA12395@amd> <4cf79414-578e-eea7-4f46-fc8789206988@gmail.com> <20190105123146.GA16354@amd> <8044cdd9-b9b3-fddd-6106-184b906859e2@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZGiS0Q5IWpPtfppv" Return-path: Content-Disposition: inline In-Reply-To: <8044cdd9-b9b3-fddd-6106-184b906859e2@gmail.com> Sender: linux-kernel-owner@vger.kernel.org To: Jacek Anaszewski Cc: Vesa =?iso-8859-1?B?SuTkc2tlbORpbmVu?= , Dan Murphy , robh+dt@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org List-Id: linux-leds@vger.kernel.org --ZGiS0Q5IWpPtfppv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > >Grab yourself an RGB LED and play with it; you'll see what the > >problems are. It is hard to explain colors over email... >=20 > Video [0] gives some overview of lp5024 capabilities. >=20 > I don't see any problems in exposing separate red,green,blue > files and brightness for the devices with hardware support for > that. Well, that's what we do today, as three separate LEDs, right? I don't have problem with that, either; other drivers already do that. He's free to use existing same interface. But that is insufficient, as it does not allow simple stuff, such as turning led "white". So... perhaps we should agree on requirements, first, and then we can discuss solutions? Requirements for RGB LED interface: 1) Userspace should be able to set the white color 2) Userspace should be able to arbitrary color from well known list and it should approximately match what would CRT, LCD or OLED monitor displ= ay 2a) LEDs probably slightly change color as they age. That's out of scope, unless the variation is much greater than on monitors. 2b) Manufacturing differences cause small color variation. Again, that's out of scope, unless the variation is much greater than on monitors. Nice to have features: 3) Full range of available colors/intensities should be available to userspace 4) Interface should work well with existing triggers 5) It would be nice if userland knew how many lumens are produced at each wavelength for each setting (again, minus aging and manufacturing variations). 6) Complexity of math in kernel should be low, and preferably it should be integer or fixed point Problems: a) RGB LEDs are usually not balanced. Setting 100% PWM on red/green/blue channels will result in nothing close to white light. In fact, to get white light on N900, blue and green channel's PWM needs to be set pretty low, as in 5%. b) LED class does not define any relation between "brightness" in sysfs and ammount of light in lumens. Some drivers use close to linear relation, some use exponential relation. Human eyes percieve logarithm of lumens. RGB color model uses even more complex function. c) Except for white LEDs, LEDs are basically sources of single wavelength of light, while CRTs and LCDs produce broader spectrums. d) RG, RGBW and probably other LED combinations exist. e) Not all "red" LEDs will produce same wavelength. Similar differences will exist for other colors. f) We have existing RGB LEDs represented as three separate monochromatic LEDs in sysfs. --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --ZGiS0Q5IWpPtfppv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlwxK+YACgkQMOfwapXb+vILFgCgxOnOlQp18Z6SjAygRd9g2tSi +T4An2pAO1RIQFE+zBc98noNikm5JT4S =CbTN -----END PGP SIGNATURE----- --ZGiS0Q5IWpPtfppv--