[PATCH 0/2] ASoC: da7219: Small fixes for jack detection and removal
This series contains 2 small fixes around the AAD part of DA7219, particularly in relation to jack pole detection on certain active headsets, and tidy up when a jack is removed.
Adam Thomson (2): ASoC: da7219: Fix pole orientation detection on certain headsets ASoC: da7219: cancel AAD related work earlier for jack removal
sound/soc/codecs/da7219-aad.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
It has been recently found that certain 'active' headsets can be mis-detected as OMTP instead of CTIA, causing obvious issus with audio quality. This relates to increased resistances which negatively impacts the pole detection circuitry within the device.
To counter this, ground switches on both headphone channels are available to enable/disable and these allow for the detection process to operate as intended, even with active headsets. This commit adds control of the ground switches to the AAD logic.
Signed-off-by: Adam Thomson DLG-Adam.Thomson.Opensource@dm.renesas.com --- sound/soc/codecs/da7219-aad.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c index 7998fdd3b378..e7d8c33e02cc 100644 --- a/sound/soc/codecs/da7219-aad.c +++ b/sound/soc/codecs/da7219-aad.c @@ -60,6 +60,9 @@ static void da7219_aad_btn_det_work(struct work_struct *work) bool micbias_up = false; int retries = 0;
+ /* Disable ground switch */ + snd_soc_component_update_bits(component, 0xFB, 0x01, 0x00); + /* Drive headphones/lineout */ snd_soc_component_update_bits(component, DA7219_HP_L_CTRL, DA7219_HP_L_AMP_OE_MASK, @@ -153,6 +156,9 @@ static void da7219_aad_hptest_work(struct work_struct *work) tonegen_freq_hptest = cpu_to_le16(DA7219_AAD_HPTEST_RAMP_FREQ_INT_OSC); }
+ /* Disable ground switch */ + snd_soc_component_update_bits(component, 0xFB, 0x01, 0x00); + /* Ensure gain ramping at fastest rate */ gain_ramp_ctrl = snd_soc_component_read(component, DA7219_GAIN_RAMP_CTRL); snd_soc_component_write(component, DA7219_GAIN_RAMP_CTRL, DA7219_GAIN_RAMP_RATE_X8); @@ -444,6 +450,9 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data) snd_soc_dapm_disable_pin(dapm, "Mic Bias"); snd_soc_dapm_sync(dapm);
+ /* 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); @@ -899,6 +908,9 @@ int da7219_aad_init(struct snd_soc_component *component) snd_soc_component_update_bits(component, DA7219_ACCDET_CONFIG_1, DA7219_BUTTON_CONFIG_MASK, 0);
+ /* Enable ground switch */ + snd_soc_component_update_bits(component, 0xFB, 0x01, 0x01); + INIT_WORK(&da7219_aad->btn_det_work, da7219_aad_btn_det_work); INIT_WORK(&da7219_aad->hptest_work, da7219_aad_hptest_work);
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 --- sound/soc/codecs/da7219-aad.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c index e7d8c33e02cc..bba73c44c219 100644 --- a/sound/soc/codecs/da7219-aad.c +++ b/sound/soc/codecs/da7219-aad.c @@ -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); } }
On Mon, 30 May 2022 13:22:21 +0000, Adam Thomson wrote:
This series contains 2 small fixes around the AAD part of DA7219, particularly in relation to jack pole detection on certain active headsets, and tidy up when a jack is removed.
Adam Thomson (2): ASoC: da7219: Fix pole orientation detection on certain headsets ASoC: da7219: cancel AAD related work earlier for jack removal
[...]
Applied to
broonie/sound.git for-linus
Thanks!
[1/2] ASoC: da7219: Fix pole orientation detection on certain headsets commit: 06f5882122e3faa183d76c4ec2c92f4c38e2c7bb [2/2] ASoC: da7219: cancel AAD related work earlier for jack removal commit: 2d969e8f35b1849a43156029a7a6e2943b89d0c0
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (2)
-
Adam Thomson
-
Mark Brown