The cxo buffers could be turned off while the main cpu(s) are running. This
can cause few issues with the charging driver.
The pmic generates sleep_b signal when all the buffers derived from the
cxo clocks are turned off. This sleep_b signal is fed to all the h/w
subsystems within the pmic.
The charger h/w block uses this for mainly two reasons
1. Turn off the VREF_BATT_THERM signal. This signal drives the battery
thermistor across a resistor divider circuit. With this signal off the
battery temperature is reported too cold. Update the driver to force this
signal on IOW make it not dependent on sleep_b. Remove this forcing when
the system suspends.
2. Run from a slower clock (sleep clk) and as a result freeze charger
register accesses. Force the charger to run from internal cxo clock while
not suspended. This guarantees charger registers are always accessible to
the cpu(s). While suspending, switch back to hw controlled clock sourcing
mode.
While in hw controlled clock sourcing mode,
the charger system switches between cxo and sleep clk depending on
the sleep_b signal. If sleep_b deactivates within six clock
cycles of the sleep clock, the charger doesn't correctly register
an exit from the sleep state and it stops functioning.
To fix this lockup , apply a "kickstart" procedure while resuming. This
procedure involves a series of steps to switch the charger's clock source
between sleep clk and cxo clock with appropriate delays, before finally
switching to cxo clock.
Change-Id: Icda8eb932df0ee7c270d35e2163be7cb8ddd43c3
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>