From patchwork Mon Jun 4 08:10:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9094 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 901BB23E1B for ; Mon, 4 Jun 2012 08:11:01 +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 415E0A18587 for ; Mon, 4 Jun 2012 08:11:01 +0000 (UTC) Received: by ggnf1 with SMTP id f1so3157919ggn.11 for ; Mon, 04 Jun 2012 01:11:00 -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=YQd7phqYDPbRjJ61TdBIJNxUqHEbxko6KAFslMIvp5g=; b=bReY+F8iGIjSNKQlwTXblLJqPF/AHkY2Zlb7EUSvP8bf8fpdOB/dZGDnC0PFysWjLf F7+6v5WR545pdbZ4/VPCEdoE1EN8LxUZ1tNrgr9YdlrnXlxfXVIPwDSdh27rKPPFwVdZ 6HsTxTJE/axbVgMrVO8n+nc0UXF1G1snRaWe3UGT7av+eLixUoRaVHkVEb3jlFPizeX0 jgl2rqX0d8+0E5Tr0JLpk4BJjeyzN4AgIVdV5OdRhTpktdhcj3XGHY8lEwTeFK/U469a EbjrPR5JvYImMeBL2VbA8koI2n0WzVJY7RYuN3iC0N8QzPLKOcVPr6WpxZqp41CkjvBb S30A== Received: by 10.50.163.99 with SMTP id yh3mr6987381igb.53.1338797460562; Mon, 04 Jun 2012 01:11:00 -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 v20csp93292ibb; Mon, 4 Jun 2012 01:10:58 -0700 (PDT) Received: by 10.14.53.67 with SMTP id f43mr4640191eec.3.1338797458056; Mon, 04 Jun 2012 01:10:58 -0700 (PDT) Received: from eu1sys200aog102.obsmtp.com (eu1sys200aog102.obsmtp.com. [207.126.144.113]) by mx.google.com with SMTP id s11si3091207ees.142.2012.06.04.01.10.47 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 04 Jun 2012 01:10:58 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.113 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.113; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.113 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-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob102.postini.com ([207.126.147.11]) with SMTP ID DSNKT8xthp5IK8bVRT20ud07wq/arAK5hpSX@postini.com; Mon, 04 Jun 2012 08:10:57 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id C7A3B114; Mon, 4 Jun 2012 08:02:22 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id E3256906; Mon, 4 Jun 2012 08:10:42 +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 89EDCA8096; Mon, 4 Jun 2012 10:10:38 +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; Mon, 4 Jun 2012 10:10:41 +0200 From: Linus Walleij To: Samuel Ortiz , Cc: Jonas Aaberg , Linus Walleij Subject: [PATCH RESEND v2] mfd/ab8500: print switch off cause Date: Mon, 4 Jun 2012 10:10:36 +0200 Message-ID: <1338797436-12927-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: ALoCoQnutkMZl4XCCAgWn95YRdJ7GOiJqzg4xcTMqzv8NmEfpgoB9/GtrfmeslGslOw5nNwKIsR7 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 --- Sam, this seems to have gone missing in the v3.5 merge window, it was sent out and IIRC accepted. Anyway, no big deal but consider pushing this for the -rc:s. 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..6c81dc0 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) + 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);