return 0;
}
+/**
+ * @brief Save the initial state of thermal for h/w resource
+ * before PASS (Power Aware System Service) daemon starting
+ * @param [in] res Instance of h/w resource
+ * @return @c 0 on success, otherwise error value
+ */
+static int pass_hal_save_thermal_initdata(struct pass_resource *res)
+{
+ struct pass_resource_init_data *initdata = &res->init_data;
+
+ initdata->tmu.cooling_device_state
+ = pass_hal_get_cooling_device_state(res);
+
+ return 0;
+}
+
/**
* @brief Restore the saved state of DVFS(Dynamic Voltage and Frequency
* Scaling) resource when PASS (Power Aware System Service) daemon
return 0;
}
+/**
+ * @brief Restore the saved state of thermal for h/w resource
+ * before PASS (Power Aware System Service) daemon starting
+ * @param [in] res Instance of h/w resource
+ * @return @c 0 on success, otherwise error value
+ */
+static int pass_hal_restore_thermal_initdata(struct pass_resource *res)
+{
+ struct pass_resource_init_data *initdata = &res->init_data;
+ int cooling_device_state = initdata->tmu.cooling_device_state;
+ int ret;
+
+ if (cooling_device_state >= 0) {
+ ret = pass_hal_set_cooling_device_state(res, cooling_device_state);
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
/**
* @brief Save the initial state of h/w resource before PASS
* (Power Aware System Service) daemon starting
res->config_data.res_name);
return ret;
}
+
+ ret = pass_hal_save_thermal_initdata(res);
+ if (ret < 0) {
+ _E("Failed to save thermal initdata for '%s' resource",
+ res->config_data.res_name);
+ return ret;
+ }
break;
case PASS_RESOURCE_MEMORY_ID:
ret = pass_hal_save_memory_initdata(res);
res->config_data.res_name);
return ret;
}
+
+ ret = pass_hal_restore_thermal_initdata(res);
+ if (ret < 0) {
+ _E("Failed to restore thermal initdata for '%s' resource",
+ res->config_data.res_name);
+ return ret;
+ }
break;
case PASS_RESOURCE_MEMORY_ID:
ret = pass_hal_restore_memory_initdata(res);