linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Dan Murphy <dmurphy@ti.com>
Cc: robh+dt@kernel.org, jacek.anaszewski@gmail.com,
	linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org
Subject: Re: [RFC PATCH] leds: multicolor: Add sysfs interface definition
Date: Wed, 30 Jan 2019 23:35:43 +0100	[thread overview]
Message-ID: <20190130223542.GA22040@amd> (raw)
In-Reply-To: <20190130183005.833-1-dmurphy@ti.com>

[-- Attachment #1: Type: text/plain, Size: 4582 bytes --]

On Wed 2019-01-30 12:30:05, Dan Murphy wrote:
> Add a documentation of LED Multicolor LED class specific
> sysfs attributes.

No, sorry. This does not most of the requirements.

								Pavel

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
display. Color list is for example here:

	 https://www.rapidtables.com/web/color/RGB_Color.html

    2a) LEDs probably slightly change color as they age. That's out of
    scope, unless the variation is much greater than on monitors.

    3a) 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.

	   https://en.wikipedia.org/wiki/Gamma_correction
	   #Windows, Mac, sRGB and TV/video standard gammas
	   https://en.wikipedia.org/wiki/SRGB#Specification_of_the_transformation

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.



> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>  .../ABI/testing/sysfs-class-led-multicolor    | 38 +++++++++++++++++++
>  1 file changed, 38 insertions(+)
>  create mode 100644 Documentation/ABI/testing/sysfs-class-led-multicolor
> 
> diff --git a/Documentation/ABI/testing/sysfs-class-led-multicolor b/Documentation/ABI/testing/sysfs-class-led-multicolor
> new file mode 100644
> index 000000000000..19f8da9b150e
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-class-led-multicolor
> @@ -0,0 +1,38 @@
> +What:		/sys/class/leds/<led>/color/sync_enable
> +Date:		January 2019
> +KernelVersion:	5.0
> +Contact:	Dan Murphy <dmurphy@ti.com>
> +Description:	read/write
> +		Writing a 1 to this file will enable the sychronization of all
> +		the defined color LEDs within the LED node.  Writing a 0 to
> +		this file will disable syncing.
> +
> +What:		/sys/class/leds/<led>/color/sync
> +Date:		January 2019
> +KernelVersion:	5.0
> +Contact:	Dan Murphy <dmurphy@ti.com>
> +Description:	write only
> +		Writing a 1 to this file while sync_enable is set to 1 will
> +		synchronize all defined LEDs within the LED node.  All LEDs
> +		defined will be configured based on the brightness that has
> +		been requested.
> +
> +		If sync_enable is set to 0 then writing a 1 to sync has no
> +		affect on the LEDs.
> +
> +What:		/sys/class/leds/<led>/color/<led color>
> +Date:		January 2019
> +KernelVersion:	5.0
> +Contact:	Dan Murphy <dmurphy@ti.com>
> +Description:	read/write
> +		These files are dynamically created based on the colors defined
> +		by the registrar of the class.
> +		The led color(s) can be but not limited to red, green, blue,
> +		white, amber and violet.  If sync is enabled then writing the
> +		brightness value of the LED is deferred until a 1 is
> +		written to /sys/class/leds/<led>/color/sync.  If syncing is
> +		disabled then the LED brightness value will be written
> +		immediately to the LED driver.
> +
> +		The value of the color is from 0 to
> +		/sys/class/leds/<led>/max_brightness.

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  parent reply	other threads:[~2019-01-30 22:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 18:30 [RFC PATCH] leds: multicolor: Add sysfs interface definition Dan Murphy
2019-01-30 19:37 ` Jacek Anaszewski
2019-01-30 19:59   ` Dan Murphy
2019-01-30 20:20     ` Jacek Anaszewski
2019-01-30 21:07       ` Dan Murphy
2019-01-30 22:14         ` Jacek Anaszewski
2019-01-31 13:48           ` Dan Murphy
2019-01-31 20:54             ` Jacek Anaszewski
2019-01-30 22:35 ` Pavel Machek [this message]
2019-02-08  4:55   ` Vesa Jääskeläinen
2019-02-08  5:09     ` Vesa Jääskeläinen
2019-02-08 16:55       ` Dan Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190130223542.GA22040@amd \
    --to=pavel@ucw.cz \
    --cc=dmurphy@ti.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).