diff options
Diffstat (limited to 'queue-5.15/hwmon-occ-add-soft-minimum-power-cap-attribute.patch')
-rw-r--r-- | queue-5.15/hwmon-occ-add-soft-minimum-power-cap-attribute.patch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/queue-5.15/hwmon-occ-add-soft-minimum-power-cap-attribute.patch b/queue-5.15/hwmon-occ-add-soft-minimum-power-cap-attribute.patch new file mode 100644 index 0000000000..e60b63e01e --- /dev/null +++ b/queue-5.15/hwmon-occ-add-soft-minimum-power-cap-attribute.patch @@ -0,0 +1,71 @@ +From 0f856e83fb99833ea451815ed3f4538dbcd315ba Mon Sep 17 00:00:00 2001 +From: Sasha Levin <sashal@kernel.org> +Date: Tue, 15 Feb 2022 09:10:22 -0600 +Subject: hwmon: (occ) Add soft minimum power cap attribute + +From: Eddie James <eajames@linux.ibm.com> + +[ Upstream commit 84dc9e8a7eec2cdff00728baedf0fb35fc7c11e8 ] + +Export the power caps data for the soft minimum power cap through hwmon. + +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: Guenter Roeck <linux@roeck-us.net> +Stable-dep-of: 744c2fe950e9 ("hwmon: (occ) Rework attribute registration for stack usage") +Signed-off-by: Sasha Levin <sashal@kernel.org> +--- + drivers/hwmon/occ/common.c | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c +index bbe5e4ef4113c..1757f3ab842e1 100644 +--- a/drivers/hwmon/occ/common.c ++++ b/drivers/hwmon/occ/common.c +@@ -675,6 +675,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; + } +@@ -836,12 +839,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; + } +@@ -1048,6 +1052,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++; ++ } + } + } + +-- +2.39.5 + |