# battery goes out quickly



## rocky (Apr 1, 2009)

Hello all,

I have bought a HP Compaq Presario CQ40-401(au) and I installed FreeBSD 7.1 on it.

My battery is charged to 100%. After 20 minutes of uptime, the battery goes quickly to 69%. I am running FireFox3, pidgin, etc. Not too many, right? 

I guess that there's something wrong. But I don't know...

Thanks you for any suggestions and helps,

-- kyanh


```
$ uptime
 7:48PM  up 23 mins, 3 users, load averages: 2.38, 1.70, 1.03
```


```
$ sysctl -a |grep batt
hw.acpi.battery.life: 62
hw.acpi.battery.time: -1
hw.acpi.battery.state: 1
hw.acpi.battery.units: 1
hw.acpi.battery.info_expire: 5
machdep.apm_swab_batt_minutes: 0
dev.battery.0.%desc: ACPI Control Method Battery
dev.battery.0.%driver: battery
dev.battery.0.%location: handle=\_SB_.PCI0.LPC0.BAT0
dev.battery.0.%pnpinfo: _HID=PNP0C0A _UID=1
dev.battery.0.%parent: acpi0
```



```
$ ps x
  986  ??  Is     0:00.00 /usr/local/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
 1009  ??  S      0:00.08 /usr/local/libexec/gconfd-2
  923  v0  I      0:00.01 -bash (bash)
  927  v0  I+     0:00.01 /bin/sh /usr/local/bin/startx
  948  v0  I+     0:00.00 xinit /home/pi/.xinitrc -- /usr/local/bin/X :0 -auth /home/pi/.serverauth.927
  967  v0  S      0:01.04 /usr/local/bin/openbox
  970  v0  S      0:08.08 /usr/local/bin/conky
  971  v0  S      0:03.02 /usr/local/bin/fbpanel
  974  v0  S      0:00.92 /usr/local/bin/xscreensaver -nosplash
  975  v0  S      0:58.12 /usr/local/bin/xvnkb
  980  v0  S      0:00.66 /usr/local/apps/ROX-Filer/ROX-Filer
  981  v0  S      0:02.73 pidgin
  985  v0  I      0:00.00 dbus-launch --autolaunch 0c226a9e5676c3a684285a1849c73ad7 --binary-syntax --close-stderr
  994  v0  I      0:00.01 /bin/sh /usr/local/bin/firefox3 http://mail.google.com/mail
  999  v0  I      0:00.00 /bin/sh /usr/local/lib/firefox3/run-mozilla.sh /usr/local/lib/firefox3/firefox-bin http://mail.google.com/mail
 1004  v0  I      2:15.88 /usr/local/lib/firefox3/firefox-bin http://mail.google.com/mail
 1027  v0  S      0:00.79 xterm -e screen -A
 1030  p0  Ss+    0:00.03 screen -A
 1034  p1  Is     0:00.11 /bin/bash
 1117  p2  Ss     0:00.12 /bin/bash
 1126  p2  R+     0:00.04 ps x
```

Here's a part of `top`'s output:


```
PID USERNAME    THR PRI NICE   SIZE    RES STATE  C   TIME   WCPU COMMAND
  949 pi            1  63    0   301M 39728K select 1   3:27 23.29% Xorg
 1004 pi            8  54    0   124M 98256K ucond  1   0:00 20.46% firefox-bin
  975 pi            1   8    0  6392K  4164K nanslp 1   1:06  7.28% xvnkb
 1117 pi            1   8    0  5468K  3188K wait   1   0:00  0.20% bash
  971 pi            1  44    0 36012K 15928K select 1   0:03  0.10% fbpanel
  970 pi            1  44    0  5764K  2776K select 0   0:09  0.00% conky
  981 pi            1  44    0 46684K 26636K select 1   0:03  0.00% pidgin
  967 pi            1  44    0 26396K 10080K select 1   0:01  0.00% openbox
  974 pi            1  44    0  5300K  3148K select 0   0:01  0.00% xscreensaver
 1027 pi            1  44    0 10824K  8200K select 0   0:01  0.00% xterm
  980 pi            1  44    0 45852K 17320K select 1   0:01  0.00% ROX-Filer
 1031 pi            1  44    0  3572K  2132K select 0   0:00  0.00% screen
 1034 pi            1   8    0  5468K  3188K wait   1   0:00  0.00% bash
 1009 pi            1  44    0 21140K  5408K select 1   0:00  0.00% gconfd-2
 1030 pi            1  20    0  3572K  1896K pause  0   0:00  0.00% screen
  923 pi            1   8    0  4396K  2316K wait   0   0:00  0.00% bash
 1128 pi            1  44    0  3580K  1704K CPU0   0   0:00  0.00% top
  994 pi            1   8    0  3512K  1688K wait   1   0:00  0.00% sh
 1043 pi            1   8    0  3620K  1588K wait   1   0:00  0.00% su
  927 pi            1   8    0  3464K  1464K wait   0   0:00  0.00% sh
  999 pi            1   8    0  3512K  1700K wait   1   0:00  0.00% sh
  948 pi            1   8    0  4396K  1656K wait   1   0:00  0.00% xinit
  986 pi            1  44    0  3384K  1736K select 0   0:00  0.00% dbus-daemon
  985 pi            1  49    0  4684K  1988K select 0   0:00  0.00% dbus-launch
```


