#include "utils/CPUInfo.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
+#include "utils/AMLUtils.h"
int aml_set_sysfs_str(const char *path, const char *val)
{
}
}
-int aml_get_cputype()
+enum AML_DEVICE_TYPE aml_get_cputype()
{
- static int aml_cputype = -1;
- if (aml_cputype == -1)
+ static enum AML_DEVICE_TYPE aml_cputype = AML_DEVICE_TYPE_UNKNOWN;
+ if (aml_cputype == AML_DEVICE_TYPE_UNKNOWN)
{
std::string cpu_hardware = g_cpuInfo.getCPUHardware();
// default to AMLogic M1
- aml_cputype = 1;
+ aml_cputype = AML_DEVICE_TYPE_M1;
if (cpu_hardware.find("MESON-M3") != std::string::npos)
- aml_cputype = 3;
+ aml_cputype = AML_DEVICE_TYPE_M3;
else if (cpu_hardware.find("MESON3") != std::string::npos)
- aml_cputype = 3;
+ aml_cputype = AML_DEVICE_TYPE_M3;
else if (cpu_hardware.find("Meson6") != std::string::npos)
- aml_cputype = 6;
+ aml_cputype = AML_DEVICE_TYPE_M6;
else if (cpu_hardware.find("Meson8") != std::string::npos)
- aml_cputype = 8;
+ aml_cputype = AML_DEVICE_TYPE_M8;
}
return aml_cputype;
// do not touch scaling_min_freq on android
#if !defined(TARGET_ANDROID)
// only needed for m1/m3 SoCs
- if (aml_get_cputype() <= 3)
+ if (aml_get_cputype() <= AML_DEVICE_TYPE_M3)
{
int cpufreq = 300000;
if (limit)
void aml_cpufreq_max(bool limit)
{
- if (!aml_wired_present() && aml_get_cputype() > 3)
+ if (!aml_wired_present() && aml_get_cputype() > AML_DEVICE_TYPE_M3)
{
// this is a MX Stick, they cannot substain 1GHz
// operation without overheating so limit them to 800MHz.
if (aml_present())
{
// m1 uses 1, m3 and above uses 2
- int raw = aml_get_cputype() < 3 ? 1:2;
+ int raw = aml_get_cputype() < AML_DEVICE_TYPE_M3 ? 1:2;
aml_set_sysfs_int("/sys/class/audiodsp/digital_raw", passthrough ? raw:0);
}
}
*
*/
+enum AML_DEVICE_TYPE
+{
+ AML_DEVICE_TYPE_UNKNOWN = -1,
+ AML_DEVICE_TYPE_M1,
+ AML_DEVICE_TYPE_M3,
+ AML_DEVICE_TYPE_M6,
+ AML_DEVICE_TYPE_M8
+};
+
int aml_set_sysfs_str(const char *path, const char *val);
int aml_get_sysfs_str(const char *path, char *valstr, const int size);
int aml_set_sysfs_int(const char *path, const int val);
void aml_permissions();
bool aml_hw3d_present();
bool aml_wired_present();
-int aml_get_cputype();
+enum AML_DEVICE_TYPE aml_get_cputype();
void aml_cpufreq_min(bool limit);
void aml_cpufreq_max(bool limit);
void aml_set_audio_passthrough(bool passthrough);