Hi, I think everything is now working as expected:
I have charged a partially emtpy pandora battery (carefully placed on the spring contacts because there is no case yet :). And I could monitor the capacity level go up from ~40% to 100% and in parallel the voltage. The charger driver also reported “charging” and at 100% it reported “full”. I have just now tested the OTG DC/DC converter and also could switch on/off the 5V at the OTG port.
To do all this, I had to hack the kernel drivers in a way that I am able to test if the chip and the system is working as expected. So let me describe and document some findings:
Charger is bq24297 * I have hacked a driver I had found on the web until it works well enough for hardware bring-up [1] * this chip responds on I2C only if battery or USB power is available - so it is “missing” if we power the board only from the EVM (which will never be the case in production devices) * it should be possible to hot-swap the battery as long as an external charger is connected * charging and OTG only works if battery temperature is between -10°C and 60°C (measured by battery NTC) * a missing battery is reported as -20°C * it presents itself as /sys/class/power_supply/bq24297 * the driver has some /sys nodes: /sys/devices/platform/44000000.ocp/48072000.i2c/i2c-1/1-006b * battparam: shows all register values for debugging * max_current: specifies the max current drawn from USB energy source * otg: specify the current limit (uA) of the OTG driver (0, 1000000, 1500000) * to switch to OTG: echo 1000000 >otg * to switch off again: echo 0 >otg * id: this should be removed (I had thought that the charger monitors the ID pin to be able to auto-switch to OTG but it doesn’t) * the driver detects VBUS availablility and battery presence * the driver will need extensions to make OTG automatically work on cable-plug-in (maybe with help from some udev rule) * it will need a lot of polishing to get it upstream * what I was not yet able to test is how the charger behaves with a completely drained battery - it should silently charge at low current without CPU intervention…
Fuel gauge is bq27421 (but I am thinking about switching to bq27621) * driver is available in Linux: compatible = "ti,bq27425" * it automatically reports voltage, charging level, chip temperature * but it needs battery power to respond on I2C * so it will fail and loose all data on battery hot-swap * a new modprobe bq27xxx_charger might solve that issue * there are patches flying around to better support the bq27421 * e.g. setup some battery parameters like battery capacity by design (currently reports 1340mAh for any battery) * it does not report real battery temperature by NTC * I have also planned to connect the NTC to one of the twl6040 ADCs on the CPU board so we will be able to read the real battery temp - but I don’t know if this conflicts * the OTG ID pin also goes to the CPU board * there was a bug in the schematics/placement list which could have damaged the chip in the prototype, but it has “survived” this extra stress * why not bq27200 like in Pandora? the bq27200 would be the only chip to limit the I2C2 speed to 100kHz
USB-Hosts DC/DC is a tps2505 * operation is simple and has no driver * it has a general enable GPIO which starts the DC/DC * if enabled, the HDMI and the VBUS of the 3G/4G modem are driven with 5V * both host ports have additional switches with two more GPIOs controlling them * Overcurrent on the host ports is detected and reported by driving the red indicator LEDs - it can also be detected by CPU
BR, Nikolaus
[1]: http://git.goldelico.com/?p=gta04-kernel.git;a=blob;f=drivers/power/bq2429x_...