diff --git a/src/plugins/AMD.cpp b/src/plugins/AMD.cpp index 66020b6..0734e6d 100644 --- a/src/plugins/AMD.cpp +++ b/src/plugins/AMD.cpp @@ -1064,6 +1064,44 @@ std::vector> getMinCoreClock(AMDGPUData data) { }}; } +std::vector> getSlowdownTemperature(AMDGPUData data) { + auto string = fileContents(data.hwmonPath + "/temp1_crit"); + if (!string.has_value()) + return {}; + + // millicelsius -> celsius + StaticReadable sr{static_cast(std::stoi(*string)) / 1000, _("°C")}; + + return {DeviceNode{ + .name = _("Slowdown Temperature"), + .interface = sr, + .hash = md5(data.pciId + "Slowdown Temperature"), + }}; +} + +std::vector> getShutdownTemperature(AMDGPUData data) { + auto string = fileContents(data.hwmonPath + "/temp1_emergency"); + if (!string.has_value()) + return {}; + + // millicelsius -> celsius + StaticReadable sr{static_cast(std::stoi(*string)) / 1000, _("°C")}; + + return {DeviceNode{ + .name = _("Shutdown Temperature"), + .interface = sr, + .hash = md5(data.pciId + "Shutdown Temperature"), + }}; +} + +std::vector> getTemperatureRoot(AMDGPUData data) { + return {DeviceNode{ + .name = _("Temperatures"), + .interface = std::nullopt, + .hash = md5(data.pciId + "Temperatures"), + }}; +} + std::vector> getVoltFreqRoot(AMDGPUData data) { if (data.ppTableType.has_value() && (*data.ppTableType == Navi || *data.ppTableType == SMU13)) @@ -1154,7 +1192,11 @@ std::vector> getGPUName(AMDGPUData data) { // clang-format off auto gpuTree = TreeConstructor{ getGPUName, { - {getTemperature, {}}, + {getTemperatureRoot, { + {getTemperature, {}}, + {getSlowdownTemperature, {}}, + {getShutdownTemperature, {}} + }}, {getFanRoot, { {getFanMode, {}}, {getFanSpeedWrite, {}},