Skip to content

Commit f8d32aa

Browse files
roylee123lguohan
authored andcommitted
[platform]: As7712 32x add fancontrol (#1270)
* Update sonic-platform-modules-accton to lastest Signed-off-by: roylee123 <[email protected]> * [AS7712-32X] Add fancontrol. Signed-off-by: roylee123 <[email protected]> * [AS7712-32X] add psuutil.py and sensors.conf Signed-off-by: roylee123 <[email protected]> * Remove 1 reduntant line. Signed-off-by: roylee123 <[email protected]> * [AS7712-32X] Change fan driver to support fancontrol. Signed-off-by: roylee123 <[email protected]>
1 parent 41f14fc commit f8d32aa

File tree

5 files changed

+94
-3
lines changed

5 files changed

+94
-3
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
INTERVAL=10
2+
FCTEMPS=/sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/sys_temp
3+
FCFANS=/sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan1_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan2_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan3_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan4_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan5_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan6_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan11_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan12_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan13_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan14_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan15_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan16_input
4+
MINTEMP=/sys/bus/i2c/devices/2-0066/pwm1=135
5+
MAXTEMP=/sys/bus/i2c/devices/2-0066/pwm1=160
6+
MINSTART=/sys/bus/i2c/devices/2-0066/pwm1=100
7+
MINSTOP=/sys/bus/i2c/devices/2-0066/pwm1=32
8+
MINPWM=/sys/bus/i2c/devices/2-0066/pwm1=32
9+
MAXPWM=/sys/bus/i2c/devices/2-0066/pwm1=69
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env python
2+
3+
#############################################################################
4+
# Accton
5+
#
6+
# Module contains an implementation of SONiC PSU Base API and
7+
# provides the PSUs status which are available in the platform
8+
#
9+
#############################################################################
10+
11+
import os.path
12+
13+
try:
14+
from sonic_psu.psu_base import PsuBase
15+
except ImportError as e:
16+
raise ImportError (str(e) + "- required module not found")
17+
18+
class PsuUtil(PsuBase):
19+
"""Platform-specific PSUutil class"""
20+
21+
def __init__(self):
22+
PsuBase.__init__(self)
23+
24+
self.psu_path = "/sys/bus/i2c/devices/"
25+
self.psu_presence = "/psu_present"
26+
self.psu_oper_status = "/psu_power_good"
27+
self.psu_mapping = {
28+
1: "11-0053",
29+
2: "10-0050",
30+
}
31+
32+
def get_num_psus(self):
33+
return len(self.psu_mapping)
34+
35+
def get_psu_status(self, index):
36+
if index is None:
37+
return False
38+
39+
status = 0
40+
node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status
41+
try:
42+
with open(node, 'r') as power_status:
43+
status = int(power_status.read())
44+
except IOError:
45+
return False
46+
47+
return status == 1
48+
49+
def get_psu_presence(self, index):
50+
if index is None:
51+
return False
52+
53+
status = 0
54+
node = self.psu_path + self.psu_mapping[index] + self.psu_presence
55+
try:
56+
with open(node, 'r') as presence_status:
57+
status = int(presence_status.read())
58+
except IOError:
59+
return False
60+
61+
return status == 1
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# libsensors configuration file for AS7712-32X
2+
# ------------------------------------------------
3+
#
4+
5+
chip "ym2651-*"
6+
label power1 "PSU Output Power"
7+
label temp1 "Power Supply Temp"
8+
label fan1 "Fan Speed"
9+
10+
chip "as7712_32x_fan-*"
11+
label fan1 "Fan tray 1 front"
12+
label fan2 "Fan tray 2 front"
13+
label fan3 "Fan tray 3 front"
14+
label fan4 "Fan tray 4 front"
15+
label fan5 "Fan tray 5 front"
16+
label fan6 "Fan tray 6 front"
17+
label fan11 "Fan tray 1 rear"
18+
label fan12 "Fan tray 2 rear"
19+
label fan13 "Fan tray 3 rear"
20+
label fan14 "Fan tray 4 rear"
21+
label fan15 "Fan tray 5 rear"
22+
label fan16 "Fan tray 6 rear"

platform/broadcom/platform-modules-accton.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ SONIC_DPKG_DEBS += $(ACCTON_AS7712_32X_PLATFORM_MODULE)
1717
ACCTON_AS5712_54X_PLATFORM_MODULE = sonic-platform-accton-as5712-54x_$(ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION)_amd64.deb
1818
$(ACCTON_AS5712_54X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as5712_54x-r0
1919
$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS5712_54X_PLATFORM_MODULE)))
20-
SONIC_DPKG_DEBS += $(ACCTON_AS5712_54X_PLATFORM_MODULE)
2120

2221
ACCTON_AS7816_64X_PLATFORM_MODULE = sonic-platform-accton-as7816-64x_$(ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION)_amd64.deb
2322
$(ACCTON_AS7816_64X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7816_64x-r0
24-
2523
$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7816_64X_PLATFORM_MODULE)))
24+

0 commit comments

Comments
 (0)