From patchwork Wed Oct 8 13:44:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 5053801 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 01A759F30B for ; Wed, 8 Oct 2014 13:49:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB4BE20125 for ; Wed, 8 Oct 2014 13:49:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B20DF20035 for ; Wed, 8 Oct 2014 13:49:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932068AbaJHNpy (ORCPT ); Wed, 8 Oct 2014 09:45:54 -0400 Received: from bhuna.collabora.co.uk ([93.93.135.160]:52424 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932556AbaJHNpx (ORCPT ); Wed, 8 Oct 2014 09:45:53 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: javier) with ESMTPSA id B584A609E10 From: Javier Martinez Canillas To: Mark Brown Cc: Doug Anderson , Chanwoo Choi , Olof Johansson , Chris Zhong , Krzysztof Kozlowski , Abhilash Kesavan , linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Javier Martinez Canillas Subject: [PATCH 1/5] regulator: of: Add regulator-initial-mode parse support Date: Wed, 8 Oct 2014 15:44:03 +0200 Message-Id: <1412775847-15213-2-git-send-email-javier.martinez@collabora.co.uk> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1412775847-15213-1-git-send-email-javier.martinez@collabora.co.uk> References: <1412775847-15213-1-git-send-email-javier.martinez@collabora.co.uk> 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=ham 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 regulator core allows boards to define an initial operating mode to be used as a default for regulators. With board files and platform data, it is possible to fill a struct regulation_constraints .initial_mode to set an initial mode for each regulator. But currently there isn't a way to do the same with DeviceTrees. Argubly the operating modes are Linux-specific so that information should not be in the DT which should be used to only describe hardware. But regulators having different operating modes is also a hardware property since many PMICs have support to set different modes for their regulators. So, the generic REGULATOR_MODE_{FAST,NORMAL,IDLE,STANDBY} modes can be used to describe different level of power efficiency required for each regulator and drivers can map those levels to the real modes supported by the hardware as stated on their data-sheet. Signed-off-by: Javier Martinez Canillas --- drivers/regulator/of_regulator.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 18236be..a076b7f 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -93,6 +93,9 @@ static void of_get_regulation_constraints(struct device_node *np, }; } + if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) + constraints->initial_mode = pval; + for (i = 0; i < ARRAY_SIZE(regulator_states); i++) { switch (i) { case PM_SUSPEND_MEM: