On Sun, Oct 31, 2021 at 11:00 AM Hans de Goede <hdegoede@xxxxxxxxxx> wrote: > > The handling of PMIC register reads through writing 0 to address 4 > of the opregion is wrong. Instead of returning the read value > through the value64, which is a no-op for function == ACPI_WRITE calls, > store the value and then on a subsequent function == ACPI_READ with > address == 3 (the address for the value field of the OpRegion) > return the stored value. > > This has been tested on a Xiaomi Mi Pad 2 and makes the ACPI battery dev > there mostly functional (unfortunately there are still other issues). > > Here are the SET() / GET() functions of the PMIC ACPI device, > which use this opregion, which clearly show the new behavior to > be correct: OpRegion vs opregion (I would prefer the former), i.o.w. a bit of consistency would be nice to have. -- With Best Regards, Andy Shevchenko