From patchwork Fri Jan 11 13:12:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 1965891 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 2C69B3FF0F for ; Fri, 11 Jan 2013 13:17:29 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TteQp-0001Z2-RK; Fri, 11 Jan 2013 13:14:00 +0000 Received: from mail-we0-f175.google.com ([74.125.82.175]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TteQH-0001Ei-Gu for linux-arm-kernel@lists.infradead.org; Fri, 11 Jan 2013 13:13:26 +0000 Received: by mail-we0-f175.google.com with SMTP id z53so838316wey.6 for ; Fri, 11 Jan 2013 05:13:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=QIZtDcwuUhE9wjBhuG+pLmKlo0VMMs+7DY5ivnVM2M0=; b=ZwpmIzr15pQbjfAJkTfJqpbnzZRcsN3Su7CL+Zt+HGKNiOzUvzRYrJFH720VE9t09E 0VnMMCUJvBftapNNnGm0hYwll5L6zhFSX6bJ4sizqWkFpPpcXjtEtgLzgNzWPJLsz44Y YFdZWstpGmKv4f/WtxcB/qcji2TrNczt4TClXDgCqJGn8B33JKmbVsM0q/IKIpngQQmI mK/dQaBId4a5C/+bVxrW1sgofPWcqdBTZbEfUGdSLKdANwp/Cb/FDM5JiVq1NLv87EsU AdAqvBhVN7NRQSxRT4NkJ/4Dq2e1tvNBxzlC3uT/yKjw/h5GeOX4Y1MSL6to8Z43Mfmx 131Q== X-Received: by 10.180.14.2 with SMTP id l2mr15362955wic.2.1357910003681; Fri, 11 Jan 2013 05:13:23 -0800 (PST) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id p2sm7204515wic.7.2013.01.11.05.13.21 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jan 2013 05:13:22 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/18] power: ab8500_charger: Rename the power_loss function Date: Fri, 11 Jan 2013 13:12:49 +0000 Message-Id: <1357909986-9262-2-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1357909986-9262-1-git-send-email-lee.jones@linaro.org> References: <1357909986-9262-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQl4qwMW03Uioofmn3s6gTb4KTILJxJt/aDccJXaPXKEYoCaunJQuoP0IzsSKs6GC4IHp0Lk X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130111_081325_703837_48FF6463 X-CRM114-Status: GOOD ( 15.04 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.175 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Robert Marklund , linus.walleij@stericsson.com, arnd@arndb.de, cbouatmailru@gmail.com, Paer-Olof Haakansson , Lee Jones X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Paer-Olof Haakansson Rename the ab8500_power_loss_handling function to a more descriptive name ab8500_enable_disable_sw_fallback Signed-off-by: Lee Jones Signed-off-by: Robert Marklund Reviewed-by: Par-Olof HAKANSSON Reviewed-by: Karl KOMIEROWSKI Tested-by: Par-Olof HAKANSSON --- drivers/power/ab8500_charger.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index 2ddface..d6e1792 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c @@ -270,20 +270,19 @@ static enum power_supply_property ab8500_charger_usb_props[] = { POWER_SUPPLY_PROP_CURRENT_NOW, }; -/** - * ab8500_power_loss_handling - set how we handle powerloss. - * @di: pointer to the ab8500_charger structure - * - * Magic nummbers are from STE HW department. +/* + * Function for enabling and disabling sw fallback mode + * should always be disabled when no charger is connected. */ -static void ab8500_power_loss_handling(struct ab8500_charger *di) +static void ab8500_enable_disable_sw_fallback(struct ab8500_charger *di, + bool fallback) { u8 reg; int ret; - dev_dbg(di->dev, "Autopower : %d\n", di->autopower); + dev_dbg(di->dev, "SW Fallback: %d\n", fallback); - /* read the autopower register */ + /* read the register containing fallback bit */ ret = abx500_get_register_interruptible(di->dev, 0x15, 0x00, ®); if (ret) { dev_err(di->dev, "%d write failed\n", __LINE__); @@ -297,12 +296,12 @@ static void ab8500_power_loss_handling(struct ab8500_charger *di) return; } - if (di->autopower) + if (fallback) reg |= 0x8; else reg &= ~0x8; - /* write back the changed value to autopower reg */ + /* write back the changed fallback bit value to register */ ret = abx500_set_register_interruptible(di->dev, 0x15, 0x00, reg); if (ret) { dev_err(di->dev, "%d write failed\n", __LINE__); @@ -332,12 +331,12 @@ static void ab8500_power_supply_changed(struct ab8500_charger *di, !di->ac.charger_connected && di->autopower) { di->autopower = false; - ab8500_power_loss_handling(di); + ab8500_enable_disable_sw_fallback(di, false); } else if (!di->autopower && (di->ac.charger_connected || di->usb.charger_connected)) { di->autopower = true; - ab8500_power_loss_handling(di); + ab8500_enable_disable_sw_fallback(di, true); } } power_supply_changed(psy);