From patchwork Tue Apr 17 07:30:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 7886 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 B8C7E23E4C for ; Tue, 17 Apr 2012 07:31:06 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 81399A1876B for ; Tue, 17 Apr 2012 07:31:06 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so11751811iag.11 for ; Tue, 17 Apr 2012 00:31:06 -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=hiGeRkaqW0JvcnF0dT6jTmtU0pX6kv3FmQBldkltbtw=; b=OlIOL/SLomUFvNXpb8YqIpl2EOaC0+/iKOM/bjBrx/TRnmyMT/hqhfp8y4V486uPZZ NPiFWdcyJcqEfw4pbhkQGRctB9a0HzjKhh65l6uS7uJ5m0QW47jfRqDuLfh7nIEB2UH6 XnTSxvKGyW8TfySrg6ivEMbGlGsHeKThWGfwU8ZBgRVS+HQi5wZqlAI4BW7viGBIh0ID r0qqsUmAKZ/m3trp81XEalwl5g8SuvEtUnar1PQPEOOZOHh/HtVpOZgfj9mn/l5jgt77 fbZsEUYqoUnHnslFNsqlWhlqizFl0FFHeVmIMIEE0BfpBK26S5Y3i7tv5gg2oG28GA17 szHg== Received: by 10.50.10.201 with SMTP id k9mr8247939igb.55.1334647866320; Tue, 17 Apr 2012 00:31:06 -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 x6csp130029ibt; Tue, 17 Apr 2012 00:31:05 -0700 (PDT) Received: by 10.14.37.79 with SMTP id x55mr2019689eea.109.1334647865266; Tue, 17 Apr 2012 00:31:05 -0700 (PDT) Received: from eu1sys200aog120.obsmtp.com (eu1sys200aog120.obsmtp.com. [207.126.144.149]) by mx.google.com with SMTP id s55si5718693eeh.148.2012.04.17.00.30.59 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Apr 2012 00:31:05 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.149 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.149; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.149 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-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob120.postini.com ([207.126.147.11]) with SMTP ID DSNKT40cM3C3YYGRLDikbtSS6dJEXmDad+od@postini.com; Tue, 17 Apr 2012 07:31:05 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 6461E51; Tue, 17 Apr 2012 07:30:28 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 6932D71; Tue, 17 Apr 2012 05:26:06 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id AD092A8096; Tue, 17 Apr 2012 09:30:40 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 17 Apr 2012 09:30:43 +0200 From: Linus Walleij To: Samuel Ortiz , Cc: Jonas Aaberg , Linus Walleij Subject: [PATCH 4/6] mfd/ab8500: print switch off cause Date: Tue, 17 Apr 2012 09:30:40 +0200 Message-ID: <1334647840-1736-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: ALoCoQn9gBpQ+h3oDybCXrPloedvqUetYQ0ogs0u72znl4SWcnAvsD9/Wm10EC3Itkq5uRG5hSSK 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 --- drivers/mfd/ab8500-core.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index eee9560..9781e1e 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,20 @@ 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) + printk("\"%s\" ", switch_off_status[i]); + value = value >> 1; + + } + printk("\n"); + } else { + printk("None\n"); + } + if (plat && plat->init) plat->init(ab8500);