[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211004170847.3f92ef48@thinkpad>
Date: Mon, 4 Oct 2021 17:08:47 +0200
From: Marek BehĂșn <kabel@...nel.org>
To: Andrew Lunn <andrew@...n.ch>
Cc: Rob Herring <robh+dt@...nel.org>, Pavel Machek <pavel@....cz>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
"linux-leds@...r.kernel.org" <linux-leds@...r.kernel.org>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org
Subject: Re: lets settle the LED `function` property regarding the netdev
trigger
On Mon, 4 Oct 2021 16:50:09 +0200
Andrew Lunn <andrew@...n.ch> wrote:
> > Hello Andrew,
> >
> > I am aware of this, and in fact am working on a proposal for an
> > extension of netdev LED extension, to support the different link
> > modes. (And also to support for multi-color LEDs.)
> >
> > But I am not entirely sure whether these different link modes should be
> > also definable via device-tree. Are there devices with ethernet LEDs
> > dedicated for a specific speed? (i.e. the manufacturer says in the
> > documentation of the device, or perhaps on the device's case, that this
> > LED shows 100M/1000M link, and that other LED is shows 10M link?)
> > If so, that this should be specified in the devicetree, IMO. But are
> > such devices common?
>
> I have a dumb 5 port switch next to me. One port is running at 1G. Its
> left green LED is on and blinks with traffic. Another port of the
> switch is running at 100Mbps and its right orange LED is on, blinks
> for traffic. And there is text on the case saying 10/100 orange, 1G
> green.
>
> I think this is pretty common. You generally do want to know if 10/100
> is being used, it can indicate problems. Same for a 10G port running
> at 1G, etc.
OK then. I will work no a proposal for device tree bindings for this.
> > And what about multi-color LEDs? There are ethernet ports where one LED
> > is red-green, and so can generate red, green, and yellow color. Should
> > device tree also define which color indicates which mode?
>
> There are two different ways this can be implemented. There can be two
> independent LEDs within the same package. So you can generate three
> colours. Or there can be two cross connected LEDs within the
> package. Apply +ve you get one colour, apply -ve you get a different
> colour. Since you cannot apply both -ve and +ve at the same time, you
> cannot get both colours at once.
>
> If you have two independent LEDs, I would define two LEDs in DT.
No, we have multicolor LED API which is meant for exactly this
situation: a multicolor LED.
(I am talking about something like the KJ2518D-262 from
http://www.rego.com.tw/product_detail.php?prdt_id=258
which has Green/Orange on left and Yellow on right side.
The left Green/Orange LED has 3 pins, and so it can mix the colors into
yellow.)
> Things get tricky for the two dependency LEDs. Does the LED core have
> support for such LEDs?
Unfortunately not yet. The multicolor API supports LEDs where the
sub-leds are independent.
> This is where we need to strike a balance between too simple and too
> complex. Implement most of the common features, but don't support
> exotic stuff, like two dependency LEDs?
I think the best solution here would be a subclass "enumcolor" (or
different name), where you can choose between several pre-defined colors.
In sysfs you could then do
echo 1 >brightness
echo green >color
echo yellow >color
There already are other people who need to register such LEDs.
Marek
Powered by blists - more mailing lists