From patchwork Wed Jun 14 12:25:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 9786181 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 F30E360384 for ; Wed, 14 Jun 2017 12:25:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCBE720072 for ; Wed, 14 Jun 2017 12:25:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF65821E5A; Wed, 14 Jun 2017 12:25:20 +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=-6.0 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2FF320072 for ; Wed, 14 Jun 2017 12:25:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751863AbdFNMZS (ORCPT ); Wed, 14 Jun 2017 08:25:18 -0400 Received: from [91.227.64.183] ([91.227.64.183]:50646 "EHLO rere.qmqm.pl" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751843AbdFNMZR (ORCPT ); Wed, 14 Jun 2017 08:25:17 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 64BB621; Wed, 14 Jun 2017 14:25:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1497443115; bh=feWlnt0tu3QdAhIY+ZctTprji2xWFBwoq4BT6c8Vd5I=; h=Date:From:Subject:To:Cc:From; b=HrsU6a6bOSAHa+plXqY52+x84p29JBTQm8VVuBxTYnhnMnSmbH56fPNOHAH7S3VnA oTI0m5rqY5df9muoqPdG6x8q0oc/mww6zlVahEG4FR7STT+Jh5fQMys/yzrXIp1nTn QiTEwdL2XgE0+2NZ5RaSQ0nwMgeXkuKEow5HHc5IVEC/1g03T/X/HgM9brfJnqTclW 4m/N1WMkLZUX+0jotvMfd4id8BG5VPvj62CTTKPTEFBM6dre2Y0edGhL0DkkL0Gwt9 ylSKW1O4AzuSSM+lWf7zDEDJu/x+qpFy1yo0qqj6WPW+Q3cMTEvYm3imTGlD70nos+ 7A/78jRNYVm4A== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.99.2 at rere Date: Wed, 14 Jun 2017 14:25:13 +0200 Message-Id: From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH] regulator: tps65910: wire up sleep control configuration MIME-Version: 1.0 To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-omap@vger.kernel.org Cc: Mark Brown , Tony Lindgren , Liam Girdwood , Keerthy , Rob Herring , Mark Rutland Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This enables configuring the PMIC's sleep mode via device-tree. A pointer indirection to sleep mode data is removed, as it simplifies the implementation slightly. References: 201cf052810d20814a77ca0e0045a2c1a3508a1f Signed-off-by: Michał Mirosław --- Documentation/devicetree/bindings/mfd/tps65910.txt | 4 ++++ drivers/mfd/tps65910.c | 22 +++++++++++++++------- include/linux/mfd/tps65910.h | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/tps65910.txt b/Documentation/devicetree/bindings/mfd/tps65910.txt index 38833e63a59f9..8af1202b381dc 100644 --- a/Documentation/devicetree/bindings/mfd/tps65910.txt +++ b/Documentation/devicetree/bindings/mfd/tps65910.txt @@ -61,6 +61,10 @@ Optional properties: There should be 9 entries here, one for each gpio. - ti,system-power-controller: Telling whether or not this pmic is controlling the system power. +- ti,sleep-enable: Enable SLEEP state. +- ti,sleep-keep-therm: Keep thermal monitoring on in sleep state. +- ti,sleep-keep-ck32k: Keep the 32KHz clock output on in sleep state. +- ti,sleep-keep-hsclk: Keep high speed internal clock on in sleep state. Regulator Optional properties: - ti,regulator-ext-sleep-control: enable external sleep diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index 11cab1582f2f2..8263605f6d2fa 100644 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -328,11 +328,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910, goto err_sleep_init; } - /* Return if there is no sleep keepon data. */ - if (!pmic_pdata->slp_keepon) - return 0; - - if (pmic_pdata->slp_keepon->therm_keepon) { + if (pmic_pdata->slp_keepon.therm_keepon) { ret = tps65910_reg_set_bits(tps65910, TPS65910_SLEEP_KEEP_RES_ON, SLEEP_KEEP_RES_ON_THERM_KEEPON_MASK); @@ -342,7 +338,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910, } } - if (pmic_pdata->slp_keepon->clkout32k_keepon) { + if (pmic_pdata->slp_keepon.clkout32k_keepon) { ret = tps65910_reg_set_bits(tps65910, TPS65910_SLEEP_KEEP_RES_ON, SLEEP_KEEP_RES_ON_CLKOUT32K_KEEPON_MASK); @@ -352,7 +348,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910, } } - if (pmic_pdata->slp_keepon->i2chs_keepon) { + if (pmic_pdata->slp_keepon.i2chs_keepon) { ret = tps65910_reg_set_bits(tps65910, TPS65910_SLEEP_KEEP_RES_ON, SLEEP_KEEP_RES_ON_I2CHS_KEEPON_MASK); @@ -415,6 +411,18 @@ static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client, prop = of_property_read_bool(np, "ti,en-ck32k-xtal"); board_info->en_ck32k_xtal = prop; + prop = of_property_read_bool(np, "ti,sleep-enable"); + board_info->en_dev_slp = prop; + + prop = of_property_read_bool(np, "ti,sleep-keep-therm"); + board_info->slp_keepon.therm_keepon = prop; + + prop = of_property_read_bool(np, "ti,sleep-keep-ck32k"); + board_info->slp_keepon.clkout32k_keepon = prop; + + prop = of_property_read_bool(np, "ti,sleep-keep-hsclk"); + board_info->slp_keepon.i2chs_keepon = prop; + board_info->irq = client->irq; board_info->irq_base = -1; board_info->pm_off = of_property_read_bool(np, diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index ffb21e79204d6..deffdcd0236f9 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h @@ -879,7 +879,7 @@ struct tps65910_board { bool en_ck32k_xtal; bool en_dev_slp; bool pm_off; - struct tps65910_sleep_keepon_data *slp_keepon; + struct tps65910_sleep_keepon_data slp_keepon; bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO]; unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS]; struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];