https://bugzilla.kernel.org/show_bug.cgi?id=42598

           Summary: Battery is not detected on start of Linux
           Product: ACPI
           Version: 2.5
    Kernel Version: 3.2.0-rc6-49-g511585a
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Power-Battery
        AssignedTo: acpi_power-batt...@kernel-bugs.osdl.org
        ReportedBy: harald.brenn...@gmx.de
        Regression: No


Created an attachment (id=72102)
 --> (https://bugzilla.kernel.org/attachment.cgi?id=72102)
DSDT.dsl 

Problem:
The battery is not automatically detected on starting the system.
/sys/class/power_supply/BAT1/ is empty.

Environment:
Hardware: Toshiba Satellite L755-161 notebook
System: openSuse 11.4, openSuse 12.1
Kernel: 2.6.x, 3.1.0-rc5-1-vanilla / 3.2.0-rc6-49-g511585a-vanilla

Symptoms:
On start of Windows 7, the battery state is shown correctly. On start of Linux,
the system says battery not present. The battery is present and correctly
described only after one of the following actions is taken with Linux:
1. Open the lid of the notebook
2. Unplug and plug the external power ("AC")
3. Start the system without the battery. Shutdown and start again with battery.
The first two are to be done with a running system, of course. The third only
shows the battery for the first start after the shutdown.

Cause:
Methods _STA and _BST of device BAT1 (Battery) return the current value only if
flag BTIN has been set. This flag is set by method BSTA of device BAT1. BSTA is
called by methods _Q09 and _Q20 of device EC (Embedded Control).
(see the attached DSDT)

Solution:
1. Call method BSTA in function acpi_battery_add of drivers/acpi/battery.c
This works fine. 
However, this is specific code and will not work with other hardware.

2. When a query method of Embedded Control is registered
(acpi_ec_register_query_methods), immediately call it
(acpi_evaluate_object(handle, NULL, NULL, NULL)).
This also works fine. 
Compared to procedure (1) this has the advantage that it is not hardware
specific. It possibly has the disadvantage that calling a query method might be
harmful (I am no ACPI expert).

3. Though proceeding as in (1) or (2) works and (2) is not explicitly dependent
on hardware specifics, considering the freedom that the DSDT language grants to
implement features not mentioned in the specs (like the above mentioned BSTA
method), to achieve the goals cited in
"In the early days of Linux/ACPI, DSDT modifications were common to work around
both BIOS bugs and Linux bugs. However, the stated goal of the Linux/ACPI
project today is that Linux should run on un-modified firmware. Thus, the DSDT
database at the old http://acpi.sourceforge.net web site is now largely a
historical artifact."
(cited from http://www.lesswatts.org/projects/acpi/overridingDSDT.php)
it may be necessary to use kernel parameters to control DSDT handling.
Therefore, I suggest to define kernel parameters acpi.ec_query_on_register
and/or acpi.bat_init_state_method. 
3.1 When acpi.ec_query_on_register is defined, on registering a query method 
of Embedded Control(acpi_ec_register_query_methods), depending on the contents
of acpi.ec_query_on_register the following is done:
- acpi.ec_register_query_methods is empty: 
  All query methods of Embedded Control are called
- acpi.ec_register_query_methods is not empty and does not start with !: 
  Query method of Embedded Control is called if its name (something like _QXX
where the Xs are hexadecimal digits) is in acpi.ec_register_query_methods
- acpi.ec_register_query_methods is not empty and does start with !: 
  Query method of Embedded Control is called if its name is not in
acpi.ec_register_query_methods
3.2 In function acpi_battery_add the function acpi_battery_init_state is called
with parameter acpi.bat_init_state_method if acpi.bat_init_state_method is not
null and not empty. The function acpi_battery_init_state calls the DSTD method
with the name specified in acpi.bat_init_state_method.
Both methods work fine and allow to take care of DSTS specifics via kernel
parameters. (see the attached patch, works with kernel versions 3.1.x and
3.2.x)

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
acpi-bugzilla mailing list
acpi-bugzilla@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acpi-bugzilla

Reply via email to