* [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set for YT8521
@ 2026-11-20 10:00 Chukun Pan
2026-11-20 10:00 ` [PATCH v2 2/2] net: phy: motorcomm: add missing trigger link " Chukun Pan
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Chukun Pan @ 2026-11-20 10:00 UTC (permalink / raw)
To: Frank
Cc: Andrew Lunn, Paolo Abeni, Jakub Kicinski, Eric Dumazet,
David S . Miller, Heiner Kallweit, linux-kernel, netdev,
Chukun Pan
Add support for manual brightness setting on YT8521/YT8531 PHY.
Testing with on/off and heartbeat on the Radxa E20C (YT8531).
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
---
Changes in v2:
Fix macro definition location
Add missing checks for using ytphy_read_ext()
Clear force led status in led_hw_control_set()
---
drivers/net/phy/motorcomm.c | 48 +++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
index a87e83fdf590..5a0cd4d7d633 100644
--- a/drivers/net/phy/motorcomm.c
+++ b/drivers/net/phy/motorcomm.c
@@ -271,6 +271,10 @@
*/
#define YTPHY_WCR_TYPE_PULSE BIT(0)
+#define YTPHY_LED_GENERAL_CFG_REG 0xA00B
+#define YTPHY_LED_FORCE_MODE(x) BIT((x) * 3)
+#define YTPHY_LED_FORCE_EN(x) BIT((x) * 3 + 2)
+
#define YTPHY_PAD_DRIVE_STRENGTH_REG 0xA010
#define YT8531_RGMII_RXC_DS_MASK GENMASK(15, 13)
#define YT8531_RGMII_RXD_DS_HI_MASK BIT(12) /* Bit 2 of rxd_ds */
@@ -1775,6 +1779,43 @@ static int yt8531s_config_init(struct phy_device *phydev)
return phy_restore_page(phydev, old_page, ret);
}
+static int yt8521_hw_led_on_set(struct phy_device *phydev, u8 index,
+ bool value)
+{
+ int mask, reg, val;
+
+ val = ytphy_read_ext(phydev, YTPHY_LED_GENERAL_CFG_REG);
+ if (val < 0)
+ return val;
+
+ mask = YTPHY_LED_FORCE_EN(index) | YTPHY_LED_FORCE_MODE(index);
+ if (value)
+ reg = val | mask;
+ else
+ reg = val & ~mask;
+
+ if (reg == val)
+ return 0;
+
+ return ytphy_write_ext(phydev, YTPHY_LED_GENERAL_CFG_REG, reg);
+}
+
+static int yt8521_led_brightness_set(struct phy_device *phydev, u8 index,
+ enum led_brightness value)
+{
+ int ret;
+
+ if (index >= YT8521_MAX_LEDS)
+ return -EINVAL;
+
+ /* clear HW LED setup */
+ ret = ytphy_write_ext(phydev, YT8521_LED0_CFG_REG + index, 0);
+ if (ret < 0)
+ return ret;
+
+ return yt8521_hw_led_on_set(phydev, index, (value != LED_OFF));
+}
+
static const unsigned long supported_trgs = (BIT(TRIGGER_NETDEV_FULL_DUPLEX) |
BIT(TRIGGER_NETDEV_HALF_DUPLEX) |
BIT(TRIGGER_NETDEV_LINK) |
@@ -1801,10 +1842,15 @@ static int yt8521_led_hw_control_set(struct phy_device *phydev, u8 index,
unsigned long rules)
{
u16 val = 0;
+ int ret;
if (index >= YT8521_MAX_LEDS)
return -EINVAL;
+ ret = yt8521_hw_led_on_set(phydev, index, false);
+ if (ret < 0)
+ return ret;
+
if (test_bit(TRIGGER_NETDEV_LINK, &rules)) {
val |= YT8521_LED_10_ON_EN;
val |= YT8521_LED_100_ON_EN;
@@ -3266,6 +3312,7 @@ static struct phy_driver motorcomm_phy_drvs[] = {
.soft_reset = yt8521_soft_reset,
.suspend = yt8521_suspend,
.resume = yt8521_resume,
+ .led_brightness_set = yt8521_led_brightness_set,
.led_hw_is_supported = yt8521_led_hw_is_supported,
.led_hw_control_set = yt8521_led_hw_control_set,
.led_hw_control_get = yt8521_led_hw_control_get,
@@ -3288,6 +3335,7 @@ static struct phy_driver motorcomm_phy_drvs[] = {
.get_wol = ytphy_get_wol,
.set_wol = yt8531_set_wol,
.link_change_notify = yt8531_link_change_notify,
+ .led_brightness_set = yt8521_led_brightness_set,
.led_hw_is_supported = yt8521_led_hw_is_supported,
.led_hw_control_set = yt8521_led_hw_control_set,
.led_hw_control_get = yt8521_led_hw_control_get,
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] net: phy: motorcomm: add missing trigger link for YT8521
2026-11-20 10:00 [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set for YT8521 Chukun Pan
@ 2026-11-20 10:00 ` Chukun Pan
2026-11-24 10:39 ` netdev-bot+sashiko
2026-11-21 16:57 ` [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set " Andrew Lunn
2026-11-24 10:39 ` netdev-bot+sashiko
2 siblings, 1 reply; 6+ messages in thread
From: Chukun Pan @ 2026-11-20 10:00 UTC (permalink / raw)
To: Frank
Cc: Andrew Lunn, Paolo Abeni, Jakub Kicinski, Eric Dumazet,
David S . Miller, Heiner Kallweit, linux-kernel, netdev,
Chukun Pan
TRIGGER_NETDEV_LINK is available in led_hw_control_set,
but missing in led_hw_control_get. Add it.
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
Changes in v2:
Collect Reviewed-by
---
drivers/net/phy/motorcomm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
index 5a0cd4d7d633..4552eee872a8 100644
--- a/drivers/net/phy/motorcomm.c
+++ b/drivers/net/phy/motorcomm.c
@@ -1918,6 +1918,11 @@ static int yt8521_led_hw_control_get(struct phy_device *phydev, u8 index,
if (val & YT8521_LED_10_ON_EN)
__set_bit(TRIGGER_NETDEV_LINK_10, rules);
+ if ((val & YT8521_LED_10_ON_EN) &&
+ (val & YT8521_LED_100_ON_EN) &&
+ (val & YT8521_LED_1000_ON_EN))
+ __set_bit(TRIGGER_NETDEV_LINK, rules);
+
return 0;
}
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set for YT8521
2026-11-20 10:00 [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set for YT8521 Chukun Pan
2026-11-20 10:00 ` [PATCH v2 2/2] net: phy: motorcomm: add missing trigger link " Chukun Pan
@ 2026-11-21 16:57 ` Andrew Lunn
2026-11-24 6:50 ` Chukun Pan
2026-11-24 10:39 ` netdev-bot+sashiko
2 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2026-11-21 16:57 UTC (permalink / raw)
To: Chukun Pan
Cc: Frank, Paolo Abeni, Jakub Kicinski, Eric Dumazet,
David S . Miller, Heiner Kallweit, linux-kernel, netdev
On Fri, Nov 20, 2026 at 06:00:00PM +0800, Chukun Pan wrote:
> Add support for manual brightness setting on YT8521/YT8531 PHY.
> Testing with on/off and heartbeat on the Radxa E20C (YT8531).
Did you test enabling a mode which uses the hardware to blink?
Sometimes you need to take it out of forced mode. It could be that any
value other than 0 in YT8521_LED0_CFG_REG does that, but there is
nothing i can see here which suggests that.
If 0 is forced, maybe add
#define YT8521_LED_FORCED 0
next to YT8521_LED_10_ON_EN ?
Please also take a read of:
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
You need to set the subject line.
Andrew
---
pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set for YT8521
2026-11-21 16:57 ` [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set " Andrew Lunn
@ 2026-11-24 6:50 ` Chukun Pan
0 siblings, 0 replies; 6+ messages in thread
From: Chukun Pan @ 2026-11-24 6:50 UTC (permalink / raw)
To: andrew
Cc: Frank.Sae, amadeus, davem, edumazet, hkallweit1, kuba,
linux-kernel, netdev, pabeni
Hi,
> Did you test enabling a mode which uses the hardware to blink?
I've tested that the rx and tx in netdev trigger work correctly.
> Sometimes you need to take it out of forced mode. It could be that any
> value other than 0 in YT8521_LED0_CFG_REG does that, but there is
> nothing i can see here which suggests that.
Inside yt8521_led_hw_control_set(), I have already exited
Forced Mode using yt8521_hw_led_on_set().
Forced Mode is controlled solely by LED_GENERAL_CFG_REG and
is independent of LED0_CFG_REG.
Sorry, but did I explain that clearly?
Thanks,
Chukun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set for YT8521
2026-11-20 10:00 [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set for YT8521 Chukun Pan
2026-11-20 10:00 ` [PATCH v2 2/2] net: phy: motorcomm: add missing trigger link " Chukun Pan
2026-11-21 16:57 ` [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set " Andrew Lunn
@ 2026-11-24 10:39 ` netdev-bot+sashiko
2 siblings, 0 replies; 6+ messages in thread
From: netdev-bot+sashiko @ 2026-11-24 10:39 UTC (permalink / raw)
To: amadeus
Cc: Frank.Sae, andrew, pabeni, kuba, edumazet, davem, hkallweit1,
linux-kernel, netdev
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 1 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The new LED callbacks in drivers/net/phy/motorcomm.c reach
extended registers through the unlocked helpers…
- [Medium] yt8521_hw_led_on_set() may program only part of what looks
like a 2-bit per-LED force-mode field in YTPHY_LED_GENERAL_CFG_REG…
- [Low] The patch adds a force state in YTPHY_LED_GENERAL_CFG_REG, but
yt8521_led_hw_control_get() still reads only YT8521_LEDx_CFG_REG (line…
- [Low] The commit message body says only 'Add support for manual
brightness setting on YT8521/YT8531 PHY.' It does not mention that the…
--
net: phy: motorcomm: add led_brightness_set for YT8521
This adds a led_brightness_set callback for the YT8521 and YT8531 PHYs.
The callback clears the per-LED hardware control config. It then turns the
LED on or off with the force bits in the LED general config register
(0xA00B). It also makes yt8521_led_hw_control_set() clear those force bits
before it programs the trigger rules.
> net: phy: motorcomm: add led_brightness_set for YT8521
>
> Add support for manual brightness setting on YT8521/YT8531 PHY.
> Testing with on/off and heartbeat on the Radxa E20C (YT8531).
[Severity: Low]
This isn't a bug, but the subject only names YT8521. The callback is added
to both the YT8521 and YT8531 entries in motorcomm_phy_drvs.
The body also doesn't mention that yt8521_led_hw_control_set() now clears
the force-enable and force-mode bits in YTPHY_LED_GENERAL_CFG_REG. Before
this patch the hw-control path never touched 0xA00B, so any force state
left by firmware or a bootloader stayed in place.
The only mention is the v2 changelog line "Clear force led status in
led_hw_control_set()". That line is below the --- separator, so it will be
dropped when the patch is applied.
Could the body describe this change as well?
> diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
> index a87e83fdf590c..5a0cd4d7d6336 100644
> --- a/drivers/net/phy/motorcomm.c
> +++ b/drivers/net/phy/motorcomm.c
> @@ -271,6 +271,10 @@
> */
> #define YTPHY_WCR_TYPE_PULSE BIT(0)
>
> +#define YTPHY_LED_GENERAL_CFG_REG 0xA00B
> +#define YTPHY_LED_FORCE_MODE(x) BIT((x) * 3)
> +#define YTPHY_LED_FORCE_EN(x) BIT((x) * 3 + 2)
[Severity: Medium]
Is the force mode field really one bit wide? Each LED gets a 3-bit slot
here, but bit x*3+1 (bits 1, 4 and 7) is never defined or touched. That
layout looks like a 2-bit force_mode field at [x*3+1:x*3] next to a 1-bit
force_en.
If so, yt8521_hw_led_on_set() only ORs in BIT(x*3) | BIT(x*3+2):
mask = YTPHY_LED_FORCE_EN(index) | YTPHY_LED_FORCE_MODE(index);
if (value)
reg = val | mask;
The resulting forced mode would then depend on whatever bit x*3+1 already
held. If firmware or a bootloader left that bit set, would brightness on
program mode 0b11 instead of solid on? The LED would then show a different
pattern from what sysfs reports.
I couldn't confirm the field layout from in-tree documentation. Should the
whole mode field be masked and set explicitly?
[ ... ]
> @@ -1775,6 +1779,43 @@ static int yt8531s_config_init(struct phy_device *phydev)
> return phy_restore_page(phydev, old_page, ret);
> }
>
> +static int yt8521_hw_led_on_set(struct phy_device *phydev, u8 index,
> + bool value)
> +{
> + int mask, reg, val;
> +
> + val = ytphy_read_ext(phydev, YTPHY_LED_GENERAL_CFG_REG);
> + if (val < 0)
> + return val;
> +
> + mask = YTPHY_LED_FORCE_EN(index) | YTPHY_LED_FORCE_MODE(index);
> + if (value)
> + reg = val | mask;
> + else
> + reg = val & ~mask;
> +
> + if (reg == val)
> + return 0;
> +
> + return ytphy_write_ext(phydev, YTPHY_LED_GENERAL_CFG_REG, reg);
> +}
> +
> +static int yt8521_led_brightness_set(struct phy_device *phydev, u8 index,
> + enum led_brightness value)
> +{
> + int ret;
> +
> + if (index >= YT8521_MAX_LEDS)
> + return -EINVAL;
> +
> + /* clear HW LED setup */
> + ret = ytphy_write_ext(phydev, YT8521_LED0_CFG_REG + index, 0);
> + if (ret < 0)
> + return ret;
> +
> + return yt8521_hw_led_on_set(phydev, index, (value != LED_OFF));
> +}
[Severity: High]
Is the MDIO bus lock held for these extended register accesses? The
kernel-doc for both helpers says:
drivers/net/phy/motorcomm.c:ytphy_read_ext() / ytphy_write_ext()
* NOTE:The caller must have taken the MDIO bus lock.
But the PHY LED core only holds phydev->lock when it calls the callback:
drivers/net/phy/phy_device.c:phy_led_set_brightness() {
...
mutex_lock(&phydev->lock);
err = phydev->drv->led_brightness_set(phydev, phyled->index, value);
mutex_unlock(&phydev->lock);
...
}
So the call chain is:
led_set_brightness()
phy_led_set_brightness() <- phydev->lock only
yt8521_led_brightness_set()
ytphy_write_ext(LEDx_CFG)
__phy_write()
yt8521_hw_led_on_set()
ytphy_read_ext(0xA00B)
ytphy_write_ext(0xA00B)
Won't __mdiobus_read() and __mdiobus_write() hit
lockdep_assert_held_once(&bus->mdio_lock) the first time the brightness
changes?
Without the bus lock, the 0x1E page select and 0x1F data accesses can also
interleave with other users of the same bus. Examples are other PHYs being
polled by the state machine, phy_mii_ioctl(), and phy_select_page() or the
_with_lock helpers. Could a write then land in the wrong extended register,
or a read return another register's value? Software blink triggers like
heartbeat call this path repeatedly, so the window keeps reopening.
The read-modify-write of 0xA00B in yt8521_hw_led_on_set() is not atomic
either. Can a concurrent update of the force bits for another LED index be
lost?
The existing hw_control_set/get callbacks already used the unlocked
helpers. This patch adds a new unlocked callback, and also a new unlocked
read-modify-write in yt8521_led_hw_control_set(). The follow-up commit "net:
phy: motorcomm: add missing trigger link for YT8521" doesn't address this,
since it only changes yt8521_led_hw_control_get().
Would it work to take phy_lock_mdio_bus() and phy_unlock_mdio_bus() around
the whole LED operation (both the 0xA00B update and the LEDx_CFG write),
rather than locking each access separately?
> static const unsigned long supported_trgs = (BIT(TRIGGER_NETDEV_FULL_DUPLEX) |
> BIT(TRIGGER_NETDEV_HALF_DUPLEX) |
> BIT(TRIGGER_NETDEV_LINK) |
> @@ -1801,10 +1842,15 @@ static int yt8521_led_hw_control_set(struct phy_device *phydev, u8 index,
> unsigned long rules)
> {
> u16 val = 0;
> + int ret;
>
> if (index >= YT8521_MAX_LEDS)
> return -EINVAL;
>
> + ret = yt8521_hw_led_on_set(phydev, index, false);
> + if (ret < 0)
> + return ret;
> +
[Severity: Low]
This clears the force bits when hw_control_set() runs. Does it run when the
netdev trigger is activated over an LED that was forced on?
Take this sequence. With trigger "none", brightness is set to 1.
yt8521_led_brightness_set() writes LEDx_CFG = 0 and sets FORCE_EN and
FORCE_MODE in 0xA00B.
Then "netdev" is written to the trigger. __led_trigger_set() only turns
the LED off when an old trigger is being removed:
drivers/leds/led-triggers.c:__led_trigger_set() {
...
if (trig || !hw_triggered)
led_set_brightness(led_cdev, LED_OFF);
}
...
}
That code sits inside the if (led_cdev->trigger) block, so it doesn't run
when going from "none" to "netdev".
netdev_trig_activate() then sets trigger_data->hw_control = true and calls
set_device_name(), which skips the baseline state during activation:
drivers/leds/trigger/ledtrig-netdev.c:set_device_name() {
...
if (!trigger_data->hw_control || led_get_trigger_data(trigger_data->led_cdev))
set_baseline_state(trigger_data);
...
}
So yt8521_led_hw_control_set() is never called, and the force bits stay
set. yt8521_led_hw_control_get() only reads YT8521_LED0_CFG_REG + index,
which is 0, so it reports no rules.
The trigger then believes the LED is offloaded with no rules, while the
hardware keeps it forced on. This lasts until a NETDEV_UP or NETDEV_CHANGE
event, or a mode attribute change.
Other PHY drivers such as marvell end up in a similar hw_control state
here. This driver only reaches it because the patch adds the force mode.
Should yt8521_led_hw_control_get() take the 0xA00B force bits into account?
> if (test_bit(TRIGGER_NETDEV_LINK, &rules)) {
> val |= YT8521_LED_10_ON_EN;
> val |= YT8521_LED_100_ON_EN;
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120100001.1568757-1-amadeus%40jmu.edu.cn
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] net: phy: motorcomm: add missing trigger link for YT8521
2026-11-20 10:00 ` [PATCH v2 2/2] net: phy: motorcomm: add missing trigger link " Chukun Pan
@ 2026-11-24 10:39 ` netdev-bot+sashiko
0 siblings, 0 replies; 6+ messages in thread
From: netdev-bot+sashiko @ 2026-11-24 10:39 UTC (permalink / raw)
To: amadeus
Cc: Frank.Sae, andrew, pabeni, kuba, edumazet, davem, hkallweit1,
linux-kernel, netdev
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] Since this patch, yt8521_led_hw_control_get()
(drivers/net/phy/motorcomm.c, lines 1912-1924) reports…
- [Low] The commit message describes this as a fix for missing behaviour:
TRIGGER_NETDEV_LINK is accepted by yt8521_led_hw_control_set() but was…
--
net: phy: motorcomm: add missing trigger link for YT8521
This patch makes yt8521_led_hw_control_get() report TRIGGER_NETDEV_LINK
when the 10, 100 and 1000 link-on bits are all set in the LED config
register. yt8521_led_hw_control_set() already accepts that rule.
> net: phy: motorcomm: add missing trigger link for YT8521
>
> TRIGGER_NETDEV_LINK is available in led_hw_control_set,
> but missing in led_hw_control_get. Add it.
[Severity: Low]
Should this have a Fixes: tag? The commit message describes this as adding
missing behaviour. The getter was added by commit 355b82c54c122e ("net:
phy: motorcomm: Add support for PHY LEDs on YT8521").
The subject only mentions YT8521. The PHY_ID_YT8531 phy_driver entry in
drivers/net/phy/motorcomm.c uses the same getter:
.led_hw_control_get = yt8521_led_hw_control_get,
so YT8531 behaviour changes too. Would it be worth mentioning that?
If this gets a Fixes: tag and goes to stable, it will also bring along the
trigger state problem described below.
> diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
> index 5a0cd4d7d6336..4552eee872a8c 100644
> --- a/drivers/net/phy/motorcomm.c
> +++ b/drivers/net/phy/motorcomm.c
> @@ -1918,6 +1918,11 @@ static int yt8521_led_hw_control_get(struct phy_device *phydev, u8 index,
> if (val & YT8521_LED_10_ON_EN)
> __set_bit(TRIGGER_NETDEV_LINK_10, rules);
>
> + if ((val & YT8521_LED_10_ON_EN) &&
> + (val & YT8521_LED_100_ON_EN) &&
> + (val & YT8521_LED_1000_ON_EN))
> + __set_bit(TRIGGER_NETDEV_LINK, rules);
[Severity: Medium]
LINK_10, LINK_100 and LINK_1000 are already set just above this. Doesn't
yt8521_led_hw_control_get() now return LINK|LINK_10|LINK_100|LINK_1000?
Can the netdev trigger handle that combination?
netdev_trig_activate() copies the result without checking it:
drivers/leds/trigger/ledtrig-netdev.c:netdev_trig_activate() {
...
rc = led_cdev->hw_control_get(led_cdev, &mode);
if (!rc)
trigger_data->mode = mode;
...
}
However, netdev_led_attr_store() rejects LINK combined with any LINK_xx
bit:
drivers/leds/trigger/ledtrig-netdev.c:netdev_led_attr_store() {
...
if (test_bit(TRIGGER_NETDEV_LINK, &mode) &&
(test_bit(TRIGGER_NETDEV_LINK_10, &mode) ||
test_bit(TRIGGER_NETDEV_LINK_100, &mode) ||
test_bit(TRIGGER_NETDEV_LINK_1000, &mode) ||
...
return -EINVAL;
...
}
The register can have all three speed bits set in three ways:
- left that way by the bootloader
- as the hardware default
- written by yt8521_led_hw_control_set(), which sets all three bits for
either a LINK request or a LINK_10|LINK_100|LINK_1000 request
Suppose the netdev trigger is activated on a YT8521 or YT8531 LED in that
state. Any later sysfs write that leaves LINK set then fails with -EINVAL
until link=0 is written first. Examples are writing 1 to tx, rx,
full_duplex or half_duplex, or writing 0 to link_10.
Before this patch the activated mode was LINK_10|LINK_100|LINK_1000, and
those writes worked.
realtek_main.c and air_an8801.c use the same pattern. It still breaks the
trigger's rule that LINK and LINK_xx are mutually exclusive.
Would it be better to report only LINK here and leave out the speed bits?
Or should ledtrig-netdev normalise or accept this combination?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120100001.1568757-1-amadeus%40jmu.edu.cn
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-24 10:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 10:00 [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set for YT8521 Chukun Pan
2026-11-20 10:00 ` [PATCH v2 2/2] net: phy: motorcomm: add missing trigger link " Chukun Pan
2026-11-24 10:39 ` netdev-bot+sashiko
2026-11-21 16:57 ` [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set " Andrew Lunn
2026-11-24 6:50 ` Chukun Pan
2026-11-24 10:39 ` netdev-bot+sashiko
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®