diff options
author | Albert ARIBAUD <albert.u.boot@aribaud.net> | 2013-10-11 14:47:25 +0200 |
---|---|---|
committer | Albert ARIBAUD <albert.u.boot@aribaud.net> | 2013-10-11 14:47:25 +0200 |
commit | 5a9120439416a9101dec7c7dc65bb75a5ff09c4e (patch) | |
tree | f0db772d4b4db863feca1332afca8313ae94b937 /drivers/power/battery | |
parent | 572886af5984febafa6f083e6b8af0465f4f5764 (diff) | |
parent | 4d6c96711bd550ae292df566c2b36ff3e3dac24c (diff) | |
download | talos-obmc-uboot-5a9120439416a9101dec7c7dc65bb75a5ff09c4e.tar.gz talos-obmc-uboot-5a9120439416a9101dec7c7dc65bb75a5ff09c4e.zip |
Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master'
Diffstat (limited to 'drivers/power/battery')
-rw-r--r-- | drivers/power/battery/Makefile | 1 | ||||
-rw-r--r-- | drivers/power/battery/bat_trats2.c | 65 |
2 files changed, 66 insertions, 0 deletions
diff --git a/drivers/power/battery/Makefile b/drivers/power/battery/Makefile index 637d1ffb3e..4bf315da9b 100644 --- a/drivers/power/battery/Makefile +++ b/drivers/power/battery/Makefile @@ -10,6 +10,7 @@ include $(TOPDIR)/config.mk LIB := $(obj)libbattery.o COBJS-$(CONFIG_POWER_BATTERY_TRATS) += bat_trats.o +COBJS-$(CONFIG_POWER_BATTERY_TRATS2) += bat_trats2.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/power/battery/bat_trats2.c b/drivers/power/battery/bat_trats2.c new file mode 100644 index 0000000000..f2648329d4 --- /dev/null +++ b/drivers/power/battery/bat_trats2.c @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2013 Samsung Electronics + * Piotr Wilczek <p.wilczek@samsung.com> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <power/pmic.h> +#include <power/battery.h> +#include <power/max8997_pmic.h> +#include <errno.h> + +static struct battery battery_trats; + +static int power_battery_charge(struct pmic *bat) +{ + struct power_battery *p_bat = bat->pbat; + + if (bat->chrg->chrg_state(p_bat->chrg, CHARGER_ENABLE, 450)) + return -1; + + return 0; +} + +static int power_battery_init_trats2(struct pmic *bat_, + struct pmic *fg_, + struct pmic *chrg_, + struct pmic *muic_) +{ + bat_->pbat->fg = fg_; + bat_->pbat->chrg = chrg_; + bat_->pbat->muic = muic_; + + bat_->fg = fg_->fg; + bat_->chrg = chrg_->chrg; + bat_->chrg->chrg_type = muic_->chrg->chrg_type; + return 0; +} + +static struct power_battery power_bat_trats2 = { + .bat = &battery_trats, + .battery_init = power_battery_init_trats2, + .battery_charge = power_battery_charge, +}; + +int power_bat_init(unsigned char bus) +{ + static const char name[] = "BAT_TRATS2"; + struct pmic *p = pmic_alloc(); + + if (!p) { + printf("%s: POWER allocation error!\n", __func__); + return -ENOMEM; + } + + debug("Board BAT init\n"); + + p->interface = PMIC_NONE; + p->name = name; + p->bus = bus; + + p->pbat = &power_bat_trats2; + return 0; +} |