From patchwork Mon Feb 12 13:17:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 872063 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="KGCazp4/"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zg5sJ2QJXz9sRW for ; Tue, 13 Feb 2018 00:21:08 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933843AbeBLNUx (ORCPT ); Mon, 12 Feb 2018 08:20:53 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:43081 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935255AbeBLNRs (ORCPT ); Mon, 12 Feb 2018 08:17:48 -0500 Received: by mail-lf0-f65.google.com with SMTP id q69so2534041lfi.10 for ; Mon, 12 Feb 2018 05:17:48 -0800 (PST) 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=m85RyQv8NKO+UsZ9nVriTvZRsERzHYgC3rhiaoQ10vk=; b=KGCazp4/Tur4NxBEjFfFrEWwZcMQwlKL6Z8ZRt8AhiCZPm3sA4IVXXXFtTdwhAKIJQ sbmS1zFgb7mvj2zTAR8gOI0Kf/XlLv0+rIHSQ7XIfmhNL0IkqYGox51IqB2xuFIDt0dG lbf2IeMiWeiGK4pUc66YQR022Nu+TumEFALng= 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=m85RyQv8NKO+UsZ9nVriTvZRsERzHYgC3rhiaoQ10vk=; b=adchulAqOq5YSRDMHtQKn2eJM4HeesTOuWJW01j2YdLe8ZMOpGFTQsykyCSvfTekWo ZxpMckHLcmLw5agbvGBKeE8hS5Ba4rUgWWQDV9dAYoBrtD2nW9rE/H2/LPflV/lDs6QK /OoHnjztEoHVv0oQobRS0iFlQbb02oW35z5Y/9To7OoIAudlmCeMwchWBW7+rCVI7C0K 4rfKy8Z2MsPjixbktt0AY4R2HuowvUNu1cvJomljR1EdWDbQXx6HONakUX+ZHo/DcRlo iat3BCU93xB+0VogLcXIo/ZTHjSqDwvSuOhKUkNh/cAhN0lybLJ6XQ5VJDd3YTrvkRfM aWcQ== X-Gm-Message-State: APf1xPDnIi8UQcdfrbqa7KrG/tk/S9KsNVa6QL44wEfeJnhJfj5DqW6N 7TMR+CB36Ijm1V8fCYlLAiuPkA== X-Google-Smtp-Source: AH8x224WpKmB8wiBR+v4CmhuoZqvocAJHxI4mVDmtiRNIpoj/t4/CpyWTh60q4glqcKtoWTpVXTRJQ== X-Received: by 10.25.40.205 with SMTP id o196mr7399440lfo.89.1518441467306; Mon, 12 Feb 2018 05:17:47 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id r88sm1584648lje.30.2018.02.12.05.17.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 05:17:46 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Linus Walleij , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 08/21] regulator: max77686: Pass descriptor instead of GPIO number Date: Mon, 12 Feb 2018 14:17:04 +0100 Message-Id: <20180212131717.27193-9-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180212131717.27193-1-linus.walleij@linaro.org> References: <20180212131717.27193-1-linus.walleij@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@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 --- drivers/regulator/max77686-regulator.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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;