From patchwork Thu Sep 19 08:14:06 2013
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Piotr Wilczek
X-Patchwork-Id: 275902
X-Patchwork-Delegate: promsoft@gmail.com
Return-Path:
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
Received: from theia.denx.de (theia.denx.de [85.214.87.163])
by ozlabs.org (Postfix) with ESMTP id E1BC42C0110
for ;
Thu, 19 Sep 2013 18:15:13 +1000 (EST)
Received: from localhost (localhost [127.0.0.1])
by theia.denx.de (Postfix) with ESMTP id 8BE924A0DC;
Thu, 19 Sep 2013 10:15:11 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at theia.denx.de
Received: from theia.denx.de ([127.0.0.1])
by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id l8NcJ-ToL4f7; Thu, 19 Sep 2013 10:15:11 +0200 (CEST)
Received: from theia.denx.de (localhost [127.0.0.1])
by theia.denx.de (Postfix) with ESMTP id 63F6E4A0DE;
Thu, 19 Sep 2013 10:15:05 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
by theia.denx.de (Postfix) with ESMTP id 69DB24A065
for ; Thu, 19 Sep 2013 10:14:54 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at theia.denx.de
Received: from theia.denx.de ([127.0.0.1])
by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id P1Csdu3YKYvB for ;
Thu, 19 Sep 2013 10:14:48 +0200 (CEST)
X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5
NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested)
Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34])
by theia.denx.de (Postfix) with ESMTP id 800444A07F
for ; Thu, 19 Sep 2013 10:14:47 +0200 (CEST)
Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27])
by mailout4.samsung.com
(Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit
(built Nov
17 2011)) with ESMTP id <0MTD00BOY5K9E670@mailout4.samsung.com> for
u-boot@lists.denx.de; Thu, 19 Sep 2013 17:14:39 +0900 (KST)
X-AuditID: cbfee61b-b7f776d0000016c8-9b-523ab26e631e
Received: from epmmp1.local.host ( [203.254.227.16])
by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 85.FE.05832.E62BA325;
Thu, 19 Sep 2013 17:14:38 +0900 (KST)
Received: from mcdsrvbld02.digital.local ([106.116.37.23])
by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01
(7.0.4.24.0) 64bit (built Nov 17 2011))
with ESMTPA id <0MTD008RG5JY9320@mmp1.samsung.com>; Thu,
19 Sep 2013 17:14:38 +0900 (KST)
From: Piotr Wilczek
To: u-boot@lists.denx.de, Minkyu Kang
Date: Thu, 19 Sep 2013 10:14:06 +0200
Message-id: <1379578448-12777-2-git-send-email-p.wilczek@samsung.com>
X-Mailer: git-send-email 1.7.10
In-reply-to: <1379578448-12777-1-git-send-email-p.wilczek@samsung.com>
References: <1369383791-21795-1-git-send-email-p.wilczek@samsung.com>
<1379578448-12777-1-git-send-email-p.wilczek@samsung.com>
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFvrNJMWRmVeSWpSXmKPExsVy+t9jAd28TVZBBjfnW1ucbXrDbvHm4WZG
i44jLYwW656sZbV4u7eT3YHV4+ydHYwefVtWMQYwRXHZpKTmZJalFunbJXBl9HyNLzgqXLHn
/2nWBsZ+gS5GTg4JAROJpR+Xs0LYYhIX7q1n62Lk4hASWMQo8X7eKmYIp4tJ4tK1J4wgVWwC
2hLL37wBsjk4RARsJPZOcAWpYRZoYJS4u6eDFSQuLOAt8ft/Mkg5i4CqxNpbU9hBbF4BV4lf
p44yQiyTl3h6v48NxOYUcJP48aaXFWJXI6PEtDsLWScw8i5gZFjFKJpakFxQnJSea6RXnJhb
XJqXrpecn7uJERwkz6R3MK5qsDjEKMDBqMTDG3HBMkiINbGsuDL3EKMEB7OSCO/XpVZBQrwp
iZVVqUX58UWlOanFhxilOViUxHkPtloHCgmkJ5akZqemFqQWwWSZODilGhjz7+9ZEaq151xd
fpSGsriuStPvJcLyp8UDHNOKJ/94Emzjpm/B8mV34mu+zRZ3Q3ODG2IjnYy0EsWueK7J1yw0
ZHR7+/rHu/lrtDXn+ltGfjJyu+f15Z5e564P6Tt9nr/6wyjD++qQJkO0uur+eCcVsz+TXlRe
2cNiahvUtG1ORdePm+tvbVZiKc5INNRiLipOBAAn3VSSDgIAAA==
Cc: Piotr Wilczek ,
Kyungmin Park
Subject: [U-Boot] [PATCH V5 1/3] power:battery: add battery support for
Trats2 board
X-BeenThere: u-boot@lists.denx.de
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: U-Boot discussion
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
MIME-Version: 1.0
Sender: u-boot-bounces@lists.denx.de
Errors-To: u-boot-bounces@lists.denx.de
Signed-off-by: Piotr Wilczek
Signed-off-by: Kyungmin Park
---
Changes in v5: none
Changes in v4: none
Changes in v3: none
Changes in v2: none
drivers/power/battery/Makefile | 1 +
drivers/power/battery/bat_trats2.c | 65 ++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+)
create mode 100644 drivers/power/battery/bat_trats2.c
diff --git a/drivers/power/battery/Makefile b/drivers/power/battery/Makefile
index 637d1ff..4bf315d 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 0000000..f264832
--- /dev/null
+++ b/drivers/power/battery/bat_trats2.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Piotr Wilczek
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include
+#include
+#include
+#include
+#include
+
+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;
+}