From: Lee Jones <lee@kernel.org>
To: Nam Tran <trannamatk@gmail.com>
Cc: pavel@kernel.org, gregkh@linuxfoundation.org,
rdunlap@infradead.org, christophe.jaillet@wanadoo.fr,
krzk+dt@kernel.org, robh@kernel.org, conor+dt@kernel.org,
corbet@lwn.net, linux-leds@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org
Subject: Re: [PATCH v18 2/3] leds: add basic support for TI/National Semiconductor LP5812 LED Driver
Date: Tue, 25 Nov 2025 13:48:36 +0000 [thread overview]
Message-ID: <20251125134836.GC1127788@google.com> (raw)
In-Reply-To: <20251123191042.116917-3-trannamatk@gmail.com>
On Mon, 24 Nov 2025, Nam Tran wrote:
> The LP5812 is a 4x3 matrix RGB LED driver with an autonomous animation
> engine and time-cross-multiplexing (TCM) support for up to 12 LEDs or
> 4 RGB LEDs. Each LED can be configured through the related registers
> to realize vivid and fancy lighting effects.
>
> This patch adds minimal driver support for the LP5812, implementing
> only the essential functionality: I2C communication with the device,
> LED registration, brightness control in manual mode, and basic sysfs
> interfaces for LED configuration and fault monitoring.
>
> This patch adds minimal driver support for the LP5812, implementing
> only the essential functionality: I2C communication with the device,
> LED registration, brightness control in manual mode, and basic sysfs
> interfaces for LED configuration and fault monitoring.
>
> Signed-off-by: Nam Tran <trannamatk@gmail.com>
> ---
> MAINTAINERS | 4 +
> drivers/leds/rgb/Kconfig | 13 +
> drivers/leds/rgb/Makefile | 1 +
> drivers/leds/rgb/leds-lp5812.c | 646 +++++++++++++++++++++++++++++++++
> drivers/leds/rgb/leds-lp5812.h | 172 +++++++++
> 5 files changed, 836 insertions(+)
> create mode 100644 drivers/leds/rgb/leds-lp5812.c
> create mode 100644 drivers/leds/rgb/leds-lp5812.h
[...]
> +static ssize_t parse_drive_mode(struct lp5812_chip *chip, const char *str)
> +{
> + int i;
> +
> + chip->u_drive_mode.s_drive_mode.mix_sel_led_0 = false;
> + chip->u_drive_mode.s_drive_mode.mix_sel_led_1 = false;
> + chip->u_drive_mode.s_drive_mode.mix_sel_led_2 = false;
> + chip->u_drive_mode.s_drive_mode.mix_sel_led_3 = false;
> +
> + if (sysfs_streq(str, LP5812_MODE_DIRECT_NAME)) {
> + chip->u_drive_mode.s_drive_mode.led_mode = LP5812_MODE_DIRECT_VALUE;
> + return 0;
> + }
> +
> + for (i = 0; i < ARRAY_SIZE(chip_mode_map); i++) {
> + if (!sysfs_streq(str, chip_mode_map[i].mode_name))
> + continue;
> +
> + chip->u_drive_mode.s_drive_mode.led_mode = chip_mode_map[i].mode;
> + chip->u_scan_order.s_scan_order.scan_order_0 = chip_mode_map[i].scan_order_0;
> + chip->u_scan_order.s_scan_order.scan_order_1 = chip_mode_map[i].scan_order_1;
> + chip->u_scan_order.s_scan_order.scan_order_2 = chip_mode_map[i].scan_order_2;
> + chip->u_scan_order.s_scan_order.scan_order_3 = chip_mode_map[i].scan_order_3;
Where are all of these used?
> +
> + switch (chip_mode_map[i].selection_led) {
> + case LP5812_MODE_MIX_SELECT_LED_0:
> + chip->u_drive_mode.s_drive_mode.mix_sel_led_0 = true;
> + break;
> + case LP5812_MODE_MIX_SELECT_LED_1:
> + chip->u_drive_mode.s_drive_mode.mix_sel_led_1 = true;
> + break;
> + case LP5812_MODE_MIX_SELECT_LED_2:
> + chip->u_drive_mode.s_drive_mode.mix_sel_led_2 = true;
> + break;
> + case LP5812_MODE_MIX_SELECT_LED_3:
> + chip->u_drive_mode.s_drive_mode.mix_sel_led_3 = true;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + return 0;
> + }
> +
> + return -EINVAL;
> +}
[...]
> +union u_scan_order {
What is 'u'?
> + struct {
> + u8 scan_order_0:2;
> + u8 scan_order_1:2;
> + u8 scan_order_2:2;
> + u8 scan_order_3:2;
> + } s_scan_order;
> + u8 scan_order_val;
> +};
[...]
--
Lee Jones [李琼斯]
next prev parent reply other threads:[~2025-11-25 13:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-23 19:10 [PATCH v18 0/3] leds: add new LED driver for TI LP5812 Nam Tran
2025-11-23 19:10 ` [PATCH v18 1/3] dt-bindings: leds: add TI/National Semiconductor LP5812 LED Driver Nam Tran
2025-11-24 7:30 ` Krzysztof Kozlowski
2025-11-24 7:55 ` Krzysztof Kozlowski
2025-11-24 7:57 ` Krzysztof Kozlowski
2025-11-24 8:02 ` Krzysztof Kozlowski
2025-11-26 16:55 ` Nam Tran
2025-11-23 19:10 ` [PATCH v18 2/3] leds: add basic support for " Nam Tran
2025-11-25 13:48 ` Lee Jones [this message]
2025-11-26 16:00 ` Nam Tran
2025-11-27 11:32 ` Lee Jones
2025-11-27 14:58 ` Nam Tran
2025-11-23 19:10 ` [PATCH v18 3/3] docs: leds: Document TI LP5812 LED driver Nam Tran
2025-11-23 19:20 ` Randy Dunlap
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=20251125134836.GC1127788@google.com \
--to=lee@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=krzk+dt@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=rdunlap@infradead.org \
--cc=robh@kernel.org \
--cc=trannamatk@gmail.com \
/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).