Skip to content

Commit 1d0a57a

Browse files
authored
[dell]: add psuutil support for s6000 (#1342)
also remove w83627dhg as it raises false alarm.
1 parent bdbf956 commit 1d0a57a

File tree

3 files changed

+75
-22
lines changed

3 files changed

+75
-22
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#
2+
# psuutil.py
3+
# Platform-specific PSU status interface for SONiC
4+
#
5+
6+
7+
import os.path
8+
9+
try:
10+
from sonic_psu.psu_base import PsuBase
11+
except ImportError as e:
12+
raise ImportError(str(e) + "- required module not found")
13+
14+
15+
class PsuUtil(PsuBase):
16+
"""Platform-specific PSUutil class"""
17+
18+
def __init__(self):
19+
PsuBase.__init__(self)
20+
21+
def get_cpld_register(self, reg_name):
22+
cpld_dir = "/sys/devices/platform/dell-s6000-cpld.0"
23+
retval = 'ERR'
24+
reg_file = cpld_dir +'/' + reg_name
25+
if (not os.path.isfile(reg_file)):
26+
return retval
27+
28+
try:
29+
with open(reg_file, 'r') as fd:
30+
retval = fd.read()
31+
except Exception as error:
32+
logging.error("Unable to open ", reg_file, "file !")
33+
34+
retval = retval.rstrip('\r\n')
35+
return retval
36+
37+
def get_num_psus(self):
38+
"""
39+
Retrieves the number of PSUs available on the device
40+
:return: An integer, the number of PSUs available on the device
41+
"""
42+
S6000_MAX_PSUS = 2
43+
return S6000_MAX_PSUS
44+
45+
def get_psu_status(self, index):
46+
"""
47+
Retrieves the oprational status of power supply unit (PSU) defined
48+
by index <index>
49+
:param index: An integer, index of the PSU of which to query status
50+
:return: Boolean, True if PSU is operating properly, False if PSU is\
51+
faulty
52+
"""
53+
status = 0
54+
psu_status = self.get_cpld_register('psu'+str(index - 1)+'_status')
55+
if (psu_status != 'ERR'):
56+
status = int(psu_status, 10)
57+
58+
presence = self.get_psu_presence(index)
59+
60+
return (status & presence)
61+
62+
def get_psu_presence(self, index):
63+
"""
64+
Retrieves the presence status of power supply unit (PSU) defined
65+
by index <index>
66+
:param index: An integer, index of the PSU of which to query status
67+
:return: Boolean, True if PSU is plugged, False if not
68+
"""
69+
status = 0
70+
psu_presence = self.get_cpld_register('psu'+str(index - 1)+'_prs')
71+
if (psu_presence != 'ERR'):
72+
status = int(psu_presence, 10)
73+
74+
return status

device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf

-21
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,6 @@ chip "max6620-i2c-*-2a"
2727
ignore fan3
2828
ignore fan4
2929

30-
chip "w83627dhg-*"
31-
label in0 "VCore 1"
32-
label in1 "VCore 2"
33-
set in0_min 0
34-
set in0_max 1.74
35-
set in1_min 0
36-
set in1_max 1.74
37-
ignore fan1
38-
ignore fan2
39-
ignore fan3
40-
ignore fan4
41-
ignore fan5
42-
ignore in4
43-
ignore in5
44-
ignore in6
45-
ignore temp1
46-
ignore temp2
47-
ignore temp3
48-
ignore cpu0_vid
49-
ignore intrusion0
50-
5130
chip "jc42-*"
5231
set temp1_max 50
5332
set temp1_crit 85

0 commit comments

Comments
 (0)