From patchwork Tue Jun 25 13:28:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?=C5=81ukasz_Majewski?= X-Patchwork-Id: 254152 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 7A8DC2C0079 for ; Tue, 25 Jun 2013 23:29:02 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6FE894A026; Tue, 25 Jun 2013 15:28:58 +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 vVnxIdeGrjrh; Tue, 25 Jun 2013 15:28:58 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E55E64A021; Tue, 25 Jun 2013 15:28:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9FB904A021 for ; Tue, 25 Jun 2013 15:28:44 +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 wm-ipjVSSlB0 for ; Tue, 25 Jun 2013 15:28:37 +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 mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by theia.denx.de (Postfix) with ESMTP id 36C774A020 for ; Tue, 25 Jun 2013 15:28:31 +0200 (CEST) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MOY00A4DARBTE80@mailout2.samsung.com> for u-boot@lists.denx.de; Tue, 25 Jun 2013 22:28:27 +0900 (KST) X-AuditID: cbfee61a-b7f3b6d000006edd-6f-51c99afba54d Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id B6.48.28381.BFA99C15; Tue, 25 Jun 2013 22:28:27 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MOY00GZ6AR9LD40@mmp2.samsung.com>; Tue, 25 Jun 2013 22:28:27 +0900 (KST) From: Lukasz Majewski To: u-boot@lists.denx.de Date: Tue, 25 Jun 2013 15:28:15 +0200 Message-id: <1372166895-29861-1-git-send-email-l.majewski@samsung.com> X-Mailer: git-send-email 1.7.10 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPJMWRmVeSWpSXmKPExsVy+t9jQd3fs04GGuyaImvx5uFmRovJi+cz W7zd28nuwOxx9s4ORo++LasYPY7f2M4UwBzFZZOSmpNZllqkb5fAlTHr3U22gll8FTPufmdr YFzC3cXIySEhYCLxbWkTI4QtJnHh3nq2LkYuDiGB6YwSiz82sEA4XUwSp5cvYwOpYhPQk/h8 9ykTiC0iICHxq/8qWDezgKvE947TLCC2sICLxNaWP8wgNouAqsSbn7PAenkF3CTetMFsk5d4 er+PbQIj9wJGhlWMoqkFyQXFSem5hnrFibnFpXnpesn5uZsYwd5+JrWDcWWDxSFGAQ5GJR7e yF0nAoVYE8uKK3MPMUpwMCuJ8B7KOhkoxJuSWFmVWpQfX1Sak1p8iFGag0VJnPdAq3WgkEB6 YklqdmpqQWoRTJaJg1OqgTE06sXzc2e4rbN0Y4JuhDNbf7C2c1faNOnm//+PWg+9F9JllnCI CdCSnTwjaHLH1ze+h0PESrPfcc0X4thr9PLcFbn7suwF3IulW5bOsclRWfktTvyggX3Qnqa3 Oj/FhAqNZ1f/Pb45WUjYxVPr4kEuZekaf/f37AvOTDOo+pspePZI9qHP0UosxRmJhlrMRcWJ AICcRCfyAQAA Cc: Tom Rini Subject: [U-Boot] [PATCH] power:bat:trats: Break battery charging with ctrl+C 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 Add support for disabling battery charging with ctrl+C keyboard combination pressed. Moreover the battery update is done more frequently. Signed-off-by: Lukasz Majewski Cc: Tom Rini --- drivers/power/battery/bat_trats.c | 13 +++++++++---- drivers/power/power_core.c | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/power/battery/bat_trats.c b/drivers/power/battery/bat_trats.c index ca0d214..97a9661 100644 --- a/drivers/power/battery/bat_trats.c +++ b/drivers/power/battery/bat_trats.c @@ -41,18 +41,23 @@ static int power_battery_charge(struct pmic *bat) for (k = 0; bat->chrg->chrg_bat_present(p_bat->chrg) && bat->chrg->chrg_type(p_bat->muic) && battery->state_of_chrg < 100; k++) { - udelay(10000000); - puts("."); + udelay(2000000); + if (!(k % 5)) + puts("."); bat->fg->fg_battery_update(p_bat->fg, bat); - if (k == 100) { + if (k == 200) { debug(" %d [V]", battery->voltage_uV); puts("\n"); k = 0; } + if (ctrlc()) { + printf("\nCharging disabled on request.\n"); + goto exit; + } } - + exit: bat->chrg->chrg_state(p_bat->chrg, CHARGER_DISABLE, 0); return 0; diff --git a/drivers/power/power_core.c b/drivers/power/power_core.c index 90df2c5..f16b9dc 100644 --- a/drivers/power/power_core.c +++ b/drivers/power/power_core.c @@ -205,7 +205,8 @@ int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (strcmp(argv[3], "charge") == 0) { if (p->pbat) { - printf("PRINT BAT charge %s\n", p->name); + printf("BAT: %s charging (ctrl+c to break)\n", + p->name); if (p->low_power_mode) p->low_power_mode(); if (p->pbat->battery_charge)