/* Get the policy of thermal management unit. */
int (*get_policy)(char *res_thermal_name, char *policy);
+
+ /* Get and set the state of thermal cooling-device */
+ int (*set_cooling_device_state)(char *coolign_device_name, int state);
+ int (*get_cooling_device_state)(char *cooling_device_name);
+
+ /* Get the maximum state of thermal cooling-device */
+ int (*get_cooling_device_max_state)(char *cooling_device_name);
};
/*
/* Get the policy of thermal management unit. */
int hal_power_thermal_get_policy(unsigned int res_type, char *res_thermal_name, char *policy);
+/* Get and set the state of thermal cooling-device */
+int hal_power_thermal_set_cooling_device_state(unsigned int device_type, char *cooling_device_name, int state);
+int hal_power_thermal_get_cooling_device_state(unsigned int device_type, char *cooling_device_name);
+
+/* Get maximum state of thermal cooling-device */
+int hal_power_thermal_get_cooling_device_max_state(unsigned int device_type, char *cooling_device_name);
+
/**
* Memory Operation for Memory H/W
*/
return tmu->get_policy(res_thermal_name, policy);
}
+/* Get and set the state of thermal cooling-device */
+EXPORT int hal_power_thermal_set_cooling_device_state(unsigned int device_type,
+ char *cooling_device_name,
+ int state)
+{
+ struct pass_resource_tmu_ops *tmu;
+
+ if (!g_power_funcs)
+ return -ENOTSUP;
+
+ if (!cooling_device_name || state < 0)
+ return -EINVAL;
+
+ tmu = get_tmu(g_power_funcs, device_type);
+ if (!tmu)
+ return -EPERM;
+
+ if (!tmu->set_cooling_device_state)
+ return -ENOTSUP;
+
+ /*
+ * In the case of the HAL TMU ops, cooling_device_name is used
+ * as the first argument instead of res_name.
+ */
+ return tmu->set_cooling_device_state(cooling_device_name, state);
+}
+
+EXPORT int hal_power_thermal_get_cooling_device_state(unsigned int device_type,
+ char *cooling_device_name)
+{
+ struct pass_resource_tmu_ops *tmu;
+
+ if (!g_power_funcs)
+ return -ENOTSUP;
+
+ if (!cooling_device_name)
+ return -EINVAL;
+
+ tmu = get_tmu(g_power_funcs, device_type);
+ if (!tmu)
+ return -EPERM;
+
+ if (!tmu->get_cooling_device_state)
+ return -ENOTSUP;
+
+ /*
+ * In the case of the HAL TMU ops, cooling_device_name is used
+ * as the first argument instead of res_name.
+ */
+ return tmu->get_cooling_device_state(cooling_device_name);
+}
+
+EXPORT int hal_power_thermal_get_cooling_device_max_state(unsigned int device_type,
+ char *cooling_device_name)
+{
+ struct pass_resource_tmu_ops *tmu;
+
+ if (!g_power_funcs)
+ return -ENOTSUP;
+
+ if (!cooling_device_name)
+ return -EINVAL;
+
+ tmu = get_tmu(g_power_funcs, device_type);
+ if (!tmu)
+ return -EPERM;
+
+ if (!tmu->get_cooling_device_max_state)
+ return -ENOTSUP;
+
+ /*
+ * In the case of the HAL TMU ops, cooling_device_name is used
+ * as the first argument instead of res_name.
+ */
+ return tmu->get_cooling_device_max_state(cooling_device_name);
+}
+
/**
* Memory Operation for Memory H/W
*/