Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/thd_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,22 +253,19 @@ void cthd_engine::enable_power_floor_event()
++current_zone_index;
}

int cthd_engine::check_acpi_platform_profile() {
// Check PM profile and fail to start for non mobile platforms
void cthd_engine::check_acpi_platform_profile() {
// Check PM profile and warn to start on non-mobile platforms
csys_fs pm_profile_fs("/sys/firmware/acpi/pm_profile");
if (pm_profile_fs.exists()) {
std::string pm_profile;
pm_profile_fs.read("", pm_profile);
thd_log_info("PM profile is %s\n", pm_profile.c_str());
if (pm_profile != "2" && pm_profile != "8") {
thd_log_error("Non mobile platform, exiting..\n");
return THD_FATAL_ERROR;
thd_log_warn("Non-mobile platform: thermal tables may not have been validated.\n");
}
Comment on lines 262 to 265

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking to turn this function to void

} else {
thd_log_info("PM profile is not available, skipping check\n");
}

return THD_SUCCESS;
}

void cthd_engine::thd_parse_features()
Expand Down Expand Up @@ -297,10 +294,6 @@ int cthd_engine::thd_engine_init(bool ignore_cpuid_check, bool adaptive) {
thd_log_debug("Ignore CPU ID check for MSRs\n");
proc_list_matched = true;
} else {
if (check_acpi_platform_profile() != THD_SUCCESS) {
return THD_FATAL_ERROR;
}

check_cpu_id();

if (!proc_list_matched) {
Expand All @@ -311,6 +304,8 @@ int cthd_engine::thd_engine_init(bool ignore_cpuid_check, bool adaptive) {
return THD_ERROR;
}
}

check_acpi_platform_profile();
}
Comment on lines 306 to 309

ret = read_thermal_sensors();
Expand Down
2 changes: 1 addition & 1 deletion src/thd_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class cthd_engine {
void parser_deinit();
int debug_mode_on(void);

int check_acpi_platform_profile();
void check_acpi_platform_profile();

int check_feature(thermald_feature_names_t feature) {
if (feature >= MAX_FEATURE) {
Expand Down
4 changes: 1 addition & 3 deletions src/thd_engine_adaptive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,7 @@ int cthd_engine_adaptive::thd_engine_init(bool ignore_cpuid_check,
size_t size;
int res;

if (check_acpi_platform_profile() != THD_SUCCESS) {
return THD_FATAL_ERROR;
}
check_acpi_platform_profile();

thd_parse_features();

Expand Down
Loading