dce69e0a06
[ Upstream commit 009a789443fe4c8e6b1ecb7c16b4865c026184cd ]
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:
OperationRegion (REGS, 0x8F, Zero, 0x50)
Field (REGS, ByteAcc, NoLock, Preserve)
{
CLNT, 8,
SA, 8,
OFF, 8,
VAL, 8,
RWM, 8
}
Method (GET, 3, Serialized)
{
If ((AVBE == One))
{
CLNT = Arg0
SA = Arg1
OFF = Arg2
RWM = Zero
If ((AVBG == One))
{
GPRW = Zero
}
}
Return (VAL) /* \_SB_.PCI0.I2C7.PMI5.VAL_ */
}
Method (SET, 4, Serialized)
{
If ((AVBE == One))
{
CLNT = Arg0
SA = Arg1
OFF = Arg2
VAL = Arg3
RWM = One
If ((AVBG == One))
{
GPRW = One
}
}
}
Fixes:
|
||
---|---|---|
.. | ||
acpica | ||
apei | ||
arm64 | ||
dptf | ||
hmat | ||
nfit | ||
pmic | ||
x86 | ||
ac.c | ||
acpi_adxl.c | ||
acpi_amba.c | ||
acpi_apd.c | ||
acpi_cmos_rtc.c | ||
acpi_configfs.c | ||
acpi_dbg.c | ||
acpi_extlog.c | ||
acpi_ipmi.c | ||
acpi_lpat.c | ||
acpi_lpit.c | ||
acpi_lpss.c | ||
acpi_memhotplug.c | ||
acpi_pad.c | ||
acpi_platform.c | ||
acpi_pnp.c | ||
acpi_processor.c | ||
acpi_tad.c | ||
acpi_video.c | ||
acpi_watchdog.c | ||
battery.c | ||
bgrt.c | ||
blacklist.c | ||
bus.c | ||
button.c | ||
cm_sbs.c | ||
container.c | ||
cppc_acpi.c | ||
custom_method.c | ||
debugfs.c | ||
device_pm.c | ||
device_sysfs.c | ||
dock.c | ||
ec_sys.c | ||
ec.c | ||
event.c | ||
evged.c | ||
fan.c | ||
glue.c | ||
hed.c | ||
internal.h | ||
ioapic.c | ||
irq.c | ||
Kconfig | ||
Makefile | ||
numa.c | ||
nvs.c | ||
osi.c | ||
osl.c | ||
pci_irq.c | ||
pci_link.c | ||
pci_mcfg.c | ||
pci_root.c | ||
pci_slot.c | ||
power.c | ||
pptt.c | ||
proc.c | ||
processor_core.c | ||
processor_driver.c | ||
processor_idle.c | ||
processor_pdc.c | ||
processor_perflib.c | ||
processor_thermal.c | ||
processor_throttling.c | ||
property.c | ||
reboot.c | ||
resource.c | ||
sbs.c | ||
sbshc.c | ||
sbshc.h | ||
scan.c | ||
sleep.c | ||
sleep.h | ||
spcr.c | ||
sysfs.c | ||
tables.c | ||
thermal.c | ||
utils.c | ||
video_detect.c | ||
wakeup.c |