Bug 10695 - no AC status notification
Summary: no AC status notification
Status: CLOSED CODE_FIX
Alias: None
Product: ACPI
Classification: Unclassified
Component: Power-Battery (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Len Brown
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-14 08:16 UTC by Alex Fiestas
Modified: 2008-10-16 22:30 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.24.7
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
dmesg output (21.72 KB, text/plain)
2008-05-14 08:18 UTC, Alex Fiestas
Details
lshw output (15.89 KB, text/plain)
2008-05-14 08:20 UTC, Alex Fiestas
Details
acpidump (real) output (81.14 KB, text/plain)
2008-05-14 08:22 UTC, Alex Fiestas
Details
patch vs 2.6.26-rc2 (763 bytes, patch)
2008-05-14 16:05 UTC, Len Brown
Details | Diff

Description Alex Fiestas 2008-05-14 08:16:24 UTC
Latest working kernel version:2.6.22
Earliest failing kernel version:
Distribution: Mandriva
Hardware Environment: Sony vaio fz315s
Problem Description:
When the ac_adapter is disconnected, acpi in theory should generate 2 events, 

ac_adapter AC 00000080 00000000
battery BAT0 00000080 00000001

but in my case it only generates the BAT0 event.

Steps to reproduce:
Install a 2.6.24 kernel, execute acpi_listen and plug/unplug the ac_adapter.
Comment 1 Alex Fiestas 2008-05-14 08:18:33 UTC
Created attachment 16137 [details]
dmesg output
Comment 2 Alex Fiestas 2008-05-14 08:20:54 UTC
Created attachment 16138 [details]
lshw output
Comment 3 Alex Fiestas 2008-05-14 08:22:10 UTC
Created attachment 16139 [details]
acpidump (real) output
Comment 4 Len Brown 2008-05-14 15:57:33 UTC
> When the ac_adapter is disconnected,
> acpi in theory should generate 2 events, 
>
> ac_adapter AC 00000080 00000000
> battery BAT0 00000080 00000001

The DSDT for this machine does have an AC Adapter.
It is callled "ADP1", matching the (arbitrary) example in the ACPI spec,
rather than "AC" in the example above.

        Device (ADP1)
        {
            Name (_HID, "ACPI0003")
            Method (_PSR, 0, NotSerialized)
            {
                If (LEqual (ECON, Zero))
                {
                    And (PHSB (0xD4, Zero), 0x80, Local0)
                }
                Else
                {
                    Store (^^PCI0.LPCB.EC.RPWR, Local0)
                }

                If (LEqual (Local0, Zero))
                {
                    Return (Zero)
                }
                Else
                {
                    Return (One)
                }
            }

            Method (_PCL, 0, NotSerialized)
            {
                Return (_SB)
            }
        }

There is a single place in the AML where a notify is sent
to Device(ADP1) -- GPE21.
you should be able to see what GPE fires on AC/DC events with
grep . /sys/firmware/acpi/interrupts/*
and watching which one increments. (2.6.25 and later)
Hopefully it is gpe21 (hex).


                    Method (_Q21, 0, NotSerialized)
                    {
                        P8XH (Zero, 0x21)
                        Store (RPWR, PWRS)
                        Notify (ADP1, 0x81)
                        Notify (BAT0, 0x80)
                        PNOT ()
                    }

The problem here may be that the AML is sending 0x81
when the ac driver expects 0x80.
If CONFIG_ACPI_DEBUG=y, then ac will print a message when
it receives an unknown notify value.
Comment 5 Len Brown 2008-05-14 16:05:25 UTC
Created attachment 16152 [details]
patch vs 2.6.26-rc2

please try this patch
Comment 6 Alex Fiestas 2008-05-17 09:00:27 UTC
Hi, this patch work perfectly! I tested it with all my laptops and it works very well.

A note, I tested it under 2.6.24 kernel. 

Thanks!
Comment 7 Zhang Rui 2008-05-25 19:53:51 UTC
len, I think this bug can be closed. :)
Comment 8 Len Brown 2008-06-13 22:26:57 UTC
patch in comment #5 applied to acpi-test
Comment 9 Len Brown 2008-06-23 13:46:37 UTC
shipped in linux-2.6.26-rc7

commit f163ff5176a8e9c827d8ebe044710d67d40799c3
Author: Len Brown <len.brown@intel.com>
Date:   Sat Jun 14 01:26:37 2008 -0400

    ACPI: no AC status notification
Comment 10 Len Brown 2008-10-16 22:30:32 UTC
*** Bug 10511 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.