[Xiaomi Mi 5 Questions & Answers] deathscythemeng:
Lineage OS 14.1 is a very good ROM. Thanks to [MENTION=455439]bgcngm[/MENTION]. However, we find that charging is shower than that in CM 13.0. Here are some tests and findings by me.

I test on four conditions - power off, first time after power on, second time after power on, in TWRP 3.0.2-3.

Battery level is around 93% when I do the test. It is a little high, but if you read following findings, you will find that it is not a problem.

The charger I used is EQ-24BCN from LeEco. Output ability is 3.6~8V/3A, 12V/2A. It is a QC 3.0 charger. You can find it in official list of QC from Qcom website. The link is

https://www.qualcomm.com/documents/quick-charge-device-list

1. Power off.

[IMG="Power off"]http://i1.piimg.com/1949/b1cd468334056f8f.jpg[/IMG]

There are four signals in the picture. Green and blue are USB D+ and D-(2V/div). Yellow is output voltage of charger(5V/div). Pink is output current of charger(1A/div). Output voltage changes from 5V to 9V, and that is the time charger is identified as QC2.0. And then output voltage changes drop down to 5V and rises to around 6V, and that is the time charger is identified as QC3.0. So QC 3.0 is working when the phone is power off.

2. In TWRP 3.0.2-3

[IMG="TWRP 3.0.2-3"]http://p1.bqimg.com/1949/8f33b649c3ee7d53.jpg[/IMG]

I think TWRP 3.0.2-3 is using CM 13.0 kernel. Correct me if I am wrong. In the picture, voltage of charger changes from 5V to 9V and then keeps the value. So the charger is identified as QC2.0. I read the value of

/sys/class/power_supply/usb/type

, and it is USB_HVDCP. The value also indicates that it is recognized as QC 2.0 charger.

3. The first time after power on

[IMG="1st after power on"]http://p1.bqimg.com/1949/9f2d93ca772e9d12.jpg[/IMG]

The behavior is quite similar compared to power off condition. There is only a short time when output voltage of charger is 9V, and then QC 3.0 is detected. The value of /sys/class/power_supply/usb/type is USB_HVDCP_3. So QC 3.0 is working after power on.

4. The second time after power on.

[IMG="2nd after power on"]http://i1.piimg.com/1949/76edc4e55547b015.jpg[/IMG]

Unfortunately, QC will not work if you plug the charger again. Output voltage is always 5V, and the value of /sys/class/power_supply/usb/type is USB_DCP. QC 3.0 charger is recognized as normal charger.

Other findings:

QC 3.0 will not work each time after power on. QC will not work if you simply reboot the phone. It will only work when QC works normally and then power on. For example, power off the phone, plug in QC 3.0 charger, wait until battery ico presents, then QC is working, plug out charger, power on the phone, wait until Android boots, and at last plug in charger again, and then QC 3.0 will work. I find only two state when QC will always work - one is power off, the other is TWRP 3.0.2-2 (I think the reason is that it uses CM13 kernel).

If QC 3.0 charger is successfully recognized, the value of /sys/class/power_supply/usb/type should be USB_HVDCP_3. I am not an expert in software, so correct me if I am wrong. I hope that anyone who wants to help can help to read the value of /sys/class/power_supply/usb/type if you find QC may work. Let's find all situations that QC will work, and I think it will help [MENTION=455439]bgcngm[/MENTION] fix the issue.

Update:

I have tried to replace hvdcp_opti binary with the one from dev 7.1.20 and stable 8.1.6.0. QC only works for the first time. The issue may not be related with hvdcp_opti binary, but it still can not be confirmed.

Further update:

I have complied cm-14.1 boot image with kernel source of cm-13.0 branch. QC 3.0 is confirmed to work normally. I believe the issue of QC is kernel-related. I may seek further to find what certain patches break QC 3.0.