linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Holland <samuel@sholland.org>
To: Lee Jones <lee@kernel.org>
Cc: Pavel Machek <pavel@ucw.cz>,
	linux-leds@vger.kernel.org, Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev
Subject: Re: [RESEND PATCH v7 2/5] leds: sun50i-a100: New driver for the A100 LED controller
Date: Sun, 29 Oct 2023 13:37:25 -0500	[thread overview]
Message-ID: <f5468eac-96ec-e8c9-bcc1-9ec219bf3352@sholland.org> (raw)
In-Reply-To: <a1adbe50-3400-fd10-1856-8c1d0ed82276@sholland.org>

Hi Lee,

On 10/17/23 19:38, Samuel Holland wrote:
> On 3/16/23 08:34, Lee Jones wrote:
>> On Sat, 31 Dec 2022, Samuel Holland wrote:
>>> +	for_each_available_child_of_node(np, child) {
>>> +		struct sun50i_a100_ledc_led *led;
>>> +		struct led_classdev *cdev;
>>> +		u32 addr, color;
>>> +
>>> +		ret = of_property_read_u32(child, "reg", &addr);
>>> +		if (ret || addr >= count) {
>>> +			dev_err(dev, "LED 'reg' values must be from 0 to %d\n",
>>
>> Doesn't sounds like an address.
> 
> The one-wire protocol involves the first LED responding to the first 24
> bits of the transfer, then forwarding the rest to the next LED. The
> address is the ordinal position in the chain. So I don't think there is
> any reason to have gaps in the addresses--the LEDs would still have to
> physically be there, but you would not be able to control them. That
> said, the driver doesn't need to enforce this, so I can remove the check.

There's actually a reason for the driver enforcing that LED addresses
are contiguous. Removing this check decouples the largest address from
the number of LED class devices. Unfortunately, there's a register field
(LEDC_RESET_TIMING_CTRL_REG_LED_NUM) that must be set to the largest
address for transfers to work correctly.

This means the driver would need to iterate through the child nodes in
two passes inside the probe function: first to find the largest reg
value, and second to actually register the LED class devices.

Since I don't think having gaps in the addresses is a realistic use
case, I'd like to keep this restriction for now (with a comment). We
could always pay the complexity cost later if someone really does want
to relax this check.

Regards,
Samuel


  reply	other threads:[~2023-10-29 18:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-31 23:55 [RESEND PATCH v7 0/5] leds: Allwinner A100 LED controller support Samuel Holland
2022-12-31 23:55 ` [RESEND PATCH v7 1/5] dt-bindings: leds: Add Allwinner A100 LED controller Samuel Holland
2022-12-31 23:55 ` [RESEND PATCH v7 2/5] leds: sun50i-a100: New driver for the " Samuel Holland
2023-01-09 17:16   ` Lee Jones
2023-03-01 14:27     ` Lee Jones
2023-03-16 13:34   ` Lee Jones
2023-10-18  0:38     ` Samuel Holland
2023-10-29 18:37       ` Samuel Holland [this message]
2023-10-31  7:48         ` Lee Jones
2023-10-19 20:26   ` André Apitzsch
2023-10-23  9:58     ` Lee Jones
2023-11-17 12:54     ` Lee Jones
2022-12-31 23:55 ` [RESEND PATCH v7 3/5] arm64: dts: allwinner: a100: Add LED controller node Samuel Holland
2022-12-31 23:55 ` [RESEND PATCH v7 4/5] riscv: dts: allwinner: d1: " Samuel Holland
2022-12-31 23:55 ` [RESEND PATCH v7 5/5] riscv: dts: allwinner: d1: Add RGB LEDs to boards Samuel Holland
2023-01-26  4:59 ` [RESEND PATCH v7 0/5] leds: Allwinner A100 LED controller support Trevor Woerner
2023-03-07 20:56 ` Palmer Dabbelt
2023-03-08  4:13 ` Guo Ren

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=f5468eac-96ec-e8c9-bcc1-9ec219bf3352@sholland.org \
    --to=samuel@sholland.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=pavel@ucw.cz \
    --cc=wens@csie.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).