8.1-rc2 ACPI fix and Cherrytrail support

296 views
Skip to first unread message

Don Quijote

unread,
Nov 13, 2018, 6:03:01 PM11/13/18
to Android-x86
Hello,

first the short version, then a detailed version with some questions etc

tl;dr:
1. Please revert commit 611e5e2b35488e652667a20d9f7fa8a55bf9f77e ("ACPICA: Update for generic_serial_bus and attrib_raw_process_bytes protocol") in the kernel repo. It is a cherrypicked commit, that only found its way into Linux kernel 4.20. It seems to break ACPI for Intel Atom devices in 4.18! My guess is, that this is also the main cause of this problem: https://groups.google.com/forum/#!msg/android-x86/PkYpy3Y-lPw/uM9OpcHlBwAJ  (It's also an Atom device, an problem with the charging indicator (was my reason to dig into it) and it seems to be the same kernel error as I experienced. Do you have a special reason to use that commit on the 4.18 kernel?

2. Please enable the drivers for Cherrytrail devices in the kernel. If you need to know which options to enable, I can upload a patch file.



Now the long version:
I own a HP x2 210 G2. It has an Intel Atom x5-Z8350 CPU.

I first tried to use Android-x86 with the 7.X releases, but i mostly didnt work. No sound, no charging indicator, screen orientation getting stuck, crashes, pen for touchscreen not getting recognized correctly. First I tried newer kernels that I found in this group. I found out, that the correct hdmi audio driver was not available in the old kernel, just as it didnt have working support for cherrytrail devices. I got audio and charging indicator to work, but the remaining issues (more crashes, pen not working no matter what I tried) stopped me from trying any further.

Next try was with the 8.1-rc1: Really bad situation. Every build (self compiled and the ISOs from the download page) crashed, no application was able to start, newer kernels or different kernel builds were not able to get a working image at all, just black screens on/after boot. So, I waited again.


Now enter 8.1-rc2: Downloaded ISO, put it onto the USB stick, installed and... BOOM: audio working from the start, no crashes, smooth animations, and even the PEN was recognized correctly! Very nice. But no charging indicator. So I updated my local repo, enabled CHT support (see tl;dr point 2) and restarted. Still no working charging indicator. Battery always showing up as charging, even when the device was running on battery power alone. Strange.
I dug into it, saw ACPI errors during debug boot, found the error report in the google group and began to compare the android-x86 kernel to the unmodified 4.18 kernel. I found a strange looking commit (see tl;dr point 1), reverted it, compiled and the charging indicator is working again on my device.


Now everything is working, EXCEPT: the screen rotation is not working. Apps testing the sensors are working correctly. And sometimes I can rotate the screen once or twice after boot. Then it gets stuck. After reboot it works again for a moment, then: no screen rotation anymore again. Checking the devices in the console (/sys/class/...) still shows all sensors correctly and the kernel log shows no related errors.
So I think it is a problem in the communication between kernel and android itself. Do you have any ideas, how to fix that? Maybe I have to change something in the startup script?

Apart from that (I can use screen rotation apps for now) I can now fully use my device with android-x86. If you can incorporate the two changes I mentioned in the tl;dr I won't have to compile it myself everytime (and can free ~200GB of HDD space xD ), so that would be great. As I said, I can supply a patch if you want me to.


Thanks to everyone participating in this project. Keep up the good work!

Chih-Wei Huang

unread,
Nov 13, 2018, 10:31:45 PM11/13/18
to Android-x86
Don Quijote <rosins...@gmail.com> 於 2018年11月14日 週三 上午7:03寫道:
> first the short version, then a detailed version with some questions etc
>
> tl;dr:
> 1. Please revert commit 611e5e2b35488e652667a20d9f7fa8a55bf9f77e ("ACPICA: Update for generic_serial_bus and attrib_raw_process_bytes protocol") in the kernel repo. It is a cherrypicked commit, that only found its way into Linux kernel 4.20. It seems to break ACPI for Intel Atom devices in 4.18! My guess is, that this is also the main cause of this problem: https://groups.google.com/forum/#!msg/android-x86/PkYpy3Y-lPw/uM9OpcHlBwAJ (It's also an Atom device, an problem with the charging indicator (was my reason to dig into it) and it seems to be the same kernel error as I experienced. Do you have a special reason to use that commit on the 4.18 kernel?

This is necessary for Surface 3 battery driver.
It is also a Cherrytrail device.
The patch recommended by the upstream maintainer.
Anyway, I can discuss it with the maintainer again.

> 2. Please enable the drivers for Cherrytrail devices in the kernel. If you need to know which options to enable, I can upload a patch file.

Which drivers did you mean exactly?
Please provide a patch.

Thank you for the good report!


--
Chih-Wei
Android-x86 project
http://www.android-x86.org

youling 257

unread,
Nov 13, 2018, 10:54:23 PM11/13/18
to Android-x86
It is a set of patch.
[0/6] ACPICA version 20181003 - Patchwork
[1/6] ACPICA: Update for generic_serial_bus and

在 2018年11月14日星期三 UTC+8上午11:31:45,Chih-Wei Huang写道:

youling 257

unread,
Nov 13, 2018, 10:57:45 PM11/13/18
to Android-x86
only when you test 4.20rc2 kernel on androidx86, if has same charging indicator problem, you can report a bug for bugzilla.kernel about "ACPICA: Update for generic_serial_bus and".

在 2018年11月14日星期三 UTC+8上午7:03:01,Don Quijote写道:

Don Quijote

unread,
Nov 14, 2018, 2:41:52 AM11/14/18
to Android-x86
I have to go to work now, so the quick answer: My device needs the Dollar Cove drivers enabled:

CONFIG_INTEL_SOC_PMIC_CHTDC_TI and CONFIG_CHT_DC_TI_PMIC_OPREGION

Exclude CONFIG_INTEL_CHTDC_TI_PWRBTN for now, as it makes the power button event fire twice when being pushed, starting the camera when turning off the device.

