Bug 109891

Summary: Power adapter udev event never get reported on surface pro 4
Product: ACPI Reporter: Weng Xuetian (wengxt)
Component: Power-OtherAssignee: Chen Yu (yu.c.chen)
Status: CLOSED WILL_NOT_FIX    
Severity: normal CC: rui.zhang
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.3.3 Subsystem:
Regression: No Bisected commit-id:
Attachments: acpidump

Description Weng Xuetian 2015-12-24 03:23:11 UTC
There are two devices under /sys/class/power_supply

ls /sys/class/power_supply/
ADP1  BAT1

With following command:
udevadm monitor -p -s power_supply

When pluging/unpluging the power, I can only observe event related to BAT1, but nothing related to ADP1. But if I execute "cat /sys/class/power_supply/ADP1/online" manually, the returned value indeed reflects the actualy state of power adaptor.
Comment 1 Aaron Lu 2016-02-01 08:40:52 UTC
*** Bug 111001 has been marked as a duplicate of this bug. ***
Comment 2 Chen Yu 2016-02-15 16:21:08 UTC
According to your description, it seems like the adapter driver does not report netlink event to upper level.
And I've made a double-check on Surface Pro 3, there are BAT0 and AC0 under power_supply, both of them issue udev events to udevadm when plug/unplug the adapter, can you please provide:
ls -l /sys/class/power_supply and the acpidump file?
Comment 3 Weng Xuetian 2016-02-15 16:46:52 UTC
Created attachment 203681 [details]
acpidump

$ LANG=C ls -l /sys/class/power_supply/
total 0
lrwxrwxrwx 1 root root 0 Feb 14 10:13 ADP1 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:18/PNP0C09:00/ACPI0003:00/power_supply/ADP1
lrwxrwxrwx 1 root root 0 Feb 14 10:13 BAT1 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:18/PNP0C09:00/PNP0C0A:00/power_supply/BAT1
Comment 4 Chen Yu 2016-02-15 17:09:57 UTC
On sp4, BIOS did not provide any notification mechanism on AC(no Notify(ADP1)), so although AC driver provide udev/netlink transaction in acpi_ac_notify, no one is willing to cover this path due to BIOS implementation, and the AC status is maintained directly by EC, so it is correct.
Comment 5 Weng Xuetian 2016-02-16 20:49:41 UTC
Ah, thank you.

It seems that I can patch the dsdt file and add related Notify(ADP1, 0x81) to after following lines:
ADBG ("Adapter plug inserted")
ADBG ("Adapter plug removed")

With patched dsdt now I can receive related infomation via udevadm. So I guess this is a bug in firmware instead of kernel?
Comment 6 Chen Yu 2016-02-17 01:47:14 UTC
I think so, it looks like BIOS does not think it is necessary to inform the OS of the AC status.
Comment 7 Chen Yu 2016-02-18 02:34:39 UTC
I'm closing this thread as this is due to firmware implementation.