From: Nam Tran <trannamatk@gmail.com>
To: lee@kernel.org
Cc: gregkh@linuxfoundation.org, pavel@kernel.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: Thu, 27 Nov 2025 21:58:17 +0700 [thread overview]
Message-ID: <20251127145817.172871-1-trannamatk@gmail.com> (raw)
In-Reply-To: <20251127113213.GI3070764@google.com>
On Thu, 27 Nov 2025, Lee Jones wrote:
> On Wed, 26 Nov 2025, Nam Tran wrote:
>
> > On Tue, 25 Nov 2025, Lee Jones wrote:
> >
> > > > +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?
> >
> > These fields are part of unions (u_drive_mode and u_scan_order).
> > The bitfields are packed into drive_mode_val and scan_order_val, which are
> > written to DEV_CONFIG1 and DEV_CONFIG2 in lp5812_set_drive_mode_scan_order().
>
> Sure, but where. What line of code?
These fields are used in lp5812_set_drive_mode_scan_order() when writing the
packed register values
val = chip->u_drive_mode.drive_mode_val;
ret = lp5812_write(chip, LP5812_DEV_CONFIG1, val);
if (ret)
return ret;
val = chip->u_scan_order.scan_order_val;
ret = lp5812_write(chip, LP5812_DEV_CONFIG2, val);
This is where the bitfields set in parse_drive_mode() are used.
Best regards,
Nam Tran
next prev parent reply other threads:[~2025-11-27 14:58 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
2025-11-26 16:00 ` Nam Tran
2025-11-27 11:32 ` Lee Jones
2025-11-27 14:58 ` Nam Tran [this message]
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=20251127145817.172871-1-trannamatk@gmail.com \
--to=trannamatk@gmail.com \
--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=lee@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 \
/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).