Bug 67821 - No ac_adapter notifications, even after acpi -a
Summary: No ac_adapter notifications, even after acpi -a
Status: CLOSED CODE_FIX
Alias: None
Product: ACPI
Classification: Unclassified
Component: Power-Battery (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: acpi_power-battery
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-27 19:18 UTC by Aleksandr Mezin
Modified: 2014-01-07 06:31 UTC (History)
2 users (show)

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


Attachments
acpidump output (86.32 KB, application/gzip)
2013-12-30 21:21 UTC, Aleksandr Mezin
Details

Description Aleksandr Mezin 2013-12-27 19:18:44 UTC
Everytime I had problems with AC adapter notifications on my laptop.

However, before 3.13 there was a workaround - let acpid call "acpi -a" when battery starts charging/discharging. After that, adapter's state updates.

Today I built 3.13-rc5, and this workaround doesn't help anymore. 
"acpi -a" tells that adapter is offline, but acpi_listen doesn't show "ac_adapter" event, and UPower (and hence KDE's PowerDevil) thinks that adapter is still online (i've checked UPower using qdbus).

On kernel 3.12.6 the workaround does its job.

Also, isn't it possible to do something like my workaround in the kernel?
Comment 1 Aleksandr Mezin 2013-12-29 04:47:51 UTC
With this patch things, at least, become as they were before 3.13

diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 8711e37..3c2e4aa 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -207,7 +207,7 @@ static int acpi_ac_probe(struct platform_device *pdev)
                goto end;
 
        result = acpi_install_notify_handler(ACPI_HANDLE(&pdev->dev),
-                       ACPI_DEVICE_NOTIFY, acpi_ac_notify_handler, ac);
+                       ACPI_ALL_NOTIFY, acpi_ac_notify_handler, ac);
        if (result) {
                power_supply_unregister(&ac->charger);
                goto end;
@@ -255,7 +255,7 @@ static int acpi_ac_remove(struct platform_device *pdev)
                return -EINVAL;
 
        acpi_remove_notify_handler(ACPI_HANDLE(&pdev->dev),
-                       ACPI_DEVICE_NOTIFY, acpi_ac_notify_handler);
+                       ACPI_ALL_NOTIFY, acpi_ac_notify_handler);
 
        ac = platform_get_drvdata(pdev);
        if (ac->charger.dev)
Comment 2 Lan Tianyu 2013-12-30 07:42:14 UTC
Please provide the output of acpidump.
Comment 3 Aleksandr Mezin 2013-12-30 21:21:29 UTC
Created attachment 120291 [details]
acpidump output
Comment 4 Lan Tianyu 2013-12-31 02:27:37 UTC
From the acpidump, aml code notifies AC driver with zero event which is a system event. So ACPI_DEVICE_NOTIFY is not enough. Please send the patch in the comment 1 to acpi mallist.

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