Received: by 10.223.185.116 with SMTP id b49csp2268234wrg; Mon, 12 Feb 2018 07:07:04 -0800 (PST) X-Google-Smtp-Source: AH8x227Db51VDLcb6eW/cMSbqaRJBVZhZOKwxGV5uO7hgopWvysdEfzETzgCdJet1ZMfZdHBDX44 X-Received: by 10.101.80.130 with SMTP id r2mr9412088pgp.107.1518448024453; Mon, 12 Feb 2018 07:07:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518448024; cv=none; d=google.com; s=arc-20160816; b=1CDiotnHpyCiy9PgGoPaYwh1XASCTLYzc8YsRu5OTAQQWofqPD5APbyYvHpqD9mhgX VRaRpEBSeZ7KRSK8nAaqOMMhnh9cggU9QZAX+O8Nj3szOxVVJW+4L2JOAx9nj3Op8yar BR+GCrqTIvQfFKBJyzxVX4nilOfWd0LeNwP66SOFVfWcN7w6lvjzsyGINrAqA3x5b5d8 X17Jv4n61PbHGz9Gyuc8thlqCLV2v4F0tZdiF+VXnWPI0bhRWy3WKVAQU8S7WwzKLCmo sF4klxsIc8kkJfDx2v0cvNCfyS4OULIak2q0UL1JECzeOBocrQsk66+rYlTzUs4nlSvT p7xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=ewLTTKBiZfcpQ7AbwjCftBoVU48Bg/a8VeyRTPHq/WY=; b=m9bdiyZAoGXIoIH4LqMBLMuFZmtt6hg4VQgyO9spQbwtwdzGkuiMV1GHjGu3klxZLC RqueDssp3GM7pJyUhvguK62LTXcvILE3gIyAJec6shr6Udioz/KbJ5L+ql7B4ujBxrAY wiv3nLpg0K+/91jWVsTszLsI6KeVjXGB4hO9qg+TPARMLDlqded1VI5KB7532PEBTrrD 6orT3cALClNkyWlfaaK7uH9rfb/efz/jOJUERheUWzBTZ4lmd7kcfPiyB5IUuSZrXmsN +5aU8Hr3pVtjX3o5OromT69Htmpylk1Y6tVxwv3+0lzAjFKsizUAxyGR+WcGkRMewgPq xAuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gvm1ODa1; 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 e33-v6si2582464pld.628.2018.02.12.07.06.37; Mon, 12 Feb 2018 07:07:04 -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=Gvm1ODa1; 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 S932893AbeBLO7U (ORCPT + 99 others); Mon, 12 Feb 2018 09:59:20 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:38410 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932358AbeBLO67 (ORCPT ); Mon, 12 Feb 2018 09:58:59 -0500 Received: by mail-wr0-f193.google.com with SMTP id t94so15477471wrc.5 for ; Mon, 12 Feb 2018 06:58:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=ewLTTKBiZfcpQ7AbwjCftBoVU48Bg/a8VeyRTPHq/WY=; b=Gvm1ODa1q23jwvSmouCi2o7cWCZmkut5emvECOldqar7erw4EZEk1rpCTI8SwymWPf tN1MppitantL1EqVUkMV1zrg4P1I4pI6EuCtGEn+WRcrJaHhUd460Ya4MOn/IVEugi9s 124hMYqaJt3PTXsOqZcGsZNAkRQ7+xnYtBpqs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=ewLTTKBiZfcpQ7AbwjCftBoVU48Bg/a8VeyRTPHq/WY=; b=JF6Vgm1ZB00UTzeOuQ5Rp+iSrST1gKcxCYGVl8qc7Dp795goXO2QXiG06EHtBXTB0O zNLE/7NfzxOKuqf39YbXkBOe18MyQes1MB7FLh6+bNfTB3xc622riARtd/URwHPdI+b2 wNFGw4XuLSs5/sH3r3FjyiBTK27ISDt3S8OQ/HhtfL3pWCqE374Pp3Hyr/2iWqWQilt/ QQDONewd328h3dV1LCLx5AFGAS1jge8sOb9Q+x+m2NM5/B66OrXsWMK4ABYBKfmviD8e URl65ehK14WVeKWNu2T/6X1s+5Gr/R0IpqgdjCl4RauoEf3A6+zP9VJC1j3NQvQIi5qj JkpQ== X-Gm-Message-State: APf1xPD+gHfDxo1uQV/yXI8t16T09ClgguVoDcpnp4//Mwasadwmj77B Pigawi3NhTtijaZanu5GvadU6w== X-Received: by 10.223.151.207 with SMTP id t15mr9544335wrb.223.1518447537526; Mon, 12 Feb 2018 06:58:57 -0800 (PST) Received: from dell ([2.27.35.139]) by smtp.gmail.com with ESMTPSA id b65sm16780100wrd.26.2018.02.12.06.58.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 06:58:56 -0800 (PST) Date: Mon, 12 Feb 2018 14:58:55 +0000 From: Lee Jones To: Linus Walleij Cc: Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Subject: Re: [PATCH 14/21] regulator: s5m8767: Pass descriptor instead of GPIO number Message-ID: <20180212145855.2xxr5zvfbuswsbgh@dell> References: <20180212131717.27193-1-linus.walleij@linaro.org> <20180212131717.27193-15-linus.walleij@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180212131717.27193-15-linus.walleij@linaro.org> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 12 Feb 2018, Linus Walleij wrote: > Instead of passing a global GPIO number for the enable GPIO, pass > a descriptor looked up from the device tree node for the > regulator. > > This regulator supports passing platform data, but enable/sleep > regulators are looked up from the device tree exclusively, so > we can need not touch other files. > > Cc: Lee Jones > Signed-off-by: Linus Walleij > --- > Lee: would be nice if you could ACK this smallish patch to > the MFD header. Fine, but any sign of a conflict and I'll need a PR. Acked-by: Lee Jones > --- > drivers/regulator/s5m8767.c | 26 +++++++++++++++----------- > include/linux/mfd/samsung/core.h | 4 +++- > 2 files changed, 18 insertions(+), 12 deletions(-) > > diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c > index 4836947e1521..b8443a360646 100644 > --- a/drivers/regulator/s5m8767.c > +++ b/drivers/regulator/s5m8767.c > @@ -13,6 +13,7 @@ > > #include > #include > +#include > #include > #include > #include > @@ -459,15 +460,14 @@ static void s5m8767_regulator_config_ext_control(struct s5m8767_info *s5m8767, > return; > } > > - if (!gpio_is_valid(rdata->ext_control_gpio)) { > + if (!rdata->ext_control_gpiod) { > dev_warn(s5m8767->dev, > "ext-control for %s: GPIO not valid, ignoring\n", > - rdata->reg_node->name); > + rdata->reg_node->name); > return; > } > > - config->ena_gpio = rdata->ext_control_gpio; > - config->ena_gpio_flags = GPIOF_OUT_INIT_HIGH; > + config->ena_gpiod = rdata->ext_control_gpiod; > } > > /* > @@ -577,8 +577,14 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, > continue; > } > > - rdata->ext_control_gpio = of_get_named_gpio(reg_np, > - "s5m8767,pmic-ext-control-gpios", 0); > + rdata->ext_control_gpiod = devm_gpiod_get_from_of_node(&pdev->dev, > + reg_np, > + "s5m8767,pmic-ext-control-gpios", > + 0, > + GPIOD_OUT_HIGH, > + "s5m8767"); > + if (IS_ERR(rdata->ext_control_gpiod)) > + return PTR_ERR(rdata->ext_control_gpiod); > > rdata->id = i; > rdata->initdata = of_get_regulator_init_data( > @@ -954,10 +960,8 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) > config.driver_data = s5m8767; > config.regmap = iodev->regmap_pmic; > config.of_node = pdata->regulators[i].reg_node; > - config.ena_gpio = -EINVAL; > - config.ena_gpio_flags = 0; > - config.ena_gpio_initialized = true; > - if (gpio_is_valid(pdata->regulators[i].ext_control_gpio)) > + config.ena_gpiod = NULL; > + if (pdata->regulators[i].ext_control_gpiod) > s5m8767_regulator_config_ext_control(s5m8767, > &pdata->regulators[i], &config); > > @@ -970,7 +974,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) > return ret; > } > > - if (gpio_is_valid(pdata->regulators[i].ext_control_gpio)) { > + if (pdata->regulators[i].ext_control_gpiod) { > ret = s5m8767_enable_ext_control(s5m8767, rdev); > if (ret < 0) { > dev_err(s5m8767->dev, > diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h > index 5a23dd4df432..28f4ae76271d 100644 > --- a/include/linux/mfd/samsung/core.h > +++ b/include/linux/mfd/samsung/core.h > @@ -39,6 +39,8 @@ > #define STEP_12_5_MV 12500 > #define STEP_6_25_MV 6250 > > +struct gpio_desc; > + > enum sec_device_type { > S5M8751X, > S5M8763X, > @@ -151,7 +153,7 @@ struct sec_regulator_data { > int id; > struct regulator_init_data *initdata; > struct device_node *reg_node; > - int ext_control_gpio; > + struct gpio_desc *ext_control_gpiod; > }; > > /* -- Lee Jones Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog