Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-07-14 11:33:41 +0200
committerJiri Slaby <jslaby@suse.cz>2019-07-14 11:33:53 +0200
commitc676a9d47332d41331c298e42aec0356aee17815 (patch)
tree7f1e0bc1fd7312de15272832cb1f810113678629
parentf21448d2c990a3a55f91412dc64cb049612a99b8 (diff)
iio: adc: stm32-adc: add missing vdda-supply (bnc#1012628).
-rw-r--r--patches.kernel.org/5.2.1-043-iio-adc-stm32-adc-add-missing-vdda-supply.patch96
-rw-r--r--series.conf1
2 files changed, 97 insertions, 0 deletions
diff --git a/patches.kernel.org/5.2.1-043-iio-adc-stm32-adc-add-missing-vdda-supply.patch b/patches.kernel.org/5.2.1-043-iio-adc-stm32-adc-add-missing-vdda-supply.patch
new file mode 100644
index 0000000000..0c4a1250bf
--- /dev/null
+++ b/patches.kernel.org/5.2.1-043-iio-adc-stm32-adc-add-missing-vdda-supply.patch
@@ -0,0 +1,96 @@
+From: Fabrice Gasnier <fabrice.gasnier@st.com>
+Date: Wed, 19 Jun 2019 14:29:55 +0200
+Subject: [PATCH] iio: adc: stm32-adc: add missing vdda-supply
+References: bnc#1012628
+Patch-mainline: 5.2.1
+Git-commit: 7685010fca2ba0284f31fd1380df3cffc96d847e
+
+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 <fabrice.gasnier@st.com>
+Fixes: 1add69880240 ("iio: adc: Add support for STM32 ADC core").
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ drivers/iio/adc/stm32-adc-core.c | 21 ++++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c
+index 2327ec18b40c..1f7ce5186dfc 100644
+--- 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(struct device *dev)
+ 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 @@ static int stm32_adc_core_hw_start(struct device *dev)
+ 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(struct device *dev)
+ 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 platform_device *pdev)
+ 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);
+--
+2.22.0
+
diff --git a/series.conf b/series.conf
index cf328167ae..d37d516d99 100644
--- a/series.conf
+++ b/series.conf
@@ -69,6 +69,7 @@
patches.kernel.org/5.2.1-040-lkdtm-support-llvm-objcopy.patch
patches.kernel.org/5.2.1-041-binder-fix-memory-leak-in-error-path.patch
patches.kernel.org/5.2.1-042-binder-return-errors-from-buffer-copy-functions.patch
+ patches.kernel.org/5.2.1-043-iio-adc-stm32-adc-add-missing-vdda-supply.patch
########################################################
# Build fixes that apply to the vanilla kernel too.