struct pass_resource_battery_ops battery;
};
-/*
- * Define the resource structure for nonstandard H/W.
- *
- * @tmu : function lists for the TMU (Thermal Management Unit).
- * @battery : function lists for the battery charging.
- *
- * Following function is Deprecated. (Not recommended for use)
- * @set_pmqos_data : function to bypass the scenario data to HAL.
- *
- * This structure indicates the nonstandard H/W which doesn't have
- * the official supported framework (e.g., cpufreq, devfreq and so on)
- * in Linux Kernel. But, the specific device might be controlled
- * according to PMQoS scenario or other cases.
- */
-struct pass_resource_nonstandard {
- struct pass_resource_tmu_ops tmu;
- struct pass_resource_battery_ops battery;
-
- /*
- * NOTE: It is not propper method. But PASS must need to keep
- * the backwards compatibility, set the PMQoS's data from
- * platform to hal. So, It is not recommended to use it.
- *
- * This function will be removed after finding the proper method.
- */
- int (*set_pmqos_data)(char *res_name, void *data);
-};
-
typedef struct _hal_backend_power_funcs {
struct pass_resource_cpu *cpu;
struct pass_resource_bus *bus;
struct pass_resource_gpu *gpu;
struct pass_resource_memory *memory;
struct pass_resource_battery *battery;
- struct pass_resource_nonstandard *nonstandard;
} hal_backend_power_funcs;
/**
#define PASS_RESOURCE_PROCESS_GROUP_ID 9
#define PASS_RESOURCE_DISK_ID 10
#define PASS_RESOURCE_NETWORK_ID 11
-#define PASS_RESOURCE_NONSTANDARD_ID 99
#define PASS_RESOURCE_CPU_NAME "cpu"
#define PASS_RESOURCE_BUS_NAME "bus"
#define PASS_RESOURCE_PROCESS_GROUP_NAME "process_group"
#define PASS_RESOURCE_DISK_NAME "disk"
#define PASS_RESOURCE_NETWORK_NAME "network"
-#define PASS_RESOURCE_NONSTANDARD_NAME "nonstandard"
int hal_power_get_backend(unsigned int res_type);
int hal_power_put_backend(void);
int hal_power_memory_get_fault_around_bytes(unsigned int res_type, char *res_name);
int hal_power_memory_set_fault_around_bytes(unsigned int res_type, char *res_name, int fault_around_bytes);
-/**
- * Miscellaneous Operation for CPU/BUS/GPU H/W
- */
-/*
- * NOTE: It is deprecated method. But PASS must need to keep
- * the backwards compatibility, set the PMQoS's data from
- * platform to hal. So, It is not recommended to use it.
- *
- * This function will be removed after finding the proper method.
- */
-int hal_power_misc_set_pmqos_data(unsigned int res_type, char *res_name, void *data);
-
#ifdef __cplusplus
}
#endif
### main package #########
Name: %{name}
Summary: %{name} interface
-Version: 0.0.1
+Version: 0.0.2
Release: 1
Group: Development/Libraries
License: Apache-2.0
if (funcs && funcs->battery)
return 1;
break;
- case PASS_RESOURCE_NONSTANDARD_ID:
- if (funcs && funcs->nonstandard)
- return 1;
- break;
case PASS_RESOURCE_PROCESS_ID:
case PASS_RESOURCE_DISPLAY_ID:
case PASS_RESOURCE_SYSTEM_ID:
if (funcs && funcs->battery)
*tmu = &(funcs->battery->tmu);
break;
- case PASS_RESOURCE_NONSTANDARD_ID:
- if (funcs && funcs->nonstandard)
- *tmu = &(funcs->nonstandard->tmu);
- break;
default:
return -EPERM;
}
if (funcs && funcs->battery)
*charging = &(funcs->battery->battery);
break;
- case PASS_RESOURCE_NONSTANDARD_ID:
- if (funcs && funcs->nonstandard)
- *charging = &(funcs->nonstandard->battery);
- break;
default:
return -EPERM;
}
goto err_memory;
}
- power_funcs->nonstandard = calloc(1, sizeof(struct pass_resource_nonstandard));
- if (!power_funcs->nonstandard) {
- ret = -ENOMEM;
- goto err_battery;
- }
-
*data = (void *)power_funcs;
return 0;
free(funcs->gpu);
free(funcs->memory);
free(funcs->battery);
- free(funcs->nonstandard);
free(funcs);
return exec_func_with_int(memory->set_fault_around_bytes, res_name, fault_around_bytes);
}
-
-/**
- * Miscellaneous Operation for CPU/BUS/GPU H/W
- */
-/*
- * NOTE: It is not propper method. But PASS must need to keep
- * the backwards compatibility, set the PMQoS's data from
- * platform to hal. So, It is not recommended to use it.
- *
- * This function will be removed after finding the proper method.
- */
-EXPORT int hal_power_misc_set_pmqos_data(unsigned int res_type,
- char *res_name, void *data)
-{
- struct pass_resource_nonstandard *nonstandard = NULL;
-
- if (!g_power_funcs)
- return -ENOTSUP;
-
- if (!res_name || !data)
- return -EINVAL;
-
- switch (res_type) {
- case PASS_RESOURCE_NONSTANDARD_ID:
- nonstandard = g_power_funcs->nonstandard;
- break;
- default:
- return -EPERM;
- }
-
- if (!nonstandard->set_pmqos_data)
- return -ENOTSUP;
-
- return nonstandard->set_pmqos_data(res_name, data);
-}
EXPECT_TRUE(ret == 0);
}
-TEST(HalApiPowerTest, hal_power_get_backend_with_nonstandard_id) {
- int ret = hal_power_get_backend(PASS_RESOURCE_NONSTANDARD_ID);
- EXPECT_TRUE(ret != 0);
-
- ret = hal_power_put_backend();
- EXPECT_TRUE(ret == 0);
-}
-
TEST(HalApiPowerTest, hal_power_dvfs_get_curr_governor_valid) {
int ret;
char governor[MAX_BUFF];
ret = hal_power_dvfs_get_curr_governor(PASS_RESOURCE_MEMORY_ID, res_name, governor);
EXPECT_TRUE(ret == -EPERM);
- ret = hal_power_dvfs_get_curr_governor(PASS_RESOURCE_NONSTANDARD_ID, res_name, governor);
- EXPECT_TRUE(ret == -EPERM);
ret = test_end();
EXPECT_TRUE(ret == 0);
ret = hal_power_dvfs_get_curr_freq(PASS_RESOURCE_MEMORY_ID, res_name);
EXPECT_TRUE(ret == -EPERM);
- ret = hal_power_dvfs_get_curr_freq(PASS_RESOURCE_NONSTANDARD_ID, res_name);
- EXPECT_TRUE(ret == -EPERM);
ret = test_end();
EXPECT_TRUE(ret == 0);
ret = hal_power_dvfs_get_min_freq(PASS_RESOURCE_MEMORY_ID, res_name);
EXPECT_TRUE(ret == -EPERM);
- ret = hal_power_dvfs_get_min_freq(PASS_RESOURCE_NONSTANDARD_ID, res_name);
- EXPECT_TRUE(ret == -EPERM);
ret = test_end();
EXPECT_TRUE(ret == 0);
ret = hal_power_dvfs_get_max_freq(PASS_RESOURCE_MEMORY_ID, res_name);
EXPECT_TRUE(ret == -EPERM);
- ret = hal_power_dvfs_get_max_freq(PASS_RESOURCE_NONSTANDARD_ID, res_name);
- EXPECT_TRUE(ret == -EPERM);
ret = test_end();
EXPECT_TRUE(ret == 0);
ret = hal_power_dvfs_set_min_freq(PASS_RESOURCE_MEMORY_ID, res_name, 0);
EXPECT_TRUE(ret != 0);
- ret = hal_power_dvfs_set_min_freq(PASS_RESOURCE_NONSTANDARD_ID, res_name, 0);
- EXPECT_TRUE(ret != 0);
ret = test_end();
EXPECT_TRUE(ret == 0);
ret = hal_power_dvfs_set_max_freq(PASS_RESOURCE_MEMORY_ID, res_name, 0);
EXPECT_TRUE(ret != 0);
- ret = hal_power_dvfs_set_max_freq(PASS_RESOURCE_NONSTANDARD_ID, res_name, 0);
- EXPECT_TRUE(ret != 0);
ret = test_end();
EXPECT_TRUE(ret == 0);