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: 128077 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3203583ljc; Mon, 12 Feb 2018 05:20:59 -0800 (PST) X-Google-Smtp-Source: AH8x226e9hg2jTWs8fm0EC0v+GSd8xdzDy739y/Ofexd9gx/UOSlCHZssFT632agUysyR142YIR/ X-Received: by 10.98.223.80 with SMTP id u77mr11810984pfg.186.1518441659691; Mon, 12 Feb 2018 05:20:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518441659; cv=none; d=google.com; s=arc-20160816; b=o4tNiXxNXsFX8QXaKZWqNxZdpqNG4jsVobsVMdusPtsJ35luXhnC+snJ3bVWyDcaMZ cVRwmJHQEai7sCVSq1QpndPeDzcZuG63P4CApGxdUuE4YbM9A+s/AkhArg8hrb/j0/8s /V+Aoov2Ek7j+2GOyU4zcFP2+97CK2uC9gCm6escjsIibjEI9HJSLm6LIBrmecAdjw/W PfVF/7rsL0XdLsMxiZSOM8794l40jJVVmBZmd/W5ph1lpFjJjxfJqQ86Pve4jZbyn6po /R6ex05ArWEQ1kQDNzbvNgNZ1HtCKGhna+elTM+iWvDrkI4gSBLfgY13oYmqaVSJjtDG kOmw== 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=m85RyQv8NKO+UsZ9nVriTvZRsERzHYgC3rhiaoQ10vk=; b=BJj77UX0ZYcIF9tl/rZzxc2PxCYOsvaFRfY0QT5BgYCEs2vGJpXOFeT0HQ4W9dLltt 03fYsEoveEMZsfOftfEJB/SlSor4YJ7Q5U9u50I0fWEZROgm3R9CKZH0bJ+m3cYN681a MUSeaSGbJq26OruiqslyJYakBEWw+LLouAV/gm+HKs5lCbEbcRwAi5i/7FljaOqdxMjU djwQcFtxfTbLitYrvefVAqye+xi1VVzDEw8KAMmpy9hALWONS58az6pIgsE0APxBkiQl Iz7mUm0ILJY8Dv7RV+tlaoIe7Soin/o4rTUw605GW8ruoFakvS+AZi99BNAoexoIFOQa aodw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KGCazp4/; 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 l9si2769133pff.155.2018.02.12.05.20.59; Mon, 12 Feb 2018 05:20:59 -0800 (PST) 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=KGCazp4/; 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 S964774AbeBLNUy (ORCPT + 13 others); Mon, 12 Feb 2018 08:20:54 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:44090 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935256AbeBLNRs (ORCPT ); Mon, 12 Feb 2018 08:17:48 -0500 Received: by mail-lf0-f65.google.com with SMTP id c188so4486137lfc.11 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=GyojDwz21GikN9YL4RvtwkE5mgygJUTTwr1jhARJJAetLJW8aVpspgQXGJS8dEcUk0 yWbk4nAu4+FansSR/ddPQtkWAxJucEb6DMgR5067ZGXT4SxWkU+AQKBWmFZmZnt4bTPm BCiNF94mHcAJgVDF7pODAejkIWK4LSvVN+kxXZJOrfUh7JXMPr/uIDJr3r6leomBHNQe fvvhO/V+x3YWW2dwv/RHBruUZhMqov5jXFZcCwowWQ4pin97ira8TvkIk9N39rvw9Wo8 grGrB/mJWMQ/0rihwp/5PpQzCzuetWjq8ew3gfOIz+NoIcyOOZO5DYIseAJWzLJIVu/M 2v/g== X-Gm-Message-State: APf1xPDDZEyfsqDLyQASeaG+NpTuzhGeZL4Ovvf3CvGBcLrB3EsnKwit jkCarOfy+Z/qWo+xgDaQ0aBJJA== 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-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 --- 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;