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: Tue Apr 18 19:09:55 CEST 2006 [mika]
8 ################################################################################
9 # Notice: taken from http://people.ubuntulinux.org/~scott/patches/powernowd/
10 ################################################################################
12 /usr/sbin/laptop-detect 2>/dev/null && LAPTOP=1
17 if [ ! -f $CPUINFO ] ; then
18 echo >&2 $CPUINFO not detected...
22 # /lib/modules/2.6.16-grml/kernel/arch/i386/kernel/cpu/cpufreq/ ->
25 # cpufreq-nforce2 [ ] nForce2 FSB changing cpufreq driver
26 # gx-suspmod [ ] Cpufreq driver for Cyrix MediaGX and NatSemi Geode
29 # p4-clockmod [~] cpufreq driver for Pentium(TM) 4/Xeon(TM)
33 # speedstep-centrino [x]
35 # speedstep-lib [ ] Library for Intel SpeedStep 1 or 2 cpufreq drivers.
38 # /lib/modules/2.6.16-grml/kernel/drivers/cpufreq ->
39 # cpufreq_conservative
46 MODEL_NAME=`grep '^model name' "$CPUINFO" | head -n 1 | sed -e 's/^.*: //;'`
47 CPU=`grep -E '^cpud[^:]+:' "$CPUINFO" | head -n 1 | sed -e 's/^.*: //;'`
48 VENDOR_ID=`grep -E '^vendor_id[^:]+:' "$CPUINFO" | head -n 1 | sed -e 's/^.*: //;'`
49 CPU_FAMILY=$(sed -e '/^cpu family/ {s/.*: //;p;Q};d' $CPUINFO)
52 MODULE_FALLBACK=acpi-cpufreq
54 # Two modules for PIII-M depending the chipset.
55 # modprobe speedstep-ich$EXT || modprobe speestep-smi$EXT would be another way
56 if [ -f $IOPORTS ] && grep -q 'Intel .*ICH' $IOPORTS ; then
57 PIII_MODULE=speedstep-ich
59 PIII_MODULE=speedstep-smi
64 # If the CPU has the est flag, it supports enhanced speedstep and should
65 # use the speedstep-centrino driver
66 if [ "`grep est $CPUINFO`" ]; then
67 MODULE=speedstep-centrino;
68 elif [ $CPU_FAMILY = 15 ]; then
69 # Right. Check if it's a P4 without est.
70 # Could be speedstep-ich, or could be p4-clockmod.
72 # Disabled for now - the latency tends to be bad enough to make it
74 # echo "FREQDRIVER=p4-clockmod" >/etc/default/powernowd
76 #if [ $LAPTOP = "1" ]; then
77 # MODULE_FALLBACK=p4-clockmod;
80 # So it doesn't have Enhanced Speedstep, and it's not a P4. It could be
81 # a Speedstep PIII, or it may be unsupported. There's no terribly good
82 # programmatic way of telling.
84 Intel\(R\)\ Pentium\(R\)\ III\ Mobile\ CPU*)
85 MODULE=$PIII_MODULE ;;
87 # JD: says this works with cpufreq_userspace
88 Mobile\ Intel\(R\)\ Pentium\(R\)\ III\ CPU\ -\ M*)
89 MODULE=$PIII_MODULE ;;
91 # https://bugzilla.ubuntu.com/show_bug.cgi?id=4262
93 Pentium\ III\ \(Coppermine\)*)
94 MODULE=$PIII_MODULE ;;
96 Intel\(R\)\ Celeron\(R\)\ M\ processor*)
103 # Hurrah. This is nice and easy.
121 if [ $CPU_FAMILY == 6 ]; then
127 if [ "`grep longrun $CPUINFO`" ]; then
133 ## END OF FILE #################################################################