From patchwork Sun Apr 22 23:07:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 133944 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp370242lji; Sun, 22 Apr 2018 16:13:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+5BbKKc7cNIG5CIduAW++ojuozC2mB6zSAw/vrHYlH98jZWDWA7ZYa48FmCMRVoYH4szJZ X-Received: by 10.99.99.133 with SMTP id x127mr15062167pgb.50.1524438785260; Sun, 22 Apr 2018 16:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524438785; cv=none; d=google.com; s=arc-20160816; b=zlwcIqPy+wUtfXIftdDHqCfzRmQQQgpIgHmJ9xDZCfpCesg86LaeBxwXXdPNgGet5+ jlgLGz8jwhvlDa+gV7ej1exXfVYxHMki/mDLMlHjJGNEzzWt+3CBZ/5/ZaWftcDgwMWy uk4aZosTKP95vlhABSQ5rKrJK1MfWwFJ5vBUU204+p1Kt65DYlcNTvN45eVJDEZNsu5y Vfy+KYvoh5ILnNzrjLgtTuFg6LeKrXqYdull/AABaNkyC9X9IFL43oBHTzpvGSn33LoP 3Es3FarUiskvC6TmNhmuwaqbGzd9mbnP1ZYDS22KbX8J6oZm3bcwFm/LvOKQA/Gv1WXu WZ2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=dn2F8aZQOmoMM3GMvlYfhA/F0xsoRmM3i8KywfDXWEM=; b=wOMGip9zUiz/FLaP+yj1t1Dcju9ur+EPOdui25YpSV0LPc3CTUlsFD45eisz2lMZYr UyB4rAIDvmwBqo2SsPvqKCFI56e9D+0oW6XBsaX3WkwPhYCfSLPaVMax0z58vKh9vbL6 neHe930SZfT4jLuMj7uGHe5m+TNiXM28q+KReq1VEF8GL2ypHxqD30e46OMYDgkWwNAW AHiJSE+HcElz84S7HCAifFUPKnWdjjOsJgmeSQ8C2ItTNk6GoX+2pXeRVQYQuAod4pFK t6tUpk29TTwV7zLjWkRHdlvTBJSkAlkzjGfRbNkhr/g+I+ib5QDfKxSNaPIJx9qfT9b6 efTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ioIesM28; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14-v6si11488160plk.535.2018.04.22.16.13.05; Sun, 22 Apr 2018 16:13:05 -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=pass header.i=@linaro.org header.s=google header.b=ioIesM28; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753934AbeDVXNC (ORCPT + 29 others); Sun, 22 Apr 2018 19:13:02 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:37609 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753829AbeDVXKC (ORCPT ); Sun, 22 Apr 2018 19:10:02 -0400 Received: by mail-lf0-f66.google.com with SMTP id b23-v6so12251700lfg.4 for ; Sun, 22 Apr 2018 16:10:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dn2F8aZQOmoMM3GMvlYfhA/F0xsoRmM3i8KywfDXWEM=; b=ioIesM28G6uNuTELgYqQtHRmcZUt1FnGfa5vqw/OB8YJvhtA/3it0B3+LAsW4tlj6Q aPcTX6NxL15jme1B3D+RdAvyoS+AcElVPBVHAKa9M7kd1/OyVWUm1UE7d5KWa7HVfh7J rMQKhlXhYHtb5KmB8g/6j+tlWTCUTLMgHqjJI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dn2F8aZQOmoMM3GMvlYfhA/F0xsoRmM3i8KywfDXWEM=; b=NxAORGvkp/fGN78llE76KK9SQPbFpudrfxH33a276dvhLF8UnipAZHWVAWjCUs444q 2GSzsf4vHbyFU0g0Y/6nYsYAVuk7DY71mGoUjCVtbmwK6rpOLd03tyqUK67itnVX+eHQ hq1syri6suT+6XEPpAIPj9+cTi4Fhd+XAtWoUm7IjZ/nW2wkzgRGqFD94VEKF6r61Gk9 Pscc8XsevtXZeRpi7KOrjOZWsZ2DRpAcsPNmtOuT2FyGAd7jt+titsws1SvjnXS2Ttex dFHcIqQvh2CKGtpcoqvvXunTsA1tkuq7fKPI89nK0fxpIhzhfxIIqXWi+vCc1M48LKRO f+BQ== X-Gm-Message-State: ALQs6tCpDKyzXQ1dO5/AB2tIRWXrD9el3bvBSWATE3OLRWV3dvxbJNu/ 0jX6MFA35wESzIgvhbfNMEDhOw== X-Received: by 2002:a19:740a:: with SMTP id v10-v6mr7177076lfe.59.1524438600923; Sun, 22 Apr 2018 16:10:00 -0700 (PDT) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id r25sm2036291ljc.8.2018.04.22.16.09.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Apr 2018 16:10:00 -0700 (PDT) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Linus Walleij , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 05/18 v2] regulator: max77686: Pass descriptor instead of GPIO number Date: Mon, 23 Apr 2018 01:07:29 +0200 Message-Id: <20180422230742.3729-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180422230742.3729-1-linus.walleij@linaro.org> References: <20180422230742.3729-1-linus.walleij@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of passing a global GPIO number, pass a descriptor looked up from the device tree configuration node. Cc: Chanwoo Choi Cc: Krzysztof Kozlowski Cc: Bartlomiej Zolnierkiewicz Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebase the patch on the other changes. --- drivers/regulator/max77686-regulator.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) -- 2.14.3 diff --git a/drivers/regulator/max77686-regulator.c b/drivers/regulator/max77686-regulator.c index c301f3733475..5ebd06f47e6a 100644 --- a/drivers/regulator/max77686-regulator.c +++ b/drivers/regulator/max77686-regulator.c @@ -25,8 +25,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -90,6 +89,7 @@ enum max77686_ramp_rate { }; struct max77686_data { + struct device *dev; DECLARE_BITMAP(gpio_enabled, MAX77686_REGULATORS); /* Array indexed by regulator id */ @@ -269,16 +269,20 @@ static int max77686_of_parse_cb(struct device_node *np, case MAX77686_BUCK8: case MAX77686_BUCK9: case MAX77686_LDO20 ... MAX77686_LDO22: - config->ena_gpio = of_get_named_gpio(np, - "maxim,ena-gpios", 0); - config->ena_gpio_flags = GPIOF_OUT_INIT_HIGH; - config->ena_gpio_initialized = true; + config->ena_gpiod = devm_gpiod_get_from_of_node(max77686->dev, + np, + "maxim,ena", + 0, + GPIOD_OUT_HIGH, + "max77686-LDO"); + if (IS_ERR(config->ena_gpiod)) + return PTR_ERR(config->ena_gpiod); break; default: return 0; } - if (gpio_is_valid(config->ena_gpio)) { + if (config->ena_gpiod) { set_bit(desc->id, max77686->gpio_enabled); return regmap_update_bits(config->regmap, desc->enable_reg, @@ -521,6 +525,7 @@ static int max77686_pmic_probe(struct platform_device *pdev) if (!max77686) return -ENOMEM; + max77686->dev = &pdev->dev; config.dev = iodev->dev; config.regmap = iodev->regmap; config.driver_data = max77686;