In some old patch, that enabled Dollar Cove in the kernel ( https://lore.kernel.org/patchwork/patch/825698/ ) you also find some ACPI stuff. Maybe those ACPI patches from 4.20 only break Dollar Cove devices?!

Btw. do you know which PMIC is used in the Surface 3? Whiskey Cove or Dollar Cove?

And on another thought, refering to youling 257: Maybe Dollar Cove devices were fixed in a later patch from the series and the fix wasn't applied to the android x86 repo?

Don Quijote

unread,
Nov 14, 2018, 2:11:37 PM11/14/18
to Android-x86
An update from me:

I followed the link from youling 257 ( https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?qt=grep&q=Bob+Moore ) and the newest commit is this one: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=58a0228707870c8330917f919804986855443a19
I shows huge changes to exfield.c, changes to the while ACPI system and the Intel PMIC drivers. And the log says it fixes "issues with BYT/CHT" and it shall "avoid device enumeration problems on boards with Dollar Cove". This reinforces my opinion, that the patch set was incomplete or bugged.

Besides the Surface 3 has been used with Linux distributions with working battery support for some time now. I think it's unlikely that something was bugged in a way that you had to apply those patches for the Surface 3 battery to work. It only says in the commit log "... but this change works correctly on the Surface 3.". It works with Surface 3, but it doesn't say, that it required for it to work.

The Surface 3 also uses a Cherrytrail SoC (Z8700). Maybe it was a missing driver until now? As I said, my Z8350 needs Dollar Cove PMIC & ACPI to be enabled. I have no Surface 3 to test it with those drivers. But maybe it's worth a try.


I'm currently recompiling android x86 after I cleaned up and resynced my repository. I'm trying to find the minimum configuration for my battery indicator to work.
For now I have enabled:
CONFIG_INTEL_SOC_PMIC_CHTDC_TI
CONFIG_CHT_DC_TI_PMIC_OPREGION
CONFIG_CHARGER_BQ2415X
CONFIG_CHARGER_BQ24190
CONFIG_INTEL_CHT_INT33FE

I think this should be the minimum amount of drivers for it to work.
other options I have enabled (have nothing to do with the battery/ACPI):
HID_ELAN
CONFIG_USB_ROLES_INTEL_XHCI


While I was testing I enabled close to all drivers for Atom SoC. Including Medfield drivers, BXT Whiskey Cove, CONFIG_PINCTRL_MERRIFIELD, additional GPIO stuff (Whiskey Cove) etc. It didn't hurt and I didn't want to compile a thousand times because I missed one small option.
Maybe it's worth thinking about enabling all of those. There are many small, mobile x86 devices out there, that are using the Atom SoCs, so enabling as many as possible of those might be worth it.

Chih-Wei Huang

unread,
Nov 14, 2018, 9:53:25 PM11/14/18
to Android-x86
Don Quijote <rosins...@gmail.com> 於 2018年11月15日 週四 上午3:11寫道:
>
> An update from me:
>
> I followed the link from youling 257 ( https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?qt=grep&q=Bob+Moore ) and the newest commit is this one: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=58a0228707870c8330917f919804986855443a19
> I shows huge changes to exfield.c, changes to the while ACPI system and the Intel PMIC drivers. And the log says it fixes "issues with BYT/CHT" and it shall "avoid device enumeration problems on boards with Dollar Cove". This reinforces my opinion, that the patch set was incomplete or bugged.
>
> Besides the Surface 3 has been used with Linux distributions with working battery support for some time now. I think it's unlikely that something was bugged in a way that you had to apply those patches for the Surface 3 battery to work. It only says in the commit log "... but this change works correctly on the Surface 3.". It works with Surface 3, but it doesn't say, that it required for it to work.

No. The battery driver of Surface 3 is not in upstream kernel yet.
Patches are required -- they may get in in 4.20.
If any Linux distros has a working battery support,
they must have applied patches as we did.
Why did I know? The developer told me.

> The Surface 3 also uses a Cherrytrail SoC (Z8700). Maybe it was a missing driver until now? As I said, my Z8350 needs Dollar Cove PMIC & ACPI to be enabled. I have no Surface 3 to test it with those drivers. But maybe it's worth a try.
>
> I'm currently recompiling android x86 after I cleaned up and resynced my repository. I'm trying to find the minimum configuration for my battery indicator to work.
> For now I have enabled:
> CONFIG_INTEL_SOC_PMIC_CHTDC_TI
> CONFIG_CHT_DC_TI_PMIC_OPREGION
> CONFIG_CHARGER_BQ2415X
> CONFIG_CHARGER_BQ24190
> CONFIG_INTEL_CHT_INT33FE
>
> I think this should be the minimum amount of drivers for it to work.
> other options I have enabled (have nothing to do with the battery/ACPI):
> HID_ELAN
> CONFIG_USB_ROLES_INTEL_XHCI
>
> While I was testing I enabled close to all drivers for Atom SoC. Including Medfield drivers, BXT Whiskey Cove, CONFIG_PINCTRL_MERRIFIELD, additional GPIO stuff (Whiskey Cove) etc. It didn't hurt and I didn't want to compile a thousand times because I missed one small option.
> Maybe it's worth thinking about enabling all of those. There are many small, mobile x86 devices out there, that are using the Atom SoCs, so enabling as many as possible of those might be worth it.

If these options could be module (m) or
a normal Linux distro has enabled them,
I am not against adding them.
Let me check...

Chih-Wei Huang

unread,
Nov 14, 2018, 9:54:27 PM11/14/18
to Android-x86
Hi Don,
Please test the following patch provided by the developer.
(shown inline)

---------- Forwarded message ---------
From: Benjamin Tissoires <benjamin....@gmail.com>
Date: 2018年11月14日 週三 下午3:19
Subject: Re: 8.1-rc2 ACPI fix and Cherrytrail support
To: Chih-Wei Huang <cwh...@android-x86.org>


Hi Chih-Wei,

On Wed, Nov 14, 2018 at 4:45 AM Chih-Wei Huang <cwh...@android-x86.org> wrote:
>
> Hi Benjamin,
> In my group someone reported the patch
> "ACPICA: Update for generic_serial_bus and attrib_raw_process_bytes protocol"
> causes problem to battery driver of his device.
> Please see the forwarded message.
>
> This patch was recommended by you
> for battery driver of Surface 3.
> Unless I made some mistakes when cherrypicked it.
> Please check:
> https://osdn.net/projects/android-x86/scm/git/kernel/commits/611e5e2b35488e652667a20d9f7fa8a55bf9f77e
>
> ---------- Forwarded message ---------
> From: Don Quijote <rosins...@gmail.com>
> Date: 2018年11月14日 週三 上午7:03
> Subject: 8.1-rc2 ACPI fix and Cherrytrail support
> To: Android-x86 <andro...@googlegroups.com>
> Hello,
>
> first the short version, then a detailed version with some questions etc
>
> tl;dr:
> 1. Please revert commit 611e5e2b35488e652667a20d9f7fa8a55bf9f77e
> ("ACPICA: Update for generic_serial_bus and attrib_raw_process_bytes
> protocol") in the kernel repo. It is a cherrypicked commit, that only
> found its way into Linux kernel 4.20. It seems to break ACPI for Intel
> Atom devices in 4.18! My guess is, that this is also the main cause of
> this problem: https://groups.google.com/forum/#!msg/android-x86/PkYpy3Y-lPw/uM9OpcHlBwAJ

There is something fishy in this comment :
ACPI Error: Invalid zero data length in transfer buffer (20180531/exfield-400)

AFAICT, we are missing the '+2' from the length buffer in the other
cases (non Surface 3 I would say).

Can you ask the reporter to try the simple following patch (gmail
might break it, but you get the gist of it, adding '+2' at line 397)?

---
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index 17b937c5144f..a89cd088b3d6 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -394,7 +394,7 @@ acpi_ex_write_data_to_field(union
acpi_operand_object *source_desc,
* Length; (Byte 1 of the data buffer)
* Data[x-1]: (Bytes 2-x of the arbitrary
length data buffer)
*/
- data_length = source_desc->buffer.pointer[1];
/* Data length is 2nd byte */
+ data_length = source_desc->buffer.pointer[1] +
2; /* Data length is 2nd byte */
if (!data_length) {
ACPI_ERROR((AE_INFO,
"Invalid zero data length
in transfer buffer"));
---

Cheers,
Benjamin

Don Quijote

unread,
Nov 16, 2018, 8:48:10 PM11/16/18
to Android-x86
Hello,

I applied your patch and it seems to work. With "+2" at the end of this line the battery is detected correctly and shows its remaining capacity/time. Great, thanks for your help.

I've attached a patch file for the config that I used to compile. The second file is the extract of the drivers that were loaded by openSUSE Tumbleweed Live, when I tried to narrow down on what I need to enable.

Now I have only two issues remaining: One input device sometimes doesn't work. Eg. I can use the touchscreen with my Pen and I can use the touchpad on the detachable keyboard, but touching the screen with a finger doesn't work. After a restart I can use Pen and finger, but the touchpad doesn't work. Any ideas?

And do you have an idea on how to debug the screen rotation?
HPx2.diff
Tumbleweed_DriverInfo.txt

Chih-Wei Huang

unread,
Nov 19, 2018, 10:47:08 PM11/19/18
to Android-x86
Don Quijote <rosins...@gmail.com> 於 2018年11月17日 週六 上午9:48寫道:
>
> Hello,
>
> I applied your patch and it seems to work. With "+2" at the end of this line the battery is detected correctly and shows its remaining capacity/time. Great, thanks for your help.

Fine. Thank you for the testing.

> I've attached a patch file for the config that I used to compile. The second file is the extract of the drivers that were loaded by openSUSE Tumbleweed Live, when I tried to narrow down on what I need to enable.
>
> Now I have only two issues remaining: One input device sometimes doesn't work. Eg. I can use the touchscreen with my Pen and I can use the touchpad on the detachable keyboard, but touching the screen with a finger doesn't work. After a restart I can use Pen and finger, but the touchpad doesn't work. Any ideas?

No... But you can also ask the Benjamin
who is the hid-multitouch driver maintainer.

> And do you have an idea on how to debug the screen rotation?

Sounds like a driver issue.
Use some sensors testing app to check
the g-sensor reported value.
Reply all
Reply to author
Forward
0 new messages