Skip to content

Commit

Permalink
hwmon: (occ) Add soft minimum power cap attribute
Browse files Browse the repository at this point in the history
Export the power caps data for the soft minimum power cap through hwmon.

OpenBMC-Staging-Count: 1
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Link: https://lore.kernel.org/r/20220215151022.7498-5-eajames@linux.ibm.com
Signed-off-by: Joel Stanley <joel@jms.id.au>
  • Loading branch information
Eddie James authored and shenki committed Feb 24, 2022
1 parent daaee92 commit 2b8d17d
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions drivers/hwmon/occ/common.c
Expand Up @@ -674,6 +674,9 @@ static ssize_t occ_show_caps_3(struct device *dev,
case 7:
val = caps->user_source;
break;
case 8:
val = get_unaligned_be16(&caps->soft_min) * 1000000ULL;
break;
default:
return -EINVAL;
}
Expand Down Expand Up @@ -835,12 +838,13 @@ static int occ_setup_sensor_attrs(struct occ *occ)
case 1:
num_attrs += (sensors->caps.num_sensors * 7);
break;
case 3:
show_caps = occ_show_caps_3;
fallthrough;
case 2:
num_attrs += (sensors->caps.num_sensors * 8);
break;
case 3:
show_caps = occ_show_caps_3;
num_attrs += (sensors->caps.num_sensors * 9);
break;
default:
sensors->caps.num_sensors = 0;
}
Expand Down Expand Up @@ -1047,6 +1051,15 @@ static int occ_setup_sensor_attrs(struct occ *occ)
attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
show_caps, NULL, 7, 0);
attr++;

if (sensors->caps.version > 2) {
snprintf(attr->name, sizeof(attr->name),
"power%d_cap_min_soft", s);
attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
show_caps, NULL,
8, 0);
attr++;
}
}
}

Expand Down

0 comments on commit 2b8d17d

Please sign in to comment.