2 # Filename: cpufreq-detect.sh
3 # Purpose: detect cpu type and set $MODULE to appropriate kernel module for cpufrequency scaling
4 # Authors: grml-team (grml.org), (C) Ubuntu, (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 ################################################################################
8 # Notice: also check out /etc/init.d/loadcpufreq of current cpufrequtils in Debian.
10 # Notice: based on http://people.ubuntulinux.org/~scott/patches/powernowd/ and
11 # scripts found in the powernowd package version 0.97-1ubuntu6 on Ubuntu.
12 ################################################################################
14 /usr/sbin/laptop-detect 2>/dev/null && LAPTOP=1
19 if [ ! -f $CPUINFO ] ; then
20 echo >&2 $CPUINFO not detected...
24 # /lib/modules/2.6.16-grml/kernel/arch/i386/kernel/cpu/cpufreq/ ->
27 # cpufreq-nforce2 [ ] nForce2 FSB changing cpufreq driver
28 # gx-suspmod [ ] Cpufreq driver for Cyrix MediaGX and NatSemi Geode
31 # p4-clockmod [~] cpufreq driver for Pentium(TM) 4/Xeon(TM)
35 # speedstep-centrino [x]
37 # speedstep-lib [ ] Library for Intel SpeedStep 1 or 2 cpufreq drivers.
40 # /lib/modules/2.6.16-grml/kernel/drivers/cpufreq ->
41 # cpufreq_conservative
48 MODEL_NAME=`grep '^model name' "$CPUINFO" | head -n 1 | sed -e 's/^.*: //;'`
49 CPU=`grep -E '^cpud[^:]+:' "$CPUINFO" | head -n 1 | sed -e 's/^.*: //;'`
50 VENDOR_ID=`grep -E '^vendor_id[^:]+:' "$CPUINFO" | head -n 1 | sed -e 's/^.*: //;'`
51 CPU_FAMILY=$(sed -e '/^cpu family/ {s/.*: //;p;Q};d' $CPUINFO)
54 MODULE_FALLBACK=acpi-cpufreq
56 # Two modules for PIII-M depending the chipset.
57 # modprobe speedstep-ich$EXT || modprobe speestep-smi$EXT would be another way
58 if [ -f $IOPORTS ] && grep -q 'Intel .*ICH' $IOPORTS ; then
59 PIII_MODULE=speedstep-ich
61 PIII_MODULE=speedstep-smi
66 # If the CPU has the est flag, it supports enhanced speedstep and should
67 # use the speedstep-centrino driver
68 if [ "$(grep est $CPUINFO)" ]; then
71 # Prefer acpi-cpufreq for kernels after 2.6.20
75 MODULE=speedstep-centrino
78 elif [ $CPU_FAMILY = 15 ]; then
79 # Right. Check if it's a P4 without est.
80 # Could be speedstep-ich, or could be p4-clockmod.
82 # Disabled for now - the latency tends to be bad enough to make it
84 # echo "FREQDRIVER=p4-clockmod" >/etc/default/powernowd
86 #if [ $LAPTOP = "1" ]; then
87 # MODULE_FALLBACK=p4-clockmod;
90 # So it doesn't have Enhanced Speedstep, and it's not a P4. It could be
91 # a Speedstep PIII, or it may be unsupported. There's no terribly good
92 # programmatic way of telling.
94 Intel\(R\)\ Pentium\(R\)\ III\ Mobile\ CPU*)
95 MODULE=$PIII_MODULE ;;
97 # JD: says this works with cpufreq_userspace
98 Mobile\ Intel\(R\)\ Pentium\(R\)\ III\ CPU\ -\ M*)
99 MODULE=$PIII_MODULE ;;
101 # https://bugzilla.ubuntu.com/show_bug.cgi?id=4262
103 Pentium\ III\ \(Coppermine\)*)
104 MODULE=$PIII_MODULE ;;
106 Intel\(R\)\ Celeron\(R\)\ M\ processor*)
107 MODULE=p4-clockmod ;;
113 # Hurrah. This is nice and easy.
131 if [ $CPU_FAMILY = 6 ]; then
137 if [ "`grep longrun $CPUINFO`" ]; then
143 ## END OF FILE #################################################################