#!/system/bin/sh

. ./_readconf

COUNT=0

while [ ${COUNT} -le 600 ]; do
  if [ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
    GOV=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`
    if [ "${GOV}" != "performance" ]; then
      break
    fi
  fi
  sleep 5
  COUNT=`expr ${COUNT} + 5`
done

if [ "${cpufreq_scaling_governor}" != "" -a -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
  echo "${cpufreq_scaling_governor}" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
fi
if [ "${cpufreq_max_freq}" != "" -a -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq ]; then
  echo "${cpufreq_max_freq}" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
fi
if [ "${cpufreq_min_freq}" != "" -a -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq ]; then
  echo "${cpufreq_min_freq}" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
fi
