From patchwork Tue Jun 5 08:11:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9110 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 BCBF323E0C for ; Tue, 5 Jun 2012 08:11:52 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 725E7A1890E for ; Tue, 5 Jun 2012 08:11:52 +0000 (UTC) Received: by ggnf1 with SMTP id f1so4212068ggn.11 for ; Tue, 05 Jun 2012 01:11:52 -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=9Qktl1XI1bMGZSEL3Gi9n8fj6YmtYOp/OcXiCvVqP1U=; b=FZ9qji51ONodgQvyhxlI5oexuBBKoQA2PbvkHunzRYzwhO0WFHSJiCJePdLW5qfShS y6K17wGQj8PakmEzb9yxVuNIHRjEpD+JUFHnmT4nu1YjXVdnF+Pf2gUywrb37MFXnVwS wFyens93qolem91OqM/Zt+6NSmslQJvo8wYdgefU7QyN6fMTkEf3Wak9TlA2CmYuz5w/ ayPMwPBPufhZCv9CNvtBVfD/HcZfbRrAUiLilhH7geEb9LRoi0Gr0I38Qm/m1R2yaVxN jEoSKucXOzFAnzOsn7lzYTEMF5+TkAmP+Yk6pIby/PJgMJ7LuSirxusVKoM98gcnO7Yw irmg== Received: by 10.50.163.99 with SMTP id yh3mr1197876igb.53.1338883911722; Tue, 05 Jun 2012 01:11:51 -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.24.148 with SMTP id v20csp11058ibb; Tue, 5 Jun 2012 01:11:50 -0700 (PDT) Received: by 10.14.95.134 with SMTP id p6mr6622859eef.18.1338883909475; Tue, 05 Jun 2012 01:11:49 -0700 (PDT) Received: from eu1sys200aog117.obsmtp.com (eu1sys200aog117.obsmtp.com. [207.126.144.143]) by mx.google.com with SMTP id z4si376725eef.58.2012.06.05.01.11.44 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 05 Jun 2012 01:11:49 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.143 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.143; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.143 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 eu1sys200aob117.postini.com ([207.126.147.11]) with SMTP ID DSNKT82/QKagc5/twgcbwh9y8rOuTXxqYR9U@postini.com; Tue, 05 Jun 2012 08:11:49 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 CB3BBE5; Tue, 5 Jun 2012 08:11:38 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 665332324; Tue, 5 Jun 2012 08:11:38 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 765A4A8083; Tue, 5 Jun 2012 10:11:34 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 5 Jun 2012 10:11:38 +0200 From: Linus Walleij To: Samuel Ortiz , Cc: Joe Perches , Jonas Aaberg , Linus Walleij Subject: [PATCH v3] mfd/ab8500: print switch off cause Date: Tue, 5 Jun 2012 10:11:34 +0200 Message-ID: <1338883894-20388-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: ALoCoQlgXH0EJGMHcADzCn1f6zbmdnNTYXGO5jQZ1DU6x4DY08DOz5pmi7QIW02P4gWenI3Pp8n8 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 v2->v3: - Use printk() with KERN_CONT instead of separate dev_* or printk() calls. (Review comment from Joe Perches.) 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 | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index dac0e29..279bdeb 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -1217,6 +1217,15 @@ static const struct of_device_id ab8500_match[] = { static int __devinit ab8500_probe(struct platform_device *pdev) { + 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(&pdev->dev); const struct platform_device_id *platid = platform_get_device_id(pdev); enum ab8500_version version = AB8500_VERSION_UNDEFINED; @@ -1323,7 +1332,21 @@ static int __devinit ab8500_probe(struct platform_device *pdev) 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(KERN_CONT " \"%s\"", + switch_off_status[i]); + value = value >> 1; + + } + printk(KERN_CONT "\n"); + } else { + printk(KERN_CONT " None\n"); + } + if (plat && plat->init) plat->init(ab8500);