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

            Bug ID: 218945
           Summary: The fix in 218789 breaks ac and battery readings for
                    asus laptops (gu605)
           Product: ACPI
           Version: 2.5
          Hardware: Intel
                OS: Linux
            Status: NEW
          Severity: blocking
          Priority: P3
         Component: EC
          Assignee: acpi...@kernel-bugs.osdl.org
          Reporter: vitaly.tors...@gmail.com
        Regression: No

Created attachment 306438
  --> https://bugzilla.kernel.org/attachment.cgi?id=306438&action=edit
Workaround for asus gu605

Creating this ticket to highlight a regression introduced with a fix proposed
in https://bugzilla.kernel.org/show_bug.cgi?id=218789

Actually that patch breaks ac and battery modules. 
Sysfs readings for gu605 reported: 
- that AC is always online independently if power source connected
- battery readings are wrong: capacity always 100, voltage is always 5000,
current is always 1000000; charge_full and charge_full_design is always 5000.
All values are not correct. 

I've updated defect 218789 with a workaround patch that makes ac and battery
modules working again with 6.10 source tree. 

Unfortunately, I can not provide correct solution since I am not acpi expert,
but I feel that Lenovo laptop might need quirks or separate logic for EC
initialization flow.

Additionally, not sure if it is correct to use ACPI_ROOT_OBJECT as acpi_handle
when actual acpi_ec requested for initialization. An ACPI expert might need to
look into this. 

Here are some results of investigation: 

In 218789 due to reported error proposed to use ACPI_ROOT_OBJECT which supposed
to initalize EC's, but on asus laptops this change breaks backward
compatibility.

So ec_install_handlers is called from acpi_ec_setup and first_ec will be set to
ec in the beginning, so in ec_install_handlers() ACPI_ROOT_OBJECT will be used
as handler. 
 static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device,
                               bool call_reg)
 {
       acpi_handle scope_handle = ec == first_ec ? ACPI_ROOT_OBJECT :
ec->handle;

And this method is called from acpi_ec_setup where first_ec will be set to ec: 

static int acpi_ec_setup(struct acpi_ec *ec, struct acpi_device *device, bool
call_reg)
{
        int ret;

        /* First EC capable of handling transactions */
        if (!first_ec)
                first_ec = ec;

I understand that original defect should be fixed, but preserving things which
used to work should be also priority. 

Please let me know if additional information is needed. 

The fix which just works (probably it is not "proper" fix, but that patch makes
asus battery and ac modules working as supposed to).

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
acpi-bugzilla mailing list
acpi-bugzilla@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acpi-bugzilla

Reply via email to