+
+static const char pnd_script_base[] = "sudo -n /usr/pandora/scripts";
+
+int plat_cpu_clock_get(void)
+{
+ FILE *f;
+ int ret = 0;
+ f = fopen("/proc/pandora/cpu_mhz_max", "r");
+ if (f) {
+ fscanf(f, "%d", &ret);
+ fclose(f);
+ }
+ return ret;
+}
+
+int plat_cpu_clock_apply(int cpu_clock)
+{
+ char buf[128];
+
+ if (cpu_clock != 0 && cpu_clock != plat_cpu_clock_get()) {
+ snprintf(buf, sizeof(buf), "unset DISPLAY; echo y | %s/op_cpuspeed.sh %d",
+ pnd_script_base, cpu_clock);
+ system(buf);
+ }
+ return 0;
+}
+
+int plat_get_bat_capacity(void)
+{
+ FILE *f;
+ int ret = 0;
+ f = fopen("/sys/class/power_supply/bq27500-0/capacity", "r");
+ if (f) {
+ fscanf(f, "%d", &ret);
+ fclose(f);
+ }
+ return ret;
+}