Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp845848ybi; Fri, 12 Jul 2019 05:36:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIJbzmq15vPr2TLya5JaM0iglSpE5GG2KO+Iu74m+eNbXh4diN8Hx8jftGoT/ugtZJBaxe X-Received: by 2002:a63:1f1f:: with SMTP id f31mr10467826pgf.353.1562935016810; Fri, 12 Jul 2019 05:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562935016; cv=none; d=google.com; s=arc-20160816; b=gFK8FH+ssG76/ywBBjtvNKfsDtjRdPLmsDYYWEUBV4jjZ0ST6lqHd26xI63Lqd7rsZ KXgwouhTUXPjz+DUHvOSiZrRKVQLq13vkTv5SgkeKXVYrBgzL5zP8TrV0TQEq6LBDzl8 krc40AYaGqrAXYX/A8SQN6k4euQJGgx0zhaYHXoTbz6jEJmrK/iBSzP1+IimGKb3Wfnk zQkbxqXnxVIluRrcDPOakHEZ6uqEEMuQnfBg07UYrzn7CcFaMEiw6xj2IAfyUPjxTlhz vlofVr6FUrKdFQDGIpoBydNRqIrc1/t0YxTl6czGANQGmrD6PSNZXTiA9jtrMUjnPZnZ FL5A== 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=AK9x4Mzr4I5HD8Tu2lImFOrWAzKwUpryAJllvBH04p1Fki7tRd/rjv4qGMM+W/QnSw 0l+spzjSjmOK9uxMhuoeFsjwAkFBFUJw/+4TyzZNab2BRKSalKc4yPBLP0TKCGVSBcef uc6Izmauja5VoobR3MUVviyl3ELeYcYEfkxoaY3WVwThGzr+dU1/1VklCtZez6EtbGfc rSfnv82Vw8FQQQeAnGxyf9AXPqaIRcIUBGPv10yOS3Yhb5K14dU7Yal6gaJMKERnTYA9 DZdEytxA62aDtt/U8k3TmwYTW8V6+v8EuK/T7V/+l3s7UmID+XeFP71dyYnN330EbQlp 9YsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oer0wU1x; 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 x25si8167685pfn.13.2019.07.12.05.36.41; Fri, 12 Jul 2019 05:36:56 -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=oer0wU1x; 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 S1729726AbfGLMeX (ORCPT + 99 others); Fri, 12 Jul 2019 08:34:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:53904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727683AbfGLMeM (ORCPT ); Fri, 12 Jul 2019 08:34:12 -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 A5FE7208E4; Fri, 12 Jul 2019 12:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934851; bh=z2PB0owPThVnK2H60EQBS4IbVg/99sL+l3sZvBSv2fE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oer0wU1xAO83QqcXbvgYNclEZrvd937ZkZZ8ePhrBKfkKMWeWX8JAPEhcnEHwZMZ4 7H++jdNj6bWi4VLN8ONPOLrXyFfBnMStaKgyZ0xN8SrpHztuvoGDY/QwtQ9jC6GDJo lhM0/QdExOVqgBthLFCpXTprTF6wZoQJqZVuiAf0= 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.2 44/61] iio: adc: stm32-adc: add missing vdda-supply Date: Fri, 12 Jul 2019 14:19:57 +0200 Message-Id: <20190712121622.994345336@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121620.632595223@linuxfoundation.org> References: <20190712121620.632595223@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);