From patchwork Thu Sep 27 20:08:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11778 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 70A8D24140 for ; Thu, 27 Sep 2012 20:09:28 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id B4E36A18B18 for ; Thu, 27 Sep 2012 20:09:27 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so5234855iej.11 for ; Thu, 27 Sep 2012 13:09:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=yXGOQbyqYMUuERpVmpodzmcTATWEuEnxiQHwe01eSJY=; b=AfYiEHeqkn7vndlj65jP8PwucChyYxyELeSsCWySr/JxmwOw3HKOWLwJoNfbi4c0Wf tbkUccMnD0u52l4JaXzn4PMR43XwhwD5BmQzk1gyZ3XFjOB7SBJaEPIDimsx6bwoGCKd 4znAJFFjiPkQSnv/mlpudco9nh+cX+S4o6iMusyVIg1iGqhp+2IW541lPCVaOk8QdzmD eWQRFhchdoKI4vTP+4dfXuje3TLHXIogCkTycrmBT3VygP4vUS2Rc6yMCJ6kzkrq77Uq H7wZoVHzO3onUxrp+1XYmYf7I+tfS74G9abZPIb0nQFI/s5yxN0TArsnL7nAeuJoUgxR S6uA== Received: by 10.50.0.193 with SMTP id 1mr4746446igg.0.1348776567494; Thu, 27 Sep 2012 13:09:27 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp436268igc; Thu, 27 Sep 2012 13:09:27 -0700 (PDT) Received: by 10.68.213.5 with SMTP id no5mr14825542pbc.24.1348776566877; Thu, 27 Sep 2012 13:09:26 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id pi9si5467641pbb.12.2012.09.27.13.09.26 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:09:26 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) smtp.mail=mathieu.poirier@linaro.org Received: by mail-pb0-f50.google.com with SMTP id md4so1686045pbc.37 for ; Thu, 27 Sep 2012 13:09:26 -0700 (PDT) Received: by 10.68.217.67 with SMTP id ow3mr14518913pbc.26.1348776566617; Thu, 27 Sep 2012 13:09:26 -0700 (PDT) Received: from localhost.localdomain (S0106002369de4dac.cg.shawcable.net. [70.73.24.112]) by mx.google.com with ESMTPS id sa2sm1587890pbc.4.2012.09.27.13.09.25 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:09:26 -0700 (PDT) From: mathieu.poirier@linaro.org To: patches@linaro.org Subject: [PATCH 05/57] power: ab8500_bm: Rename the power_loss function Date: Thu, 27 Sep 2012 14:08:22 -0600 Message-Id: <1348776554-10019-6-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1348776554-10019-1-git-send-email-mathieu.poirier@linaro.org> References: <1348776554-10019-1-git-send-email-mathieu.poirier@linaro.org> X-Gm-Message-State: ALoCoQmshSmQMm5YO4VyiNZFEyEn8HLwokqtcMmw8aub2q9PrWIsagAO3u0WrMPeH4GokKHp/Jvf From: Paer-Olof Haakansson Rename the ab8500_power_loss_handling function to a more describing name ab8500_enable_disable_sw_fallback Signed-off-by: Robert Marklund Signed-off-by: Paer-Olof Haakansson Signed-off-by: Mathieu Poirier Reviewed-by: Par-Olof HAKANSSON Reviewed-by: Karl KOMIEROWSKI --- drivers/power/ab8500_charger.c | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index 22076f5..a7d0c3a 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c @@ -268,20 +268,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__); @@ -295,12 +294,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__); @@ -330,12 +329,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);