[U-Boot] [PATCH 15/16] arm:trats:pmic: Support for charging battery at Samsung's TRATS board

Tom Rini
2012-09-14T17:32:13Z

On Fri, Sep 14, 2012 at 05:40:14PM +0200, Lukasz Majewski wrote:

> The battery connected to Samsung's Trats development board is now
> charged when voltage drops below threshold.
[snip]
> @@ -247,6 +250,40 @@ int power_board_init(void)
> pmic_init_max8997();
> power_fg_init(I2C_9);
> power_muic_init(I2C_5);
> +
> + chrg = power_chrg_get_type();
> + debug("CHARGER TYPE: %d\n", chrg);
> +
> + if (!pmic_charger_bat_present()) {
> + puts("No battery detected\n");
> + return -1;
> + }
> +
> + power_check_battery(&bat);
> +
> + if (bat.state == CHARGE && chrg == CHARGER_USB) {
> + puts("CHARGER ENABLE\n");
> + if (pmic_charger_state(CHARGER_ENABLE, 450))
> + return -1;
> +
> + for (k = 0; pmic_charger_bat_present() &&
> + power_chrg_get_type() &&
> + bat.state_of_chrg < 5; k++) {
> + udelay(10000000);
> + puts(".");
> + power_update_battery(&bat);
> +
> + if (k == 100) {
> + printf(" %d [V]\n", bat.voltage_uV);
> + k = 0;
> + }
> +
> + }
> +
> + puts("CHARGER DISABLE\n");
> + pmic_charger_state(CHARGER_DISABLE, 0);
> + }

If I read this right we'll pause in the middle of start up to charge the
battery for possibly a long time right? And this could be a while loop
even, yes? If so to the first one, this really should be under some
sort of CONFIG option. I know the value of showing proof of concept
type examples in development boards but that should still be an opt-in
thing I would think.

--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120914/f5af9820/attachment.pgp>