Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3501187imm; Thu, 17 May 2018 09:43:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZob7P+1nugi5voA+RVwMOQ3UXXmRyfoRrvLBeLSpLCYOHOFi09fJgxKCIjUbP3RZm1iDrgS X-Received: by 2002:a17:902:3343:: with SMTP id a61-v6mr5814031plc.241.1526575382908; Thu, 17 May 2018 09:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526575382; cv=none; d=google.com; s=arc-20160816; b=h5W1tF3r/Sz9lVTbXoa1FzQumSMAZWfQDViwIX4nV8N76A/SMFT9A84vIHxZjYRYTM S2KzM//Dxz8Klen59uLFLzAfiFsNYzMl/45lyp0Bf8Qu04sQJOqkafcaoss8dy5bztvS x438BVOoWED3XUETT4YsUUrpt8ppIr+uhKBefmSgcJYp30LapLfNQC11CcZrLgHc4qXf RiH5IUIggNQxHFUg4hxFQY6TIKMIzPePPCPByaGARmVA1W1MpBlZxw6gVDUoPGpfUrP4 cswR3rIZ3w8vR71sTVX+V82UUKD/KAqU39BRr6rwS7ZF8SBmNx3oolSWgAPLBpeOaBsP GnSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=j6aIjIr+TRCJom7P2yKM1NpRFuWdP5ZoPxiJOOQDSYY=; b=R27mnaRE57WTaryRKY3pKBtpYYd2ZoSPaAS/AoD0uuGzWDRn3q3pTDk1FIoagmiiPH VpDmiOtZ2vyN0uXBux3AjzPmzk+PE9bbyxznJp9w790JDqAovtgFyCBQ636mJl11Dfyf iBmelhcOgoZ/kXjTdxyJU3JyNb9n5sAxg/Ps2zrualOU2Bv0Mk9LCPhBJyz4wNYx/Ifx g506Ss84q96RaIetD6WwrAvmYFNagihbsmAptPjDAnUge+0rA5blH5MRL08/kWCvMyAf gQtdK/wsXPGIiUpnHJdgJ/4UfgsbNFH8jd62TBBPshcgKlHuwbB4ef0eLzoH9nXV8utG pFRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=xKFKgXnE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2-v6si5827362pfh.215.2018.05.17.09.42.48; Thu, 17 May 2018 09:43:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=xKFKgXnE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752735AbeEQQl5 (ORCPT + 99 others); Thu, 17 May 2018 12:41:57 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:53694 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752715AbeEQQlw (ORCPT ); Thu, 17 May 2018 12:41:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=j6aIjIr+TRCJom7P2yKM1NpRFuWdP5ZoPxiJOOQDSYY=; b=xKFKgXnEDiVB yKbW72S5YK6pZszLI2jngYp5V8rrhoz9xqj3RBRVZWUQHGm+WZ3TTcskGbbznfmIzTI3+V9xGDeMf ZaH/F38hbVxj4LPD/QYfKdDiP+/6uPscQpfgs/CSFKrozUJ7kgm0Vxgabrc6SD8+UPWU+CbG3hJQG SRPAw=; Received: from [37.205.61.206] (helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fJLyM-00014g-RX; Thu, 17 May 2018 16:41:46 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id 0CD3D44007E; Thu, 17 May 2018 17:41:44 +0100 (BST) From: Mark Brown To: David Collins Cc: Mark Brown , broonie@kernel.org, lgirdwood@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, rnayak@codeaurora.org, sboyd@kernel.org, dianders@chromium.org, linux-kernel@vger.kernel.org Subject: Applied "regulator: of: add support for allowed modes configuration" to the regulator tree In-Reply-To: <58bb4f965515a67a6cbbc726b0d7b092c22b79d7.1526088289.git.collinsd@codeaurora.org> Message-Id: <20180517164144.0CD3D44007E@finisterre.ee.mobilebroadband> Date: Thu, 17 May 2018 17:41:44 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch regulator: of: add support for allowed modes configuration has been applied to the regulator tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 54557ad9737e28b06b632cce723ef2373fe6bf12 Mon Sep 17 00:00:00 2001 From: David Collins Date: Fri, 11 May 2018 18:46:47 -0700 Subject: [PATCH] regulator: of: add support for allowed modes configuration Add support for configuring the machine constraints valid_modes_mask element based on a list of allowed modes specified via a device tree property. Signed-off-by: David Collins Signed-off-by: Mark Brown --- drivers/regulator/of_regulator.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 0d3f73eacb99..d61fed28fdb9 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -32,7 +32,7 @@ static void of_get_regulation_constraints(struct device_node *np, struct regulator_state *suspend_state; struct device_node *suspend_np; unsigned int mode; - int ret, i; + int ret, i, len; u32 pval; constraints->name = of_get_property(np, "regulator-name", NULL); @@ -136,6 +136,33 @@ static void of_get_regulation_constraints(struct device_node *np, } } + len = of_property_count_elems_of_size(np, "regulator-allowed-modes", + sizeof(u32)); + if (len > 0) { + if (desc && desc->of_map_mode) { + for (i = 0; i < len; i++) { + ret = of_property_read_u32_index(np, + "regulator-allowed-modes", i, &pval); + if (ret) { + pr_err("%s: couldn't read allowed modes index %d, ret=%d\n", + np->name, i, ret); + break; + } + mode = desc->of_map_mode(pval); + if (mode == REGULATOR_MODE_INVALID) + pr_err("%s: invalid regulator-allowed-modes element %u\n", + np->name, pval); + else + constraints->valid_modes_mask |= mode; + } + if (constraints->valid_modes_mask) + constraints->valid_ops_mask + |= REGULATOR_CHANGE_MODE; + } else { + pr_warn("%s: mode mapping not defined\n", np->name); + } + } + if (!of_property_read_u32(np, "regulator-system-load", &pval)) constraints->system_load = pval; -- 2.17.0