xx_vv_immortalwrt/package/kernel/r8125/patches/120-add-LED-configuration-from-OF.patch
Tianling Shen 1aea98f3c8
Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-02-27 21:50:23 +08:00

46 lines
1.3 KiB
Diff

--- a/src/r8125_n.c
+++ b/src/r8125_n.c
@@ -44,6 +44,7 @@
#include <linux/etherdevice.h>
#include <linux/delay.h>
#include <linux/mii.h>
+#include <linux/of.h>
#include <linux/if_vlan.h>
#include <linux/crc32.h>
#include <linux/interrupt.h>
@@ -14221,6 +14222,25 @@ rtl8125_setup_mqs_reg(struct rtl8125_pri
tp->imr_reg[i] = (u16)(IMR1_8125 + (i - 1) * 4);
}
+static int
+rtl8125_led_configuration(struct rtl8125_private *tp)
+{
+ const int led_regs[] = { 0x18, 0x86, 0x84, 0x96 }; /* LEDSEL 0-3 */
+ u32 led_data[4];
+ int ret, i;
+
+ ret = of_property_read_u32_array(tp->pci_dev->dev.of_node,
+ "realtek,led-data", led_data, 4);
+
+ if (ret)
+ return ret;
+
+ for (i = 0; i < 4; i++)
+ RTL_W16(tp, led_regs[i], led_data[i]);
+
+ return 0;
+}
+
static void
rtl8125_init_software_variable(struct net_device *dev)
{
@@ -14677,6 +14697,8 @@ rtl8125_init_software_variable(struct ne
else if (tp->InitRxDescType == RX_DESC_RING_TYPE_4)
tp->rtl8125_rx_config &= ~EnableRxDescV4_1;
+ rtl8125_led_configuration(tp);
+
tp->NicCustLedValue = RTL_R16(tp, CustomLED);
tp->wol_opts = rtl8125_get_hw_wol(tp);