Bug 8559

Summary: no smartbattery status on Laptop
Product: ACPI Reporter: John Floyd (john.floyd)
Component: Power-BatteryAssignee: acpi_power-battery
Status: CLOSED CODE_FIX    
Severity: normal    
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.20 Subsystem:
Regression: --- Bisected commit-id:
Attachments: acpidump output
Find SBS by SMBUS host controller HID

Description John Floyd 2007-05-31 15:43:49 UTC
Most recent kernel where this bug did *NOT* occur: none
Distribution: Fedora 6
Hardware Environment: Kontron Revolution Weatherproof Laptop
Software Environment: Stock standard environment.  All modules are Fedora
distribution. Updated to latest.
Problem Description: No samrtbattery entry in /proc/acpi/battery

Have a specialised weatherproof laptop with a smartbattery running FC6
latest kernel. I cannot get battey monitoring going. Have loaded
modules i2c_ec and sbs with out any errors.

log/messages indicate that the EC driver loads with
ACPI: EC HC smbus [SMB1]

There is nothing from the sbs module though it is loaded and
the /proc/acpi/battery directory is empty.

The smartbattery can be recognized. If I run the following command ...

   smartbattery 1             (1 is to specify the i2c dev,
                            needs i2c-dev module loaded)

then I get battery status, which behaves properly (changes if I unplug
AC etc). It shows Battery name, status , charge or discharge current,
time to full/left, temperature etc.  The smartbattery command came
with the initial code exploring the ec-smbus interface a couple of
years ago by Bruno Ducrot.
 
However nothing shows up in the proc/acpi/battery directory under the
sbs module, and therefore the gui battery indicators do not work

Any suggestions?

Love to get this working in the gui.

Posted this to acpi group, and Alexey Starikovskiy asked me to post here with
output from acpidump will be attached next

John
Comment 1 John Floyd 2007-05-31 15:45:28 UTC
Created attachment 11625 [details]
acpidump output
Comment 2 Alexey Starikovskiy 2007-06-03 12:56:35 UTC
sbs driver in kernel relies on SBS having ACPI0002 HID and not REVO0002 as it is
in your case. To make it work you need to replace sbs.c:129 .ids=ACPI_SBS_HID
with .ids="ACPI0002,REVO0002". Note "O" is not zero in the name.
Comment 3 John Floyd 2007-06-03 18:07:04 UTC
Alexey,

This worked quite nicely thanks.  Once you described the fix it was obvious from
the DSDT, and the ACPI specs.  

Maybe a log output that says that the HID wasnt found would be nice.  I will
pass this info on the Kontron people.  

I suppose that a module parameter is not possible to allow a load-time
configuration?  

Otherwise this bug could be closed.

John
Comment 4 Alexey Starikovskiy 2007-06-04 10:55:34 UTC
Notebooks with Smart Batteries are quite rare, but the sbs module is loaded by
each distribution kernel, thus message of absent HID will do more harm than benefit.
I was considering of moving a check up to the parent device -- it is smbus host
controller with ids="ACPI0001,ACPI0005", as it is more needed for successful
work of 
SBS
Comment 5 Alexey Starikovskiy 2007-06-05 12:36:16 UTC
Created attachment 11690 [details]
Find SBS by SMBUS host controller HID

John, could you please check if following patch detects your batteries?
Comment 6 John Floyd 2007-06-06 17:20:23 UTC
Alex,

I downloaded the latest kernel 2.6.22-rc4 and applied your patches.

Success - this works nicely with no other changes to code.

Thanks.  Just have to wait till my distro goes to 2.6.22!  Would this version
back port or there a lot of changes in the rest of the acpi code?


Cheers
John
Comment 7 Alexey Starikovskiy 2007-06-08 09:12:41 UTC
Should work with .21, may be with some minor modifications... And with .20 with
some more mods.
Comment 8 Len Brown 2007-06-23 13:22:59 UTC
#define ACPI_SBS_HID                    "ACPI0002"

-	.ids = ACPI_SBS_HID,
+	.ids = "ACPI0001,ACPI0005",

Is it possible that ACPI0002 is ever present without ACPI0001 or ACPI0005?
Comment 9 Len Brown 2007-07-25 23:01:29 UTC
patch in comment #5 shipped in Linux-2.6.23-rc1
closed.