Help configuring kernel for Baytrail system

From: Nicolas George
Date: Mon Jun 15 2015 - 09:17:00 EST


Hi.

I am trying to configure a kernel for a Baytrail SoC-based hybrid laptop (a
Lenovo Miix 3-1030). Amongst other things, the battery gauge is not
detected. I suspect it may be related to the following commit:

# commit 894acb2f823b13afacfe40b02efbd9146af58586
# Author: David Box <david.e.box@xxxxxxxxxxxxxxx>
# Date: Thu Jan 15 01:12:17 2015 -0800
#
# i2c: designware: Add Intel Baytrail PMIC I2C bus support

It is very likely that I am missing a simple compile-time or run-time
option, and in that case, on top of getting the configuration right, I have
a second question: how could I find the solution by myself?

Here is the problem data:

- The battery gauge works with the kernel from the Ubuntu 15.4 live image.
Quite a few other things fail to work with that kernel, so using it is not
a solution, but it is proof that it can work.

- I have tried with 3.16 from Debian, 4.0.1 and 4.1-rc* with custom
configuration, and the battery is completely invisible. Nothing in dmesg.

- The sysfs entry for the battery is this:
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/80860F41:00/PNP0C0A:00
It should contain a driver link to bus/acpi/drivers/battery, but it does
not.

- Adding custom debug messages, I was able to find that
acpi_bus_get_status_handle() evaluates the _STA attribute of the BATC
device to 0, meaning the device is not present.

- The corresponding code in the ACPI tables is this:

Device (BATC)
{
[...]
Method (_STA, 0, NotSerialized) // _STA: Status
{
If ((AVBL == One))
{
BUF7 = CMD7 /* \_SB_.I2C1.CMD7 */
If ((STAT != Zero))
{
Return (Zero)
}

Return (0x1F)
}

Return (Zero)
}

but I do not know how to debug further. Enabling full ACPI debug messages
gives so much output that it is unusable.

- I also suspect that the issue comes from the "dev->pm_runtime_disabled"
flag on the corresponding I2C bus entry: it is enabled by
i2c_dw_eval_lock_support() with a message "I2C bus managed by PUNIT", and
inhibits probing the device. I did not manage to find how to re-enable it.


Please let me know if you have any advice on this issue in particular or any
more general documentation on how to investigate I2C and PLATFORM/ACPI-based
systems.

In the meantime, I have summarized what I was able to get working on this
laptop on the following webpage:
http://nsup.org/~george/comp/linux_lenovo_miix3/

Regards,

--
Nicolas George

Attachment: signature.asc
Description: Digital signature