ASoC: da7219: cancel AAD related work earlier for jack removal

To avoid the unlikely possibility of register misalignment for
headphones being ungrounded/driven after a jack has been removed,
move the cancel_work_sync() call to the start of the jack removal
handling in the IRQ thread.

Signed-off-by: Adam Thomson <DLG-Adam.Thomson.Opensource@dm.renesas.com>
Link: https://lore.kernel.org/r/b3f9a679f1e27a9359dcecb496953c4af30acbaa.1653916368.git.DLG-Adam.Thomson.Opensource@dm.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Adam Thomson 2022-05-30 13:22:23 +00:00 committed by Mark Brown
parent 06f5882122
commit 2d969e8f35
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 4 additions and 4 deletions

View File

@ -434,6 +434,10 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data)
mask |= DA7219_AAD_REPORT_ALL_MASK;
da7219_aad->jack_inserted = false;
/* Cancel any pending work */
cancel_work_sync(&da7219_aad->btn_det_work);
cancel_work_sync(&da7219_aad->hptest_work);
/* Un-drive headphones/lineout */
snd_soc_component_update_bits(component, DA7219_HP_R_CTRL,
DA7219_HP_R_AMP_OE_MASK, 0);
@ -452,10 +456,6 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data)
/* Enable ground switch */
snd_soc_component_update_bits(component, 0xFB, 0x01, 0x01);
/* Cancel any pending work */
cancel_work_sync(&da7219_aad->btn_det_work);
cancel_work_sync(&da7219_aad->hptest_work);
}
}