From patchwork Thu Sep 27 20:08:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11813 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 5623A24140 for ; Thu, 27 Sep 2012 20:10:17 +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 09442A18351 for ; Thu, 27 Sep 2012 20:10:16 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so5234801iej.11 for ; Thu, 27 Sep 2012 13:10:16 -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=wRbiuBALt98ET2u4gCTPIzE1HBTpLO6RoKVOjv5gsJI=; b=Iw4IcqU5HJTaBu8hP7k9nUtu3XV5fnAPQqi8O6bZG8D5Gf6iWDweH5ocrZYraGm0ZE a0QXx1qnLU23w4wcp4OlrydUSwnyVwbsWKXKkUCYlQKjZ/5Z7ia6mQw2ehqAeN0yrESF wyTCjvw7Jx+pjxezF7p2fBrMSDUrcER94lDsIEx3ZfGkBmle3jxsgmCtnn1s4UOi1X87 Se9DgWDwcN5sEoNHgT9clbwhl2LYd51c+BRpJuEJ/kKRWVujUw8xPizCA5lo9eY7KZau AfPoP1LPBOsJGnMnJ00JAJWDeYRH6smod6R8Plz5MehGcoo33NuO6EWdCJZORxlyEosd 7QQg== Received: by 10.50.154.227 with SMTP id vr3mr15237263igb.43.1348776616804; Thu, 27 Sep 2012 13:10:16 -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 ex8csp436365igc; Thu, 27 Sep 2012 13:10:15 -0700 (PDT) Received: by 10.68.190.71 with SMTP id go7mr7723774pbc.66.1348776615581; Thu, 27 Sep 2012 13:10:15 -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.10.15 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:10:15 -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:10:15 -0700 (PDT) Received: by 10.68.189.161 with SMTP id gj1mr14517954pbc.21.1348776614612; Thu, 27 Sep 2012 13:10:14 -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.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:10:13 -0700 (PDT) From: mathieu.poirier@linaro.org To: patches@linaro.org Subject: [PATCH 40/57] power: ab8500: ADC for battery thermistor Date: Thu, 27 Sep 2012 14:08:57 -0600 Message-Id: <1348776554-10019-41-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: ALoCoQmTDGX0z0IEqb8+bw0FiabGbD3JcUfK7ll5UwZm0w1CnUQeXm+rK1DWU6v1zcCfHr1O2Y43 From: Marcus Cooper When using ABx500_ADC_THERM_BATCTRL the battery ID resistor is combined with a NTC resistor to both identify the battery and to measure its temperature. Signed-off-by: Marcus Cooper Signed-off-by: Mathieu Poirier Reviewed-by: Mian Yousaf KAUKAB Reviewed-by: Michel JAOUEN Reviewed-by: Hakan BERG Reviewed-by: Rabin VINCENT --- drivers/power/ab8500_btemp.c | 4 +++- include/linux/mfd/abx500.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index 506f124..56a3bb9 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@ -557,7 +557,9 @@ static int ab8500_btemp_id(struct ab8500_btemp *di) /* BATTERY_UNKNOWN is defined on position 0, skip it! */ for (i = BATTERY_UNKNOWN + 1; i < di->bat->n_btypes; i++) { if ((res <= di->bat->bat_type[i].resis_high) && - (res >= di->bat->bat_type[i].resis_low)) { + (res >= di->bat->bat_type[i].resis_low) && + (di->bat->bat_type[i].adc_therm == + di->bat->adc_therm)) { dev_dbg(di->dev, "Battery detected on %s" " low %d < res %d < high: %d" " index: %d\n", diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 97e918f..cb2b82a 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h @@ -270,6 +270,7 @@ struct abx500_maxim_parameters { * @low_high_cur_lvl: charger current in temp low/high state in mA * @low_high_vol_lvl: charger voltage in temp low/high state in mV' * @battery_resistance: battery inner resistance in mOhm. + * @adc_therm: battery uses controller or resistor for temp. * @n_r_t_tbl_elements: number of elements in r_to_t_tbl * @r_to_t_tbl: table containing resistance to temp points * @n_v_cap_tbl_elements: number of elements in v_to_cap_tbl @@ -297,6 +298,7 @@ struct abx500_battery_type { int low_high_cur_lvl; int low_high_vol_lvl; int battery_resistance; + enum abx500_adc_therm adc_therm; int n_temp_tbl_elements; struct abx500_res_to_temp *r_to_t_tbl; int n_v_cap_tbl_elements;