r8169: add support for LED's on RTL8168/RTL8101
Heiner Kallweit
maintainerPATCH v2 1/1 r8169: add support for LED's on RTL8168/RTL8101
This adds support for the LED's on most chip versions. Excluded are the old non-PCIe versions and RTL8125. RTL8125 has a different LED register layout, support for it will follow later.
LED's can be controlled from userspace using the netdev LED trigger.
Tested on RTL8168h.
Note: The driver can't know which LED's are actually physically wired. Therefore not every LED device may represent a physically available LED.
---
v2:
- changed LED naming scheme to predictable name: enxxx-y::lan
--- drivers/net/ethernet/realtek/Makefile | 3 + drivers/net/ethernet/realtek/r8169.h | 7 + drivers/net/ethernet/realtek/r8169_leds.c | 157 ++++++++++++++++++++++ drivers/net/ethernet/realtek/r8169_main.c | 65 +++++++++ 4 files changed, 232 insertions(+) create mode 100644 drivers/net/ethernet/realtek/r8169_leds.c
drivers/net/ethernet/realtek/Makefile +3 -0
@@ -7,4 +7,7 @@ obj-$(CONFIG_8139CP) += 8139cp.o obj-$(CONFIG_8139TOO) += 8139too.o obj-$(CONFIG_ATP) += atp.o r8169-objs += r8169_main.o r8169_firmware.o r8169_phy_config.o +ifdef CONFIG_LEDS_TRIGGER_NETDEV +r8169-objs += r8169_leds.o +endif obj-$(CONFIG_R8169) += r8169.o
drivers/net/ethernet/realtek/r8169.h +7 -0
@@ -8,6 +8,7 @@* See MAINTAINERS file for support contact information. */ +#include <linux/netdevice.h> #include <linux/types.h> #include <linux/phy.h>
@@ -77,3 +78,9 @@ u16 rtl8168h_2_get_adc_bias_ioffset(struct rtl8169_private *tp);u8 rtl8168d_efuse_read (struct rtl8169_private *tp,int reg_addr);void r8169_hw_phy_config (struct rtl8169_private *tp,struct phy_device *phydev,enum mac_version ver); + +void r8169_get_led_name (struct rtl8169_private *tp,int idx, +char *buf,int buf_len); +int rtl8168_get_led_mode (struct rtl8169_private *tp); +int rtl8168_led_mod_ctrl (struct rtl8169_private *tp,u16 mask,u16 val); +void rtl8168_init_leds (struct net_device *ndev);
drivers/net/ethernet/realtek/r8169_leds.c new file +157 -0
157 lines not on this page · raw message
drivers/net/ethernet/realtek/r8169_main.c +65 -0
95 lines not on this page · raw message
Signature · 1 line
2.43.0
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 9 lines · On Sat, 16 Dec 2023 20:58:10 +0100 you wrote:
This adds support for the LED's on most chip versions. Excluded are the old non-PCIe versions and RTL8125. RTL8125 has a different LED register layout, support for it will follow later.
LED's can be controlled from userspace using the netdev LED trigger.
Tested on RTL8168h.
[...]
Here is the summary with links:
- [v2,net-next] r8169: add support for LED's on RTL8168/RTL8101
https://git.kernel.org/netdev/net-next/c/18764b883e15
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html