[Edgecore][sonic-platform-modules-accton]Support kernel 6.1 and bookworm (#16982)
* [Edgecore][sonic-platform-modules-accton]Support kernel 6.1 and bookworm * Modify pddf drv code for i2c_remove_callback function fail
This commit is contained in:
parent
c436ce20be
commit
6ed491db74
@ -4,14 +4,13 @@ include $(PLATFORM_PATH)/sai.dep
|
||||
# TODO: re-enable once the following have been updated for bookworm:
|
||||
# * Nokia
|
||||
# * Dell
|
||||
# * Accton
|
||||
# * Juniper
|
||||
# * Ragile
|
||||
include $(PLATFORM_PATH)/platform-modules-s6000.dep
|
||||
#include $(PLATFORM_PATH)/platform-modules-dell.dep
|
||||
include $(PLATFORM_PATH)/platform-modules-arista.dep
|
||||
include $(PLATFORM_PATH)/platform-modules-ingrasys.dep
|
||||
#include $(PLATFORM_PATH)/platform-modules-accton.dep
|
||||
include $(PLATFORM_PATH)/platform-modules-accton.dep
|
||||
include $(PLATFORM_PATH)/platform-modules-alphanetworks.dep
|
||||
include $(PLATFORM_PATH)/platform-modules-inventec.dep
|
||||
include $(PLATFORM_PATH)/platform-modules-cel.dep
|
||||
|
@ -3,7 +3,6 @@ include $(PLATFORM_PATH)/sai.mk
|
||||
# TODO: re-enable once the following have been updated for bookworm:
|
||||
# * Nokia
|
||||
# * Dell
|
||||
# * Accton
|
||||
# * Juniper
|
||||
# * Ragile
|
||||
# * Ufispace
|
||||
@ -11,7 +10,7 @@ include $(PLATFORM_PATH)/sai.mk
|
||||
#include $(PLATFORM_PATH)/platform-modules-dell.mk
|
||||
include $(PLATFORM_PATH)/platform-modules-arista.mk
|
||||
#include $(PLATFORM_PATH)/platform-modules-ingrasys.mk
|
||||
#include $(PLATFORM_PATH)/platform-modules-accton.mk
|
||||
include $(PLATFORM_PATH)/platform-modules-accton.mk
|
||||
include $(PLATFORM_PATH)/platform-modules-alphanetworks.mk
|
||||
#include $(PLATFORM_PATH)/platform-modules-inventec.mk
|
||||
include $(PLATFORM_PATH)/platform-modules-cel.mk
|
||||
|
@ -769,7 +769,7 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int as4630_54pe_cpld_remove(struct i2c_client *client)
|
||||
static void as4630_54pe_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as4630_54pe_cpld_data *data = i2c_get_clientdata(client);
|
||||
const struct attribute_group *group = NULL;
|
||||
@ -794,7 +794,6 @@ static int as4630_54pe_cpld_remove(struct i2c_client *client)
|
||||
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int as4630_54pe_cpld_read_internal(struct i2c_client *client, u8 reg)
|
||||
|
@ -186,7 +186,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as4630_54pe_psu_remove(struct i2c_client *client)
|
||||
static void as4630_54pe_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as4630_54pe_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -194,7 +194,6 @@ static int as4630_54pe_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as4630_54pe_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -772,7 +772,7 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int as4630_54te_cpld_remove(struct i2c_client *client)
|
||||
static void as4630_54te_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as4630_54te_cpld_data *data = i2c_get_clientdata(client);
|
||||
const struct attribute_group *group = NULL;
|
||||
@ -797,7 +797,6 @@ static int as4630_54te_cpld_remove(struct i2c_client *client)
|
||||
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int as4630_54te_cpld_read_internal(struct i2c_client *client, u8 reg)
|
||||
|
@ -187,7 +187,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as4630_54te_psu_remove(struct i2c_client *client)
|
||||
static void as4630_54te_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as4630_54te_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -195,7 +195,6 @@ static int as4630_54te_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as4630_54te_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -225,14 +225,3 @@ class FanUtil(object):
|
||||
|
||||
return True
|
||||
|
||||
#def main():
|
||||
# fan = FanUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % fan.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % fan.get_size_path_map()
|
||||
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
|
||||
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
|
||||
# print fan.get_fan_to_device_path(x, y)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -109,13 +109,3 @@ class ThermalUtil(object):
|
||||
def get_thermal_2_val(self):
|
||||
return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX)
|
||||
|
||||
#def main():
|
||||
# thermal = ThermalUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
|
||||
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
|
||||
# print thermal.get_thermal_to_device_path(x)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -193,7 +193,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as5712_54x_psu_remove(struct i2c_client *client)
|
||||
static void as5712_54x_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as5712_54x_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -201,7 +201,6 @@ static int as5712_54x_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as5712_54x_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -498,7 +498,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as5712_54x_sfp_remove(struct i2c_client *client)
|
||||
static void as5712_54x_sfp_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as5712_54x_sfp_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -506,7 +506,6 @@ static int as5712_54x_sfp_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as5712_54x_sfp_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum port_numbers {
|
||||
|
@ -1277,7 +1277,7 @@ add_mux_failed:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int as5712_54x_cpld_mux_remove(struct i2c_client *client)
|
||||
static void as5712_54x_cpld_mux_remove(struct i2c_client *client)
|
||||
{
|
||||
struct i2c_mux_core *muxc = i2c_get_clientdata(client);
|
||||
struct as5712_54x_cpld_data *data = i2c_mux_priv(muxc);
|
||||
@ -1306,7 +1306,6 @@ static int as5712_54x_cpld_mux_remove(struct i2c_client *client)
|
||||
|
||||
i2c_mux_del_adapters(muxc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int as5712_54x_cpld_read_internal(struct i2c_client *client, u8 reg)
|
||||
|
@ -230,14 +230,3 @@ class FanUtil(object):
|
||||
|
||||
return True
|
||||
|
||||
#def main():
|
||||
# fan = FanUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % fan.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % fan.get_size_path_map()
|
||||
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
|
||||
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
|
||||
# print fan.get_fan_to_device_path(x, y)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -91,6 +91,8 @@ class ThermalUtil(object):
|
||||
|
||||
return int(content)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def get_num_thermals(self):
|
||||
return self.THERMAL_NUM_ON_MAIN_BROAD
|
||||
@ -112,14 +114,3 @@ class ThermalUtil(object):
|
||||
|
||||
def get_thermal_2_val(self):
|
||||
return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX)
|
||||
|
||||
#def main():
|
||||
# thermal = ThermalUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
|
||||
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
|
||||
# print thermal.get_thermal_to_device_path(x)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -447,7 +447,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as5812_54t_cpld_remove(struct i2c_client *client)
|
||||
static void as5812_54t_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as5812_54t_cpld_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -456,7 +456,6 @@ static int as5812_54t_cpld_remove(struct i2c_client *client)
|
||||
kfree(data);
|
||||
as5812_54t_cpld_remove_client(client);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int as5812_54t_cpld_read(unsigned short cpld_addr, u8 reg)
|
||||
|
@ -191,7 +191,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as5812_54t_psu_remove(struct i2c_client *client)
|
||||
static void as5812_54t_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as5812_54t_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -199,7 +199,6 @@ static int as5812_54t_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as5812_54t_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -230,14 +230,3 @@ class FanUtil(object):
|
||||
|
||||
return True
|
||||
|
||||
#def main():
|
||||
# fan = FanUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % fan.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % fan.get_size_path_map()
|
||||
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
|
||||
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
|
||||
# print fan.get_fan_to_device_path(x, y)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -91,6 +91,8 @@ class ThermalUtil(object):
|
||||
|
||||
return int(content)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def get_num_thermals(self):
|
||||
return self.THERMAL_NUM_ON_MAIN_BROAD
|
||||
@ -113,13 +115,3 @@ class ThermalUtil(object):
|
||||
def get_thermal_2_val(self):
|
||||
return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX)
|
||||
|
||||
#def main():
|
||||
# thermal = ThermalUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
|
||||
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
|
||||
# print thermal.get_thermal_to_device_path(x)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -193,7 +193,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as5812_54x_psu_remove(struct i2c_client *client)
|
||||
static void as5812_54x_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as5812_54x_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -201,7 +201,6 @@ static int as5812_54x_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as5812_54x_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -498,7 +498,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as5812_54x_sfp_remove(struct i2c_client *client)
|
||||
static void as5812_54x_sfp_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as5812_54x_sfp_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -506,7 +506,6 @@ static int as5812_54x_sfp_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as5812_54x_sfp_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum port_numbers {
|
||||
|
@ -267,7 +267,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int cpr_4011_4mxx_remove(struct i2c_client *client)
|
||||
static void cpr_4011_4mxx_remove(struct i2c_client *client)
|
||||
{
|
||||
struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -275,7 +275,6 @@ static int cpr_4011_4mxx_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id cpr_4011_4mxx_id[] = {
|
||||
|
@ -1277,7 +1277,7 @@ add_mux_failed:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int as5812_54x_cpld_mux_remove(struct i2c_client *client)
|
||||
static void as5812_54x_cpld_mux_remove(struct i2c_client *client)
|
||||
{
|
||||
struct i2c_mux_core *muxc = i2c_get_clientdata(client);
|
||||
struct as5812_54x_cpld_data *data = i2c_mux_priv(muxc);
|
||||
@ -1306,7 +1306,6 @@ static int as5812_54x_cpld_mux_remove(struct i2c_client *client)
|
||||
|
||||
i2c_mux_del_adapters(muxc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int as5812_54x_cpld_read_internal(struct i2c_client *client, u8 reg)
|
||||
|
@ -466,7 +466,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int ym2651y_remove(struct i2c_client *client)
|
||||
static void ym2651y_remove(struct i2c_client *client)
|
||||
{
|
||||
struct ym2651y_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -474,7 +474,6 @@ static int ym2651y_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &ym2651y_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id ym2651y_id[] = {
|
||||
|
@ -174,14 +174,11 @@ class FanUtil(object):
|
||||
def get_fan_fault(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP)
|
||||
|
||||
#def get_fan_speed(self, fan_num):
|
||||
# return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP)
|
||||
|
||||
def get_fan_dir(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
|
||||
|
||||
def get_fan_duty_cycle(self):
|
||||
#duty_path = self.FAN_DUTY_PATH
|
||||
|
||||
try:
|
||||
val_file = open(self.FAN_DUTY_PATH)
|
||||
except IOError as e:
|
||||
@ -203,9 +200,6 @@ class FanUtil(object):
|
||||
fan_file.close()
|
||||
return True
|
||||
|
||||
#def get_fanr_fault(self, fan_num):
|
||||
# return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP)
|
||||
|
||||
def get_fanr_speed(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP)
|
||||
|
||||
@ -218,20 +212,6 @@ class FanUtil(object):
|
||||
logging.debug('GET. FAN fault. fan_num, %d', fan_num)
|
||||
return False
|
||||
|
||||
#if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0:
|
||||
# logging.debug('GET. FANR fault. fan_num, %d', fan_num)
|
||||
# return False
|
||||
|
||||
return True
|
||||
|
||||
#def main():
|
||||
# fan = FanUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % fan.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % fan.get_size_path_map()
|
||||
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
|
||||
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
|
||||
# print fan.get_fan_to_device_path(x, y)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -80,6 +80,7 @@ class ThermalUtil(object):
|
||||
except:
|
||||
logging.debug('GET. unable to close file. device_path:%s', device_path)
|
||||
return None
|
||||
|
||||
return int(content)
|
||||
|
||||
else:
|
||||
@ -113,17 +114,3 @@ class ThermalUtil(object):
|
||||
def get_thermal_temp(self):
|
||||
return (self._get_thermal_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_val(self.THERMAL_NUM_3_IDX))
|
||||
|
||||
def main():
|
||||
thermal = ThermalUtil()
|
||||
print("termal1=%d" %thermal._get_thermal_val(1))
|
||||
print("termal2=%d" %thermal._get_thermal_val(2))
|
||||
print("termal3=%d" %thermal._get_thermal_val(3))
|
||||
print("termal4=%d" %thermal._get_thermal_val(4))
|
||||
#
|
||||
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
|
||||
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
|
||||
# print thermal.get_thermal_to_device_path(x)
|
||||
#
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -462,7 +462,7 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int as5835_54t_cpld_remove(struct i2c_client *client)
|
||||
static void as5835_54t_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as5835_54t_cpld_data *data = i2c_get_clientdata(client);
|
||||
const struct attribute_group *group = NULL;
|
||||
@ -490,7 +490,6 @@ static int as5835_54t_cpld_remove(struct i2c_client *client)
|
||||
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int as5835_54t_cpld_read_internal(struct i2c_client *client, u8 reg)
|
||||
|
@ -447,13 +447,12 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as5835_54t_fan_remove(struct i2c_client *client)
|
||||
static void as5835_54t_fan_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as5835_54t_fan_data *data = i2c_get_clientdata(client);
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&client->dev.kobj, &as5835_54t_fan_group);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Addresses to scan */
|
||||
|
@ -189,7 +189,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as5835_54t_psu_remove(struct i2c_client *client)
|
||||
static void as5835_54t_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as5835_54t_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -197,7 +197,6 @@ static int as5835_54t_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as5835_54t_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -174,14 +174,10 @@ class FanUtil(object):
|
||||
def get_fan_fault(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP)
|
||||
|
||||
#def get_fan_speed(self, fan_num):
|
||||
# return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP)
|
||||
|
||||
def get_fan_dir(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
|
||||
|
||||
def get_fan_duty_cycle(self):
|
||||
#duty_path = self.FAN_DUTY_PATH
|
||||
try:
|
||||
val_file = open(self.FAN_DUTY_PATH)
|
||||
except IOError as e:
|
||||
@ -203,8 +199,6 @@ class FanUtil(object):
|
||||
fan_file.close()
|
||||
return True
|
||||
|
||||
#def get_fanr_fault(self, fan_num):
|
||||
# return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP)
|
||||
|
||||
def get_fanr_speed(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP)
|
||||
@ -218,9 +212,5 @@ class FanUtil(object):
|
||||
logging.debug('GET. FAN fault. fan_num, %d', fan_num)
|
||||
return False
|
||||
|
||||
#if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0:
|
||||
# logging.debug('GET. FANR fault. fan_num, %d', fan_num)
|
||||
# return False
|
||||
|
||||
return True
|
||||
|
||||
|
@ -1055,7 +1055,7 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int as5835_54x_cpld_remove(struct i2c_client *client)
|
||||
static void as5835_54x_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as5835_54x_cpld_data *data = i2c_get_clientdata(client);
|
||||
const struct attribute_group *group = NULL;
|
||||
@ -1083,7 +1083,6 @@ static int as5835_54x_cpld_remove(struct i2c_client *client)
|
||||
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int as5835_54x_cpld_read_internal(struct i2c_client *client, u8 reg)
|
||||
|
@ -447,13 +447,12 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as5835_54x_fan_remove(struct i2c_client *client)
|
||||
static void as5835_54x_fan_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as5835_54x_fan_data *data = i2c_get_clientdata(client);
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&client->dev.kobj, &as5835_54x_fan_group);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Addresses to scan */
|
||||
|
@ -189,7 +189,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as5835_54x_psu_remove(struct i2c_client *client)
|
||||
static void as5835_54x_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as5835_54x_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -197,7 +197,6 @@ static int as5835_54x_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as5835_54x_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -43,13 +43,8 @@ class FanUtil(object):
|
||||
|
||||
FAN_NODE_NUM_OF_MAP = 2
|
||||
FAN_NODE_FAULT_IDX_OF_MAP = 1
|
||||
#FAN_NODE_SPEED_IDX_OF_MAP = 2
|
||||
FAN_NODE_DIR_IDX_OF_MAP = 2
|
||||
#FAN_NODE_DUTY_IDX_OF_MAP = 4
|
||||
#FANR_NODE_FAULT_IDX_OF_MAP = 5
|
||||
|
||||
#BASE_VAL_PATH = '/sys/bus/i2c/devices/11-0066/{0}'
|
||||
#FAN_DUTY_PATH = '/sys/bus/i2c/devices/11-0066/fan_duty_cycle_percentage'
|
||||
BASE_VAL_PATH = '/sys/devices/platform/as6712_32x_fan/{0}'
|
||||
FAN_DUTY_PATH = '/sys/devices/platform/as6712_32x_fan/fan1_duty_cycle_percentage'
|
||||
|
||||
@ -66,7 +61,7 @@ class FanUtil(object):
|
||||
#fan1_fault
|
||||
#fan1_present
|
||||
|
||||
#(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage',
|
||||
|
||||
_fan_to_device_node_mapping = {
|
||||
(FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault',
|
||||
(FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction',
|
||||
@ -182,14 +177,11 @@ class FanUtil(object):
|
||||
def get_fan_fault(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP)
|
||||
|
||||
#def get_fan_speed(self, fan_num):
|
||||
# return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP)
|
||||
|
||||
def get_fan_dir(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
|
||||
|
||||
def get_fan_duty_cycle(self):
|
||||
#duty_path = self.FAN_DUTY_PATH
|
||||
|
||||
try:
|
||||
val_file = open(self.FAN_DUTY_PATH)
|
||||
except IOError as e:
|
||||
@ -200,13 +192,7 @@ class FanUtil(object):
|
||||
val_file.close()
|
||||
|
||||
return int(content)
|
||||
#self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP)
|
||||
#static u32 reg_val_to_duty_cycle(u8 reg_val)
|
||||
#{
|
||||
# reg_val &= FAN_DUTY_CYCLE_REG_MASK;
|
||||
# return ((u32)(reg_val+1) * 625 + 75)/ 100;
|
||||
#}
|
||||
#
|
||||
|
||||
def set_fan_duty_cycle(self, val):
|
||||
|
||||
try:
|
||||
@ -214,13 +200,11 @@ class FanUtil(object):
|
||||
except IOError as e:
|
||||
print("Error: unable to open file: %s" % str(e))
|
||||
return False
|
||||
#val = ((val + 1 ) * 625 +75 ) / 100
|
||||
|
||||
fan_file.write(str(val))
|
||||
fan_file.close()
|
||||
return True
|
||||
|
||||
#def get_fanr_fault(self, fan_num):
|
||||
# return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP)
|
||||
|
||||
def get_fanr_speed(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP)
|
||||
@ -234,20 +218,5 @@ class FanUtil(object):
|
||||
logging.debug('GET. FAN fault. fan_num, %d', fan_num)
|
||||
return False
|
||||
|
||||
#if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0:
|
||||
# logging.debug('GET. FANR fault. fan_num, %d', fan_num)
|
||||
# return False
|
||||
|
||||
return True
|
||||
|
||||
#def main():
|
||||
# fan = FanUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % fan.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % fan.get_size_path_map()
|
||||
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
|
||||
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
|
||||
# print fan.get_fan_to_device_path(x, y)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -88,6 +88,8 @@ class ThermalUtil(object):
|
||||
|
||||
return int(content)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def get_num_thermals(self):
|
||||
return self.THERMAL_NUM_ON_MAIN_BROAD
|
||||
@ -112,13 +114,3 @@ class ThermalUtil(object):
|
||||
def get_thermal_temp(self):
|
||||
return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX))
|
||||
|
||||
#def main():
|
||||
# thermal = ThermalUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
|
||||
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
|
||||
# print thermal.get_thermal_to_device_path(x)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -721,7 +721,7 @@ exit_mux_register:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int as6712_32x_cpld_mux_remove(struct i2c_client *client)
|
||||
static void as6712_32x_cpld_mux_remove(struct i2c_client *client)
|
||||
{
|
||||
struct i2c_mux_core *muxc = i2c_get_clientdata(client);
|
||||
struct as6712_32x_cpld_data *data = i2c_mux_priv(muxc);
|
||||
@ -750,7 +750,6 @@ static int as6712_32x_cpld_mux_remove(struct i2c_client *client)
|
||||
|
||||
i2c_mux_del_adapters(muxc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int as6712_32x_cpld_read_internal(struct i2c_client *client, u8 reg)
|
||||
|
@ -188,7 +188,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as6712_32x_psu_remove(struct i2c_client *client)
|
||||
static void as6712_32x_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as6712_32x_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -196,7 +196,6 @@ static int as6712_32x_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as6712_32x_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -300,7 +300,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int cpr_4011_4mxx_remove(struct i2c_client *client)
|
||||
static void cpr_4011_4mxx_remove(struct i2c_client *client)
|
||||
{
|
||||
struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -308,7 +308,6 @@ static int cpr_4011_4mxx_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id cpr_4011_4mxx_id[] = {
|
||||
|
@ -498,13 +498,12 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7312_54x_fan_remove(struct i2c_client *client)
|
||||
static void as7312_54x_fan_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7312_54x_fan_data *data = i2c_get_clientdata(client);
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&client->dev.kobj, &as7312_54x_fan_group);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Addresses to scan */
|
||||
|
@ -155,7 +155,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7312_54x_psu_remove(struct i2c_client *client)
|
||||
static void as7312_54x_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7312_54x_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -163,7 +163,6 @@ static int as7312_54x_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7312_54x_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -1919,7 +1919,7 @@ static int qfp_remove(struct i2c_client *client, struct qsfp_data *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sfp_device_remove(struct i2c_client *client)
|
||||
static void sfp_device_remove(struct i2c_client *client)
|
||||
{
|
||||
int ret = 0;
|
||||
struct sfp_port_data *data = i2c_get_clientdata(client);
|
||||
@ -1936,7 +1936,6 @@ static int sfp_device_remove(struct i2c_client *client)
|
||||
kfree(data->writebuf);
|
||||
#endif
|
||||
kfree(data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Addresses scanned
|
||||
|
@ -1074,7 +1074,7 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int as7312_54x_cpld_remove(struct i2c_client *client)
|
||||
static void as7312_54x_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7312_54x_cpld_data *data = i2c_get_clientdata(client);
|
||||
const struct attribute_group *group = NULL;
|
||||
@ -1102,7 +1102,6 @@ static int as7312_54x_cpld_remove(struct i2c_client *client)
|
||||
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int as7312_54x_cpld_read_internal(struct i2c_client *client, u8 reg)
|
||||
|
@ -44,12 +44,8 @@ class FanUtil(object):
|
||||
|
||||
FAN_NODE_NUM_OF_MAP = 2
|
||||
FAN_NODE_FAULT_IDX_OF_MAP = 1
|
||||
#FAN_NODE_SPEED_IDX_OF_MAP = 2
|
||||
FAN_NODE_DIR_IDX_OF_MAP = 2
|
||||
#FAN_NODE_DUTY_IDX_OF_MAP = 4
|
||||
#FANR_NODE_FAULT_IDX_OF_MAP = 5
|
||||
|
||||
#BASE_VAL_PATH = '/sys/devices/platform/as5712_54x_fan/{0}'
|
||||
BASE_VAL_PATH = '/sys/bus/i2c/devices/2-0066/{0}'
|
||||
FAN_DUTY_PATH = '/sys/bus/i2c/devices/2-0066/fan_duty_cycle_percentage'
|
||||
|
||||
@ -68,7 +64,7 @@ class FanUtil(object):
|
||||
#fan1_fault
|
||||
#fan1_present
|
||||
|
||||
#(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage',
|
||||
|
||||
_fan_to_device_node_mapping = {
|
||||
(FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault',
|
||||
(FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction',
|
||||
@ -189,14 +185,10 @@ class FanUtil(object):
|
||||
def get_fan_fault(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP)
|
||||
|
||||
#def get_fan_speed(self, fan_num):
|
||||
# return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP)
|
||||
|
||||
def get_fan_dir(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
|
||||
|
||||
def get_fan_duty_cycle(self):
|
||||
#duty_path = self.FAN_DUTY_PATH
|
||||
try:
|
||||
val_file = open(self.FAN_DUTY_PATH)
|
||||
except IOError as e:
|
||||
@ -207,13 +199,7 @@ class FanUtil(object):
|
||||
val_file.close()
|
||||
|
||||
return int(content)
|
||||
#self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP)
|
||||
#static u32 reg_val_to_duty_cycle(u8 reg_val)
|
||||
#{
|
||||
# reg_val &= FAN_DUTY_CYCLE_REG_MASK;
|
||||
# return ((u32)(reg_val+1) * 625 + 75)/ 100;
|
||||
#}
|
||||
#
|
||||
|
||||
def set_fan_duty_cycle(self, val):
|
||||
|
||||
try:
|
||||
@ -221,13 +207,11 @@ class FanUtil(object):
|
||||
except IOError as e:
|
||||
print("Error: unable to open file: %s" % str(e))
|
||||
return False
|
||||
#val = ((val + 1 ) * 625 +75 ) / 100
|
||||
|
||||
fan_file.write(str(val))
|
||||
fan_file.close()
|
||||
return True
|
||||
|
||||
#def get_fanr_fault(self, fan_num):
|
||||
# return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP)
|
||||
|
||||
def get_fanr_speed(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP)
|
||||
@ -243,14 +227,3 @@ class FanUtil(object):
|
||||
|
||||
return True
|
||||
|
||||
#def main():
|
||||
# fan = FanUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % fan.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % fan.get_size_path_map()
|
||||
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
|
||||
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
|
||||
# print fan.get_fan_to_device_path(x, y)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -92,6 +92,7 @@ class ThermalUtil(object):
|
||||
|
||||
return int(content)
|
||||
|
||||
return 0
|
||||
|
||||
def get_num_thermals(self):
|
||||
return self.THERMAL_NUM_ON_MAIN_BROAD
|
||||
@ -116,13 +117,3 @@ class ThermalUtil(object):
|
||||
def get_thermal_temp(self):
|
||||
return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX))
|
||||
|
||||
#def main():
|
||||
# thermal = ThermalUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
|
||||
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
|
||||
# print thermal.get_thermal_to_device_path(x)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -496,13 +496,12 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7312_54x_fan_remove(struct i2c_client *client)
|
||||
static void as7312_54x_fan_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7312_54x_fan_data *data = i2c_get_clientdata(client);
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&client->dev.kobj, &as7312_54x_fan_group);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Addresses to scan */
|
||||
|
@ -155,7 +155,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7312_54x_psu_remove(struct i2c_client *client)
|
||||
static void as7312_54x_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7312_54x_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -163,7 +163,6 @@ static int as7312_54x_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7312_54x_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -1919,7 +1919,7 @@ static int qfp_remove(struct i2c_client *client, struct qsfp_data *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sfp_device_remove(struct i2c_client *client)
|
||||
static void sfp_device_remove(struct i2c_client *client)
|
||||
{
|
||||
int ret = 0;
|
||||
struct sfp_port_data *data = i2c_get_clientdata(client);
|
||||
@ -1936,7 +1936,6 @@ static int sfp_device_remove(struct i2c_client *client)
|
||||
kfree(data->writebuf);
|
||||
#endif
|
||||
kfree(data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Addresses scanned
|
||||
|
@ -1074,7 +1074,7 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int as7312_54x_cpld_remove(struct i2c_client *client)
|
||||
static void as7312_54x_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7312_54x_cpld_data *data = i2c_get_clientdata(client);
|
||||
const struct attribute_group *group = NULL;
|
||||
@ -1102,7 +1102,6 @@ static int as7312_54x_cpld_remove(struct i2c_client *client)
|
||||
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int as7312_54x_cpld_read_internal(struct i2c_client *client, u8 reg)
|
||||
|
@ -630,14 +630,13 @@ out_kfree:
|
||||
}
|
||||
|
||||
|
||||
static int fan_remove(struct i2c_client *client)
|
||||
static void fan_remove(struct i2c_client *client)
|
||||
{
|
||||
struct fan_data_t *data = i2c_get_clientdata(client);
|
||||
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&client->dev.kobj, &data->group);
|
||||
kfree(data->group.attrs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -914,7 +914,7 @@ out_kfree:
|
||||
}
|
||||
|
||||
|
||||
static int as7315_i2c_cpld_remove(struct i2c_client *client)
|
||||
static void as7315_i2c_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct cpld_data *data = i2c_get_clientdata(client);
|
||||
struct i2c_mux_core *muxc = data->muxc;
|
||||
@ -925,7 +925,6 @@ static int as7315_i2c_cpld_remove(struct i2c_client *client)
|
||||
i2c_mux_del_adapters(muxc);
|
||||
}
|
||||
accton_i2c_cpld_remove_client(client);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int accton_i2c_cpld_read(u8 cpld_addr, u8 reg)
|
||||
|
@ -263,7 +263,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7315_27xb_psu_remove(struct i2c_client *client)
|
||||
static void as7315_27xb_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7315_27xb_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -271,7 +271,6 @@ static int as7315_27xb_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7315_27xb_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -497,13 +497,12 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7326_56x_fan_remove(struct i2c_client *client)
|
||||
static void as7326_56x_fan_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7326_56x_fan_data *data = i2c_get_clientdata(client);
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&client->dev.kobj, &as7326_56x_fan_group);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Addresses to scan */
|
||||
|
@ -155,7 +155,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7326_56x_psu_remove(struct i2c_client *client)
|
||||
static void as7326_56x_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7326_56x_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -163,7 +163,6 @@ static int as7326_56x_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7326_56x_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -1031,7 +1031,7 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int as7326_56x_cpld_remove(struct i2c_client *client)
|
||||
static void as7326_56x_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7326_56x_cpld_data *data = i2c_get_clientdata(client);
|
||||
const struct attribute_group *group = NULL;
|
||||
@ -1059,7 +1059,6 @@ static int as7326_56x_cpld_remove(struct i2c_client *client)
|
||||
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int as7326_56x_cpld_read_internal(struct i2c_client *client, u8 reg)
|
||||
|
@ -586,13 +586,12 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7712_32x_fan_remove(struct i2c_client *client)
|
||||
static void as7712_32x_fan_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7712_32x_fan_data *data = i2c_get_clientdata(client);
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&client->dev.kobj, &as7712_32x_fan_group);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Addresses to scan */
|
||||
|
@ -155,7 +155,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7712_32x_psu_remove(struct i2c_client *client)
|
||||
static void as7712_32x_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7712_32x_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -163,7 +163,6 @@ static int as7712_32x_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7712_32x_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -1126,20 +1126,19 @@ static int qfp_remove(struct i2c_client *client, struct qsfp_data *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sfp_device_remove(struct i2c_client *client)
|
||||
static void sfp_device_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sfp_port_data *data = i2c_get_clientdata(client);
|
||||
|
||||
switch (data->driver_type) {
|
||||
case DRIVER_TYPE_SFP_MSA:
|
||||
return sfp_msa_remove(client, data->msa);
|
||||
sfp_msa_remove(client, data->msa);
|
||||
case DRIVER_TYPE_SFP_DDM:
|
||||
return sfp_ddm_remove(client, data->ddm);
|
||||
sfp_ddm_remove(client, data->ddm);
|
||||
case DRIVER_TYPE_QSFP:
|
||||
return qfp_remove(client, data->qsfp);
|
||||
qfp_remove(client, data->qsfp);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct i2c_driver sfp_driver = {
|
||||
|
@ -43,12 +43,8 @@ class FanUtil(object):
|
||||
|
||||
FAN_NODE_NUM_OF_MAP = 2
|
||||
FAN_NODE_FAULT_IDX_OF_MAP = 1
|
||||
#FAN_NODE_SPEED_IDX_OF_MAP = 2
|
||||
FAN_NODE_DIR_IDX_OF_MAP = 2
|
||||
#FAN_NODE_DUTY_IDX_OF_MAP = 4
|
||||
#FANR_NODE_FAULT_IDX_OF_MAP = 5
|
||||
|
||||
#BASE_VAL_PATH = '/sys/devices/platform/as5712_54x_fan/{0}'
|
||||
BASE_VAL_PATH = '/sys/bus/i2c/devices/9-0066/{0}'
|
||||
FAN_DUTY_PATH = '/sys/bus/i2c/devices/9-0066/fan_duty_cycle_percentage'
|
||||
|
||||
@ -65,7 +61,7 @@ class FanUtil(object):
|
||||
#fan1_fault
|
||||
#fan1_present
|
||||
|
||||
#(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage',
|
||||
|
||||
_fan_to_device_node_mapping = {
|
||||
(FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault',
|
||||
(FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction',
|
||||
@ -183,14 +179,11 @@ class FanUtil(object):
|
||||
def get_fan_fault(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP)
|
||||
|
||||
#def get_fan_speed(self, fan_num):
|
||||
# return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP)
|
||||
|
||||
def get_fan_dir(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
|
||||
|
||||
def get_fan_duty_cycle(self):
|
||||
#duty_path = self.FAN_DUTY_PATH
|
||||
try:
|
||||
val_file = open(self.FAN_DUTY_PATH)
|
||||
except IOError as e:
|
||||
@ -201,13 +194,7 @@ class FanUtil(object):
|
||||
val_file.close()
|
||||
|
||||
return int(content)
|
||||
#self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP)
|
||||
#static u32 reg_val_to_duty_cycle(u8 reg_val)
|
||||
#{
|
||||
# reg_val &= FAN_DUTY_CYCLE_REG_MASK;
|
||||
# return ((u32)(reg_val+1) * 625 + 75)/ 100;
|
||||
#}
|
||||
#
|
||||
|
||||
def set_fan_duty_cycle(self, val):
|
||||
|
||||
try:
|
||||
@ -215,14 +202,11 @@ class FanUtil(object):
|
||||
except IOError as e:
|
||||
print("Error: unable to open file: %s" % str(e))
|
||||
return False
|
||||
#val = ((val + 1 ) * 625 +75 ) / 100
|
||||
|
||||
fan_file.write(str(val))
|
||||
fan_file.close()
|
||||
return True
|
||||
|
||||
#def get_fanr_fault(self, fan_num):
|
||||
# return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP)
|
||||
|
||||
def get_fanr_speed(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP)
|
||||
|
||||
@ -235,20 +219,6 @@ class FanUtil(object):
|
||||
logging.debug('GET. FAN fault. fan_num, %d', fan_num)
|
||||
return False
|
||||
|
||||
#if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0:
|
||||
# logging.debug('GET. FANR fault. fan_num, %d', fan_num)
|
||||
# return False
|
||||
|
||||
return True
|
||||
|
||||
#def main():
|
||||
# fan = FanUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % fan.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % fan.get_size_path_map()
|
||||
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
|
||||
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
|
||||
# print fan.get_fan_to_device_path(x, y)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -87,6 +87,7 @@ class ThermalUtil(object):
|
||||
|
||||
return int(content)
|
||||
|
||||
return 0
|
||||
|
||||
def get_num_thermals(self):
|
||||
return self.THERMAL_NUM_ON_MAIN_BROAD
|
||||
@ -110,14 +111,3 @@ class ThermalUtil(object):
|
||||
return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX)
|
||||
def get_thermal_temp(self):
|
||||
return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX))
|
||||
|
||||
#def main():
|
||||
# thermal = ThermalUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
|
||||
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
|
||||
# print thermal.get_thermal_to_device_path(x)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -571,7 +571,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7716_32x_cpld_remove(struct i2c_client *client)
|
||||
static void as7716_32x_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7716_32x_cpld_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -580,7 +580,6 @@ static int as7716_32x_cpld_remove(struct i2c_client *client)
|
||||
kfree(data);
|
||||
as7716_32x_cpld_remove_client(client);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int as7716_32x_cpld_read(unsigned short cpld_addr, u8 reg)
|
||||
|
@ -487,13 +487,12 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7716_32x_fan_remove(struct i2c_client *client)
|
||||
static void as7716_32x_fan_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7716_32x_fan_data *data = i2c_get_clientdata(client);
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&client->dev.kobj, &as7716_32x_fan_group);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Addresses to scan */
|
||||
|
@ -181,7 +181,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7716_32x_psu_remove(struct i2c_client *client)
|
||||
static void as7716_32x_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7716_32x_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -189,7 +189,6 @@ static int as7716_32x_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7716_32x_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -216,7 +216,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7716_32x_sfp_remove(struct i2c_client *client)
|
||||
static void as7716_32x_sfp_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7716_32x_sfp_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -224,7 +224,6 @@ static int as7716_32x_sfp_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7716_32x_sfp_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum port_numbers {
|
||||
|
@ -151,12 +151,11 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int accton_i2c_cpld_remove(struct i2c_client *client)
|
||||
static void accton_i2c_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
sysfs_remove_group(&client->dev.kobj, &as5712_54x_cpld_group);
|
||||
|
||||
accton_i2c_cpld_remove_client(client);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id accton_i2c_cpld_id[] = {
|
||||
|
@ -267,7 +267,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int cpr_4011_4mxx_remove(struct i2c_client *client)
|
||||
static void cpr_4011_4mxx_remove(struct i2c_client *client)
|
||||
{
|
||||
struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -275,7 +275,6 @@ static int cpr_4011_4mxx_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id cpr_4011_4mxx_id[] = {
|
||||
|
@ -413,7 +413,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int ym2651y_remove(struct i2c_client *client)
|
||||
static void ym2651y_remove(struct i2c_client *client)
|
||||
{
|
||||
struct ym2651y_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -421,7 +421,6 @@ static int ym2651y_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &ym2651y_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id ym2651y_id[] = {
|
||||
|
@ -43,12 +43,8 @@ class FanUtil(object):
|
||||
|
||||
FAN_NODE_NUM_OF_MAP = 2
|
||||
FAN_NODE_FAULT_IDX_OF_MAP = 1
|
||||
#FAN_NODE_SPEED_IDX_OF_MAP = 2
|
||||
FAN_NODE_DIR_IDX_OF_MAP = 2
|
||||
#FAN_NODE_DUTY_IDX_OF_MAP = 4
|
||||
#FANR_NODE_FAULT_IDX_OF_MAP = 5
|
||||
|
||||
#BASE_VAL_PATH = '/sys/devices/platform/as5712_54x_fan/{0}'
|
||||
BASE_VAL_PATH = '/sys/bus/i2c/devices/9-0066/{0}'
|
||||
FAN_DUTY_PATH = '/sys/bus/i2c/devices/9-0066/fan_duty_cycle_percentage'
|
||||
|
||||
@ -65,7 +61,7 @@ class FanUtil(object):
|
||||
#fan1_fault
|
||||
#fan1_present
|
||||
|
||||
#(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage',
|
||||
|
||||
_fan_to_device_node_mapping = {
|
||||
(FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault',
|
||||
(FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction',
|
||||
@ -107,10 +103,6 @@ class FanUtil(object):
|
||||
return None
|
||||
|
||||
content = val_file.readline().rstrip()
|
||||
#print "fan_num=%d" %fan_num
|
||||
#print "node_num=%d" %node_num
|
||||
#print "device_path=%s" %device_path
|
||||
#print "content=%s" %content
|
||||
|
||||
if content == '':
|
||||
logging.debug('GET. content is NULL. device_path:%s', device_path)
|
||||
@ -162,10 +154,6 @@ class FanUtil(object):
|
||||
for node_num in range(self.FAN_NODE_FAULT_IDX_OF_MAP, self.FAN_NODE_NUM_OF_MAP+1):
|
||||
self._fan_to_device_path_mapping[(fan_num, node_num)] = fan_path.format(
|
||||
self._fan_to_device_node_mapping[(fan_num, node_num)])
|
||||
#self._fan_to_device_path_mapping[(fan_num, node_num)] = fan_path + self._fan_to_device_node_mapping[(fan_num, node_num)])
|
||||
#print "fan_num=%d" %fan_num
|
||||
#print "node_num=%d" %node_num
|
||||
#print "self._fan_to_device_path_mapping[(fan_num, node_num)]=%s" %self._fan_to_device_path_mapping[(fan_num, node_num)]
|
||||
|
||||
def get_num_fans(self):
|
||||
return self.FAN_NUM_ON_MAIN_BROAD
|
||||
@ -191,14 +179,11 @@ class FanUtil(object):
|
||||
def get_fan_fault(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP)
|
||||
|
||||
#def get_fan_speed(self, fan_num):
|
||||
# return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP)
|
||||
|
||||
def get_fan_dir(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
|
||||
|
||||
def get_fan_duty_cycle(self):
|
||||
#duty_path = self.FAN_DUTY_PATH
|
||||
|
||||
try:
|
||||
val_file = open(self.FAN_DUTY_PATH)
|
||||
except IOError as e:
|
||||
@ -209,13 +194,7 @@ class FanUtil(object):
|
||||
val_file.close()
|
||||
|
||||
return int(content)
|
||||
#self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP)
|
||||
#static u32 reg_val_to_duty_cycle(u8 reg_val)
|
||||
#{
|
||||
# reg_val &= FAN_DUTY_CYCLE_REG_MASK;
|
||||
# return ((u32)(reg_val+1) * 625 + 75)/ 100;
|
||||
#}
|
||||
#
|
||||
|
||||
def set_fan_duty_cycle(self, val):
|
||||
|
||||
try:
|
||||
@ -223,13 +202,11 @@ class FanUtil(object):
|
||||
except IOError as e:
|
||||
print("Error: unable to open file: %s" % str(e))
|
||||
return False
|
||||
#val = ((val + 1 ) * 625 +75 ) / 100
|
||||
|
||||
fan_file.write(str(val))
|
||||
fan_file.close()
|
||||
return True
|
||||
|
||||
#def get_fanr_fault(self, fan_num):
|
||||
# return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP)
|
||||
|
||||
def get_fanr_speed(self, fan_num):
|
||||
return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP)
|
||||
@ -237,27 +214,12 @@ class FanUtil(object):
|
||||
def get_fan_status(self, fan_num):
|
||||
if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD:
|
||||
logging.debug('GET. Parameter error. fan_num, %d', fan_num)
|
||||
print("fan %d return none" %fan_num)
|
||||
|
||||
return None
|
||||
|
||||
if self.get_fan_fault(fan_num) is not None and self.get_fan_fault(fan_num) > 0:
|
||||
logging.debug('GET. FAN fault. fan_num, %d', fan_num)
|
||||
return False
|
||||
|
||||
#if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0:
|
||||
# logging.debug('GET. FANR fault. fan_num, %d', fan_num)
|
||||
# return False
|
||||
|
||||
return True
|
||||
|
||||
#def main():
|
||||
# fan = FanUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % fan.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % fan.get_size_path_map()
|
||||
# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1):
|
||||
# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1):
|
||||
# print fan.get_fan_to_device_path(x, y)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -59,7 +59,6 @@ class ThermalUtil(object):
|
||||
self._thermal_to_device_path_mapping[x] = thermal_path.format(
|
||||
self._thermal_to_device_node_mapping[x][0],
|
||||
self._thermal_to_device_node_mapping[x][1])
|
||||
#print "self._thermal_to_device_path_mapping[x]=%s" %self._thermal_to_device_path_mapping[x]
|
||||
|
||||
def _get_thermal_node_val(self, thermal_num):
|
||||
if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_ON_MAIN_BROAD:
|
||||
@ -88,6 +87,7 @@ class ThermalUtil(object):
|
||||
|
||||
return int(content)
|
||||
|
||||
return 0
|
||||
|
||||
def get_num_thermals(self):
|
||||
return self.THERMAL_NUM_ON_MAIN_BROAD
|
||||
@ -112,13 +112,3 @@ class ThermalUtil(object):
|
||||
def get_thermal_temp(self):
|
||||
return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX))
|
||||
|
||||
#def main():
|
||||
# thermal = ThermalUtil()
|
||||
#
|
||||
# print 'get_size_node_map : %d' % thermal.get_size_node_map()
|
||||
# print 'get_size_path_map : %d' % thermal.get_size_path_map()
|
||||
# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1):
|
||||
# print thermal.get_thermal_to_device_path(x)
|
||||
#
|
||||
#if __name__ == '__main__':
|
||||
# main()
|
||||
|
@ -505,8 +505,6 @@ static ssize_t sfp_value_store(struct device *dev, struct device_attribute *da,
|
||||
int index;
|
||||
long keyin = 0;
|
||||
|
||||
//printk("sfp_value_store\n");
|
||||
//printk("attr->index=%d\n", attr->index);
|
||||
mutex_lock(&data->update_lock);
|
||||
switch (attr->index)
|
||||
{
|
||||
@ -550,8 +548,6 @@ static ssize_t sfp_value_show(struct device *dev, struct device_attribute *da,
|
||||
int index;
|
||||
int status = -EINVAL;
|
||||
|
||||
//printk("sfp_value_show, attr->index=%d\n", attr->index);
|
||||
//printk("TRANSCEIVER_PRESENT_ATTR_ID(1)=%d, TRANSCEIVER_RESET_ATTR_ID(1)=%d\n", TRANSCEIVER_PRESENT_ATTR_ID(1), TRANSCEIVER_RESET_ATTR_ID(1));
|
||||
mutex_lock(&data->update_lock);
|
||||
switch (attr->index)
|
||||
{
|
||||
@ -569,7 +565,6 @@ static ssize_t sfp_value_show(struct device *dev, struct device_attribute *da,
|
||||
case MODULE_RESET_17 ... MODULE_RESET_24:
|
||||
case MODULE_RESET_25 ... MODULE_RESET_32:
|
||||
index=sfp_array_index_get(attr->index);
|
||||
//printk("rst:attr->index=%d, index=%d\n",attr->index, index);
|
||||
if(index < 0 || index > PORT_NUM_MAX -1)
|
||||
break;
|
||||
status = sprintf(buf, "%u\n", data->reset[index]);
|
||||
@ -809,7 +804,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7716_32xb_cpld_remove(struct i2c_client *client)
|
||||
static void as7716_32xb_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -818,7 +813,6 @@ static int as7716_32xb_cpld_remove(struct i2c_client *client)
|
||||
kfree(data);
|
||||
as7716_32xb_cpld_remove_client(client);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int as7716_32xb_cpld_read(unsigned short cpld_addr, u8 reg)
|
||||
@ -930,7 +924,6 @@ static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da,
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
//printk("set_mode_reset:attr->index=%d\n",attr->index);
|
||||
switch (attr->index) {
|
||||
case MODULE_RESET_1 ... MODULE_RESET_8:
|
||||
reg = 0x04;
|
||||
@ -957,17 +950,14 @@ static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da,
|
||||
if (unlikely(status < 0)) {
|
||||
goto exit;
|
||||
}
|
||||
//printk("set_mode_reset:reset=%d, reg=0x%x, mask=0x%x, ori_val=0x%x\n", reset, reg, mask, status);
|
||||
/* Update lp_mode status */
|
||||
if (reset)
|
||||
{
|
||||
val = status&(~mask);
|
||||
//printk("1:new val=0x%x\n", val);
|
||||
}
|
||||
else
|
||||
{
|
||||
val =status | (mask);
|
||||
//printk("0:new val=0x%x\n", val);
|
||||
}
|
||||
|
||||
status = as7716_32xb_cpld_write_internal(client, reg, val);
|
||||
|
@ -403,8 +403,6 @@ static ssize_t fan_value_store(struct device *dev, struct device_attribute *da,
|
||||
int status = -EINVAL;
|
||||
int index;
|
||||
long keyin = 0;
|
||||
//printk("fan_value_store\n");
|
||||
//printk("attr->index=%d\n", attr->index);
|
||||
mutex_lock(&data->update_lock);
|
||||
switch (attr->index)
|
||||
{
|
||||
@ -505,8 +503,6 @@ static ssize_t fan_value_show(struct device *dev, struct device_attribute *da,
|
||||
struct as7716_32xb_fan_data *data = i2c_get_clientdata(client);
|
||||
int status = -EINVAL;
|
||||
int index=0;
|
||||
//printk("ffan_value_show\n");
|
||||
//printk("attr->index=%d\n", attr->index);
|
||||
mutex_lock(&data->update_lock);
|
||||
switch (attr->index)
|
||||
{
|
||||
@ -662,13 +658,12 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7716_32xb_fan_remove(struct i2c_client *client)
|
||||
static void as7716_32xb_fan_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7716_32xb_fan_data *data = i2c_get_clientdata(client);
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&client->dev.kobj, &as7716_32xb_fan_group);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Addresses to scan */
|
||||
|
@ -69,12 +69,6 @@ static ssize_t oom_info_show(struct device *dev, struct device_attribute *da,
|
||||
|
||||
mutex_lock(&data->lock);
|
||||
memcpy(buf, data->eeprom, EEPROM_DATA_SIZE);
|
||||
//for(i=0; i < EEPROM_DATA_SIZE ; i++)
|
||||
//{
|
||||
// buf[i]=data->eeprom[i];
|
||||
// printk("buf[%d]=0x%x ",i, buf[i]);
|
||||
//}
|
||||
//status = EEPROM_DATA_SIZE+1;
|
||||
|
||||
|
||||
memcpy(buf, data->eeprom, 256);
|
||||
@ -92,7 +86,6 @@ static ssize_t oom_info_store(struct device *dev, struct device_attribute *da,
|
||||
unsigned char str[3];
|
||||
unsigned int val;
|
||||
|
||||
// printk("strlen(buf)=%d\n",strlen(buf));
|
||||
k=0;
|
||||
mutex_lock(&data->lock);
|
||||
memset(data->eeprom, 0xFF, EEPROM_DATA_SIZE);
|
||||
@ -101,31 +94,20 @@ static ssize_t oom_info_store(struct device *dev, struct device_attribute *da,
|
||||
{
|
||||
for(i=0; i < strlen(buf) ; i++)
|
||||
{
|
||||
// printk("i=%d ", i);
|
||||
for(j=0;j<2; j++)
|
||||
{
|
||||
str[j]=buf[i+j];
|
||||
}
|
||||
sscanf(str, "%x", &val);
|
||||
//printk("str=%s val=0x%x ", str, val);
|
||||
i=j+i-1;
|
||||
if(k>=EEPROM_DATA_SIZE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
data->eeprom[k]=(unsigned char)val;
|
||||
//printk("data->eeprom[%d]=0x%x\n",k, data->eeprom[k]);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
//printk("buf=\n");
|
||||
//for(i=0; i < strlen(buf) ; i++)
|
||||
//{
|
||||
// printk("%c%c ", buf[i], buf[i+1]);
|
||||
// if((i % 31)==0)
|
||||
// printk("\n");
|
||||
//}
|
||||
//printk("\n");
|
||||
|
||||
|
||||
mutex_unlock(&data->lock);
|
||||
@ -215,7 +197,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7716_32xb_oom_remove(struct i2c_client *client)
|
||||
static void as7716_32xb_oom_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7716_32xb_oom_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -223,7 +205,6 @@ static int as7716_32xb_oom_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7716_32xb_oom_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,8 +160,6 @@ static ssize_t pmbus_info_show(struct device *dev, struct device_attribute *da,
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
struct as7716_32xb_pmbus_data *data = i2c_get_clientdata(client);
|
||||
int status = -EINVAL;
|
||||
//printk("pmbus_info_show\n");
|
||||
printk("attr->index=%d\n", attr->index);
|
||||
mutex_lock(&data->update_lock);
|
||||
switch (attr->index)
|
||||
{
|
||||
@ -190,11 +188,9 @@ static ssize_t pmbus_info_show(struct device *dev, struct device_attribute *da,
|
||||
status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->i_out);
|
||||
break;
|
||||
case PSU_P_OUT:
|
||||
printk("read PSU_P_OUT\n");
|
||||
status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->p_out);
|
||||
break;
|
||||
case PSU_P_OUT_UV:
|
||||
printk("read PSU_P_OUT_UV\n");
|
||||
status=snprintf(buf, PAGE_SIZE-1, "%ld\r\n", data->p_out * 1000000);
|
||||
break;
|
||||
case PSU_TEMP1_INPUT:
|
||||
@ -256,8 +252,6 @@ static ssize_t pmbus_info_store(struct device *dev, struct device_attribute *da,
|
||||
struct as7716_32xb_pmbus_data *data = i2c_get_clientdata(client);
|
||||
long keyin = 0;
|
||||
int status = -EINVAL;
|
||||
//printk("pmbus_info_store\n");
|
||||
//printk("attr->index=%d\n", attr->index);
|
||||
mutex_lock(&data->update_lock);
|
||||
status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin);
|
||||
switch (attr->index)
|
||||
@ -286,7 +280,6 @@ static ssize_t pmbus_info_store(struct device *dev, struct device_attribute *da,
|
||||
data->i_out=keyin;
|
||||
break;
|
||||
case PSU_P_OUT:
|
||||
printk("data->p_out=%d\n", data->p_out);
|
||||
data->p_out=keyin;
|
||||
break;
|
||||
case PSU_P_OUT_UV:
|
||||
@ -392,7 +385,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7716_32xb_pmbus_remove(struct i2c_client *client)
|
||||
static void as7716_32xb_pmbus_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7716_32xb_pmbus_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -400,7 +393,6 @@ static int as7716_32xb_pmbus_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7716_32xb_pmbus_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,25 +96,19 @@ static ssize_t psu_info_show(struct device *dev, struct device_attribute *da,
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
struct as7716_32xb_psu_data *data = i2c_get_clientdata(client);
|
||||
int status = -EINVAL;
|
||||
//printk("psu_info_show\n");
|
||||
// printk("attr->index=%d\n", attr->index);
|
||||
mutex_lock(&data->update_lock);
|
||||
switch (attr->index)
|
||||
{
|
||||
case PSU_PRESENT:
|
||||
//printk("data->present=%d\n",data->present);
|
||||
status = snprintf(buf, PAGE_SIZE - 1, "%d\r\n", data->present);
|
||||
break;
|
||||
case PSU_MODEL_NAME:
|
||||
//printk("data->model_name=%s\n",data->model_name);
|
||||
status = snprintf(buf, PAGE_SIZE - 1, "%s\r\n", data->model_name);
|
||||
break;
|
||||
case PSU_POWER_GOOD:
|
||||
// printk("data->present=%d\n",data->power_good);
|
||||
status = snprintf(buf, PAGE_SIZE - 1, "%d\r\n", data->power_good);
|
||||
break;
|
||||
case PSU_FAN_DIR:
|
||||
//printk("data->fan_dir=%s\n",data->fan_dir);
|
||||
status = snprintf(buf, PAGE_SIZE - 1, "%s\r\n", data->fan_dir);
|
||||
break;
|
||||
default :
|
||||
@ -132,8 +126,6 @@ static ssize_t psu_info_store(struct device *dev, struct device_attribute *da,
|
||||
struct as7716_32xb_psu_data *data = i2c_get_clientdata(client);
|
||||
long keyin = 0;
|
||||
int status = -EINVAL;
|
||||
//printk("psu_info_store\n");
|
||||
//printk("attr->index=%d\n", attr->index);
|
||||
mutex_lock(&data->update_lock);
|
||||
switch (attr->index)
|
||||
{
|
||||
@ -219,7 +211,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7716_32xb_psu_remove(struct i2c_client *client)
|
||||
static void as7716_32xb_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7716_32xb_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -227,7 +219,6 @@ static int as7716_32xb_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7716_32xb_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -137,7 +137,6 @@ static ssize_t show_present(struct device *dev, struct device_attribute *da,
|
||||
struct as7716_32x_sfp_data *data = as7716_32x_sfp_update_device(dev);
|
||||
|
||||
if (!data->valid) {
|
||||
printk("return -EIO\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@ -216,7 +215,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7716_32x_sfp_remove(struct i2c_client *client)
|
||||
static void as7716_32x_sfp_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7716_32x_sfp_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -224,7 +223,6 @@ static int as7716_32x_sfp_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7716_32x_sfp_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum port_numbers {
|
||||
@ -313,7 +311,6 @@ static struct as7716_32x_sfp_data *as7716_32x_sfp_update_device(struct device *d
|
||||
}
|
||||
|
||||
data->is_present = (status & (1 << (data->port % 8))) ? 0 : 1;
|
||||
printk("data->is_present=%d, data->port=%d, status=0x%x\n",data->is_present, data->port, status);
|
||||
/* Read eeprom data based on port number */
|
||||
memset(data->eeprom, 0, sizeof(data->eeprom));
|
||||
|
||||
@ -325,7 +322,6 @@ static struct as7716_32x_sfp_data *as7716_32x_sfp_update_device(struct device *d
|
||||
data->eeprom+(i*I2C_SMBUS_BLOCK_MAX),
|
||||
I2C_SMBUS_BLOCK_MAX);
|
||||
if (status < 0) {
|
||||
printk("unable to read eeprom from port(%d)\n", data->port);
|
||||
dev_dbg(&client->dev, "unable to read eeprom from port(%d)\n", data->port);
|
||||
goto exit;
|
||||
}
|
||||
@ -344,10 +340,6 @@ exit:
|
||||
|
||||
static int __init as7716_32x_sfp_init(void)
|
||||
{
|
||||
//extern int platform_accton_as7716_32x(void);
|
||||
//if (!platform_accton_as7716_32x()) {
|
||||
// return -ENODEV;
|
||||
//}
|
||||
|
||||
return i2c_add_driver(&as7716_32x_sfp_driver);
|
||||
}
|
||||
|
@ -49,36 +49,13 @@ static struct attribute *as7716_32xb_sys_attributes[] = {
|
||||
static ssize_t sys_info_show(struct device *dev, struct device_attribute *da,
|
||||
char *buf)
|
||||
{
|
||||
//struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
struct as7716_32xb_sys_data *data = i2c_get_clientdata(client);
|
||||
// int status = -EINVAL;
|
||||
int i;
|
||||
|
||||
//printk("sys_info_show\n");
|
||||
// printk("attr->index=%d\n", attr->index);
|
||||
mutex_lock(&data->lock);
|
||||
//for(i=0; i<8; i++)
|
||||
// printk("data->eeprom[%d]=0x%x ",i, data->eeprom[i]);
|
||||
//printk("\n");
|
||||
memcpy(buf, data->eeprom, EEPROM_DATA_SIZE);
|
||||
//for(i=0; i < EEPROM_DATA_SIZE ; i++)
|
||||
//{
|
||||
// buf[i]=data->eeprom[i];
|
||||
// printk("buf[%d]=0x%x ",i, buf[i]);
|
||||
//}
|
||||
//status = EEPROM_DATA_SIZE+1;
|
||||
|
||||
//printk("\n");
|
||||
//status = sprintf(buf, "%x", 0xA);
|
||||
//data->eeprom[0]=0x0d;
|
||||
//data->eeprom[1]=0x0;
|
||||
//data->eeprom[2]=0x06;
|
||||
// buf[3]=0xFF;
|
||||
|
||||
// for(i=0; i< 16; i++)
|
||||
// printk("buf[%d]=0x%x ",i, buf[i]);
|
||||
//printk("\n");
|
||||
|
||||
memcpy(buf, data->eeprom, 256);
|
||||
|
||||
@ -97,11 +74,6 @@ static ssize_t sys_info_store(struct device *dev, struct device_attribute *da,
|
||||
unsigned char str[3];
|
||||
unsigned int val;
|
||||
|
||||
//printk("sys_info_store\n");
|
||||
//printk("attr->index=%d\n", attr->index);
|
||||
//printk("buf[0]=0x%x, buf[1]=0x%x, buf[2]=0x%x, buf[3]=0x%x\n", buf[0], buf[1], buf[2], buf[3]);
|
||||
|
||||
// printk("strlen(buf)=%d\n",strlen(buf));
|
||||
k=0;
|
||||
mutex_lock(&data->lock);
|
||||
memset(data->eeprom, 0xFF, EEPROM_DATA_SIZE);
|
||||
@ -110,34 +82,20 @@ static ssize_t sys_info_store(struct device *dev, struct device_attribute *da,
|
||||
{
|
||||
for(i=0; i < strlen(buf) ; i++)
|
||||
{
|
||||
// printk("i=%d ", i);
|
||||
for(j=0;j<2; j++)
|
||||
{
|
||||
str[j]=buf[i+j];
|
||||
}
|
||||
sscanf(str, "%x", &val);
|
||||
// printk("str=%s val=0x%x ", str, val);
|
||||
i=j+i-1;
|
||||
if(k>=EEPROM_DATA_SIZE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
data->eeprom[k]=(unsigned char)val;
|
||||
// printk("data->eeprom[%d]=0x%x\n",k, data->eeprom[k]);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
//printk("buf=\n");
|
||||
//for(i=0; i < strlen(buf) ; i++)
|
||||
//{
|
||||
// printk("%c%c ", buf[i], buf[i+1]);
|
||||
// if((i % 31)==0)
|
||||
// printk("\n");
|
||||
//}
|
||||
//printk("\n");
|
||||
|
||||
//printk("eeprom[0]=0x%x, eeprom[1]=0x%x, eeprom[2]=0x%x, eeprom[3]=0x%x\n",
|
||||
// data->eeprom[0], data->eeprom[1], data->eeprom[2], data->eeprom[3]);
|
||||
|
||||
mutex_unlock(&data->lock);
|
||||
return size;
|
||||
@ -191,7 +149,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7716_32xb_sys_remove(struct i2c_client *client)
|
||||
static void as7716_32xb_sys_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7716_32xb_sys_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -199,7 +157,6 @@ static int as7716_32xb_sys_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7716_32xb_sys_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -162,7 +162,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7716_32xb_thermal_remove(struct i2c_client *client)
|
||||
static void as7716_32xb_thermal_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7716_32xb_thermal_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -170,7 +170,6 @@ static int as7716_32xb_thermal_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7716_32xb_thermal_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -151,12 +151,11 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int accton_i2c_cpld_remove(struct i2c_client *client)
|
||||
static void accton_i2c_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
sysfs_remove_group(&client->dev.kobj, &as5712_54x_cpld_group);
|
||||
|
||||
accton_i2c_cpld_remove_client(client);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id accton_i2c_cpld_id[] = {
|
||||
@ -234,23 +233,7 @@ static void __exit accton_i2c_cpld_exit(void)
|
||||
{
|
||||
i2c_del_driver(&accton_i2c_cpld_driver);
|
||||
}
|
||||
/*
|
||||
static struct dmi_system_id as7712_dmi_table[] = {
|
||||
{
|
||||
.ident = "Accton AS7712",
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Accton"),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "AS7712"),
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
int platform_accton_as7712_32x(void)
|
||||
{
|
||||
return dmi_check_system(as7712_dmi_table);
|
||||
}
|
||||
EXPORT_SYMBOL(platform_accton_as7712_32x);
|
||||
*/
|
||||
MODULE_AUTHOR("Brandon Chuang <brandon_chuang@accton.com.tw>");
|
||||
MODULE_DESCRIPTION("accton_i2c_cpld driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -111,12 +111,3 @@ class ThermalUtil(object):
|
||||
def get_thermal_temp(self):
|
||||
return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX))
|
||||
|
||||
def main():
|
||||
thermal = ThermalUtil()
|
||||
logging.debug('thermal1=%d', thermal._get_thermal_val(1))
|
||||
logging.debug('thermal2=%d', thermal._get_thermal_val(2))
|
||||
logging.debug('thermal3=%d', thermal._get_thermal_val(3))
|
||||
logging.debug('thermal4=%d', thermal._get_thermal_val(4))
|
||||
logging.debug('thermal5=%d', thermal._get_thermal_val(5))
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -778,7 +778,7 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int as7726_32x_cpld_remove(struct i2c_client *client)
|
||||
static void as7726_32x_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7726_32x_cpld_data *data = i2c_get_clientdata(client);
|
||||
const struct attribute_group *group = NULL;
|
||||
@ -806,7 +806,6 @@ static int as7726_32x_cpld_remove(struct i2c_client *client)
|
||||
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int as7726_32x_cpld_read_internal(struct i2c_client *client, u8 reg)
|
||||
|
@ -456,13 +456,12 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7726_32x_fan_remove(struct i2c_client *client)
|
||||
static void as7726_32x_fan_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7726_32x_fan_data *data = i2c_get_clientdata(client);
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&client->dev.kobj, &as7726_32x_fan_group);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Addresses to scan */
|
||||
|
@ -155,7 +155,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7726_32x_psu_remove(struct i2c_client *client)
|
||||
static void as7726_32x_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7726_32x_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -163,7 +163,6 @@ static int as7726_32x_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7726_32x_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -413,7 +413,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int ym2651y_remove(struct i2c_client *client)
|
||||
static void ym2651y_remove(struct i2c_client *client)
|
||||
{
|
||||
struct ym2651y_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -421,7 +421,6 @@ static int ym2651y_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &ym2651y_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id ym2651y_id[] = {
|
||||
|
@ -424,13 +424,12 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7816_64x_fan_remove(struct i2c_client *client)
|
||||
static void as7816_64x_fan_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7816_64x_fan_data *data = i2c_get_clientdata(client);
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&client->dev.kobj, &as7816_64x_fan_group);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Addresses to scan */
|
||||
|
@ -150,7 +150,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as7816_64x_psu_remove(struct i2c_client *client)
|
||||
static void as7816_64x_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as7816_64x_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -158,7 +158,6 @@ static int as7816_64x_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as7816_64x_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -1530,7 +1530,7 @@ static int qsfp_remove(struct i2c_client *client, struct qsfp_data *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sfp_device_remove(struct i2c_client *client)
|
||||
static void sfp_device_remove(struct i2c_client *client)
|
||||
{
|
||||
int ret = 0;
|
||||
struct sfp_port_data *data = i2c_get_clientdata(client);
|
||||
@ -1540,7 +1540,6 @@ static int sfp_device_remove(struct i2c_client *client)
|
||||
}
|
||||
|
||||
kfree(data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Addresses scanned
|
||||
|
@ -94,9 +94,3 @@ class ThermalUtil(object):
|
||||
def get_thermal_path(self, thermal_num):
|
||||
return self.thermal_sysfspath[thermal_num][0]
|
||||
|
||||
|
||||
def main():
|
||||
thermal = ThermalUtil()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -829,7 +829,7 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int as9716_32d_cpld_remove(struct i2c_client *client)
|
||||
static void as9716_32d_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as9716_32d_cpld_data *data = i2c_get_clientdata(client);
|
||||
const struct attribute_group *group = NULL;
|
||||
@ -857,7 +857,6 @@ static int as9716_32d_cpld_remove(struct i2c_client *client)
|
||||
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int as9716_32d_cpld_read_internal(struct i2c_client *client, u8 reg)
|
||||
|
@ -455,13 +455,12 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as9716_32d_fan_remove(struct i2c_client *client)
|
||||
static void as9716_32d_fan_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as9716_32d_fan_data *data = i2c_get_clientdata(client);
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&client->dev.kobj, &as9716_32d_fan_group);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Addresses to scan */
|
||||
|
@ -180,7 +180,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as9716_32d_psu_remove(struct i2c_client *client)
|
||||
static void as9716_32d_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as9716_32d_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -188,7 +188,6 @@ static int as9716_32d_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as9716_32d_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
|
@ -372,7 +372,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int accton_i2c_psu_remove(struct i2c_client *client)
|
||||
static void accton_i2c_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct accton_i2c_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -380,7 +380,6 @@ static int accton_i2c_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &accton_i2c_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* Support psu moduel
|
||||
*/
|
||||
|
@ -56,7 +56,7 @@ class FanUtil(object):
|
||||
#fan1_fault
|
||||
#fan1_present
|
||||
|
||||
#(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage',
|
||||
|
||||
_fan_device_node_mapping = {
|
||||
(FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault',
|
||||
(FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction',
|
||||
@ -178,7 +178,7 @@ class FanUtil(object):
|
||||
return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP)
|
||||
|
||||
def get_fan_duty_cycle(self):
|
||||
#duty_path = self.FAN_DUTY_PATH
|
||||
|
||||
try:
|
||||
val_file = open(self.FAN_DUTY_PATH)
|
||||
except IOError as e:
|
||||
|
@ -39,7 +39,7 @@ class ThermalUtil(object):
|
||||
""" Dictionary where
|
||||
key1 = thermal id index (integer) starting from 1
|
||||
value = path to fan device file (string) """
|
||||
#_thermal_to_device_path_mapping = {}
|
||||
|
||||
|
||||
thermal_sysfspath ={
|
||||
THERMAL_NUM_1_IDX: ["/sys/bus/i2c/devices/15-0048/hwmon/hwmon*/temp1_input"],
|
||||
@ -51,7 +51,6 @@ class ThermalUtil(object):
|
||||
THERMAL_NUM_7_IDX: ["/sys/bus/i2c/devices/15-004b/hwmon/hwmon*/temp1_input"],
|
||||
}
|
||||
|
||||
#def __init__(self):
|
||||
|
||||
def _get_thermal_val(self, thermal_num):
|
||||
if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_MAX:
|
||||
|
@ -839,7 +839,7 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int as9726_32d_cpld_remove(struct i2c_client *client)
|
||||
static void as9726_32d_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as9726_32d_cpld_data *data = i2c_get_clientdata(client);
|
||||
const struct attribute_group *group = NULL;
|
||||
@ -870,7 +870,6 @@ static int as9726_32d_cpld_remove(struct i2c_client *client)
|
||||
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int as9726_32d_cpld_read_internal(struct i2c_client *client, u8 reg)
|
||||
|
@ -514,13 +514,12 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as9726_32d_fan_remove(struct i2c_client *client)
|
||||
static void as9726_32d_fan_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as9726_32d_fan_data *data = i2c_get_clientdata(client);
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
sysfs_remove_group(&client->dev.kobj, &as9726_32d_fan_group);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Addresses to scan */
|
||||
|
@ -187,7 +187,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int as9726_32d_psu_remove(struct i2c_client *client)
|
||||
static void as9726_32d_psu_remove(struct i2c_client *client)
|
||||
{
|
||||
struct as9726_32d_psu_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -195,7 +195,6 @@ static int as9726_32d_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &as9726_32d_psu_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum psu_index
|
||||
@ -267,7 +266,6 @@ static struct as9726_32d_psu_data *as9726_32d_psu_update_device(struct device *d
|
||||
|
||||
/* Read psu status */
|
||||
status = as9726_32d_cpld_read(0x60, 0x03);
|
||||
//printk("status=0x%x in %s\n", status, __FUNCTION__);
|
||||
|
||||
if (status < 0) {
|
||||
dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status);
|
||||
|
@ -480,7 +480,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int ym2651y_remove(struct i2c_client *client)
|
||||
static void ym2651y_remove(struct i2c_client *client)
|
||||
{
|
||||
struct ym2651y_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -488,7 +488,6 @@ static int ym2651y_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &ym2651y_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id ym2651y_id[] = {
|
||||
|
@ -787,7 +787,7 @@ out_kfree:
|
||||
|
||||
}
|
||||
|
||||
static int accton_i2c_cpld_remove(struct i2c_client *client)
|
||||
static void accton_i2c_cpld_remove(struct i2c_client *client)
|
||||
{
|
||||
struct cpld_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -795,7 +795,6 @@ static int accton_i2c_cpld_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &data->group);
|
||||
kfree(data->group.attrs);
|
||||
accton_i2c_cpld_remove_client(client);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int accton_i2c_cpld_read(u8 cpld_addr, u8 reg)
|
||||
|
@ -1951,12 +1951,11 @@ static int pmbus_probe(struct i2c_client *client,
|
||||
return _pmbus_do_probe(client, id, info);
|
||||
}
|
||||
|
||||
int _pmbus_do_remove(struct i2c_client *client)
|
||||
void _pmbus_do_remove(struct i2c_client *client)
|
||||
{
|
||||
struct pmbus_data *data = i2c_get_clientdata(client);
|
||||
hwmon_device_unregister(data->hwmon_dev);
|
||||
kfree(data->group.attrs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MODULE_DEVICE_TABLE(i2c, pmbus_id);
|
||||
|
@ -293,7 +293,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int cpr_4011_4mxx_remove(struct i2c_client *client)
|
||||
static void cpr_4011_4mxx_remove(struct i2c_client *client)
|
||||
{
|
||||
struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -301,7 +301,6 @@ static int cpr_4011_4mxx_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id cpr_4011_4mxx_id[] = {
|
||||
|
@ -489,7 +489,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
static int ym2651y_remove(struct i2c_client *client)
|
||||
static void ym2651y_remove(struct i2c_client *client)
|
||||
{
|
||||
struct ym2651y_data *data = i2c_get_clientdata(client);
|
||||
|
||||
@ -497,7 +497,6 @@ static int ym2651y_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &ym2651y_group);
|
||||
kfree(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id ym2651y_id[] = {
|
||||
|
@ -1,16 +1,3 @@
|
||||
# Copyright (c) 2019 Edgecore Networks Corporation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR
|
||||
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
|
||||
# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
#
|
||||
# See the Apache Version 2.0 License for specific language governing
|
||||
# permissions and limitations under the License.
|
||||
|
||||
#include <Python.h>
|
||||
#include <sys/types.h>
|
||||
@ -119,13 +106,6 @@ static char docstr[] = "\
|
||||
In reading operation: data which is read from FPGA\n\
|
||||
In writing operation: None\n";
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
PyMODINIT_FUNC
|
||||
initfbfpgaio(void)
|
||||
{
|
||||
(void) Py_InitModule3("fbfpgaio", FbfpgaMethods, docstr);
|
||||
}
|
||||
#else
|
||||
static struct PyModuleDef FbfpgaModule =
|
||||
{
|
||||
PyModuleDef_HEAD_INIT,
|
||||
@ -140,5 +120,5 @@ PyInit_fbfpgaio(void)
|
||||
{
|
||||
return PyModule_Create(&FbfpgaModule);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -62,7 +62,8 @@ MODULE_PARM_DESC(poll_interval, "Time interval for data polling, in unit of seco
|
||||
#define CHASSIS_LED_COUNT (2)
|
||||
#define CHASSIS_PSU_VOUT_COUNT (1) /*V output only.*/
|
||||
#define CHASSIS_PSU_VOUT_INDEX (1) /*V output start index.*/
|
||||
|
||||
#define MAX_MODEL_NAME 21
|
||||
#define MAX_SERIAL_NUMBER 19
|
||||
|
||||
#define ATTR_ALLOC_EXTRA 1 /*For last attribute which is NUll.*/
|
||||
#define ATTR_NAME_SIZE 24
|
||||
@ -102,6 +103,14 @@ enum sensor_type_e {
|
||||
SENSOR_TYPE_PSU2,
|
||||
SENSOR_TYPE_PSU3,
|
||||
SENSOR_TYPE_PSU4,
|
||||
SENSOR_TYPE_PSU1_MODEL,
|
||||
SENSOR_TYPE_PSU2_MODEL,
|
||||
SENSOR_TYPE_PSU3_MODEL,
|
||||
SENSOR_TYPE_PSU4_MODEL,
|
||||
SENSOR_TYPE_PSU1_SERIAL,
|
||||
SENSOR_TYPE_PSU2_SERIAL,
|
||||
SENSOR_TYPE_PSU3_SERIAL,
|
||||
SENSOR_TYPE_PSU4_SERIAL,
|
||||
SENSOR_TYPE_MAX,
|
||||
};
|
||||
|
||||
@ -113,6 +122,14 @@ enum sysfs_attributes_index {
|
||||
INDEX_PSU2_START = SENSOR_TYPE_PSU2 *ATTR_TYPE_INDEX_GAP,
|
||||
INDEX_PSU3_START = SENSOR_TYPE_PSU3 *ATTR_TYPE_INDEX_GAP,
|
||||
INDEX_PSU4_START = SENSOR_TYPE_PSU4 *ATTR_TYPE_INDEX_GAP,
|
||||
INDEX_PSU1_MODEL = SENSOR_TYPE_PSU1_MODEL *ATTR_TYPE_INDEX_GAP,
|
||||
INDEX_PSU2_MODEL = SENSOR_TYPE_PSU2_MODEL *ATTR_TYPE_INDEX_GAP,
|
||||
INDEX_PSU3_MODEL = SENSOR_TYPE_PSU3_MODEL *ATTR_TYPE_INDEX_GAP,
|
||||
INDEX_PSU4_MODEL = SENSOR_TYPE_PSU4_MODEL *ATTR_TYPE_INDEX_GAP,
|
||||
INDEX_PSU1_SERIAL = SENSOR_TYPE_PSU1_SERIAL *ATTR_TYPE_INDEX_GAP,
|
||||
INDEX_PSU2_SERIAL = SENSOR_TYPE_PSU2_SERIAL *ATTR_TYPE_INDEX_GAP,
|
||||
INDEX_PSU3_SERIAL = SENSOR_TYPE_PSU3_SERIAL *ATTR_TYPE_INDEX_GAP,
|
||||
INDEX_PSU4_SERIAL = SENSOR_TYPE_PSU4_SERIAL *ATTR_TYPE_INDEX_GAP,
|
||||
INDEX_NAME = SENSOR_TYPE_MAX *ATTR_TYPE_INDEX_GAP,
|
||||
};
|
||||
|
||||
@ -123,6 +140,9 @@ enum sysfs_attributes_index {
|
||||
#define PMBUS_READ_IOUT 0x8C
|
||||
#define PMBUS_READ_POUT 0x96
|
||||
#define PMBUS_READ_PIN 0x97
|
||||
#define PMBUS_READ_FAN 0x90
|
||||
#define PMBUS_READ_TEMP 0x8D
|
||||
|
||||
|
||||
#define PMBUS_REG_START PMBUS_READ_VIN
|
||||
#define PMBUS_REG_END PMBUS_READ_PIN
|
||||
@ -134,6 +154,8 @@ enum psu_data_e {
|
||||
PSU_DATA_IOUT,
|
||||
PSU_DATA_PIN,
|
||||
PSU_DATA_POUT,
|
||||
PSU_DATA_FAN,
|
||||
PSU_DATA_TEMP,
|
||||
PSU_DATA_MAX,
|
||||
};
|
||||
|
||||
@ -147,6 +169,8 @@ struct pmbus_reg_t {
|
||||
[PSU_DATA_IOUT] = {PMBUS_READ_IOUT, false},
|
||||
[PSU_DATA_PIN ] = {PMBUS_READ_PIN, true},
|
||||
[PSU_DATA_POUT] = {PMBUS_READ_POUT, true},
|
||||
[PSU_DATA_FAN] = {PMBUS_READ_FAN, false},
|
||||
[PSU_DATA_TEMP] = {PMBUS_READ_TEMP, false},
|
||||
};
|
||||
|
||||
struct sensor_data {
|
||||
@ -154,6 +178,8 @@ struct sensor_data {
|
||||
int fan_rpm[MAX_FAN_COUNT];
|
||||
int fan_rpm_dn[MAX_FAN_COUNT];
|
||||
int psu_data [MAX_PSU_COUNT][PSU_DATA_MAX];
|
||||
int psu_model [MAX_PSU_COUNT][MAX_MODEL_NAME];
|
||||
int psu_serial [MAX_PSU_COUNT][MAX_SERIAL_NUMBER];
|
||||
int led_bright[CHASSIS_LED_COUNT];
|
||||
};
|
||||
|
||||
@ -225,6 +251,10 @@ static struct attr_pattern psu##index##_curr = {CHASSIS_PSU_CHAR_COUNT, \
|
||||
CHASSIS_PSU_CHAR_COUNT*index, "curr","_input", S_IRUGO, _attr_show, NULL}; \
|
||||
static struct attr_pattern psu##index##_pwr = {CHASSIS_PSU_CHAR_COUNT, \
|
||||
CHASSIS_PSU_CHAR_COUNT*index, "power","_input", S_IRUGO, _attr_show, NULL}; \
|
||||
static struct attr_pattern psu##index##_fan_speed = {1, \
|
||||
1*index, "psu","_fan_speed", S_IRUGO, _attr_show, NULL}; \
|
||||
static struct attr_pattern psu##index##_temp_input = {1, \
|
||||
1*index, "psu","_temp_input", S_IRUGO, _attr_show, NULL}; \
|
||||
static struct attr_pattern psu##index##_vmax = {CHASSIS_PSU_VOUT_COUNT, \
|
||||
CHASSIS_PSU_CHAR_COUNT*index + 1, "in","_max", S_IRUGO, show_psu_vout_max, NULL};\
|
||||
static struct attr_pattern psu##index##_vmin = {CHASSIS_PSU_VOUT_COUNT, \
|
||||
@ -232,7 +262,21 @@ CHASSIS_PSU_CHAR_COUNT*index + 1, "in","_min", S_IRUGO, show_psu_vout_min, NULL}
|
||||
|
||||
#define DECLARE_PSU_ATTR(index) \
|
||||
&psu##index##_vin, &psu##index##_curr, &psu##index##_pwr, \
|
||||
&psu##index##_vmax, &psu##index##_vmin
|
||||
&psu##index##_fan_speed, &psu##index##_temp_input ,&psu##index##_vmax, &psu##index##_vmin
|
||||
|
||||
#define DECLARE_PSU_MODEL_NAME_SENSOR_DEVICE_ATTR(index) \
|
||||
static struct attr_pattern psu##index##_model_name = {1, \
|
||||
1*index, "psu","_model_name", S_IRUGO, _attr_show, NULL};
|
||||
|
||||
#define DECLARE_PSU_MODEL_NAME_ATTR(index) \
|
||||
&psu##index##_model_name
|
||||
|
||||
#define DECLARE_PSU_SERIAL_NUMBER_SENSOR_DEVICE_ATTR(index) \
|
||||
static struct attr_pattern psu##index##_serial_name = {1, \
|
||||
1*index, "psu","_serial_num", S_IRUGO, _attr_show, NULL};
|
||||
|
||||
#define DECLARE_PSU_SERIAL_NUMBER_ATTR(index) \
|
||||
&psu##index##_serial_name
|
||||
|
||||
|
||||
DECLARE_PSU_SENSOR_DEVICE_ATTR(0);
|
||||
@ -240,6 +284,15 @@ DECLARE_PSU_SENSOR_DEVICE_ATTR(1);
|
||||
DECLARE_PSU_SENSOR_DEVICE_ATTR(2);
|
||||
DECLARE_PSU_SENSOR_DEVICE_ATTR(3);
|
||||
|
||||
DECLARE_PSU_MODEL_NAME_SENSOR_DEVICE_ATTR(0);
|
||||
DECLARE_PSU_MODEL_NAME_SENSOR_DEVICE_ATTR(1);
|
||||
DECLARE_PSU_MODEL_NAME_SENSOR_DEVICE_ATTR(2);
|
||||
DECLARE_PSU_MODEL_NAME_SENSOR_DEVICE_ATTR(3);
|
||||
|
||||
DECLARE_PSU_SERIAL_NUMBER_SENSOR_DEVICE_ATTR(0);
|
||||
DECLARE_PSU_SERIAL_NUMBER_SENSOR_DEVICE_ATTR(1);
|
||||
DECLARE_PSU_SERIAL_NUMBER_SENSOR_DEVICE_ATTR(2);
|
||||
DECLARE_PSU_SERIAL_NUMBER_SENSOR_DEVICE_ATTR(3);
|
||||
|
||||
|
||||
static char tty_cmd[SENSOR_TYPE_MAX][TTY_CMD_MAX_LEN] = {
|
||||
@ -259,6 +312,14 @@ static char tty_cmd[SENSOR_TYPE_MAX][TTY_CMD_MAX_LEN] = {
|
||||
"i2cdump -y -f -r "\
|
||||
__stringify(PMBUS_REG_START)"-" __stringify(PMBUS_REG_END)\
|
||||
" 56 0x58 w\r",
|
||||
"i2cdump -y -f 49 0x59 s 0x9a|tail -n +2|cut -c56-\r",
|
||||
"i2cdump -y -f 48 0x58 s 0x9a|tail -n +2|cut -c56-\r",
|
||||
"i2cdump -y -f 57 0x59 s 0x9a|tail -n +2|cut -c56-\r",
|
||||
"i2cdump -y -f 56 0x58 s 0x9a|tail -n +2|cut -c56-\r",
|
||||
"i2cdump -y -f 49 0x59 s 0x9e|tail -n +2|cut -c56-\r",
|
||||
"i2cdump -y -f 48 0x58 s 0x9e|tail -n +2|cut -c56-\r",
|
||||
"i2cdump -y -f 57 0x59 s 0x9e|tail -n +2|cut -c56-\r",
|
||||
"i2cdump -y -f 56 0x58 s 0x9e|tail -n +2|cut -c56-\r",
|
||||
};
|
||||
|
||||
static struct attr_pattern temp_in =
|
||||
@ -305,6 +366,31 @@ struct sensor_set model_ssets[SENSOR_TYPE_MAX] =
|
||||
{ PSU_DATA_MAX, INDEX_PSU4_START, tty_cmd[SENSOR_TYPE_PSU4],
|
||||
TTY_PMBUS_INTERVAL, {DECLARE_PSU_ATTR(3), NULL},
|
||||
},
|
||||
{ 1, INDEX_PSU1_MODEL, tty_cmd[SENSOR_TYPE_PSU1_MODEL],
|
||||
TTY_PMBUS_INTERVAL, {DECLARE_PSU_MODEL_NAME_ATTR(0), NULL},
|
||||
},
|
||||
{ 1, INDEX_PSU2_MODEL, tty_cmd[SENSOR_TYPE_PSU2_MODEL],
|
||||
TTY_PMBUS_INTERVAL, {DECLARE_PSU_MODEL_NAME_ATTR(1), NULL},
|
||||
},
|
||||
{ 1, INDEX_PSU3_MODEL, tty_cmd[SENSOR_TYPE_PSU3_MODEL],
|
||||
TTY_PMBUS_INTERVAL, {DECLARE_PSU_MODEL_NAME_ATTR(2), NULL},
|
||||
},
|
||||
{ 1, INDEX_PSU4_MODEL, tty_cmd[SENSOR_TYPE_PSU4_MODEL],
|
||||
TTY_PMBUS_INTERVAL, {DECLARE_PSU_MODEL_NAME_ATTR(3), NULL},
|
||||
},
|
||||
{ 1, INDEX_PSU1_SERIAL, tty_cmd[SENSOR_TYPE_PSU1_SERIAL],
|
||||
TTY_PMBUS_INTERVAL, {DECLARE_PSU_SERIAL_NUMBER_ATTR(0), NULL},
|
||||
},
|
||||
{ 1, INDEX_PSU2_SERIAL, tty_cmd[SENSOR_TYPE_PSU2_SERIAL],
|
||||
TTY_PMBUS_INTERVAL, {DECLARE_PSU_SERIAL_NUMBER_ATTR(1), NULL},
|
||||
},
|
||||
{ 1, INDEX_PSU3_SERIAL, tty_cmd[SENSOR_TYPE_PSU3_SERIAL],
|
||||
TTY_PMBUS_INTERVAL, {DECLARE_PSU_SERIAL_NUMBER_ATTR(2), NULL},
|
||||
},
|
||||
{ 1, INDEX_PSU4_SERIAL, tty_cmd[SENSOR_TYPE_PSU4_SERIAL],
|
||||
TTY_PMBUS_INTERVAL, {DECLARE_PSU_SERIAL_NUMBER_ATTR(3), NULL},
|
||||
},
|
||||
|
||||
};
|
||||
static struct minipack_data *mp_data = NULL;
|
||||
|
||||
@ -359,9 +445,7 @@ static int _tty_open(struct file **fd)
|
||||
kt.c_iflag = IGNPAR;
|
||||
kt.c_oflag = 0;
|
||||
kt.c_lflag = 0;
|
||||
kt.c_cc[VMIN] = (unsigned char)
|
||||
((MAXIMUM_TTY_STRING_LENGTH > 0xFF) ?
|
||||
0xFF : MAXIMUM_TTY_STRING_LENGTH);
|
||||
kt.c_cc[VMIN] = 0;
|
||||
kt.c_cc[VTIME] = 0;
|
||||
tty_set_termios(tty, &kt);
|
||||
|
||||
@ -393,11 +477,9 @@ static int _tty_tx(struct file *tty_fd, const char *str)
|
||||
/*Sanity check*/
|
||||
if (tty_fd == NULL)
|
||||
return -EINVAL;
|
||||
if(!(tty_fd->f_op) || !(tty_fd->f_op->read) ||!(tty_fd->f_op->write)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = tty_fd->f_op->write(tty_fd, str, strlen(str)+1,0);
|
||||
rc = kernel_write(tty_fd, str, strlen(str)+1,0);
|
||||
|
||||
if (rc < 0) {
|
||||
pr_info( "failed to write(%d)\n", rc);
|
||||
return -EBUSY;
|
||||
@ -414,14 +496,11 @@ static int _tty_rx(struct file *tty_fd, char *buf, int max_len)
|
||||
/*Sanity check*/
|
||||
if (tty_fd == NULL)
|
||||
return -EINVAL;
|
||||
if(!(tty_fd->f_op) || !(tty_fd->f_op->read) ||!(tty_fd->f_op->write)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*Clear for remained data cause ambiguous string*/
|
||||
memset(buf, 0, max_len);
|
||||
do {
|
||||
rc = tty_fd->f_op->read(tty_fd, buf, max_len, 0);
|
||||
rc = kernel_read(tty_fd, buf, max_len, 0);
|
||||
if (rc == 0) { /*Buffer Empty, waits. */
|
||||
timeout++;
|
||||
_tty_wait(TTY_RETRY_INTERVAL);
|
||||
@ -441,22 +520,19 @@ static int _tty_rx(struct file *tty_fd, char *buf, int max_len)
|
||||
/*Clear Rx buffer by reading it out.*/
|
||||
static int _tty_clear_rxbuf(struct file *tty_fd, char* buf, size_t max_size) {
|
||||
int rc, i;
|
||||
mm_segment_t old_fs;
|
||||
int retry = TTY_CMD_RETRY;
|
||||
|
||||
if (tty_fd == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
old_fs = get_fs();
|
||||
set_fs(KERNEL_DS);
|
||||
|
||||
i = 0;
|
||||
do {
|
||||
rc = tty_fd->f_op->read(tty_fd, buf, max_size, 0);
|
||||
rc = kernel_read(tty_fd, buf, max_size, 0);
|
||||
memset(buf, 0, max_size);
|
||||
i++;
|
||||
} while (rc > 0 && i < retry);
|
||||
|
||||
set_fs(old_fs);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -464,20 +540,13 @@ static int _tty_writeNread(struct file *tty_fd,
|
||||
char *wr_p, char *rd_p, int rx_max_len, u32 mdelay)
|
||||
{
|
||||
int rc;
|
||||
mm_segment_t old_fs;
|
||||
|
||||
/*Presumed file is opened!*/
|
||||
if (tty_fd == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
if(!(tty_fd->f_op) || !(tty_fd->f_op->read) ||!(tty_fd->f_op->write)) {
|
||||
pr_info("file %s cann't readable or writable?\n", TTY_DEVICE);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
memset(rd_p, 0, rx_max_len);
|
||||
old_fs = get_fs();
|
||||
set_fs(KERNEL_DS);
|
||||
|
||||
rc = _tty_tx(tty_fd, wr_p);
|
||||
if (rc < 0) {
|
||||
DEBUG_INTR( "failed to write(%d)\n", rc);
|
||||
@ -491,7 +560,6 @@ static int _tty_writeNread(struct file *tty_fd,
|
||||
}
|
||||
|
||||
exit:
|
||||
set_fs(old_fs);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -810,6 +878,27 @@ static int get_pmbus_regs_partial(int *in, int in_cnt, int *out, int *out_cnt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int extract_psu_str(int type, char *buf, int *out, int len)
|
||||
{
|
||||
char *ptr;
|
||||
int x, i;
|
||||
|
||||
ptr = buf;
|
||||
|
||||
i=0;
|
||||
for (x = 0; x < strlen(ptr); x++) {
|
||||
if(ptr[x] > 0x7A || ptr[x] <0x1E)
|
||||
continue;
|
||||
|
||||
out[i]=ptr[x];
|
||||
i++;
|
||||
if(i==(len-2))
|
||||
break;
|
||||
}
|
||||
out[len-1]=0x0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int comm2BMC(enum sensor_type_e type, int *out, int out_cnt)
|
||||
{
|
||||
@ -853,6 +942,18 @@ static int comm2BMC(enum sensor_type_e type, int *out, int out_cnt)
|
||||
get_pmbus_regs_partial(reg, total, out, &out_cnt);
|
||||
break;
|
||||
}
|
||||
case SENSOR_TYPE_PSU1_MODEL:
|
||||
case SENSOR_TYPE_PSU2_MODEL:
|
||||
case SENSOR_TYPE_PSU3_MODEL:
|
||||
case SENSOR_TYPE_PSU4_MODEL:
|
||||
ret=extract_psu_str(type, ptr, out, MAX_MODEL_NAME);
|
||||
break;
|
||||
case SENSOR_TYPE_PSU1_SERIAL:
|
||||
case SENSOR_TYPE_PSU2_SERIAL:
|
||||
case SENSOR_TYPE_PSU3_SERIAL:
|
||||
case SENSOR_TYPE_PSU4_SERIAL:
|
||||
ret=extract_psu_str(type ,ptr, out, MAX_SERIAL_NUMBER);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -882,6 +983,18 @@ static int get_type_data (
|
||||
case SENSOR_TYPE_PSU4:
|
||||
*out = &data->psu_data[type-SENSOR_TYPE_PSU1][index];
|
||||
break;
|
||||
case SENSOR_TYPE_PSU1_MODEL:
|
||||
case SENSOR_TYPE_PSU2_MODEL:
|
||||
case SENSOR_TYPE_PSU3_MODEL:
|
||||
case SENSOR_TYPE_PSU4_MODEL:
|
||||
*out = &data->psu_model[type-SENSOR_TYPE_PSU1_MODEL][index];
|
||||
break;
|
||||
case SENSOR_TYPE_PSU1_SERIAL:
|
||||
case SENSOR_TYPE_PSU2_SERIAL:
|
||||
case SENSOR_TYPE_PSU3_SERIAL:
|
||||
case SENSOR_TYPE_PSU4_SERIAL:
|
||||
*out = &data->psu_serial[type-SENSOR_TYPE_PSU1_SERIAL][index];
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -942,6 +1055,9 @@ static ssize_t _attr_show(struct device *dev, struct device_attribute *da,
|
||||
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
|
||||
struct sensor_data* data;
|
||||
int *out = NULL;
|
||||
int i;
|
||||
char model_name[MAX_MODEL_NAME];
|
||||
char serial_number[MAX_SERIAL_NUMBER];
|
||||
enum sensor_type_e type;
|
||||
|
||||
type = attr->index / ATTR_TYPE_INDEX_GAP;
|
||||
@ -959,6 +1075,35 @@ static ssize_t _attr_show(struct device *dev, struct device_attribute *da,
|
||||
if( index > count)
|
||||
return -EINVAL;
|
||||
|
||||
if(type >=SENSOR_TYPE_PSU1_MODEL && type <=SENSOR_TYPE_PSU4_MODEL)
|
||||
{
|
||||
for(i=0; i<MAX_MODEL_NAME; i++)
|
||||
{
|
||||
model_name[i]=out[i];
|
||||
}
|
||||
if(strstr(model_name, "Error")!=NULL)
|
||||
{
|
||||
model_name[0]='\0';
|
||||
}
|
||||
|
||||
return sprintf(buf, "%s\n", model_name);
|
||||
}
|
||||
if(type >=SENSOR_TYPE_PSU1_SERIAL && type <=SENSOR_TYPE_PSU4_SERIAL)
|
||||
{
|
||||
|
||||
for(i=0; i<MAX_SERIAL_NUMBER; i++)
|
||||
{
|
||||
serial_number[i]=out[i];
|
||||
}
|
||||
if(strstr(serial_number, "Error")!=NULL)
|
||||
{
|
||||
serial_number[0]='\0';
|
||||
}
|
||||
return sprintf(buf, "%s\n", serial_number);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return sprintf(buf, "%d\n", *out);
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user