--- /dev/null
+From 0c4c68d6fa1bae74d450e50823c24fcc3cd0b171 Mon Sep 17 00:00:00 2001
+From: Olivier Moysan <olivier.moysan@st.com>
+Date: Tue, 26 Feb 2019 14:51:05 +0100
+Subject: ASoC: stm32: i2s: fix 16 bit format support
+
+From: Olivier Moysan <olivier.moysan@st.com>
+
+commit 0c4c68d6fa1bae74d450e50823c24fcc3cd0b171 upstream.
+
+I2S supports 16 bits data in 32 channel length.
+However the expected driver behavior, is to
+set channel length to 16 bits when data format is 16 bits.
+
+Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/stm/stm32_i2s.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/soc/stm/stm32_i2s.c
++++ b/sound/soc/stm/stm32_i2s.c
+@@ -501,7 +501,7 @@ static int stm32_i2s_configure(struct sn
+ switch (format) {
+ case 16:
+ cfgr = I2S_CGFR_DATLEN_SET(I2S_I2SMOD_DATLEN_16);
+- cfgr_mask = I2S_CGFR_DATLEN_MASK;
++ cfgr_mask = I2S_CGFR_DATLEN_MASK | I2S_CGFR_CHLEN;
+ break;
+ case 32:
+ cfgr = I2S_CGFR_DATLEN_SET(I2S_I2SMOD_DATLEN_32) |
--- /dev/null
+From 1ac2bd16448997d9ec01922423486e1e85535eda Mon Sep 17 00:00:00 2001
+From: Olivier Moysan <olivier.moysan@st.com>
+Date: Tue, 26 Feb 2019 14:51:07 +0100
+Subject: ASoC: stm32: i2s: fix dma configuration
+
+From: Olivier Moysan <olivier.moysan@st.com>
+
+commit 1ac2bd16448997d9ec01922423486e1e85535eda upstream.
+
+DMA configuration is not balanced on start/stop.
+Move DMA configuration to trigger callback.
+
+Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/stm/stm32_i2s.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+--- a/sound/soc/stm/stm32_i2s.c
++++ b/sound/soc/stm/stm32_i2s.c
+@@ -488,7 +488,7 @@ static int stm32_i2s_configure(struct sn
+ {
+ struct stm32_i2s_data *i2s = snd_soc_dai_get_drvdata(cpu_dai);
+ int format = params_width(params);
+- u32 cfgr, cfgr_mask, cfg1, cfg1_mask;
++ u32 cfgr, cfgr_mask, cfg1;
+ unsigned int fthlv;
+ int ret;
+
+@@ -529,15 +529,11 @@ static int stm32_i2s_configure(struct sn
+ if (ret < 0)
+ return ret;
+
+- cfg1 = I2S_CFG1_RXDMAEN | I2S_CFG1_TXDMAEN;
+- cfg1_mask = cfg1;
+-
+ fthlv = STM32_I2S_FIFO_SIZE * I2S_FIFO_TH_ONE_QUARTER / 4;
+- cfg1 |= I2S_CFG1_FTHVL_SET(fthlv - 1);
+- cfg1_mask |= I2S_CFG1_FTHVL_MASK;
++ cfg1 = I2S_CFG1_FTHVL_SET(fthlv - 1);
+
+ return regmap_update_bits(i2s->regmap, STM32_I2S_CFG1_REG,
+- cfg1_mask, cfg1);
++ I2S_CFG1_FTHVL_MASK, cfg1);
+ }
+
+ static int stm32_i2s_startup(struct snd_pcm_substream *substream,
+@@ -589,6 +585,10 @@ static int stm32_i2s_trigger(struct snd_
+ /* Enable i2s */
+ dev_dbg(cpu_dai->dev, "start I2S\n");
+
++ cfg1_mask = I2S_CFG1_RXDMAEN | I2S_CFG1_TXDMAEN;
++ regmap_update_bits(i2s->regmap, STM32_I2S_CFG1_REG,
++ cfg1_mask, cfg1_mask);
++
+ ret = regmap_update_bits(i2s->regmap, STM32_I2S_CR1_REG,
+ I2S_CR1_SPE, I2S_CR1_SPE);
+ if (ret < 0) {
--- /dev/null
+From 8ba3c5215d69c09f5c39783ff3b78347769822ad Mon Sep 17 00:00:00 2001
+From: Olivier Moysan <olivier.moysan@st.com>
+Date: Tue, 26 Feb 2019 14:51:04 +0100
+Subject: ASoC: stm32: i2s: fix IRQ clearing
+
+From: Olivier Moysan <olivier.moysan@st.com>
+
+commit 8ba3c5215d69c09f5c39783ff3b78347769822ad upstream.
+
+Because of regmap cache, interrupts may not be cleared
+as expected.
+Declare IFCR register as write only and make writings
+to IFCR register unconditional.
+
+Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/stm/stm32_i2s.c | 13 ++++++-------
+ 1 file changed, 6 insertions(+), 7 deletions(-)
+
+--- a/sound/soc/stm/stm32_i2s.c
++++ b/sound/soc/stm/stm32_i2s.c
+@@ -246,8 +246,8 @@ static irqreturn_t stm32_i2s_isr(int irq
+ return IRQ_NONE;
+ }
+
+- regmap_update_bits(i2s->regmap, STM32_I2S_IFCR_REG,
+- I2S_IFCR_MASK, flags);
++ regmap_write_bits(i2s->regmap, STM32_I2S_IFCR_REG,
++ I2S_IFCR_MASK, flags);
+
+ if (flags & I2S_SR_OVR) {
+ dev_dbg(&pdev->dev, "Overrun\n");
+@@ -276,7 +276,6 @@ static bool stm32_i2s_readable_reg(struc
+ case STM32_I2S_CFG2_REG:
+ case STM32_I2S_IER_REG:
+ case STM32_I2S_SR_REG:
+- case STM32_I2S_IFCR_REG:
+ case STM32_I2S_TXDR_REG:
+ case STM32_I2S_RXDR_REG:
+ case STM32_I2S_CGFR_REG:
+@@ -547,8 +546,8 @@ static int stm32_i2s_startup(struct snd_
+ i2s->refcount++;
+ spin_unlock(&i2s->lock_fd);
+
+- return regmap_update_bits(i2s->regmap, STM32_I2S_IFCR_REG,
+- I2S_IFCR_MASK, I2S_IFCR_MASK);
++ return regmap_write_bits(i2s->regmap, STM32_I2S_IFCR_REG,
++ I2S_IFCR_MASK, I2S_IFCR_MASK);
+ }
+
+ static int stm32_i2s_hw_params(struct snd_pcm_substream *substream,
+@@ -603,8 +602,8 @@ static int stm32_i2s_trigger(struct snd_
+ return ret;
+ }
+
+- regmap_update_bits(i2s->regmap, STM32_I2S_IFCR_REG,
+- I2S_IFCR_MASK, I2S_IFCR_MASK);
++ regmap_write_bits(i2s->regmap, STM32_I2S_IFCR_REG,
++ I2S_IFCR_MASK, I2S_IFCR_MASK);
+
+ if (playback_flg) {
+ ier = I2S_IER_UDRIE;
--- /dev/null
+From 0acabecebc912b3ba06289e4ef40476acc499a37 Mon Sep 17 00:00:00 2001
+From: Lionel Debieve <lionel.debieve@st.com>
+Date: Fri, 28 Jun 2019 13:26:54 +0200
+Subject: crypto: stm32/hash - Fix hmac issue more than 256 bytes
+
+From: Lionel Debieve <lionel.debieve@st.com>
+
+commit 0acabecebc912b3ba06289e4ef40476acc499a37 upstream.
+
+Correct condition for the second hmac loop. Key must be only
+set in the first loop. Initial condition was wrong,
+HMAC_KEY flag was not properly checked.
+
+Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/crypto/stm32/stm32-hash.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/crypto/stm32/stm32-hash.c
++++ b/drivers/crypto/stm32/stm32-hash.c
+@@ -361,7 +361,7 @@ static int stm32_hash_xmit_cpu(struct st
+ return -ETIMEDOUT;
+
+ if ((hdev->flags & HASH_FLAGS_HMAC) &&
+- (hdev->flags & ~HASH_FLAGS_HMAC_KEY)) {
++ (!(hdev->flags & HASH_FLAGS_HMAC_KEY))) {
+ hdev->flags |= HASH_FLAGS_HMAC_KEY;
+ stm32_hash_write_key(hdev);
+ if (stm32_hash_wait_busy(hdev))
--- /dev/null
+From af0d4442dd6813de6e77309063beb064fa8e89ae Mon Sep 17 00:00:00 2001
+From: Lionel Debieve <lionel.debieve@st.com>
+Date: Mon, 1 Apr 2019 12:30:45 +0200
+Subject: hwrng: stm32 - fix unbalanced pm_runtime_enable
+
+From: Lionel Debieve <lionel.debieve@st.com>
+
+commit af0d4442dd6813de6e77309063beb064fa8e89ae upstream.
+
+No remove function implemented yet in the driver.
+Without remove function, the pm_runtime implementation
+complains when removing and probing again the driver.
+
+Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/char/hw_random/stm32-rng.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/char/hw_random/stm32-rng.c
++++ b/drivers/char/hw_random/stm32-rng.c
+@@ -166,6 +166,13 @@ static int stm32_rng_probe(struct platfo
+ return devm_hwrng_register(dev, &priv->rng);
+ }
+
++static int stm32_rng_remove(struct platform_device *ofdev)
++{
++ pm_runtime_disable(&ofdev->dev);
++
++ return 0;
++}
++
+ #ifdef CONFIG_PM
+ static int stm32_rng_runtime_suspend(struct device *dev)
+ {
+@@ -202,6 +209,7 @@ static struct platform_driver stm32_rng_
+ .of_match_table = stm32_rng_match,
+ },
+ .probe = stm32_rng_probe,
++ .remove = stm32_rng_remove,
+ };
+
+ module_platform_driver(stm32_rng_driver);
--- /dev/null
+From 6899b4f7c99c72968e58e502f96084f74f6e5e86 Mon Sep 17 00:00:00 2001
+From: Fabien Dessenne <fabien.dessenne@st.com>
+Date: Fri, 4 Jan 2019 14:47:16 +0100
+Subject: mailbox: mailbox-test: fix null pointer if no mmio
+
+From: Fabien Dessenne <fabien.dessenne@st.com>
+
+commit 6899b4f7c99c72968e58e502f96084f74f6e5e86 upstream.
+
+Fix null pointer issue if resource_size is called with no ioresource.
+
+Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
+Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
+Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mailbox/mailbox-test.c | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+--- a/drivers/mailbox/mailbox-test.c
++++ b/drivers/mailbox/mailbox-test.c
+@@ -363,22 +363,24 @@ static int mbox_test_probe(struct platfo
+
+ /* It's okay for MMIO to be NULL */
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+- size = resource_size(res);
+ tdev->tx_mmio = devm_ioremap_resource(&pdev->dev, res);
+- if (PTR_ERR(tdev->tx_mmio) == -EBUSY)
++ if (PTR_ERR(tdev->tx_mmio) == -EBUSY) {
+ /* if reserved area in SRAM, try just ioremap */
++ size = resource_size(res);
+ tdev->tx_mmio = devm_ioremap(&pdev->dev, res->start, size);
+- else if (IS_ERR(tdev->tx_mmio))
++ } else if (IS_ERR(tdev->tx_mmio)) {
+ tdev->tx_mmio = NULL;
++ }
+
+ /* If specified, second reg entry is Rx MMIO */
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+- size = resource_size(res);
+ tdev->rx_mmio = devm_ioremap_resource(&pdev->dev, res);
+- if (PTR_ERR(tdev->rx_mmio) == -EBUSY)
++ if (PTR_ERR(tdev->rx_mmio) == -EBUSY) {
++ size = resource_size(res);
+ tdev->rx_mmio = devm_ioremap(&pdev->dev, res->start, size);
+- else if (IS_ERR(tdev->rx_mmio))
++ } else if (IS_ERR(tdev->rx_mmio)) {
+ tdev->rx_mmio = tdev->tx_mmio;
++ }
+
+ tdev->tx_channel = mbox_test_request_channel(pdev, "tx");
+ tdev->rx_channel = mbox_test_request_channel(pdev, "rx");
--- /dev/null
+From b3ce6f6ff3c260ee53b0f2236e5fd950d46957da Mon Sep 17 00:00:00 2001
+From: Hugues Fruchet <hugues.fruchet@st.com>
+Date: Thu, 28 Feb 2019 12:10:53 -0500
+Subject: media: stm32-dcmi: fix DMA corruption when stopping streaming
+
+From: Hugues Fruchet <hugues.fruchet@st.com>
+
+commit b3ce6f6ff3c260ee53b0f2236e5fd950d46957da upstream.
+
+Avoid call of dmaengine_terminate_all() between
+dmaengine_prep_slave_single() and dmaengine_submit() by locking
+the whole DMA submission sequence.
+
+Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/platform/stm32/stm32-dcmi.c | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+--- a/drivers/media/platform/stm32/stm32-dcmi.c
++++ b/drivers/media/platform/stm32/stm32-dcmi.c
+@@ -161,6 +161,9 @@ struct stm32_dcmi {
+ u32 misr;
+ int errors_count;
+ int buffers_count;
++
++ /* Ensure DMA operations atomicity */
++ struct mutex dma_lock;
+ };
+
+ static inline struct stm32_dcmi *notifier_to_dcmi(struct v4l2_async_notifier *n)
+@@ -291,6 +294,13 @@ static int dcmi_start_dma(struct stm32_d
+ return ret;
+ }
+
++ /*
++ * Avoid call of dmaengine_terminate_all() between
++ * dmaengine_prep_slave_single() and dmaengine_submit()
++ * by locking the whole DMA submission sequence
++ */
++ mutex_lock(&dcmi->dma_lock);
++
+ /* Prepare a DMA transaction */
+ desc = dmaengine_prep_slave_single(dcmi->dma_chan, buf->paddr,
+ buf->size,
+@@ -298,6 +308,7 @@ static int dcmi_start_dma(struct stm32_d
+ if (!desc) {
+ dev_err(dcmi->dev, "%s: DMA dmaengine_prep_slave_single failed for buffer size %zu\n",
+ __func__, buf->size);
++ mutex_unlock(&dcmi->dma_lock);
+ return -EINVAL;
+ }
+
+@@ -309,9 +320,12 @@ static int dcmi_start_dma(struct stm32_d
+ dcmi->dma_cookie = dmaengine_submit(desc);
+ if (dma_submit_error(dcmi->dma_cookie)) {
+ dev_err(dcmi->dev, "%s: DMA submission failed\n", __func__);
++ mutex_unlock(&dcmi->dma_lock);
+ return -ENXIO;
+ }
+
++ mutex_unlock(&dcmi->dma_lock);
++
+ dma_async_issue_pending(dcmi->dma_chan);
+
+ return 0;
+@@ -690,7 +704,9 @@ static void dcmi_stop_streaming(struct v
+ spin_unlock_irq(&dcmi->irqlock);
+
+ /* Stop all pending DMA operations */
++ mutex_lock(&dcmi->dma_lock);
+ dmaengine_terminate_all(dcmi->dma_chan);
++ mutex_unlock(&dcmi->dma_lock);
+
+ clk_disable(dcmi->mclk);
+
+@@ -1662,6 +1678,7 @@ static int dcmi_probe(struct platform_de
+
+ spin_lock_init(&dcmi->irqlock);
+ mutex_init(&dcmi->lock);
++ mutex_init(&dcmi->dma_lock);
+ init_completion(&dcmi->complete);
+ INIT_LIST_HEAD(&dcmi->buffers);
+
--- /dev/null
+From cd8c9b5a49576bf28990237715bc2cb2210ac80a Mon Sep 17 00:00:00 2001
+From: Alexandre Torgue <alexandre.torgue@st.com>
+Date: Thu, 14 Feb 2019 17:54:24 +0100
+Subject: pinctrl: stm32: fix memory leak issue
+
+From: Alexandre Torgue <alexandre.torgue@st.com>
+
+commit cd8c9b5a49576bf28990237715bc2cb2210ac80a upstream.
+
+configs is allocated by pinconf_generic_parse_dt_config(),
+pinctrl_utils_add_map_configs() duplicates configs so it can and has to
+be freed to prevent memory leaks.
+
+Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pinctrl/stm32/pinctrl-stm32.c | 26 ++++++++++++++++----------
+ 1 file changed, 16 insertions(+), 10 deletions(-)
+
+--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
++++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
+@@ -403,7 +403,7 @@ static int stm32_pctrl_dt_subnode_to_map
+ unsigned int num_configs;
+ bool has_config = 0;
+ unsigned reserve = 0;
+- int num_pins, num_funcs, maps_per_pin, i, err;
++ int num_pins, num_funcs, maps_per_pin, i, err = 0;
+
+ pctl = pinctrl_dev_get_drvdata(pctldev);
+
+@@ -430,41 +430,45 @@ static int stm32_pctrl_dt_subnode_to_map
+ if (has_config && num_pins >= 1)
+ maps_per_pin++;
+
+- if (!num_pins || !maps_per_pin)
+- return -EINVAL;
++ if (!num_pins || !maps_per_pin) {
++ err = -EINVAL;
++ goto exit;
++ }
+
+ reserve = num_pins * maps_per_pin;
+
+ err = pinctrl_utils_reserve_map(pctldev, map,
+ reserved_maps, num_maps, reserve);
+ if (err)
+- return err;
++ goto exit;
+
+ for (i = 0; i < num_pins; i++) {
+ err = of_property_read_u32_index(node, "pinmux",
+ i, &pinfunc);
+ if (err)
+- return err;
++ goto exit;
+
+ pin = STM32_GET_PIN_NO(pinfunc);
+ func = STM32_GET_PIN_FUNC(pinfunc);
+
+ if (!stm32_pctrl_is_function_valid(pctl, pin, func)) {
+ dev_err(pctl->dev, "invalid function.\n");
+- return -EINVAL;
++ err = -EINVAL;
++ goto exit;
+ }
+
+ grp = stm32_pctrl_find_group_by_pin(pctl, pin);
+ if (!grp) {
+ dev_err(pctl->dev, "unable to match pin %d to group\n",
+ pin);
+- return -EINVAL;
++ err = -EINVAL;
++ goto exit;
+ }
+
+ err = stm32_pctrl_dt_node_to_map_func(pctl, pin, func, grp, map,
+ reserved_maps, num_maps);
+ if (err)
+- return err;
++ goto exit;
+
+ if (has_config) {
+ err = pinctrl_utils_add_map_configs(pctldev, map,
+@@ -472,11 +476,13 @@ static int stm32_pctrl_dt_subnode_to_map
+ configs, num_configs,
+ PIN_MAP_TYPE_CONFIGS_GROUP);
+ if (err)
+- return err;
++ goto exit;
+ }
+ }
+
+- return 0;
++exit:
++ kfree(configs);
++ return err;
+ }
+
+ static int stm32_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
futex-provide-distinct-return-value-when-owner-is-exiting.patch
futex-prevent-exit-livelock.patch
hid-core-check-whether-usage-page-item-is-after-usage-id-items.patch
+crypto-stm32-hash-fix-hmac-issue-more-than-256-bytes.patch
+media-stm32-dcmi-fix-dma-corruption-when-stopping-streaming.patch
+hwrng-stm32-fix-unbalanced-pm_runtime_enable.patch
+mailbox-mailbox-test-fix-null-pointer-if-no-mmio.patch
+pinctrl-stm32-fix-memory-leak-issue.patch
+asoc-stm32-i2s-fix-dma-configuration.patch
+asoc-stm32-i2s-fix-16-bit-format-support.patch
+asoc-stm32-i2s-fix-irq-clearing.patch