From patchwork Wed Oct 7 00:44:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 7341101 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1AC1D9F1D5 for ; Wed, 7 Oct 2015 00:45:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 241112071B for ; Wed, 7 Oct 2015 00:45:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E2F520649 for ; Wed, 7 Oct 2015 00:45:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753436AbbJGApJ (ORCPT ); Tue, 6 Oct 2015 20:45:09 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:30609 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753409AbbJGApH (ORCPT ); Tue, 6 Oct 2015 20:45:07 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NVT0063NRF5ED10@mailout2.w1.samsung.com>; Wed, 07 Oct 2015 01:45:05 +0100 (BST) X-AuditID: cbfec7f4-f79c56d0000012ee-6d-56146b11f193 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 3E.6B.04846.11B64165; Wed, 7 Oct 2015 01:45:05 +0100 (BST) Received: from localhost.localdomain ([10.252.80.64]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NVT00DW6RERL440@eusync2.samsung.com>; Wed, 07 Oct 2015 01:45:05 +0100 (BST) From: Krzysztof Kozlowski To: Sangbeom Kim , Krzysztof Kozlowski , Lee Jones , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org Cc: Bartlomiej Zolnierkiewicz , Marek Szyprowski , Chanwoo Choi , Inki Dae Subject: [PATCH v2 3/3] mfd: sec-core: Disable buck voltage reset on watchdog falling edge Date: Wed, 07 Oct 2015 09:44:41 +0900 Message-id: <1444178681-16188-3-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1444178681-16188-1-git-send-email-k.kozlowski@samsung.com> References: <1444178681-16188-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprJLMWRmVeSWpSXmKPExsVy+t/xK7qC2SJhBjcXylpsnLGe1eL6l+es FvOPnGO1mHR/AovF6xeGFve/HmW0uLxrDpvFjPP7mCzWHrnLbnFxxRcmBy6PO9f2sHn0bVnF 6PF5k1wAcxSXTUpqTmZZapG+XQJXxoMtjSwFy2UqZr0Ua2BcLN7FyMkhIWAisf/UFTYIW0zi wr31QDYXh5DAUkaJu3O7GSGc/4wSGxfMZgKpYhMwlti8fAlYlYjALUaJpjWvwKqYBTYwSry+ 0Qk2S1ggRmLd3n/MIDaLgKrE9fmz2EFsXgF3iZk7tjBB7JOTOHlsMiuIzSngIfHkwx8WEFsI qGbuoqdsExh5FzAyrGIUTS1NLihOSs811CtOzC0uzUvXS87P3cQICbAvOxgXH7M6xCjAwajE w/vDWCRMiDWxrLgy9xCjBAezkgivwhHhMCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8c3e9DxES SE8sSc1OTS1ILYLJMnFwSjUwVhgcX/DxrF6Yn8kb7UucrObqWbJTmov3CZlefPW7Wk7rpcpR zo3Sevzpc36o2C9x9T0Ze37FE7ZXjX/YF8fePyLhxDz/YfeC8I71+XuPtzZemnxVOOPdWesF V06XL5ywPkG92V55j89aNsuelUa3l5nfrKl7X+D6V22XMXeC7fPKa+mq0Rc4lFiKMxINtZiL ihMB0r0fFywCAAA= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The WRSTBI bit (disabled by default but enabled by bootloader), when set, is responsible for resetting voltages to default values of certain bucks on falling edge of Warm Reset Input pin from AP. However on some boards (with S2MPS13) the pin is pulled down so any suspend will effectively trigger the reset of bucks supplying the power to the little and big cores. In the same time when resuming, these bucks must provide voltage greater or equal to voltage before suspend to match the frequency chosen by cpufreq. If voltage (default value of voltage after reset) is lower than one set by cpufreq before suspend, then system will hang during resuming. Signed-off-by: Krzysztof Kozlowski Reported-by: Bartlomiej Zolnierkiewicz Tested-by: Bartlomiej Zolnierkiewicz --- Changs since v1: 1. Add Bartlomiej's Reported-by and Tested-by. --- drivers/mfd/sec-core.c | 26 ++++++++++++++++++++++++++ include/linux/mfd/samsung/core.h | 2 ++ include/linux/mfd/samsung/s2mps13.h | 1 + 3 files changed, 29 insertions(+) diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index 589e5efc2d7f..2626fc0b5b8c 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c @@ -262,6 +262,29 @@ static void sec_pmic_dump_rev(struct sec_pmic_dev *sec_pmic) dev_dbg(sec_pmic->dev, "Revision: 0x%x\n", val); } +static void sec_pmic_configure(struct sec_pmic_dev *sec_pmic) +{ + int err; + + if (sec_pmic->device_type != S2MPS13X) + return; + + if (sec_pmic->pdata->disable_wrstbi) { + /* + * If WRSTBI pin is pulled down this feature must be disabled + * because each Suspend to RAM will trigger buck voltage reset + * to default values. + */ + err = regmap_update_bits(sec_pmic->regmap_pmic, + S2MPS13_REG_WRSTBI, + S2MPS13_REG_WRSTBI_MASK, 0x0); + if (err) + dev_warn(sec_pmic->dev, + "Cannot initialize WRSTBI config: %d\n", + err); + } +} + #ifdef CONFIG_OF /* * Only the common platform data elements for s5m8767 are parsed here from the @@ -289,6 +312,8 @@ static struct sec_platform_data *sec_pmic_i2c_parse_dt_pdata( pd->manual_poweroff = of_property_read_bool(dev->of_node, "samsung,s2mps11-acokb-ground"); + pd->disable_wrstbi = of_property_read_bool(dev->of_node, + "samsung,s2mps11-wrstbi-ground"); return pd; } #else @@ -434,6 +459,7 @@ static int sec_pmic_probe(struct i2c_client *i2c, goto err_mfd; device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup); + sec_pmic_configure(sec_pmic); sec_pmic_dump_rev(sec_pmic); return ret; diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h index aa78957e092f..a06098639399 100644 --- a/include/linux/mfd/samsung/core.h +++ b/include/linux/mfd/samsung/core.h @@ -134,6 +134,8 @@ struct sec_platform_data { int buck4_init; /* Whether or not manually set PWRHOLD to low during shutdown. */ bool manual_poweroff; + /* Disable the WRSTBI (buck voltage warm reset) when probing? */ + bool disable_wrstbi; }; /** diff --git a/include/linux/mfd/samsung/s2mps13.h b/include/linux/mfd/samsung/s2mps13.h index b1fd675fa36f..239e977ba45d 100644 --- a/include/linux/mfd/samsung/s2mps13.h +++ b/include/linux/mfd/samsung/s2mps13.h @@ -184,5 +184,6 @@ enum s2mps13_regulators { * Let's assume that default value will be set. */ #define S2MPS13_BUCK_RAMP_DELAY 12500 +#define S2MPS13_REG_WRSTBI_MASK BIT(5) #endif /* __LINUX_MFD_S2MPS13_H */