Skip to contentSkip to conversation

ASoC: qcom: Fix for DMA interrupt clear reg overwriting

PATCH Superseded Srinivasa Rao Mandadapu 2 participants 3 messages Jun 3, 2021 – Jun 5, 2021

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: qcom: Fix for DMA interrupt clear reg overwriting

This patch fixes the DMA interrupt registers overwriting issue in lpass platform interrupt handler.

---
 sound/soc/qcom/lpass-platform.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
sound/soc/qcom/lpass-platform.c +11 -6
index 0df9481ea4c6..e02caa121fa4 100644
@@ -526,7 +526,7 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component,
 			return -EINVAL;
 		}
 
-		ret = regmap_write(map, reg_irqclr, val_irqclr);
+		ret = regmap_update_bits(map, reg_irqclr, val_irqclr, val_irqclr);
 		if (ret) {
 			dev_err(soc_runtime->dev, "error writing to irqclear reg: %d\n", ret);
 			return ret;
@@ -650,7 +650,7 @@ static irqreturn_t lpass_dma_interrupt_handler(
 	struct lpass_variant *v = drvdata->variant;
 	irqreturn_t ret = IRQ_NONE;
 	int rv;
-	unsigned int reg = 0, val = 0;
+	unsigned int reg = 0, val = 0, val_clr = 0, val_mask = 0;
 	struct regmap *map;
 	unsigned int dai_id = cpu_dai->driver->id;
 
@@ -676,8 +676,9 @@ static irqreturn_t lpass_dma_interrupt_handler(
 	return -EINVAL;
 	}
 	if (interrupts & LPAIF_IRQ_PER(chan)) {
-
-		rv = regmap_write(map, reg, LPAIF_IRQ_PER(chan) | val);
+		val_clr = (LPAIF_IRQ_PER(chan) | val);
+		val_mask = LPAIF_IRQ_ALL(chan);
+		rv = regmap_update_bits(map, reg, val_mask, val_clr);
 		if (rv) {
 			dev_err(soc_runtime->dev,
 				"error writing to irqclear reg: %d\n", rv);
@@ -688,7 +689,9 @@ static irqreturn_t lpass_dma_interrupt_handler(
 	}
 
 	if (interrupts & LPAIF_IRQ_XRUN(chan)) {
-		rv = regmap_write(map, reg, LPAIF_IRQ_XRUN(chan) | val);
+		val_clr = (LPAIF_IRQ_XRUN(chan) | val);
+		val_mask = LPAIF_IRQ_ALL(chan);
+		rv = regmap_update_bits(map, reg, val_mask, val_clr);
 		if (rv) {
 			dev_err(soc_runtime->dev,
 				"error writing to irqclear reg: %d\n", rv);
@@ -700,7 +703,9 @@ static irqreturn_t lpass_dma_interrupt_handler(
 	}
 
 	if (interrupts & LPAIF_IRQ_ERR(chan)) {
-		rv = regmap_write(map, reg, LPAIF_IRQ_ERR(chan) | val);
+		val_clr = (LPAIF_IRQ_ERR(chan) | val);
+		val_mask = LPAIF_IRQ_ALL(chan);
+		rv = regmap_update_bits(map, reg, val_mask, val_clr);
 		if (rv) {
 			dev_err(soc_runtime->dev,
 				"error writing to irqclear reg: %d\n", rv);
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#1 lore raw

Quoting Srinivasa Rao Mandadapu (2021-06-02 22:05:30)

Quoted 1 line

This patch fixes the DMA interrupt registers overwriting

 $ git grep "This patch" -- Documentation/process
Quoted 1 line

issue in lpass platform interrupt handler.

Can you describe the issue more?

Quoted 3 lines

---

Any Fixes tag?

sound/soc/qcom/lpass-platform.c static irqreturn_t lpass_dma_interrupt_handler( · line 653

Quoted 13 lines
 sound/soc/qcom/lpass-platform.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
sound/soc/qcom/lpass-platform.c +1 -1
index 0df9481ea4c6..e02caa121fa4 100644
@@ -650,7 +650,7 @@ static irqreturn_t lpass_dma_interrupt_handler(
        struct lpass_variant *v = drvdata->variant;
        irqreturn_t ret = IRQ_NONE;
        int rv;
-       unsigned int reg = 0, val = 0;
+       unsigned int reg = 0, val = 0, val_clr = 0, val_mask = 0;

Why assign to 0 and then overwrite it?

sound/soc/qcom/lpass-platform.c static irqreturn_t lpass_dma_interrupt_handler( · line 679

Quoted 10 lines
sound/soc/qcom/lpass-platform.c +1 -2
        struct regmap *map;
        unsigned int dai_id = cpu_dai->driver->id;
 
@@ -676,8 +676,9 @@ static irqreturn_t lpass_dma_interrupt_handler(
        return -EINVAL;
        }
        if (interrupts & LPAIF_IRQ_PER(chan)) {
-
-               rv = regmap_write(map, reg, LPAIF_IRQ_PER(chan) | val);
+               val_clr = (LPAIF_IRQ_PER(chan) | val);

Is the extra parenthesis useful?

Quoted 5 lines
sound/soc/qcom/lpass-platform.c +2 -0
+               val_mask = LPAIF_IRQ_ALL(chan);
+               rv = regmap_update_bits(map, reg, val_mask, val_clr);
                if (rv) {
                        dev_err(soc_runtime->dev,
                                "error writing to irqclear reg: %d\n", rv);
#2 lore raw

Hi Stephen,

Thanks for Your Time for review comments!!!

Quoted 3 lines · Stephen Boyd

Quoting Srinivasa Rao Mandadapu (2021-06-02 22:05:30)

Quoted 1 line

This patch fixes the DMA interrupt registers overwriting

  $ git grep "This patch" -- Documentation/process

Okay will change description.

Quoted 3 lines
Quoted 2 lines

issue in lpass platform interrupt handler.

Can you describe the issue more?

Sure. will elaborate more.

Quoted 8 lines
Quoted 3 lines

---

Any Fixes tag?

Quoted 3 lines
  sound/soc/qcom/lpass-platform.c | 17 +++++++++++------
  1 file changed, 11 insertions(+), 6 deletions(-)
Quoted 11 lines

sound/soc/qcom/lpass-platform.c static irqreturn_t lpass_dma_interrupt_handler( · line 653

Quoted 10 lines
sound/soc/qcom/lpass-platform.c +1 -1
index 0df9481ea4c6..e02caa121fa4 100644
@@ -650,7 +650,7 @@ static irqreturn_t lpass_dma_interrupt_handler(
         struct lpass_variant *v = drvdata->variant;
         irqreturn_t ret = IRQ_NONE;
         int rv;
-       unsigned int reg = 0, val = 0;
+       unsigned int reg = 0, val = 0, val_clr = 0, val_mask = 0;

Why assign to 0 and then overwrite it?

Okay. Will remove initialization.

Quoted 4 lines
Quoted 4 lines
sound/soc/qcom/lpass-platform.c +0 -0
         struct regmap *map;
         unsigned int dai_id = cpu_dai->driver->id;
 
Quoted 8 lines

sound/soc/qcom/lpass-platform.c static irqreturn_t lpass_dma_interrupt_handler( · line 679

Quoted 7 lines
sound/soc/qcom/lpass-platform.c +1 -2
@@ -676,8 +676,9 @@ static irqreturn_t lpass_dma_interrupt_handler(
         return -EINVAL;
         }
         if (interrupts & LPAIF_IRQ_PER(chan)) {
-
-               rv = regmap_write(map, reg, LPAIF_IRQ_PER(chan) | val);
+               val_clr = (LPAIF_IRQ_PER(chan) | val);

Is the extra parenthesis useful?

Not exactly. Will remove it.

Quoted 6 lines
Quoted 6 lines
sound/soc/qcom/lpass-platform.c +2 -0
+               val_mask = LPAIF_IRQ_ALL(chan);
+               rv = regmap_update_bits(map, reg, val_mask, val_clr);
                 if (rv) {
                         dev_err(soc_runtime->dev,
                                 "error writing to irqclear reg: %d\n", rv);
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.