ca On Sat, Jan 5, 2019 at 2:17 PM Zhang Rui <rui.zhang@xxxxxxxxx> wrote: > > From 6f2fac0ffcd7fd61036baa0798ab171496cff50f Mon Sep 17 00:00:00 2001 > From: Zhang Rui <rui.zhang@xxxxxxxxx> > Date: Fri, 4 Jan 2019 14:35:52 +0800 > Subject: [PATCH] ACPI/ACPICA: Run EC _REG explicitly for ECDT > > commit d737f333b211 ("ACPI: probe ECDT before loading AML tables > regardless of module-level code flag") probes ECDT before loading > the AML tables. > > This is the right thing to do according to the ACPI Spec, but > unfortunately, it breaks the current kernel EC/ECDT support, and makes > many devices, including battery, lid, etc, fails to work on a variety > of platforms. > > This is because: > 1. Probing ECDT requires installing EC address space handler > 2. EC _REG can not be evaluated at the time when probing ECDT because AML > tables have not been loaded yet. > 3. Many devices fail to work because EC _REG is not evaluated. > > To fix this, a solution is proposed in this patch to evaluate EC _REG > explicitly in ACPICA, if ECDT has been probed. It would be good to give some more details here as the patch itself appears to be rather convoluted. Also, the description above doesn't actually explain why the problem is there, as it doesn't explain why probing the ECDT early causes the EC _REG to be not evaluated. It looks like the failure is due to the change of the ordering between acpi_load_tables() and acpi_ec_ecdt_probe() in the acpi_gbl_group_module_level_code case which causes the EC to be probed before instantiating the namespace and _REG obviously cannot be evaluated then. Honestly, I don't think that ACPICA is the right place to address this as the failure appears to be Linux-specific. It would be better to fix it in the EC driver (which may require some help from ACPICA, though).