From patchwork Sun Jun 5 13:50:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9155603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 08B8C60573 for ; Sun, 5 Jun 2016 13:52:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECC3727B13 for ; Sun, 5 Jun 2016 13:52:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF78B28348; Sun, 5 Jun 2016 13:52:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 916FC27B13 for ; Sun, 5 Jun 2016 13:52:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b9YSV-0000bT-Dl; Sun, 05 Jun 2016 13:51:19 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b9YSS-0000T2-8h for linux-arm-kernel@lists.infradead.org; Sun, 05 Jun 2016 13:51:16 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C5D6FC04D29F; Sun, 5 Jun 2016 13:50:55 +0000 (UTC) Received: from shalem.localdomain.com (vpn1-7-198.ams2.redhat.com [10.36.7.198]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u55DopNa000771; Sun, 5 Jun 2016 09:50:52 -0400 From: Hans de Goede To: Lee Jones Subject: [PATCH] mfd: axp20x: Add a 500ms delay at the end of axp20x_power_off Date: Sun, 5 Jun 2016 15:50:48 +0200 Message-Id: <1465134648-27113-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sun, 05 Jun 2016 13:50:55 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160605_065116_347860_655A5D3F X-CRM114-Status: GOOD ( 12.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree , linux-pm@vger.kernel.org, Hans de Goede , Chen-Yu Tsai , Maxime Ripard , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The kernel expects the power_off function to not return, and if it does it panics. At a slight delay after the i2c write which turns off power through the pmic, to give capacitors etc. some time to drain. Without this the kernel lives on long enough after the poweroff to print the following on the serial console on my Mele A1000G quad: [ 248.583588] reboot: Power down [ 248.600490] Kernel pa With the delay the start of printing "Kernel panic" is gone. Signed-off-by: Hans de Goede Acked-by: Chen-Yu Tsai --- drivers/mfd/axp20x.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index 6364dab..fd80b09 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -677,6 +678,9 @@ static void axp20x_power_off(void) regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL, AXP20X_OFF); + + /* Give capacitors etc. time to drain to avoid kernel panic msg. */ + msleep(500); } int axp20x_match_device(struct axp20x_dev *axp20x)