Commit 768ac4f1 authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Mark Brown

ASoC: mchp-spdifrx: disable end of block interrupt on failures

Disable end of block interrupt in case of wait for completion timeout
or errors to undo previously enable operation (done in
mchp_spdifrx_isr_blockend_en()). Otherwise we can end up with an
unbalanced reference counter for this interrupt.

Fixes: ef265c55 ("ASoC: mchp-spdifrx: add driver for SPDIF RX")
Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20220727090814.2446111-2-claudiu.beznea@microchip.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f2906aa8
...@@ -288,15 +288,17 @@ static void mchp_spdifrx_isr_blockend_en(struct mchp_spdifrx_dev *dev) ...@@ -288,15 +288,17 @@ static void mchp_spdifrx_isr_blockend_en(struct mchp_spdifrx_dev *dev)
spin_unlock_irqrestore(&dev->blockend_lock, flags); spin_unlock_irqrestore(&dev->blockend_lock, flags);
} }
/* called from atomic context only */ /* called from atomic/non-atomic context */
static void mchp_spdifrx_isr_blockend_dis(struct mchp_spdifrx_dev *dev) static void mchp_spdifrx_isr_blockend_dis(struct mchp_spdifrx_dev *dev)
{ {
spin_lock(&dev->blockend_lock); unsigned long flags;
spin_lock_irqsave(&dev->blockend_lock, flags);
dev->blockend_refcount--; dev->blockend_refcount--;
/* don't enable BLOCKEND interrupt if it's already enabled */ /* don't enable BLOCKEND interrupt if it's already enabled */
if (dev->blockend_refcount == 0) if (dev->blockend_refcount == 0)
regmap_write(dev->regmap, SPDIFRX_IDR, SPDIFRX_IR_BLOCKEND); regmap_write(dev->regmap, SPDIFRX_IDR, SPDIFRX_IR_BLOCKEND);
spin_unlock(&dev->blockend_lock); spin_unlock_irqrestore(&dev->blockend_lock, flags);
} }
static irqreturn_t mchp_spdif_interrupt(int irq, void *dev_id) static irqreturn_t mchp_spdif_interrupt(int irq, void *dev_id)
...@@ -575,6 +577,7 @@ static int mchp_spdifrx_subcode_ch_get(struct mchp_spdifrx_dev *dev, ...@@ -575,6 +577,7 @@ static int mchp_spdifrx_subcode_ch_get(struct mchp_spdifrx_dev *dev,
if (ret <= 0) { if (ret <= 0) {
dev_dbg(dev->dev, "user data for channel %d timeout\n", dev_dbg(dev->dev, "user data for channel %d timeout\n",
channel); channel);
mchp_spdifrx_isr_blockend_dis(dev);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment