i2c-test: Report IRQ status

Signed-off-by: Sean Cross <xobs@kosagi.com>
bionic: Add strtol

Just wrap strtoul and look for the minus sign.

Signed-off-by: Sean Cross <xobs@kosagi.com>
cmd-gg: Get cal command working

We now support proper gas gauge calibration.

Signed-off-by: Sean Cross <xobs@kosagi.com>
gg: Implement ggCalibrate()

This function was defined, but unused and unimplemented.  Allow the user
to calibrate the gas gauge device.

Signed-off-by: Sean Cross <xobs@kosagi.com>
gg: Rename ggFullReset to ggReboot

"Full Reset" sounds like it's erasing the flash.  No, this command just
causes the gas gauge to reboot.

Signed-off-by: Sean Cross <xobs@kosagi.com>
cmd-gg: Rename "gg reset" to "gg reboot"

Rename the function to be more clear about what it actually does.

Signed-off-by: Sean Cross <xobs@kosagi.com>
chg: Remove FET manipulation code

Manipulating the FETs directly didn't seem like a good idea.  After reading
up on it, it looks like we have to manually enable ImpedenceTrack in order
to get the FETs to work properly.

Now that the gas gauge is calibrated and we're running ImpedenceTrack, it
should be able to control the FETs on its own.

Signed-off-by: Sean Cross <xobs@kosagi.com>
cmd-gg: Add ImpedenceTrack trigger command

Use this command to enable ImpedenceTrack on the battery, which seems to
be required to have the system work.

Signed-off-by: Sean Cross <xobs@kosagi.com>
cmd-gg: Add "Set [Non-]Removable" command

Add a new command to be able to set whether the battery is removable.

It is unclear what this particular bit controls, so we expose it in order
to try running the system both ways.

Signed-off-by: Sean Cross <xobs@kosagi.com>
gg: Add commands to set/clear removable mode

Signed-off-by: Sean Cross <xobs@kosagi.com>
senoko-slave: Fix IRQ reporting for power

The power IRQ handler was consulting the wrong field to determine
whether to generate an IRQ.  Correct this.

Signed-off-by: Sean Cross <xobs@kosagi.com>
chg: Remove capacity-checking code

This code assumes we have a given battery capacity, which might not
always be the case.  Let's expost the settings in the gg command instead.

Signed-off-by: Sean Cross <xobs@kosagi.com>
gg: Add function get fastcharge current

Signed-off-by: Sean Cross <xobs@kosagi.com>
cmd-gg: Add command to set/query fastcharge current

This will come in handy when we swap batteries.

Signed-off-by: Sean Cross <xobs@kosagi.com>