Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ enum cpld_type {
as9726_32d_fpga,
as9726_32d_cpld1,
as9726_32d_cpld2,
as9726_32d_cpld_cpu
as9726_32d_cpu_cpld
};

struct as9726_32d_cpld_data {
Expand All @@ -62,7 +62,7 @@ static const struct i2c_device_id as9726_32d_cpld_id[] = {
{ "as9726_32d_fpga", as9726_32d_fpga },
{ "as9726_32d_cpld1", as9726_32d_cpld1 },
{ "as9726_32d_cpld2", as9726_32d_cpld2 },
{ "as9726_32d_cpld_cpu", as9726_32d_cpld_cpu },
{ "as9726_32d_cpu_cpld", as9726_32d_cpu_cpld },
{ }
};
MODULE_DEVICE_TABLE(i2c, as9726_32d_cpld_id);
Expand Down Expand Up @@ -353,6 +353,16 @@ static const struct attribute_group as9726_32d_cpld2_group = {
.attrs = as9726_32d_cpld2_attributes,
};

static struct attribute *as9726_32d_cpu_cpld_attributes[] = {
&sensor_dev_attr_version.dev_attr.attr,
&sensor_dev_attr_access.dev_attr.attr,
NULL
};

static const struct attribute_group as9726_32d_cpu_cpld_group = {
.attrs = as9726_32d_cpu_cpld_attributes,
};

static ssize_t show_present_all(struct device *dev,
struct device_attribute *da, char *buf)
{
Expand Down Expand Up @@ -847,13 +857,14 @@ static int as9726_32d_cpld_probe(struct i2c_client *client,
case as9726_32d_cpld2:
group = &as9726_32d_cpld2_group;
break;
case as9726_32d_cpld_cpu:
/* Disable CPLD reset to avoid DUT will be reset.
*/
status=as9726_32d_cpld_write_internal(client, 0x3, 0x0);
if (status < 0)
dev_dbg(&client->dev, "cpu_cpld reg 0x65 err %d\n", status);

case as9726_32d_cpu_cpld:
group = &as9726_32d_cpu_cpld_group;
/* Disable CPLD reset to avoid DUT will be reset.
*/
status=as9726_32d_cpld_write_internal(client, 0x3, 0x0);
if (status < 0)
dev_dbg(&client->dev, "cpu_cpld reg 0x65 err %d\n", status);
break;
default:
break;
}
Expand Down Expand Up @@ -891,6 +902,9 @@ static int as9726_32d_cpld_remove(struct i2c_client *client)
case as9726_32d_cpld2:
group = &as9726_32d_cpld2_group;
break;
case as9726_32d_cpu_cpld:
group = &as9726_32d_cpu_cpld_group;
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da,
/* fan related data, the index should match sysfs_fan_attributes
*/
static const u8 fan_reg[] = {
0x01, /* fan cpld version */
0x0F, /* fan 1-6 present status */
0x10, /* fan 1-6 direction(0:F2B 1:B2F) */
0x11, /* fan PWM(for all fan) */
Expand Down Expand Up @@ -78,6 +79,7 @@ enum fan_id {
};

enum sysfs_fan_attributes {
VERSION,
FAN_PRESENT_REG,
FAN_DIRECTION_REG,
FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */
Expand Down Expand Up @@ -115,6 +117,11 @@ enum sysfs_fan_attributes {

/* Define attributes
*/
#define DECLARE_VERSION_SENSOR_DEV_ATTR() \
static SENSOR_DEVICE_ATTR(version, S_IRUGO, fan_show_value, NULL, VERSION)
#define DECLARE_VERSION_ATTR() \
&sensor_dev_attr_version.dev_attr.attr

#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index) \
static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, \
fan_show_value, NULL, FAN##index##_FAULT)
Expand Down Expand Up @@ -152,6 +159,8 @@ enum sysfs_fan_attributes {
&sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \
&sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr

/* FAN CPLD Version */
DECLARE_VERSION_SENSOR_DEV_ATTR();
/* 6 fan fault attributes in this platform */
DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1);
DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2);
Expand Down Expand Up @@ -185,6 +194,7 @@ DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR();

static struct attribute *as9726_32d_fan_attributes[] = {
/* fan related attributes */
DECLARE_VERSION_ATTR(),
DECLARE_FAN_FAULT_ATTR(1),
DECLARE_FAN_FAULT_ATTR(2),
DECLARE_FAN_FAULT_ATTR(3),
Expand Down Expand Up @@ -380,6 +390,9 @@ static ssize_t fan_show_value(struct device *dev, struct device_attribute *da,
data->reg_val[FAN_DIRECTION_REG],
attr->index - FAN1_DIRECTION));
break;
case VERSION:
ret = sprintf(buf, "%u\n", data->reg_val[VERSION]);
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@

#define IDPROM_PATH "/sys/bus/i2c/devices/13-0056/eeprom"

#define BIOS_VER_PATH "/sys/devices/virtual/dmi/id/bios_version"
#define MFU_VER_PATH "/var/tmp/last_updated_MFU_version"

enum onlp_thermal_id
{
THERMAL_RESERVED = 0,
Expand Down Expand Up @@ -105,4 +108,13 @@ int psu_serial_number_get(int id, char *serial, int serial_len);
#define DEBUG_PRINT(format, ...)
#endif

#define AIM_FREE_IF_PTR(p) \
do \
{ \
if (p) { \
aim_free(p); \
p = NULL; \
} \
} while (0)

#endif /* __PLATFORM_LIB_H__ */
Loading