Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp847094ybi; Fri, 12 Jul 2019 05:38:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYHvfkT7fSALWhj6tLIQJ+DnE9jI8avOND366ctrCXIQmhIk70dsuOkd/7La3GR3H3jciK X-Received: by 2002:a17:902:da4:: with SMTP id 33mr10284580plv.209.1562935090569; Fri, 12 Jul 2019 05:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562935090; cv=none; d=google.com; s=arc-20160816; b=P9XrYfXzn016gvAXXLrG1c/BKsXBHiM4Hbd6KVNY6ua2vLct5KYoKKcxB216G+yETP zF7fk7i17inpOzBoQPA2IeShVJQPwtvE/V0SqkZg2iJx0vKZTFuS6h+ZKfuC9PsJ0Zzt hnSLeYh+wHKrjqBIyYJLf0JYXCtZRjgHNcrG8r5lhP6zrmrIGvMcv3cs5rr6iPhHPa48 u1HCzzu3b+Zg+cJweL5eAt1w6I6Tjjhs/nR+uc22I6NXtzlATWT2z9xSuV2gO4QYzFlR pN2D9ZYsP81ElXU9BrKzqzWNc0o2Qh/5duLakwI/ELVJequcY0rggAhqRqOE6TVFZVAB hSOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=++lyUHoqM7+VgAWrRlRteLaeC6fzSDHL547/mp2Iorw=; b=KzrWHZk79ch/mMtLU4OqkeogYLDvuNA9q+SvFN0b4KbMsQ2MecKgk90IgsC4e2wzig PJ+AEggSBKZ05uer7nWJXJHOaiaxSpM73A6oGmDo5wboeJB770LwLzUs/rnPqG7XDRNr vqQndY5Z06gOBguaM/5LOEw0RxPVFRExMlpPNdZ5XmI4Os6e2tOG/6lAPhywDyA84gab elMoSy8g7L47EAo4GxnAIkrtETph9+tQDHwcaipB3OWGOvASvIbE3p4lPnAORuAwdM1n qNkdMlsOwD8Eyi0K3BHLqc8L9+HA2uYkUSXnO3Jc3asgph+vDr8MYVfONor1JF1QkRky PeOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=udvJGnO+; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j100si7811163pje.52.2019.07.12.05.37.55; Fri, 12 Jul 2019 05:38:10 -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=pass header.i=@kernel.org header.s=default header.b=udvJGnO+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729376AbfGLMbx (ORCPT + 99 others); Fri, 12 Jul 2019 08:31:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:48938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727603AbfGLMbv (ORCPT ); Fri, 12 Jul 2019 08:31:51 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DF7CE2166E; Fri, 12 Jul 2019 12:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934710; bh=z2PB0owPThVnK2H60EQBS4IbVg/99sL+l3sZvBSv2fE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=udvJGnO+RJOh39kXqAsOkGHtyE7mM9g3+NMPpHen31CTmtaWBbAEENuUiqJaD08gE zHM0IuxpCNw7s/hdHGqKBswxS15S/BVHwLLeoGpLrVksfZth2JSh6gOrRyq4uOzfjt jxlnTrmqehjxPcngqhPghep6hJ/GOfPfBYnoRFhg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabrice Gasnier , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.1 127/138] iio: adc: stm32-adc: add missing vdda-supply Date: Fri, 12 Jul 2019 14:19:51 +0200 Message-Id: <20190712121633.605114520@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fabrice Gasnier commit 7685010fca2ba0284f31fd1380df3cffc96d847e upstream. Add missing vdda-supply, analog power supply, to STM32 ADC. When vdda is an independent supply, it needs to be properly turned on or off to supply the ADC. Signed-off-by: Fabrice Gasnier Fixes: 1add69880240 ("iio: adc: Add support for STM32 ADC core"). Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/stm32-adc-core.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) --- a/drivers/iio/adc/stm32-adc-core.c +++ b/drivers/iio/adc/stm32-adc-core.c @@ -87,6 +87,7 @@ struct stm32_adc_priv_cfg { * @domain: irq domain reference * @aclk: clock reference for the analog circuitry * @bclk: bus clock common for all ADCs, depends on part used + * @vdda: vdda analog supply reference * @vref: regulator reference * @cfg: compatible configuration data * @common: common data for all ADC instances @@ -97,6 +98,7 @@ struct stm32_adc_priv { struct irq_domain *domain; struct clk *aclk; struct clk *bclk; + struct regulator *vdda; struct regulator *vref; const struct stm32_adc_priv_cfg *cfg; struct stm32_adc_common common; @@ -394,10 +396,16 @@ static int stm32_adc_core_hw_start(struc struct stm32_adc_priv *priv = to_stm32_adc_priv(common); int ret; + ret = regulator_enable(priv->vdda); + if (ret < 0) { + dev_err(dev, "vdda enable failed %d\n", ret); + return ret; + } + ret = regulator_enable(priv->vref); if (ret < 0) { dev_err(dev, "vref enable failed\n"); - return ret; + goto err_vdda_disable; } if (priv->bclk) { @@ -425,6 +433,8 @@ err_bclk_disable: clk_disable_unprepare(priv->bclk); err_regulator_disable: regulator_disable(priv->vref); +err_vdda_disable: + regulator_disable(priv->vdda); return ret; } @@ -441,6 +451,7 @@ static void stm32_adc_core_hw_stop(struc if (priv->bclk) clk_disable_unprepare(priv->bclk); regulator_disable(priv->vref); + regulator_disable(priv->vdda); } static int stm32_adc_probe(struct platform_device *pdev) @@ -468,6 +479,14 @@ static int stm32_adc_probe(struct platfo return PTR_ERR(priv->common.base); priv->common.phys_base = res->start; + priv->vdda = devm_regulator_get(&pdev->dev, "vdda"); + if (IS_ERR(priv->vdda)) { + ret = PTR_ERR(priv->vdda); + if (ret != -EPROBE_DEFER) + dev_err(&pdev->dev, "vdda get failed, %d\n", ret); + return ret; + } + priv->vref = devm_regulator_get(&pdev->dev, "vref"); if (IS_ERR(priv->vref)) { ret = PTR_ERR(priv->vref);