From patchwork Thu Sep 27 20:08:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11809 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 DD4A124140 for ; Thu, 27 Sep 2012 20:10:09 +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 8EFFEA18351 for ; Thu, 27 Sep 2012 20:10:09 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so5234801iej.11 for ; Thu, 27 Sep 2012 13:10:09 -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=4uZoln5lHhQ0zC0ytFAkOK2xG50VGY4ripwF2QczX/E=; b=OFCkAcnQJnpJdkWW3SKv1qhIOe6Hy+3H0VWhCDFYUGnNp5qD0KhoO2Om4shBFA6611 sRDh3sh6PsTBFyJNrkhIenfJD1gdowQ7G5BGd3BjO6ClGdSsSEMBe2FvSF6xhLtFuRCM quYGOrGr5qoJ5RgOqWYh/aYRByOXniyRLKEuQHQ7xSbuZJyjfHR9/7hPtgl2pDfFAZKh ESnM9bNbN8F0hc3U4bv+dSCpjcJgCdVzdp+4/DTV3FWfvpipa7zBgQcLo3Chz/xJwfQ9 YDOAaHEORy22CPO+HvjLFV92dXmPONRgvAu18dN/P7XmxGwGUZeZJVPHDZjt9WKidFRJ 3GLg== Received: by 10.42.84.69 with SMTP id k5mr3975564icl.5.1348776609274; Thu, 27 Sep 2012 13:10:09 -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 ex8csp436354igc; Thu, 27 Sep 2012 13:10:07 -0700 (PDT) Received: by 10.68.135.234 with SMTP id pv10mr14203675pbb.156.1348776607499; Thu, 27 Sep 2012 13:10:07 -0700 (PDT) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id vn9si8390651pbc.17.2012.09.27.13.10.07 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:10:07 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) client-ip=209.85.220.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.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-pa0-f50.google.com with SMTP id hz11so1847989pad.37 for ; Thu, 27 Sep 2012 13:10:07 -0700 (PDT) Received: by 10.68.234.71 with SMTP id uc7mr14445408pbc.72.1348776607184; Thu, 27 Sep 2012 13:10:07 -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.10.05 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:10:06 -0700 (PDT) From: mathieu.poirier@linaro.org To: patches@linaro.org Subject: [PATCH 36/57] power: add backup battery charge voltages. Date: Thu, 27 Sep 2012 14:08:53 -0600 Message-Id: <1348776554-10019-37-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: ALoCoQmTSK521cUyY+y9hzBM/dXPeoWC8swNhm3xWS8f8tl33oiUlpo9KZ6D4XfcCINe0zGOiIQk From: Yang QU Add 2.7v, 2.9v, 3.0v, 3.2v and 3.3v charging voltage for backup battery. Before that only 2.5v, 2.6v, 2.8v, 3.1v are available. Signed-off-by: Yang QU Signed-off-by: Mathieu Poirier Reviewed-by: Maxime COQUELIN Reviewed-by: Marcus COOPER Reviewed-by: Xiao Mei ZHANG --- drivers/power/ab8500_charger.c | 9 +++++++-- include/linux/mfd/abx500/ab8500-bm.h | 24 ++++++++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index b3b8f77..8137ea5 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c @@ -2834,6 +2834,7 @@ static int ab8500_charger_usb_get_property(struct power_supply *psy, static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) { int ret = 0; + u8 bup_vch_range = 0, vbup33_vrtcn = 0; /* Setup maximum charger current and voltage for ABB cut2.0 */ if (!is_ab8500_1p1_or_earlier(di->parent)) { @@ -2935,11 +2936,15 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) } /* Backup battery voltage and current */ + if (di->bat->bkup_bat_v > BUP_VCH_SEL_3P1V) + bup_vch_range = BUP_VCH_RANGE; + if (di->bat->bkup_bat_v == BUP_VCH_SEL_3P3V) + vbup33_vrtcn = VBUP33_VRTCN; + ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, AB8500_RTC_BACKUP_CHG_REG, - di->bat->bkup_bat_v | - di->bat->bkup_bat_i); + (di->bat->bkup_bat_v & 0x3) | di->bat->bkup_bat_i); if (ret) { dev_err(di->dev, "failed to setup backup battery charging\n"); goto out; diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h index cd15ea3..5ae8a6f 100644 --- a/include/linux/mfd/abx500/ab8500-bm.h +++ b/include/linux/mfd/abx500/ab8500-bm.h @@ -105,6 +105,7 @@ #define AB8500_RTC_BACKUP_CHG_REG 0x0C #define AB8500_RTC_CC_CONF_REG 0x01 #define AB8500_RTC_CTRL_REG 0x0B +#define AB8500_RTC_CTRL1_REG 0x11 /* * OTP register offsets @@ -179,10 +180,25 @@ #define BUP_ICH_SEL_300UA 0x08 #define BUP_ICH_SEL_700UA 0x0C -#define BUP_VCH_SEL_2P5V 0x00 -#define BUP_VCH_SEL_2P6V 0x01 -#define BUP_VCH_SEL_2P8V 0x02 -#define BUP_VCH_SEL_3P1V 0x03 +enum bup_vch_sel { + BUP_VCH_SEL_2P5V, + BUP_VCH_SEL_2P6V, + BUP_VCH_SEL_2P8V, + BUP_VCH_SEL_3P1V, + /* + * Note that the following 5 values 2.7v, 2.9v, 3.0v, 3.2v, 3.3v + * are only available on ab8540. You can't choose these 5 + * voltage on ab8500/ab8505/ab9540. + */ + BUP_VCH_SEL_2P7V, + BUP_VCH_SEL_2P9V, + BUP_VCH_SEL_3P0V, + BUP_VCH_SEL_3P2V, + BUP_VCH_SEL_3P3V, +}; + +#define BUP_VCH_RANGE 0x02 +#define VBUP33_VRTCN 0x01 /* Battery OVV constants */ #define BATT_OVV_ENA 0x02