start_cpu_freq 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. #BK got this from http://murga-linux.com/puppy/viewtopic.php?t=55417&start=15
  3. # but added test for /proc/acpi, bios-date, processor-manufacturer.
  4. # added extra code provided by pakt.
  5. #100603 gamble, any CPU >=2007 can handle acpi-cpufreq, or it will fail to load.
  6. #101014 improve test for older computers, and fix menu --well no probably not the latter.
  7. #101114 rerwin: refine usage of dmidecode.
  8. #disable freq scaling for older computers...
  9. #[ ! -d /proc/acpi ] && FLAGEXIT='yes'
  10. if [ ! -d /proc/acpi ];then #101114
  11. FLAGEXIT='yes'
  12. else
  13. [ `dmidecode -s "bios-release-date" | cut -f 3 -d '/' | rev | cut -c 1,2 | rev` -lt 7 ] && FLAGEXIT='yes' #<2006 100603: <2007 101014
  14. fi
  15. if [ "$FLAGEXIT" = "yes" ];then #101014
  16. exit
  17. fi
  18. FREQMODS="acpi-cpufreq"
  19. case "$1" in
  20. start)
  21. for ONEMOD in $FREQMODS
  22. do
  23. modprobe $ONEMOD
  24. if [ $? -eq 0 ];then
  25. modprobe cpufreq_ondemand
  26. if [ $? -eq 0 ];then
  27. for CPUNUM in `ls -1 /sys/devices/system/cpu/ | grep 'cpu[0-9]' | tr '\n' ' '`
  28. do
  29. echo ondemand >/sys/devices/system/cpu/$CPUNUM/cpufreq/scaling_governor
  30. done
  31. break
  32. else
  33. rmmod $ONEMOD
  34. fi
  35. fi
  36. done
  37. ;;
  38. esac