From patchwork Tue May 1 22:13:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 8339 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 4785423E42 for ; Tue, 1 May 2012 22:14:15 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 0D125A1820F for ; Tue, 1 May 2012 22:14:14 +0000 (UTC) Received: by mail-yw0-f52.google.com with SMTP id p61so12142yhp.11 for ; Tue, 01 May 2012 15:14:14 -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:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=rarfTCQ/RXvngCEdKpj0pffO9IURpbupUhYIC15S61s=; b=gLf2ylXH0Iajqx9hr39AJn9/oQOG5bdAsCm0f4cT+4vGCTFGBWHWf2iEbHGfFO7MFq V3QZFdR/6COdzODI33o5QM3QHcIZLBAiMdDXADy+bqcFRXMmUnj0UX0UbdZqTtLfFiYs VE0BL3xnlpBq90ii/9SeAR0mNNGUt6WSAnwNwXIqbJhtJfuKgLH2yIMKG5WU911jZyi7 LX/9BfVSdI8RBhiHMv8Id20DynvRP2mI/8zs4IAYFsGWj6RdLHBtnHDw3kwjlu7fPWxc M7TdGBQbK//QmAQkVAxEf4eetaUtzxJ5NHnFtISghdb+LEFgwCljJQTWaRIST/1IIGoi gm+w== Received: by 10.50.181.164 with SMTP id dx4mr3225424igc.1.1335910454611; Tue, 01 May 2012 15:14:14 -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.231.137.198 with SMTP id x6csp210356ibt; Tue, 1 May 2012 15:14:13 -0700 (PDT) Received: by 10.213.105.195 with SMTP id u3mr1942982ebo.14.1335910451714; Tue, 01 May 2012 15:14:11 -0700 (PDT) Received: from eu1sys200aog112.obsmtp.com (eu1sys200aog112.obsmtp.com. [207.126.144.133]) by mx.google.com with SMTP id a14si6314327een.91.2012.05.01.15.14.07 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 May 2012 15:14:11 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.133 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.133; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.133 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob112.postini.com ([207.126.147.11]) with SMTP ID DSNKT6BgL2mWADrVa88P/2bGvMfy2t5zGtxK@postini.com; Tue, 01 May 2012 22:14:11 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 6DB75C1; Tue, 1 May 2012 22:13:53 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C4FFA2BFA; Tue, 1 May 2012 22:13:52 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 7E22EA8072; Wed, 2 May 2012 00:13:52 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Wed, 2 May 2012 00:13:52 +0200 From: Linus Walleij To: Samuel Ortiz , Cc: Jonas Aaberg , Linus Walleij Subject: [PATCH 4/6 v2] mfd/ab8500: print switch off cause Date: Wed, 2 May 2012 00:13:46 +0200 Message-ID: <1335910426-19590-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.9.2 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQk+QDu0fclmjhjqY3YOK/HhOYTuEReB7sY008FcmumjJ+Ng9hcP3dMXcl8PgPflUts74Y6W From: Jonas Aaberg Instead of just printing the register value, also output some description of the value. Signed-off-by: Jonas Aaberg Reviewed-by: Mattias Wallin Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Print each cause on its own line with a tab to avoid missing initial cause heading if loglevel < info. --- drivers/mfd/ab8500-core.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index eee9560..437799a 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -1072,6 +1072,16 @@ static struct attribute_group ab9540_attr_group = { int __devinit ab8500_init(struct ab8500 *ab8500, enum ab8500_version version) { + static char *switch_off_status[] = { + "Swoff bit programming", + "Thermal protection activation", + "Vbat lower then BattOk falling threshold", + "Watchdog expired", + "Non presence of 32kHz clock", + "Battery level lower than power on reset threshold", + "Power on key 1 pressed longer than 10 seconds", + "DB8500 thermal shutdown"}; + struct ab8500_platform_data *plat = dev_get_platdata(ab8500->dev); int ret; int i; @@ -1139,7 +1149,21 @@ int __devinit ab8500_init(struct ab8500 *ab8500, enum ab8500_version version) AB8500_SWITCH_OFF_STATUS, &value); if (ret < 0) return ret; - dev_info(ab8500->dev, "switch off status: %#x", value); + dev_info(ab8500->dev, "switch off cause(s) (%#x): ", value); + + if (value) { + for (i = 0; i < ARRAY_SIZE(switch_off_status); i++) { + if (value & 1) + dev_info(ab8500->dev, + "\"\t%s\" ", switch_off_status[i]); + value = value >> 1; + + } + printk("\n"); + } else { + printk("None\n"); + } + if (plat && plat->init) plat->init(ab8500);