diff options
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/1819-drm-amd-powerplay-support-hwmon-temperature-channel-.patch')
-rw-r--r-- | meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/1819-drm-amd-powerplay-support-hwmon-temperature-channel-.patch | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/1819-drm-amd-powerplay-support-hwmon-temperature-channel-.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/1819-drm-amd-powerplay-support-hwmon-temperature-channel-.patch new file mode 100644 index 00000000..47ca5902 --- /dev/null +++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/1819-drm-amd-powerplay-support-hwmon-temperature-channel-.patch @@ -0,0 +1,120 @@ +From 8b95e8e5253af99aab2fdfb904cfe44ea922fadf Mon Sep 17 00:00:00 2001 +From: Evan Quan <evan.quan@amd.com> +Date: Wed, 17 Apr 2019 15:45:08 +0800 +Subject: [PATCH 1819/2940] drm/amd/powerplay: support hwmon temperature + channel labels V2 + +Expose temp[1-3]_label hwmon interfaces. While temp2_label +and temp3_label are visible for SOC15 dGPUs only. + +- V2: correct temp1_label as "edge" + +Change-Id: I7f1e10c52ec21d272027554cdf6da97103e0be58 +Signed-off-by: Evan Quan <evan.quan@amd.com> +Reviewed-by: Alex Deucher <alexander.deucher@amd.com> +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 34 ++++++++++++++++++- + .../gpu/drm/amd/include/kgd_pp_interface.h | 7 ++++ + 2 files changed, 40 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +index 7e364c05d0cf..a3e9b5d27c72 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +@@ -67,6 +67,15 @@ static const struct cg_flag_name clocks[] = { + {0, NULL}, + }; + ++static const struct hwmon_temp_label { ++ enum PP_HWMON_TEMP channel; ++ const char *label; ++} temp_label[] = { ++ {PP_TEMP_EDGE, "edge"}, ++ {PP_TEMP_JUNCTION, "junction"}, ++ {PP_TEMP_MEM, "mem"}, ++}; ++ + void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev) + { + if (adev->pm.dpm_enabled) { +@@ -1458,6 +1467,18 @@ static ssize_t amdgpu_hwmon_show_mem_temp_thresh(struct device *dev, + return snprintf(buf, PAGE_SIZE, "%d\n", temp); + } + ++static ssize_t amdgpu_hwmon_show_temp_label(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) ++{ ++ int channel = to_sensor_dev_attr(attr)->index; ++ ++ if (channel >= PP_TEMP_MAX) ++ return -EINVAL; ++ ++ return snprintf(buf, PAGE_SIZE, "%s\n", temp_label[channel].label); ++} ++ + static ssize_t amdgpu_hwmon_show_temp_emergency(struct device *dev, + struct device_attribute *attr, + char *buf) +@@ -2056,6 +2077,9 @@ static ssize_t amdgpu_hwmon_show_mclk_label(struct device *dev, + * - temp[1-3]_input: the on die GPU temperature in millidegrees Celsius + * - temp2_input and temp3_input are supported on SOC15 dGPUs only + * ++ * - temp[1-3]_label: temperature channel label ++ * - temp2_label and temp3_label are supported on SOC15 dGPUs only ++ * + * - temp[1-3]_crit: temperature critical max value in millidegrees Celsius + * - temp2_crit and temp3_crit are supported on SOC15 dGPUs only + * +@@ -2123,6 +2147,9 @@ static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, amdgpu_hwmon_show_temp, NULL, PP + static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, amdgpu_hwmon_show_mem_temp_thresh, NULL, 0); + static SENSOR_DEVICE_ATTR(temp3_crit_hyst, S_IRUGO, amdgpu_hwmon_show_mem_temp_thresh, NULL, 1); + static SENSOR_DEVICE_ATTR(temp3_emergency, S_IRUGO, amdgpu_hwmon_show_temp_emergency, NULL, PP_TEMP_MEM); ++static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, amdgpu_hwmon_show_temp_label, NULL, PP_TEMP_EDGE); ++static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, amdgpu_hwmon_show_temp_label, NULL, PP_TEMP_JUNCTION); ++static SENSOR_DEVICE_ATTR(temp3_label, S_IRUGO, amdgpu_hwmon_show_temp_label, NULL, PP_TEMP_MEM); + static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, amdgpu_hwmon_get_pwm1, amdgpu_hwmon_set_pwm1, 0); + static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, amdgpu_hwmon_get_pwm1_enable, amdgpu_hwmon_set_pwm1_enable, 0); + static SENSOR_DEVICE_ATTR(pwm1_min, S_IRUGO, amdgpu_hwmon_get_pwm1_min, NULL, 0); +@@ -2158,6 +2185,9 @@ static struct attribute *hwmon_attributes[] = { + &sensor_dev_attr_temp1_emergency.dev_attr.attr, + &sensor_dev_attr_temp2_emergency.dev_attr.attr, + &sensor_dev_attr_temp3_emergency.dev_attr.attr, ++ &sensor_dev_attr_temp1_label.dev_attr.attr, ++ &sensor_dev_attr_temp2_label.dev_attr.attr, ++ &sensor_dev_attr_temp3_label.dev_attr.attr, + &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_pwm1_enable.dev_attr.attr, + &sensor_dev_attr_pwm1_min.dev_attr.attr, +@@ -2291,7 +2321,9 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj, + attr == &sensor_dev_attr_temp2_emergency.dev_attr.attr || + attr == &sensor_dev_attr_temp3_emergency.dev_attr.attr || + attr == &sensor_dev_attr_temp2_input.dev_attr.attr || +- attr == &sensor_dev_attr_temp3_input.dev_attr.attr)) ++ attr == &sensor_dev_attr_temp3_input.dev_attr.attr || ++ attr == &sensor_dev_attr_temp2_label.dev_attr.attr || ++ attr == &sensor_dev_attr_temp3_label.dev_attr.attr)) + return 0; + + return effective_mode; +diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h +index a8bf8e90ceeb..30788d510576 100644 +--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h ++++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h +@@ -162,6 +162,13 @@ struct pp_states_info { + uint32_t states[16]; + }; + ++enum PP_HWMON_TEMP { ++ PP_TEMP_EDGE = 0, ++ PP_TEMP_JUNCTION, ++ PP_TEMP_MEM, ++ PP_TEMP_MAX ++}; ++ + #define PP_GROUP_MASK 0xF0000000 + #define PP_GROUP_SHIFT 28 + +-- +2.17.1 + |