Skip to content

Commit

Permalink
[Edgecore][device][platform] PSU module support low threshold(=0) and…
Browse files Browse the repository at this point in the history
… renaming sensors label.

Signed-off-by: michael_shih <michael_shih@edge-core.com>
  • Loading branch information
ec-michael-shih committed Apr 28, 2023
1 parent 33fdc12 commit 14491ab
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 37 deletions.
88 changes: 76 additions & 12 deletions device/accton/x86_64-accton_as9736_64d-r0/platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,95 +158,159 @@
],
"thermals": [
{
"name": "Temp sensor 1",
"name": "SMB_RearMiddle_temp(0x48)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "Temp sensor 2",
"name": "SMB_FrontMiddle_temp(0x49)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "Temp sensor 3",
"name": "SMB_LeftMiddle_temp(0x4C)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "Temp sensor 4",
"name": "FCM_Center_temp(0x48)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "Temp sensor 5",
"name": "FCM_Left_temp(0x49)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "Temp sensor 6",
"name": "PDB-L_temp(0x48)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "Temp sensor 7",
"name": "PDB-R_temp(0x49)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "Temp sensor 8",
"name": "UDB_RearLeft_temp_temp(0x48)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "Temp sensor 9",
"name": "UDB_RearMiddle_temp_temp(0x4C)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "Temp sensor 10",
"name": "LDB_FrontRight_temp_temp(0x4C)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "Temp sensor 11",
"name": "LDB_RearRight_temp_temp(0x4D)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "CPU Temp",
"name": "CPU_Package_temp",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "CPU_Core_0_temp",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "CPU_Core_1_temp",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "CPU_Core_2_temp",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "CPU_Core_3_temp",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "CPU_Core_4_temp",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "CPU_Core_5_temp",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "CPU_Core_6_temp",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "CPU_Core_7_temp",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#define PMBUS_REGISTER_READ_IOUT_MAX 0xa6
#define PMBUS_REGISTER_READ_POUT_MAX 0xa7
#define PMBUS_REGISTER_READ_TEMP_MAX 0xa8
#define PMBUS_REGISTER_READ_TEMP_MIN 0xa9

#define MAX_FAN_DUTY_CYCLE 100
#define I2C_RW_RETRY_COUNT 10
Expand Down Expand Up @@ -91,6 +92,7 @@ struct accton_i2c_psu_data {
u16 mfr_vout_min; /* Register value */
u16 mfr_vout_max; /* Register value */
u16 mfr_tambient_max; /* Register value */
u16 mfr_tambient_min; /* Register value */
};

static ssize_t show_linear(struct device *dev, struct device_attribute *da, char *buf);
Expand Down Expand Up @@ -130,7 +132,8 @@ enum accton_i2c_psu_sysfs_attributes {
PSU_MFR_IOUT_MAX,
PSU_MFR_PIN_MAX,
PSU_MFR_POUT_MAX,
PSU_MFR_TAMBIENT_MAX
PSU_MFR_TAMBIENT_MAX,
PSU_MFR_TAMBIENT_MIN
};

/* sysfs attributes for hwmon
Expand Down Expand Up @@ -159,6 +162,7 @@ static SENSOR_DEVICE_ATTR(psu_mfr_iout_max, S_IRUGO, show_linear, NULL, PSU_MF
static SENSOR_DEVICE_ATTR(psu_mfr_pin_max, S_IRUGO, show_linear, NULL, PSU_MFR_PIN_MAX);
static SENSOR_DEVICE_ATTR(psu_mfr_pout_max, S_IRUGO, show_linear, NULL, PSU_MFR_POUT_MAX);
static SENSOR_DEVICE_ATTR(psu_temp1_max, S_IRUGO, show_linear, NULL, PSU_MFR_TAMBIENT_MAX);
static SENSOR_DEVICE_ATTR(psu_temp1_min, S_IRUGO, show_linear, NULL, PSU_MFR_TAMBIENT_MIN);


/*Duplicate nodes for lm-sensors.*/
Expand Down Expand Up @@ -195,6 +199,7 @@ static struct attribute *accton_i2c_psu_attributes[] = {
&sensor_dev_attr_psu_mfr_vout_max.dev_attr.attr,
&sensor_dev_attr_psu_mfr_iout_max.dev_attr.attr,
&sensor_dev_attr_psu_temp1_max.dev_attr.attr,
&sensor_dev_attr_psu_temp1_min.dev_attr.attr,
/*Duplicate nodes for lm-sensors.*/
&sensor_dev_attr_curr2_input.dev_attr.attr,
&sensor_dev_attr_in3_input.dev_attr.attr,
Expand Down Expand Up @@ -272,6 +277,9 @@ static ssize_t show_linear(struct device *dev, struct device_attribute *da,
case PSU_MFR_TAMBIENT_MAX:
value = data->mfr_tambient_max;
break;
case PSU_MFR_TAMBIENT_MIN:
value = data->mfr_tambient_min;
break;
case PSU_FAN1_DUTY_CYCLE:
multiplier = 1;
value = data->fan_duty_cycle[0];
Expand Down Expand Up @@ -602,6 +610,7 @@ static struct accton_i2c_psu_data *accton_i2c_psu_update_device(struct device *d
{PMBUS_REGISTER_READ_IOUT_MAX, &data->mfr_iout_max},
{PMBUS_REGISTER_READ_POUT_MAX, &data->mfr_pout_max},
{PMBUS_REGISTER_READ_TEMP_MAX, &data->mfr_tambient_max},
{PMBUS_REGISTER_READ_TEMP_MIN, &data->mfr_tambient_min},
};

dev_dbg(&client->dev, "Starting accton_i2c_psu update\n");
Expand Down Expand Up @@ -687,3 +696,4 @@ MODULE_LICENSE("GPL");

module_init(accton_i2c_psu_init);
module_exit(accton_i2c_psu_exit);

0 comments on commit 14491ab

Please sign in to comment.