From: Marek Vasut <marex@denx.de>
To: Andrew Lunn <andrew@lunn.ch>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Jakub Kicinski <kuba@kernel.org>,
Russell King <linux@armlinux.org.uk>,
Tristram Ha <tristram.ha@microchip.com>,
UNGLinuxDriver@microchip.com, Vladimir Oltean <olteanv@gmail.com>,
Woojung Huh <woojung.huh@microchip.com>,
linux-kernel@vger.kernel.org
Subject: Re: [net-next,PATCH 2/2] net: phy: micrel: Add KSZ87XX Switch LED control
Date: Mon, 20 Jan 2025 15:20:41 +0100 [thread overview]
Message-ID: <953ad608-8be7-42e6-9162-05a98a42eb21@denx.de> (raw)
In-Reply-To: <ef933bd4-b9ae-4f78-8f05-abd1d2832bf8@lunn.ch>
On 1/16/25 2:23 PM, Andrew Lunn wrote:
> On Thu, Jan 16, 2025 at 10:58:38AM +0100, Paolo Abeni wrote:
>> On 1/13/25 1:15 AM, Marek Vasut wrote:
>>> The KSZ87xx switch contains LED control registers. There is one shared
>>> global control register bitfield which affects behavior of all LEDs on
>>> all ports, the Register 11 (0x0B): Global Control 9 bitfield [5:4].
>>> There is also one per-port Register 29/45/61 (0x1D/0x2D/0x3D): Port 1/2/3
>>> Control 10 bit 7 which controls enablement of both LEDs on each port
>>> separately.
>>>
>>> Expose LED brightness control and HW offload support for both of the two
>>> programmable LEDs on this KSZ87XX Switch. Note that on KSZ87xx there are
>>> three or more instances of simple KSZ87XX Switch PHY, one for each port,
>>> however, the registers which control the LED behavior are mostly shared.
>>>
>>> Introduce LED brightness control using Register 29/45/61 (0x1D/0x2D/0x3D):
>>> Port 1/2/3 Control 10 bit 7. This bit selects between LEDs disabled and
>>> LEDs set to Function mode. In case LED brightness is set to 0, both LEDs
>>> are turned off, otherwise both LEDs are configured to Function mode which
>>> follows the global Register 11 (0x0B): Global Control 9 bitfield [5:4]
>>> setting.
>>
>> @Andrew, @Russel: can the above problem be address with the current phy
>> API? or does phy device need to expose a new brightness_get op?
Sorry for the delayed reply.
> Coupled LEDs cause issues. Because vendors do all sorts of weird
> things with LEDs, i don't want to fully support everything every
> vendor has, or the code is just going to be unmaintanable. So we have
> the core support a subset, and some features of the hardware go
> unused.
>
> In this case, i would say software control of the LEDs is
> impossible. You cannot individually turn an LED on/off. The core
> supports this, Heiner added support for a PHY with similar issues. I
> think it is as simple as not implementing led_brightness_set().
What about the LED functionality configuration ?
I think the main issue here is that multiple LEDs exposed in sysfs
control the same bit(s) in hardware, and the sysfs attributes behind
those LEDs can get out of sync.
One alternative that crossed my mind would be to register single LED in
the KSZ87xx switch driver to control the LED functionality, and per-port
LED to control the per-port LED enablement (=brightness). It does not
model the hardware accurately, but it does avoid the complexity.
Otherwise, what is left would be custom sysfs attributes for this switch?
next prev parent reply other threads:[~2025-01-20 14:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 0:15 [net-next,PATCH 1/2] net: dsa: microchip: Add emulated MIIM access to switch LED config registers Marek Vasut
2025-01-13 0:15 ` [net-next,PATCH 2/2] net: phy: micrel: Add KSZ87XX Switch LED control Marek Vasut
2025-01-16 9:58 ` Paolo Abeni
2025-01-16 13:23 ` Andrew Lunn
2025-01-20 14:20 ` Marek Vasut [this message]
2025-01-16 9:32 ` [net-next,PATCH 1/2] net: dsa: microchip: Add emulated MIIM access to switch LED config registers Paolo Abeni
2025-01-16 13:06 ` Andrew Lunn
2025-01-20 11:59 ` Marek Vasut
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=953ad608-8be7-42e6-9162-05a98a42eb21@denx.de \
--to=marex@denx.de \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=tristram.ha@microchip.com \
--cc=woojung.huh@microchip.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
all inboxes | Powered by JetHome®