A2109 Kernel Experiments

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
The best I got was 98%
What type of charger are you using? I noticed that if I unplug my 2A charger and then plug in a 500mA charger, my tablet will charger to 100%. (My other tablet always charges to 100%.)

***EDIT***

I think I may have found an elegant solution! The original board files contain an additional bit of configuration data for the charger. I reimplemented just that configuration bit. Specifically, it results in the following difference in /sys/kernel/debug/smb349:
Code:
0x00: 0x6a
0x01: 0x48 --> 0x40
0x02: 0x97
0x03: 0xe5
0x04: 0x38
0x05: 0x16 --> 0x06
0x06: 0x66 --> 0x76
0x07: 0xdf --> 0x50
0x09: 0x00
0x0a: 0x47
0x0b: 0x45 --> 0x4e
0x0c: 0xfb --> 0x80
0x0d: 0xe1 --> 0x98
0x0e: 0x29
0x10: 0x0d --> 0x0f
0x11: 0x8b
0x12: 0x36

Especially the 0x01 register seems interesting. A Lenovo comment in the code suggests that it has to do with the current for "taper charging", which is the charging type just before the battery is full. My hypothesis is that the configuration change lowers the taper charging current, making charging last longer, until the battery is full.

Here is the full configuration bit, including, in the comment, the corresponding registers:
Code:
        .configuration_data = {
                0x6A,/*0x00*/ /*input current*/                 //0x00
                0x40,/*taper current*/                          //0X01
                0xFF,                                           //0x02
                0xFF,                                           //0x03
                0x38,/*recharge current=100mA*/                 //0x04
                0x06,/*500mA for other charger*/                //0x05
                0xFF,                                           //0x06
                0x40,/*min system voltage and termal enable*/   //0x07
                0xFF,                                           //0x08, doesn't exist
                0xFF,/*OTG active low: 0x20*/                   //0x09
                0xFF,                                           //0x0a
                0x4E,/*0x8E*/ /*temperature monitor:0~50*/      //0x0b
                0x80,                                           //0x0c
                0x98,/*<-- interrupt mask*/                     //0x0d
                0xFF,                                           //0x0e
                0xFF,                                           //0x0f
                0x0F,/*low battery threshold:3.58*/             //0x10
        },
 
Last edited:

joebine

Senior Member
Jan 14, 2015
150
32
What type of charger are you using? I noticed that if I unplug my 2A charger and then plug in a 500mA charger, my tablet will charger to 100%. (My other tablet always charges to 100%.)

I am using an original Lenovo charger 2A. I will try with a phone charger to see if I get to 100%
 

joebine

Senior Member
Jan 14, 2015
150
32
I am using an original Lenovo charger 2A. I will try with a phone charger to see if I get to 100%

Yesterday, it charged to 100%. The battery was completely dead so I plug my Lenovo 2A charger to the tablet that had not boot due to the dead battery. After 10 minutes, I power on the tablet and left it on charge. After almost 5 hours, it was charged to 100%. Strange...

This morning, the battery was at 86% after a night on deep sleep.
 

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
Yesterday, it charged to 100%. The battery was completely dead so I plug my Lenovo 2A charger to the tablet that had not boot due to the dead battery. After 10 minutes, I power on the tablet and left it on charge. After almost 5 hours, it was charged to 100%. Strange...

This morning, the battery was at 86% after a night on deep sleep.
That's strange... Perhaps you accidentally recalibrated the battery?

In the meantime, I'm experimenting with the charger config. I thought I had it fixed, but then I found out that the charger resets its configuration after USB disconnect. I've now fine-tuned my patch and I'm now charging. I've reached 100% and it's still charging :)
 

joebine

Senior Member
Jan 14, 2015
150
32
The tablet is working great with kernel 3.4, I also notice that screen lock rotation is working with kernel 3.4.

Yesterday, the tablet was at 15% of battery and I plug the 2A charger. This morning I checked and it was charge to 97%.
I unplug the 2A charger and plug in a 550mA charger and 30 seconds later it was at 100%.
 

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
The tablet is working great with kernel 3.4, I also notice that screen lock rotation is working with kernel 3.4.

Yesterday, the tablet was at 15% of battery and I plug the 2A charger. This morning I checked and it was charge to 97%.
I unplug the 2A charger and plug in a 550mA charger and 30 seconds later it was at 100%.
Great, that's like I suspected! The default settings for the charger use too much current at the end of charging, and this affects total charge negatively.

Here are two new kernel images to test, that contain the fix, based on Lenovo's tree (not including additional google patches needed for Marshmallow):
kernel-3.4-aosp-5.1.img 672cd850631c4f8121135e0ba7ccea77
kernel-3.4-cm-12.1.img d26f5ebcce1d1b11904d921e6774d91b

I only did one more thing (or actually, less), I removed a polling function that I used for debugging, but that was otherwise unvaluable. That should change nothing, nevertheless...

I also pushed my local branch to github, so you can now see clearly the changes that I made to Lenovo's tree to support kernel 3.4 on A2109. The branch is called A2109-linux-tegra-nv-3.4-CLEAN. These are the commits I made:
Code:
5fd2d31 smb349-charger: Add back in Lenovo's charger config
68d2a01 Disable powergating for TEGRA_POWERGATE_3D and TEGRA_POWERGATE_3D1
97d1604 Do not release tegra bootloader framebuffer on startup
956319f Add A2109 defconfig
5f00ebe smb349-charger: work around registers not detecting AC charger
8f697ae kai: Increase pixelclock to prevent display artifacts
ae8c040 Comment out the boost function in drivers/usb/gadget/tegra_udc.c
b7753d3 Revert fuse to non-platform driver
ba84a96 Set smaller voltage range for vmmc regulator
79a42d0 Add A2109 board file changes for kai
967858d Switch to Lenovo's driver and codec for aic326x
e6a90ec bluetooth: bluesleep: add bluedroid support
fc60e99 Add Solteam JSA1127 Ambient Light Sensor Driver from Lenovo sources
8cb6a05 Add gpio drivers for power button and Gensor rotation lock switch
c8f17f1 A2109: Add int cl2n_get_board_strap and tegra_get_hw_ramcode
f4f9905 Add tegra camera drivers mt9m114 and s5k5cag
935cd97 Revert "media: video: tegra: mt9m114 sensor kernel driver"
e22bad9 Add lis3dh accelerometer driver
8929d5e Add ft5x06 touchscreen driver
2f3b5c5 Add bq27541 battery driver
 

joebine

Senior Member
Jan 14, 2015
150
32
With this kernel I start to get lags in some apps that I didn't had with previous kernel 3.4. My ultimate test is Angry Birds 2 and it was ok before and now it got lags.

It look like only Angry Birds 2 is giving me some problems. All the other apps that I had tested are working well.
 

joebine

Senior Member
Jan 14, 2015
150
32
It's been a while I am using this kernel and it is working great. I find it a bit hard on battery usage.
 

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
It's been a while I am using this kernel and it is working great. I find it a bit hard on battery usage.
Good news. I can imagine it's not as good for battery use. But hey! We try :)

Still no bluetooth audio, I expect?
 
Top