aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
diff options
context:
space:
mode:
authorEvan Quan <evan.quan@amd.com>2019-04-17 23:53:04 -0400
committerAlex Deucher <alexander.deucher@amd.com>2019-05-24 13:20:47 -0400
commit901cb599dbc233fc325e3602e7c1218d2c24359c (patch)
treeb08e0ba946b8355571217be1152c58d8ce5fc56c /drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
parent437ccd175a7a3c9871536a26b2d28e3c99515e7f (diff)
drm/amd/powerplay: support temperature emergency max values
These new interfaces(temp1_emergency, temp2_emergency, temp3_emergency) are supported on SOC15 dGPUs only. Signed-off-by: Evan Quan <evan.quan@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 1f78deadb770..7093b4efc3a7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -1446,6 +1446,32 @@ static ssize_t amdgpu_hwmon_show_mem_temp_thresh(struct device *dev,
1446 return snprintf(buf, PAGE_SIZE, "%d\n", temp); 1446 return snprintf(buf, PAGE_SIZE, "%d\n", temp);
1447} 1447}
1448 1448
1449static ssize_t amdgpu_hwmon_show_temp_emergency(struct device *dev,
1450 struct device_attribute *attr,
1451 char *buf)
1452{
1453 struct amdgpu_device *adev = dev_get_drvdata(dev);
1454 int channel = to_sensor_dev_attr(attr)->index;
1455 int temp = 0;
1456
1457 if (channel >= PP_TEMP_MAX)
1458 return -EINVAL;
1459
1460 switch (channel) {
1461 case PP_TEMP_JUNCTION:
1462 temp = adev->pm.dpm.thermal.max_hotspot_emergency_temp;
1463 break;
1464 case PP_TEMP_EDGE:
1465 temp = adev->pm.dpm.thermal.max_edge_emergency_temp;
1466 break;
1467 case PP_TEMP_MEM:
1468 temp = adev->pm.dpm.thermal.max_mem_emergency_temp;
1469 break;
1470 }
1471
1472 return snprintf(buf, PAGE_SIZE, "%d\n", temp);
1473}
1474
1449static ssize_t amdgpu_hwmon_get_pwm1_enable(struct device *dev, 1475static ssize_t amdgpu_hwmon_get_pwm1_enable(struct device *dev,
1450 struct device_attribute *attr, 1476 struct device_attribute *attr,
1451 char *buf) 1477 char *buf)
@@ -2023,6 +2049,9 @@ static ssize_t amdgpu_hwmon_show_mclk_label(struct device *dev,
2023 * - temp[1-3]_crit_hyst: temperature hysteresis for critical limit in millidegrees Celsius 2049 * - temp[1-3]_crit_hyst: temperature hysteresis for critical limit in millidegrees Celsius
2024 * - temp2_crit_hyst and temp3_crit_hyst are supported on SOC15 dGPUs only 2050 * - temp2_crit_hyst and temp3_crit_hyst are supported on SOC15 dGPUs only
2025 * 2051 *
2052 * - temp[1-3]_emergency: temperature emergency max value(asic shutdown) in millidegrees Celsius
2053 * - these are supported on SOC15 dGPUs only
2054 *
2026 * hwmon interfaces for GPU voltage: 2055 * hwmon interfaces for GPU voltage:
2027 * 2056 *
2028 * - in0_input: the voltage on the GPU in millivolts 2057 * - in0_input: the voltage on the GPU in millivolts
@@ -2072,10 +2101,13 @@ static ssize_t amdgpu_hwmon_show_mclk_label(struct device *dev,
2072static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, amdgpu_hwmon_show_temp, NULL, 0); 2101static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, amdgpu_hwmon_show_temp, NULL, 0);
2073static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, amdgpu_hwmon_show_temp_thresh, NULL, 0); 2102static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, amdgpu_hwmon_show_temp_thresh, NULL, 0);
2074static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, amdgpu_hwmon_show_temp_thresh, NULL, 1); 2103static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, amdgpu_hwmon_show_temp_thresh, NULL, 1);
2104static SENSOR_DEVICE_ATTR(temp1_emergency, S_IRUGO, amdgpu_hwmon_show_temp_emergency, NULL, PP_TEMP_EDGE);
2075static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, amdgpu_hwmon_show_hotspot_temp_thresh, NULL, 0); 2105static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, amdgpu_hwmon_show_hotspot_temp_thresh, NULL, 0);
2076static SENSOR_DEVICE_ATTR(temp2_crit_hyst, S_IRUGO, amdgpu_hwmon_show_hotspot_temp_thresh, NULL, 1); 2106static SENSOR_DEVICE_ATTR(temp2_crit_hyst, S_IRUGO, amdgpu_hwmon_show_hotspot_temp_thresh, NULL, 1);
2107static SENSOR_DEVICE_ATTR(temp2_emergency, S_IRUGO, amdgpu_hwmon_show_temp_emergency, NULL, PP_TEMP_JUNCTION);
2077static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, amdgpu_hwmon_show_mem_temp_thresh, NULL, 0); 2108static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, amdgpu_hwmon_show_mem_temp_thresh, NULL, 0);
2078static SENSOR_DEVICE_ATTR(temp3_crit_hyst, S_IRUGO, amdgpu_hwmon_show_mem_temp_thresh, NULL, 1); 2109static SENSOR_DEVICE_ATTR(temp3_crit_hyst, S_IRUGO, amdgpu_hwmon_show_mem_temp_thresh, NULL, 1);
2110static SENSOR_DEVICE_ATTR(temp3_emergency, S_IRUGO, amdgpu_hwmon_show_temp_emergency, NULL, PP_TEMP_MEM);
2079static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, amdgpu_hwmon_get_pwm1, amdgpu_hwmon_set_pwm1, 0); 2111static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, amdgpu_hwmon_get_pwm1, amdgpu_hwmon_set_pwm1, 0);
2080static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, amdgpu_hwmon_get_pwm1_enable, amdgpu_hwmon_set_pwm1_enable, 0); 2112static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, amdgpu_hwmon_get_pwm1_enable, amdgpu_hwmon_set_pwm1_enable, 0);
2081static SENSOR_DEVICE_ATTR(pwm1_min, S_IRUGO, amdgpu_hwmon_get_pwm1_min, NULL, 0); 2113static SENSOR_DEVICE_ATTR(pwm1_min, S_IRUGO, amdgpu_hwmon_get_pwm1_min, NULL, 0);
@@ -2106,6 +2138,9 @@ static struct attribute *hwmon_attributes[] = {
2106 &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr, 2138 &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr,
2107 &sensor_dev_attr_temp3_crit.dev_attr.attr, 2139 &sensor_dev_attr_temp3_crit.dev_attr.attr,
2108 &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr, 2140 &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr,
2141 &sensor_dev_attr_temp1_emergency.dev_attr.attr,
2142 &sensor_dev_attr_temp2_emergency.dev_attr.attr,
2143 &sensor_dev_attr_temp3_emergency.dev_attr.attr,
2109 &sensor_dev_attr_pwm1.dev_attr.attr, 2144 &sensor_dev_attr_pwm1.dev_attr.attr,
2110 &sensor_dev_attr_pwm1_enable.dev_attr.attr, 2145 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
2111 &sensor_dev_attr_pwm1_min.dev_attr.attr, 2146 &sensor_dev_attr_pwm1_min.dev_attr.attr,
@@ -2234,7 +2269,10 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
2234 (attr == &sensor_dev_attr_temp2_crit.dev_attr.attr || 2269 (attr == &sensor_dev_attr_temp2_crit.dev_attr.attr ||
2235 attr == &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr || 2270 attr == &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr ||
2236 attr == &sensor_dev_attr_temp3_crit.dev_attr.attr || 2271 attr == &sensor_dev_attr_temp3_crit.dev_attr.attr ||
2237 attr == &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr)) 2272 attr == &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr ||
2273 attr == &sensor_dev_attr_temp1_emergency.dev_attr.attr ||
2274 attr == &sensor_dev_attr_temp2_emergency.dev_attr.attr ||
2275 attr == &sensor_dev_attr_temp3_emergency.dev_attr.attr))
2238 return 0; 2276 return 0;
2239 2277
2240 return effective_mode; 2278 return effective_mode;