Skip to content

Commit

Permalink
ASoC: da7219: Improve system suspend and resume handling
Browse files Browse the repository at this point in the history
When DA7219 is suspended, prevent the AAD IRQ handler is unexpectedly
executed and cause the I2C driver "Transfer while suspended" failure.

Signed-off-by: David Rau <David.Rau.opensource@dm.renesas.com>
Link: https://lore.kernel.org/r/20231101022507.6226-1-David.Rau.opensource@dm.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
David Rau authored and broonie committed Nov 1, 2023
1 parent ed2232d commit ab5201e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sound/soc/codecs/da7219-aad.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,10 +927,15 @@ void da7219_aad_suspend(struct snd_soc_component *component)
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
u8 micbias_ctrl;

disable_irq(da7219_aad->irq);

if (da7219_aad->jack) {
/* Disable jack detection during suspend */
snd_soc_component_update_bits(component, DA7219_ACCDET_CONFIG_1,
DA7219_ACCDET_EN_MASK, 0);
cancel_delayed_work_sync(&da7219_aad->jack_det_work);
/* Disable ground switch */
snd_soc_component_update_bits(component, 0xFB, 0x01, 0x00);

/*
* If we have a 4-pole jack inserted, then micbias will be
Expand All @@ -947,8 +952,6 @@ void da7219_aad_suspend(struct snd_soc_component *component)
}
}
}

synchronize_irq(da7219_aad->irq);
}

void da7219_aad_resume(struct snd_soc_component *component)
Expand All @@ -971,6 +974,8 @@ void da7219_aad_resume(struct snd_soc_component *component)
DA7219_ACCDET_EN_MASK,
DA7219_ACCDET_EN_MASK);
}

enable_irq(da7219_aad->irq);
}


Expand Down

0 comments on commit ab5201e

Please sign in to comment.