[openwrt/openwrt] realtek: enable HWMON for SFP sensors

LEDE Commits lede-commits at lists.infradead.org
Sun Apr 18 13:15:40 BST 2021


hauke pushed a commit to openwrt/openwrt.git, branch openwrt-21.02:
https://git.openwrt.org/66e470594adc43d0eb7a4ab969a376435d2e0863

commit 66e470594adc43d0eb7a4ab969a376435d2e0863
Author: Bjørn Mork <bjorn at mork.no>
AuthorDate: Sat Mar 13 17:45:52 2021 +0100

    realtek: enable HWMON for SFP sensors
    
    This adds SFP sensors as a hwmon device, allowing readout of
    temperatures, DOM and other sensor readings available from the
    SFP.  Example from a ZyXEL GS1900-10HP with a DOM capable
    1000Base-SX SFP:
    
    root at gs1900-10hp:~# grep . /sys/class/hwmon/hwmon0/*
    /sys/class/hwmon/hwmon0/curr1_crit:90
    /sys/class/hwmon/hwmon0/curr1_crit_alarm:0
    /sys/class/hwmon/hwmon0/curr1_input:4
    /sys/class/hwmon/hwmon0/curr1_label:bias
    /sys/class/hwmon/hwmon0/curr1_lcrit:0
    /sys/class/hwmon/hwmon0/curr1_lcrit_alarm:0
    /sys/class/hwmon/hwmon0/curr1_max:85
    /sys/class/hwmon/hwmon0/curr1_max_alarm:0
    /sys/class/hwmon/hwmon0/curr1_min:0
    /sys/class/hwmon/hwmon0/curr1_min_alarm:0
    /sys/class/hwmon/hwmon0/in0_crit:3795
    /sys/class/hwmon/hwmon0/in0_crit_alarm:0
    /sys/class/hwmon/hwmon0/in0_input:3317
    /sys/class/hwmon/hwmon0/in0_label:VCC
    /sys/class/hwmon/hwmon0/in0_lcrit:2805
    /sys/class/hwmon/hwmon0/in0_lcrit_alarm:0
    /sys/class/hwmon/hwmon0/in0_max:3465
    /sys/class/hwmon/hwmon0/in0_max_alarm:0
    /sys/class/hwmon/hwmon0/in0_min:3135
    /sys/class/hwmon/hwmon0/in0_min_alarm:0
    /sys/class/hwmon/hwmon0/name:sfp_p10
    /sys/class/hwmon/hwmon0/power1_crit:708
    /sys/class/hwmon/hwmon0/power1_crit_alarm:0
    /sys/class/hwmon/hwmon0/power1_input:259
    /sys/class/hwmon/hwmon0/power1_label:TX_power
    /sys/class/hwmon/hwmon0/power1_lcrit:89
    /sys/class/hwmon/hwmon0/power1_lcrit_alarm:0
    /sys/class/hwmon/hwmon0/power1_max:501
    /sys/class/hwmon/hwmon0/power1_max_alarm:0
    /sys/class/hwmon/hwmon0/power1_min:126
    /sys/class/hwmon/hwmon0/power1_min_alarm:0
    /sys/class/hwmon/hwmon0/power2_crit:1259
    /sys/class/hwmon/hwmon0/power2_crit_alarm:0
    /sys/class/hwmon/hwmon0/power2_input:404
    /sys/class/hwmon/hwmon0/power2_label:RX_power
    /sys/class/hwmon/hwmon0/power2_lcrit:6
    /sys/class/hwmon/hwmon0/power2_lcrit_alarm:0
    /sys/class/hwmon/hwmon0/power2_max:794
    /sys/class/hwmon/hwmon0/power2_max_alarm:0
    /sys/class/hwmon/hwmon0/power2_min:10
    /sys/class/hwmon/hwmon0/power2_min_alarm:0
    /sys/class/hwmon/hwmon0/temp1_crit:100000
    /sys/class/hwmon/hwmon0/temp1_crit_alarm:0
    /sys/class/hwmon/hwmon0/temp1_input:22547
    /sys/class/hwmon/hwmon0/temp1_label:temperature
    /sys/class/hwmon/hwmon0/temp1_lcrit:-50000
    /sys/class/hwmon/hwmon0/temp1_lcrit_alarm:0
    /sys/class/hwmon/hwmon0/temp1_max:85000
    /sys/class/hwmon/hwmon0/temp1_max_alarm:0
    /sys/class/hwmon/hwmon0/temp1_min:-40000
    /sys/class/hwmon/hwmon0/temp1_min_alarm:0
    /sys/class/hwmon/hwmon0/uevent:OF_NAME=sfp-p10
    /sys/class/hwmon/hwmon0/uevent:OF_FULLNAME=/sfp-p10
    /sys/class/hwmon/hwmon0/uevent:OF_COMPATIBLE_0=sff,sfp
    /sys/class/hwmon/hwmon0/uevent:OF_COMPATIBLE_N=1
    
    Tested-by: Birger Koblitz <mail at birger-koblitz.de>
    Signed-off-by: Bjørn Mork <bjorn at mork.no>
    (cherry picked from commit 2a912fb63adc3fb3a1ee746589f6df4bb02e4296)
---
 target/linux/realtek/config-5.4 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/linux/realtek/config-5.4 b/target/linux/realtek/config-5.4
index 2fbd904376..ed8c602337 100644
--- a/target/linux/realtek/config-5.4
+++ b/target/linux/realtek/config-5.4
@@ -82,6 +82,7 @@ CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 # CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_HWMON=y
 CONFIG_HZ=250
 CONFIG_HZ_250=y
 CONFIG_HZ_PERIODIC=y



More information about the lede-commits mailing list