From: Pavel Machek <pavel@ucw.cz>
To: Andreas Bergmeier <abergmeier@gmx.net>
Cc: linux-leds@vger.kernel.org
Subject: Re: Proposal: Add color_temperature support
Date: Sat, 29 Oct 2022 18:52:18 +0200 [thread overview]
Message-ID: <20221029165218.GA3337@duo.ucw.cz> (raw)
In-Reply-To: <CABfF9mNvf93FAxX7MWVe5KxhrBTV4_ZBzhJPs-JT+tXdyaja1g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3302 bytes --]
Hi!
> On the device Logitech Litra Glow it is possible to set not only the
> brightness but also the color temperature (both via usb as well as via
> hardware).
> I am currently trying to add support for the device - and expose it
> via LED - into the kernel.
> So to support all device capabilities I am proposing to extend LEDs by
> color temperature:
> And initial patch for the headers:
Internally, the litra glow is something like RGB LED, right? Can we
support it as a multicolor LED?
Best regards,
Pavel
> diff --git a/include/linux/leds.h b/include/linux/leds.h
> index ba4861ec7..494eab49b 100644
> --- a/include/linux/leds.h
> +++ b/include/linux/leds.h
> @@ -72,6 +72,9 @@ struct led_classdev {
> unsigned int brightness;
> unsigned int max_brightness;
> int flags;
> + unsigned int color_temperature;
> + unsigned int min_color_temperature;
> + unsigned int max_color_temperature;
> /* Lower 16 bits reflect status */
> #define LED_SUSPENDED BIT(0)
> @@ -123,6 +126,21 @@ struct led_classdev {
> unsigned long *delay_on,
> unsigned long *delay_off);
> + /* Set LED color temperature
> + * Must not sleep. Use color_temperature_set_blocking for drivers
> + * that can sleep while setting color temperature.
> + */
> + void (*color_temperature_set)(struct led_classdev *led_cdev,
> + unsigned int color_temperature);
> + /*
> + * Set LED color temperature immediately - it can block the caller for
> + * the time required for accessing a LED device register.
> + */
> + int (*color_temperature_set_blocking)(struct led_classdev *led_cdev,
> + unsigned int color_temperature);
> + /* Get LED color temperature */
> + unsigned int (*color_temperature_get)(struct led_classdev *led_cdev);
> +
> int (*pattern_set)(struct led_classdev *led_cdev,
> struct led_pattern *pattern, u32 len, int repeat);
> int (*pattern_clear)(struct led_classdev *led_cdev);
> @@ -140,6 +158,7 @@ struct led_classdev {
> void (*flash_resume)(struct led_classdev *led_cdev);
> struct work_struct set_brightness_work;
> + struct work_struct set_color_temperature_work;
> int delayed_set_value;
> #ifdef CONFIG_LEDS_TRIGGERS
> @@ -160,6 +179,10 @@ struct led_classdev {
> int brightness_hw_changed;
> struct kernfs_node *brightness_hw_changed_kn;
> #endif
> +#ifdef CONFIG_LEDS_COLOR_TEMPERATURE_HW_CHANGED
> + int color_temperature_hw_changed;
> + struct kernfs_node *color_temperature_hw_changed_kn;
> +#endif
> /* Ensures consistent access to the LED Flash Class device */
> struct mutex led_access;
> @@ -574,6 +597,14 @@ void led_classdev_notify_brightness_hw_changed(
> static inline void led_classdev_notify_brightness_hw_changed(
> struct led_classdev *led_cdev, enum led_brightness brightness) { }
> #endif
> +#ifdef CONFIG_LEDS_COLOR_TEMPERATURE_HW_CHANGED
> +void led_classdev_notify_color_temperature_hw_changed(
> + struct led_classdev *led_cdev, unsigned int color_temperature);
> +#else
> +static inline void led_classdev_notify_color_temperature_hw_changed(
> + struct led_classdev *led_cdev, unsigned int color_temperature) { }
> +#endif
> +
> /**
> * struct led_pattern - pattern interval settings
>
> What do you think?
> Cheers
--
People of Russia, stop Putin before his war on Ukraine escalates.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2022-10-29 16:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-29 9:54 Proposal: Add color_temperature support Andreas Bergmeier
2022-10-29 16:52 ` Pavel Machek [this message]
2022-10-29 17:11 ` Andreas Bergmeier
2022-10-29 18:32 ` Pavel Machek
2022-10-29 19:18 ` Andreas Bergmeier
2022-11-03 20:37 ` Andreas Bergmeier
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=20221029165218.GA3337@duo.ucw.cz \
--to=pavel@ucw.cz \
--cc=abergmeier@gmx.net \
--cc=linux-leds@vger.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