----------



## SirDice (Apr 1, 2009)

It's probably running at full blast. Try setting up acpi or apm.

http://www.freebsd.org/doc/en/books/handbook/acpi-overview.html


----------



## richardpl (Apr 1, 2009)

Enable powerd() in /etc/rc.conf.
Install,enable and configure ataidle from ports.
Add 





			
				&quot said:
			
		

> cpufreq_load="YES"



Edit /etc/rc.conf:

```
performance_cx_lowest="HIGH"    # Online CPU idle state
performance_cpu_freq="NONE"     # Online CPU frequency
economy_cx_lowest="HIGH"        # Offline CPU idle state
economy_cpu_freq="NONE"         # Offline CPU frequency
```


----------



## rocky (Apr 2, 2009)

Thanks SirDice and richardpl. I will try and report soon.


----------



## rocky (Apr 2, 2009)

Dear *richardpl*,

I followed your helps and the battery still went out quickly. More over, I got some more errors in `dmesg`:


```
FreeBSD 7.1-RELEASE #3: Tue Mar 24 01:40:52 ICT 2009
    toor@icy.local:/usr/obj/usr/src/sys/ICY
module_register: module cpu/ichss already exists!
Module cpu/ichss failed to register: 17
module_register: module cpu/est already exists!
Module cpu/est failed to register: 17
module_register: module cpu/p4tcc already exists!
Module cpu/p4tcc failed to register: 17
module_register: module cpu/powernow already exists!
Module cpu/powernow failed to register: 17
module_register: module cpu/smist already exists!
Module cpu/smist failed to register: 17
```

Any idea?

Regards,

--rocky


----------



## richardpl (Apr 2, 2009)

What you did?
What are your powerd flags.
Post your rc.conf.


----------



## richardpl (Apr 2, 2009)

Also send output of uptime.


----------



## foo_daemon (Apr 17, 2009)

These settings made all the difference in the world for my laptop:

/etc/rc.conf:

```
powerd_enable="YES"
powerd_flags="âˆ’a adaptive âˆ’b adaptive" # CPU Frequency Scaling on AC and Battery
```

100% Battery charge went from 1.5 hour usage to over 3


----------



## rocky (May 5, 2009)

Hi all,

I am so sorry for my very late reply. I have no time to test my battery: at office I just get it out and use AC instead.

I am now using FreeBSD-7.2-RELEASE (FreeBSD kool!!). I see that battery still goes out quite quickly.

After 23 minutes of uptime, the battery remains 67%. I guess that I have to replace the battery in next 23 mintures 

Any idea?

Thank you for your helps.

=================

My information:

powerd flags: "âˆ’a adaptive âˆ’b adaptive"

uptime


```
7:07PM  up 17 mins, 4 users, load averages: 1.37, 1.21, 0.78
7:14PM  up 24 mins, 5 users, load averages: 0.63, 0.94, 0.81
```

About cpu.0:


```
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 2200
dev.cpu.0.freq_levels: 2200/-1 1925/-1 1650/-1 1375/-1 1100/-1 825/-1 550/-1 275/-1
dev.cpu.0.cx_supported: C1/0
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_usage: 100.00%
```


----------



## richardpl (May 5, 2009)

cx_lowest is still C1 it should be C2 or C3:

Add

```
economy_cx_lowest="C3"
```
to your /etc/rc.conf


----------



## rocky (May 6, 2009)

Thank you, richardpl.

As you can see my CPU supports only C1/0:


```
dev.cpu.0.cx_supported: C1/0
```

So how can I use C3 state? My CPU is AMD Turion RM74 and I built the kernel with option I686_CPU (see http://viettug.org/attachments/download/147/icy_kernel.txt):

Below some heading lines from `dmemsg`:


```
CPU: AMD Turion(tm) X2 Dual-Core Mobile RM-74 (2200.09-MHz 686-class CPU)
  Origin = "AuthenticAMD"  Id = 0x200f31  Stepping = 1
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x2001<SSE3,CX16>
  AMD Features=0xea500800<SYSCALL,NX,MMX+,FFXSR,RDTSCP,LM,3DNow!+,3DNow!>
  AMD Features2=0x131f<LAHF,CMP,SVM,ExtAPIC,CR8,Prefetch,<b9>,<b12>>
  TSC: P-state invariant
  Cores per package: 2
```


----------



## richardpl (May 6, 2009)

It either is not supported by your CPU or ACPI is broken.


----------



## richardpl (May 6, 2009)

Modify


> powerd flags: "âˆ’a adaptive âˆ’b adaptive"


to

```
powerd flags: "âˆ’a adaptive âˆ’b adaptive -n adaptive"
```

Does:


> dev.cpu.0.freq: 2200


 ever change?


----------



## lme@ (May 9, 2009)

Using C3 causes a problem with the internal timer. In 8-Current there is a patch that enables you to use an external timer, so you can use C3 safely.

Take a look at 
http://lists.freebsd.org/pipermail/freebsd-current/2009-May/006436.html
for suggestions how to save power.


----------



## rocky (May 10, 2009)

Thank you all for helps.

I will try and report the result.

Regards,

-- rocky


----------

