The Linux Kernel has drivers for controlling power regulators and the power chips. This bugs encapsulates the investigation of the hamachi and keon devices to see if they support shutting off the USB charging circuit and then adding to the test driver scripts to shut off USB charging so the power consumption data gathering can work.
Whiteboard: [c=power p= s= u=] → [c=power p=4 s= u=]
There is an msm_charger kernel module available that looks to be able to disable the charging circuit but it doesn't expose that control to user space. I'm in the process of writing a small kernel module that does that.
Status: NEW → ASSIGNED
I'm trying to build a custom kernel for the Hamachi device. I found the kernel config file and customized it to my liking but I'm struggling to figure out the trick to get ./build.sh to build the kernel from source rather than use the one pulled from qualcomm. Do you have any suggestions?
I believe Jed has successfully built a kernel for hamachi before. We'll want to switch to a proper hamachi kernel build now that we have the source, but things aren't currently configured to easily build hamachi kernels.
Flags: needinfo?(mwu) → needinfo?(jld)
There was some discussion on IRC the other day. Our current hamachi manifest pulls CodeAurora's kernel/msm, which I haven't actually tried but I assume it won't work as-is on the device itself. I have an altered manifest, currently at https://github.com/jld/b2g-manifest/tree/master/hamachi.xml, which will build a boot image and matching WiFi drivers from Alcatel's souce release (+ our seccomp-bpf patch). Notes on installation are in https://gist.github.com/jld/7270024 (extra complication there because the WiFi drivers created by the build will be overwritten by the ones from backup-hamachi in the system.img staging tree). WARNING: Some builds seem to have a locked bootloader which won't load an image created this way, in which case the device will be bricked until an acceptable boot.img is flashed (but fastboot will still work for that).
I'm limiting the scope of this bug to be just getting charging under software control on my GP Keon. There will be follow on bugs to track the work of getting the Hamachi kernel source build up to date and patched.
According to qualcomm, the charging circuit isn't under software control from the application processor. Only the baseband processor can control it. That means the Keon and Hamachi are unable to disable charging from the b2g side. I am now switching to investigating making a source build of the kernel for the Nexus S and Nexus 4 hardware. Maybe they will support this feature.
I should not that this is really only needed for us to do automated regression testing for power usage. We are still able to manually execute tests on devices with the ammeter attached and still gather reasonably good data.
I have shifted gears to working on the Nexus S platform. It uses the max8998_charger kernel module to manage charging of the battery. I'm currently getting the Nexus S kernel to build from source so that I can make modifications.
Created attachment 8337163 [details] Charging.png Screenshot showing dmesg on the Nexus S with "USB charging enabled" messages and the resulting measurements on the ammeter. Notice that the line on the ammeter is red. That indicates that current is flowing from the charging circuit INTO the battery (i.e. the battery is charging).
Created attachment 8337165 [details] No_Charging.png This is a screenshot of the same kernel as before but with a modified battery driver that disables charging and refuses to enable it when the USB cable is connected. Notice in the dmesg output it says "REFUSING TO ENABLE CHARGING". There is also the ammeter output that shows that current is flowing from the battery into the device (i.e. the battery is discharging) even though the USB cable is attached.
My investigation is complete. Moving on to implementation. See Bug 942387 and Bug 942386.
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.