From patchwork Mon Feb 12 13:17:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 128085 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3204710ljc; Mon, 12 Feb 2018 05:22:24 -0800 (PST) X-Google-Smtp-Source: AH8x225SqFuNJE4S3rSTJpNUMfZpto+SbiyZbwtU6Iv/yKtBPeygGbXC8yYXQuytJbapTutyFAMY X-Received: by 2002:a17:902:4a0c:: with SMTP id w12-v6mr10901548pld.17.1518441744193; Mon, 12 Feb 2018 05:22:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518441744; cv=none; d=google.com; s=arc-20160816; b=MUZn3HBWapWBJ4+BulihyjtSGwrqaqNxg5s0coIhsPqmUbpW+ZSNVVgpux/iiOvGz/ //JMBUjjTlvFJ2oNOMUIerN0+FMuhyLZfeXhk5PekdWHVOuqDFKsu8T1LlMzicyPj/Ag BKggMp/9YRuylYTq/T/edoliMvKDCGfdJ5nzaMnIZhRKL4j4/7Y2PqD1ZYY+jbLP/Ybr yXqh+PrmRtY0CsNVf434c6Lj+wDgZgCT7rSi665wuGrBKpYpwDxMYSyoiDNmOMgZmqGy yxsznT6eidXRUD89dNo/H1G0Fb1yyCZUlxT9ZKO8eoJRRYVuNm2F73nBVDrQ40eWKlZU 6L6Q== 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=9BM6OVRpMQt1hkiTw+Zip0PFrliiPSsPjoDwFDm2Jn0=; b=HLNhxnj6knWutkkTb5QzsjJI4Ao+RAm0vrIQHdD3T7pNf41PsaGgbZvbz52pZ5O0G6 9JRudCgJs2Pev9koCJmg4jEtcWrdL1sQbKEmtrjyDJ/d96XioSIHnCeWni72jE227IL4 uXakOJTEyeiYAMrdP//qEeHD4h5esW0OwsXuWDdwNyPCXjYg5PD5jO7F6D5Eqjvi2s6k E5ZYGNbm4GiV0eN+lQaxPpwzcrHGkihOdISWgMNnESbV2rJVq0ympbJvq3/eKW6TsFcq U8QuWMm/S4OKosZQArAodQNfIZN54pXo5dHsRhuxtTlCa2GSRQu6LS0/6nkW/vnTmsMw Ywow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SmKemPEg; 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 k5si6333058pfj.272.2018.02.12.05.22.23; Mon, 12 Feb 2018 05:22:24 -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=SmKemPEg; 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 S935414AbeBLNVw (ORCPT + 13 others); Mon, 12 Feb 2018 08:21:52 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:42486 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935232AbeBLNRm (ORCPT ); Mon, 12 Feb 2018 08:17:42 -0500 Received: by mail-lf0-f65.google.com with SMTP id w10so7598646lfc.9 for ; Mon, 12 Feb 2018 05:17:42 -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=9BM6OVRpMQt1hkiTw+Zip0PFrliiPSsPjoDwFDm2Jn0=; b=SmKemPEgmxyEtfJXtrsyKcGUL/uxw60wyRGrBj3CxHVGexHit+xqGdjoKMolKr5gaB CaOy42ZXG4Qt5a/L7VwwJq6MCz/2IppxplGNgN6bsd8ABwLpjoYryG7Vr/9xmX2TKJMO ghPGpwg8YLGsq7m/bt4ooOMdXU4YXZEJmiIF8= 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=9BM6OVRpMQt1hkiTw+Zip0PFrliiPSsPjoDwFDm2Jn0=; b=Kf+D1og6xMBD+7Jraqt9A6GOOL/8bUKi33fLlxc7+q72vfDyEQFwIXP0djv9EJGPFf FtkaT6XJO/JglpPGbufXnOi4X3hFoZcw1a2lAtkxsrMHfuEjWT3G7n9ijfQFQXnW1bjS SxodpKOUgVWuSXtKBVNOvePKh1K2zUVlDxTCetTcv+hUr5YY6AytyM4r9EjwD8CcYjEc J/HeEwLU+vsK4F5e+RcZ7Bl7ujRP3fCTS/vx5S8OYs8GLLNj/LNUj0srYxis7FdOcWcj 1Fw9k8/6ZInbURaWCk91tPoS7oIh2r3r95qqs7uItbOBisUtgtYgj8S57xkh7tA6te0V jH1Q== X-Gm-Message-State: APf1xPALqFvaXwjsQS0uS/Npy6Cwotea3gbz8+rEo1wM/k0eSvm8/dv3 hU5enhoUHUzDK6p9QVQRCf6hGA== X-Received: by 10.46.85.17 with SMTP id j17mr8374085ljb.55.1518441461201; Mon, 12 Feb 2018 05:17:41 -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.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 05:17:40 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Linus Walleij , patches@opensource.cirrus.com, Richard Fitzgerald Subject: [PATCH 05/21] regulator: arizona-ldo1: Look up a descriptor and pass to the core Date: Mon, 12 Feb 2018 14:17:01 +0100 Message-Id: <20180212131717.27193-6-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 with the standard devm_gpiod_get_optional() call. We have augmented the GPIO core to look up the regulator special GPIO "wlf,ldoena" in a separate patch. Cc: patches@opensource.cirrus.com Cc: Richard Fitzgerald Signed-off-by: Linus Walleij --- drivers/regulator/arizona-ldo1.c | 19 ++++++------------- include/linux/regulator/arizona-ldo1.h | 3 --- 2 files changed, 6 insertions(+), 16 deletions(-) -- 2.14.3 diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c index 96fddfff5dc4..f6d6a4ad9e8a 100644 --- a/drivers/regulator/arizona-ldo1.c +++ b/drivers/regulator/arizona-ldo1.c @@ -17,12 +17,11 @@ #include #include #include -#include +#include #include #include #include #include -#include #include #include @@ -198,16 +197,6 @@ static int arizona_ldo1_of_get_pdata(struct arizona_ldo1_pdata *pdata, struct device_node *init_node, *dcvdd_node; struct regulator_init_data *init_data; - pdata->ldoena = of_get_named_gpio(np, "wlf,ldoena", 0); - if (pdata->ldoena < 0) { - dev_warn(config->dev, - "LDOENA GPIO property missing/malformed: %d\n", - pdata->ldoena); - pdata->ldoena = 0; - } else { - config->ena_gpio_initialized = true; - } - init_node = of_get_child_by_name(np, "ldo1"); dcvdd_node = of_parse_phandle(np, "DCVDD-supply", 0); @@ -264,7 +253,11 @@ static int arizona_ldo1_common_init(struct platform_device *pdev, } } - config.ena_gpio = pdata->ldoena; + /* We assume that high output = regulator off */ + config.ena_gpiod = devm_gpiod_get_optional(&pdev->dev, "wlf,ldoena", + GPIOD_OUT_HIGH); + if (IS_ERR(config.ena_gpiod)) + return PTR_ERR(config.ena_gpiod); if (pdata->init_data) config.init_data = pdata->init_data; diff --git a/include/linux/regulator/arizona-ldo1.h b/include/linux/regulator/arizona-ldo1.h index c685f1277c63..fe74ab9990e6 100644 --- a/include/linux/regulator/arizona-ldo1.h +++ b/include/linux/regulator/arizona-ldo1.h @@ -14,9 +14,6 @@ struct regulator_init_data; struct arizona_ldo1_pdata { - /** GPIO controlling LDOENA, if any */ - int ldoena; - /** Regulator configuration for LDO1 */ const struct regulator_init_data *init_data; };