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 # Latest change: Mit Jul 04 12:15:57 CEST 2007 [mika]
8 ################################################################################
9 # Notice: also check out /etc/init.d/loadcpufreq of current cpufrequtils in Debian.
11 # Notice: based on http://people.ubuntulinux.org/~scott/patches/powernowd/ and
12 # scripts found in the powernowd package version 0.97-1ubuntu6 on Ubuntu.
13 ################################################################################
15 /usr/sbin/laptop-detect 2>/dev/null && LAPTOP=1
20 if [ ! -f $CPUINFO ] ; then
21 echo >&2 $CPUINFO not detected...
25 # /lib/modules/2.6.16-grml/kernel/arch/i386/kernel/cpu/cpufreq/ ->
28 # cpufreq-nforce2 [ ] nForce2 FSB changing cpufreq driver
29 # gx-suspmod [ ] Cpufreq driver for Cyrix MediaGX and NatSemi Geode
32 # p4-clockmod [~] cpufreq driver for Pentium(TM) 4/Xeon(TM)
36 # speedstep-centrino [x]
38 # speedstep-lib [ ] Library for Intel SpeedStep 1 or 2 cpufreq drivers.
41 # /lib/modules/2.6.16-grml/kernel/drivers/cpufreq ->
42 # cpufreq_conservative
49 MODEL_NAME=`grep '^model name' "$CPUINFO" | head -n 1 | sed -e 's/^.*: //;'`
50 CPU=`grep -E '^cpud[^:]+:' "$CPUINFO" | head -n 1 | sed -e 's/^.*: //;'`
51 VENDOR_ID=`grep -E '^vendor_id[^:]+:' "$CPUINFO" | head -n 1 | sed -e 's/^.*: //;'`
52 CPU_FAMILY=$(sed -e '/^cpu family/ {s/.*: //;p;Q};d' $CPUINFO)
55 MODULE_FALLBACK=acpi-cpufreq
57 # Two modules for PIII-M depending the chipset.
58 # modprobe speedstep-ich$EXT || modprobe speestep-smi$EXT would be another way
59 if [ -f $IOPORTS ] && grep -q 'Intel .*ICH' $IOPORTS ; then
60 PIII_MODULE=speedstep-ich
62 PIII_MODULE=speedstep-smi
67 # If the CPU has the est flag, it supports enhanced speedstep and should
68 # use the speedstep-centrino driver
69 if [ "$(grep est $CPUINFO)" ]; then
72 # Prefer acpi-cpufreq for kernels after 2.6.20
76 MODULE=speedstep-centrino
79 elif [ $CPU_FAMILY = 15 ]; then
80 # Right. Check if it's a P4 without est.
81 # Could be speedstep-ich, or could be p4-clockmod.
83 # Disabled for now - the latency tends to be bad enough to make it
85 # echo "FREQDRIVER=p4-clockmod" >/etc/default/powernowd
87 #if [ $LAPTOP = "1" ]; then
88 # MODULE_FALLBACK=p4-clockmod;
91 # So it doesn't have Enhanced Speedstep, and it's not a P4. It could be
92 # a Speedstep PIII, or it may be unsupported. There's no terribly good
93 # programmatic way of telling.
95 Intel\(R\)\ Pentium\(R\)\ III\ Mobile\ CPU*)
96 MODULE=$PIII_MODULE ;;
98 # JD: says this works with cpufreq_userspace
99 Mobile\ Intel\(R\)\ Pentium\(R\)\ III\ CPU\ -\ M*)
100 MODULE=$PIII_MODULE ;;
102 # https://bugzilla.ubuntu.com/show_bug.cgi?id=4262
104 Pentium\ III\ \(Coppermine\)*)
105 MODULE=$PIII_MODULE ;;
107 Intel\(R\)\ Celeron\(R\)\ M\ processor*)
108 MODULE=p4-clockmod ;;
114 # Hurrah. This is nice and easy.
132 if [ $CPU_FAMILY == 6 ]; then
138 if [ "`grep longrun $CPUINFO`" ]; then
144 ## END OF FILE #################################################################