if (has_aml)
CLog::Log(LOGNOTICE, "aml_present, rtn(%d)", rtn);
}
- return has_aml;
+ return has_aml == 1;
+}
+
+bool aml_wired_present()
+{
+ static int has_wired = -1;
+ if (has_wired == -1)
+ {
+ char test[64] = {0};
+ if (aml_get_sysfs_str("/sys/class/net/eth0/operstate", test, 63) != -1)
+ has_wired = 1;
+ else
+ has_wired = 0;
+ }
+ return has_wired == 1;
}
void aml_permissions()
system("su -c chmod 666 /sys/class/audiodsp/digital_raw");
system("su -c chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq");
system("su -c chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq");
+ system("su -c chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor");
CLog::Log(LOGINFO, "aml_permissions: permissions changed");
}
}
return aml_cputype;
}
-void aml_cpufreq_limit(bool limit)
+void aml_cpufreq_min(bool limit)
+{
+// do not touch scaling_min_freq on android
+#if !defined(TARGET_ANDROID)
+ // only needed for m1/m3 SoCs
+ if (aml_get_cputype() <= 3)
+ {
+ int cpufreq = 300000;
+ if (limit)
+ cpufreq = 600000;
+
+ aml_set_sysfs_int("/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq", cpufreq);
+ }
+#endif
+}
+
+void aml_cpufreq_max(bool limit)
{
- int cpufreq = 300000;
- if (limit)
- cpufreq = 600000;
+ if (!aml_wired_present() && aml_get_cputype() > 3)
+ {
+ // this is a MX Stick, they cannot substain 1GHz
+ // operation without overheating so limit them to 800MHz.
+ int cpufreq = 1000000;
+ if (limit)
+ cpufreq = 800000;
- aml_set_sysfs_int("/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq", cpufreq);
+ aml_set_sysfs_int("/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", cpufreq);
+ aml_set_sysfs_str("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", "ondemand");
+ }
}
void aml_set_audio_passthrough(bool passthrough)
{
if (aml_present())
{
+ // m1 uses 1, m3 and above uses 2
int raw = aml_get_cputype() < 3 ? 1:2;
aml_set_sysfs_int("/sys/class/audiodsp/digital_raw", passthrough ? raw:0);
}
* <http://www.gnu.org/licenses/>.
*
*/
+
#include "system.h"
#include <EGL/egl.h>
#include "EGLNativeTypeAndroid.h"
#include "utils/log.h"
#include "guilib/gui3d.h"
#if defined(TARGET_ANDROID)
-#include "android/activity/XBMCApp.h"
+ #include "android/activity/XBMCApp.h"
+ #if defined(HAS_AMLPLAYER) || defined(HAS_LIBAMCODEC)
+ #include "utils/AMLUtils.h"
+ #endif
#endif
+
CEGLNativeTypeAndroid::CEGLNativeTypeAndroid()
{
}
{
#if defined(TARGET_ANDROID) && (defined(HAS_AMLPLAYER) || defined(HAS_LIBAMCODEC))
aml_permissions();
+ aml_cpufreq_min(true);
+ aml_cpufreq_max(true);
#endif
return;
}
void CEGLNativeTypeAndroid::Destroy()
{
+#if defined(TARGET_ANDROID) && (defined(HAS_AMLPLAYER) || defined(HAS_LIBAMCODEC))
+ aml_cpufreq_min(false);
+ aml_cpufreq_max(false);
+#endif
+
return;
}