Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5313138imm; Tue, 19 Jun 2018 08:26:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKHc9vLOKvk1dwsHAmmvzPMmTxHw/RrbLWp0Jgfd2EuxEHGZKlUtkfb5j/GR/CZYzI7Uc1+ X-Received: by 2002:a63:64c5:: with SMTP id y188-v6mr15595372pgb.37.1529421966565; Tue, 19 Jun 2018 08:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529421966; cv=none; d=google.com; s=arc-20160816; b=bVOgNorH6HYZYEM7sDh5KeAAzncg95xtbdazlVAaY8DtPsxGIiv2cXH9a+wv0Hgq3D M5VOH1hSIFzA/6iUd14FTAkX4pYLTgonMa8+g2vEL+oyhr1bCPpZSY8+Z+FCur7tqFfZ NaDKZiRTUiCPXHmbteR20WwxzaMLzRCAq6+CZwto8DmDyAO8++gjSUBwg6ItUAA4dYnE avA4coxL7fDYKWMt9Oh4OE5/nXt64Wd/Jymd8phxKk4S1CYoHEP6C9dVZHKu+LRgAZ9T pxVcnj/tkxAXRvO5unU4r90v4vfg2cZwKjguGe09uBpevkAx+7S5g33Q2o1K1cZnpIlQ hxxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=Syte+WlMlTsrX/qZ5pT7jrkwaHvyHFO02GBgVQPhjt8=; b=pPTAriBzMl+qJ+78Wp4C0+nHUxv0cov03dPzKxHaT7sav0eGj8ruEIdkIgZwQOO0sV HDfD9sbTCXMrn3xnvdGrrNY/HORoROp1ij5krxmSyLKOl+E5dBAx+og6rq1RGURYdNXB 1n4/flrAQS4rhrFJXgoMsK1UXnv2DOEBvb669s62Ay9pN3jSI4Zd733PJL60NqCg5MyR r5Jzu2xHNRwgY1iWmNt/DJvpTRfd63xBtK8KTOwB51n+um2K4brlgn2an4Bf1Zei09h6 I2dKWkn8n1f/+xXFo+McW7vMTg0v3g0K9J2cpWwvnA9uErQmzvBS8Ck0OzuF+mx2Pmb2 R3BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=sqSmm5mp; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5-v6si16485687pfn.109.2018.06.19.08.25.52; Tue, 19 Jun 2018 08:26:06 -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=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=sqSmm5mp; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966562AbeFSPY7 (ORCPT + 99 others); Tue, 19 Jun 2018 11:24:59 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:39094 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965878AbeFSPY6 (ORCPT ); Tue, 19 Jun 2018 11:24:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=Syte+WlMlTsrX/qZ5pT7jrkwaHvyHFO02GBgVQPhjt8=; b=sqSmm5mpdUBT LYjMG82S42ekT2F5Y15l+c8eNn9NlN2ATxWaKUwy8UxNQI6oJ39PMDHZn6Ts+WtVANDZN0CDHLF7v /AXmdnaiXjKJEuEq5S4MWdPHBFKpptMP2GvIWhhphQdNvaIBkagqxgDP0yrRoiN/6d5BzNaZX0vpv StFwI=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fVIV4-0001M9-9V; Tue, 19 Jun 2018 15:24:54 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1fVIV3-0002US-Qt; Tue, 19 Jun 2018 16:24:53 +0100 From: Mark Brown To: Charles Keepax Cc: Matthias Reichl , Mark Brown , broonie@kernel.org, hias@horus.com, lgirdwood@gmail.com, linus.walleij@linaro.org, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Applied "regulator: arizona-ldo1: Use correct device to get enable GPIO" to the regulator tree In-Reply-To: <20180619151000.21693-1-ckeepax@opensource.cirrus.com> Message-Id: Date: Tue, 19 Jun 2018 16:24:53 +0100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch regulator: arizona-ldo1: Use correct device to get enable GPIO has been applied to the regulator tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From a9191579ba1086d91842199263e6fe6bb5eec1ba Mon Sep 17 00:00:00 2001 From: Charles Keepax Date: Tue, 19 Jun 2018 16:10:00 +0100 Subject: [PATCH] regulator: arizona-ldo1: Use correct device to get enable GPIO Currently the enable GPIO is being looked up on the regulator device itself but that does not have its own DT node, this causes the lookup to fail and the regulator not to get its GPIO. The DT node is shared across the whole MFD and as such the lookup needs to happen on that parent device. Moving the lookup to the parent device also means devres can no longer be used as the life time would attach to the wrong device. Additionally, the enable GPIO is active high so we should be passing GPIOD_OUT_LOW to ensure the regulator starts in its off state allowing the driver to enable it when it is ready. Fixes: e1739e86f0cb ("regulator: arizona-ldo1: Look up a descriptor and pass to the core") Reported-by: Matthias Reichl Signed-off-by: Charles Keepax Signed-off-by: Mark Brown --- drivers/regulator/arizona-ldo1.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c index f6d6a4ad9e8a..e976d073f28d 100644 --- a/drivers/regulator/arizona-ldo1.c +++ b/drivers/regulator/arizona-ldo1.c @@ -36,6 +36,8 @@ struct arizona_ldo1 { struct regulator_consumer_supply supply; struct regulator_init_data init_data; + + struct gpio_desc *ena_gpiod; }; static int arizona_ldo1_hc_list_voltage(struct regulator_dev *rdev, @@ -253,12 +255,17 @@ static int arizona_ldo1_common_init(struct platform_device *pdev, } } - /* We assume that high output = regulator off */ - config.ena_gpiod = devm_gpiod_get_optional(&pdev->dev, "wlf,ldoena", - GPIOD_OUT_HIGH); + /* We assume that high output = regulator off + * Don't use devm, since we need to get against the parent device + * so clean up would happen at the wrong time + */ + config.ena_gpiod = gpiod_get_optional(parent_dev, "wlf,ldoena", + GPIOD_OUT_LOW); if (IS_ERR(config.ena_gpiod)) return PTR_ERR(config.ena_gpiod); + ldo1->ena_gpiod = config.ena_gpiod; + if (pdata->init_data) config.init_data = pdata->init_data; else @@ -276,6 +283,9 @@ static int arizona_ldo1_common_init(struct platform_device *pdev, of_node_put(config.of_node); if (IS_ERR(ldo1->regulator)) { + if (config.ena_gpiod) + gpiod_put(config.ena_gpiod); + ret = PTR_ERR(ldo1->regulator); dev_err(&pdev->dev, "Failed to register LDO1 supply: %d\n", ret); @@ -334,8 +344,19 @@ static int arizona_ldo1_probe(struct platform_device *pdev) return ret; } +static int arizona_ldo1_remove(struct platform_device *pdev) +{ + struct arizona_ldo1 *ldo1 = platform_get_drvdata(pdev); + + if (ldo1->ena_gpiod) + gpiod_put(ldo1->ena_gpiod); + + return 0; +} + static struct platform_driver arizona_ldo1_driver = { .probe = arizona_ldo1_probe, + .remove = arizona_ldo1_remove, .driver = { .name = "arizona-ldo1", }, -- 2.17.1