LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   battery hotplug not working (https://www.linuxquestions.org/questions/linux-hardware-18/battery-hotplug-not-working-834064/)

bookmarclinux 09-23-2010 01:30 PM

battery hotplug not working
 
Hi,

I'm running Linux 2.6.35.4 on a Kontron COMExpress board. The device has 2 battery slots so that a user can hot swap batteries while the device is running.

The problem I'm having is that battery information is never updated in /sys unless I read /proc/acpi/BAT[12]/state.

When booting the device, the battery state is correctly detected by the kernel but after that it seems like nothing happens.

Here's what the kernel reports at boot time:
Code:

[    0.564907] ACPI: acpi_battery_add called.
[    0.709876] ACPI: Battery Slot [BAT1] (battery present)
[    0.709888] ACPI: acpi_battery_add called.
[    0.720828] ACPI: Battery Slot [BAT2] (battery absent)

Note: The "acpi_battery_add called" is a printk that I added.

Here's the content of sysfs after booting:
Code:

root [ /sys/class/power_supply ]# ls -l
total 0
lrwxrwxrwx 1 root root 0 Sep 23 17:40 ADP1 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:02/ACPI0003:00/power_supply/ADP1
lrwxrwxrwx 1 root root 0 Sep 23 18:15 BAT1 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:02/PNP0C0A:00/power_supply/BAT1

If I remove the battery, nothing changes. The sysfs stays the same with the old battery status. I have to manually poke at /proc to "force" an update so that the devices are rediscovered.

Now, I've tried adding some printk in the drivers/acpi/battery.c source code and it seems that the acpi_battery_notify function is never called (not even at boot time). I guess this must be the problem but I really don't know where to go from here...

Note: I also fiddled with the acpi_osi and acpi_os_name variables to no avail (I've tried "Linux" and "Windows 2006").

My current solution is to poke at /proc from time to time, it works but I'm forced to compile my kernel with CONFIG_ACPI_PROCFS_POWER which is marked as deprecated...

Any help is welcomed!

Marc

bookmarclinux 09-23-2010 02:47 PM

I'm also seeing this message:

Code:

[    2.340551] i2c /dev entries driver
[    2.340924] i801_smbus 0000:00:1f.3: PCI INT B -> GSI 20 (level, low) -> IRQ 20
[    2.340932] ACPI: resource 0000:00:1f.3 [io  0x0400-0x041f] conflicts with ACPI region SMB0 [mem 0x00000400-0x0000041f 64bit disabled]
[    2.340937] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver

And looking at the disassembled DSDT table from the BIOS it seems like this region is associated with:

Code:

Name (SMBS, 0x0400)
SMBus?

bookmarclinux 09-23-2010 03:23 PM

Disabling the i2c-i801 driver in the kernel effectively resolves the conflict but batteries still aren't updated.

Maybe related to:
https://bugzilla.kernel.org/show_bug.cgi?id=12376


All times are GMT -5. The time now is 12:50 AM.