Skip to content

Commit ab0925a

Browse files
committed
ASoC: da7219: Small fixes for jack detection and removal
Merge series from Adam Thomson <DLG-Adam.Thomson.Opensource@dm.renesas.com>: 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.
2 parents d6f8168 + 2d969e8 commit ab0925a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

sound/soc/codecs/da7219-aad.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ static void da7219_aad_btn_det_work(struct work_struct *work)
6060
bool micbias_up = false;
6161
int retries = 0;
6262

63+
/* Disable ground switch */
64+
snd_soc_component_update_bits(component, 0xFB, 0x01, 0x00);
65+
6366
/* Drive headphones/lineout */
6467
snd_soc_component_update_bits(component, DA7219_HP_L_CTRL,
6568
DA7219_HP_L_AMP_OE_MASK,
@@ -153,6 +156,9 @@ static void da7219_aad_hptest_work(struct work_struct *work)
153156
tonegen_freq_hptest = cpu_to_le16(DA7219_AAD_HPTEST_RAMP_FREQ_INT_OSC);
154157
}
155158

159+
/* Disable ground switch */
160+
snd_soc_component_update_bits(component, 0xFB, 0x01, 0x00);
161+
156162
/* Ensure gain ramping at fastest rate */
157163
gain_ramp_ctrl = snd_soc_component_read(component, DA7219_GAIN_RAMP_CTRL);
158164
snd_soc_component_write(component, DA7219_GAIN_RAMP_CTRL, DA7219_GAIN_RAMP_RATE_X8);
@@ -428,6 +434,10 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data)
428434
mask |= DA7219_AAD_REPORT_ALL_MASK;
429435
da7219_aad->jack_inserted = false;
430436

437+
/* Cancel any pending work */
438+
cancel_work_sync(&da7219_aad->btn_det_work);
439+
cancel_work_sync(&da7219_aad->hptest_work);
440+
431441
/* Un-drive headphones/lineout */
432442
snd_soc_component_update_bits(component, DA7219_HP_R_CTRL,
433443
DA7219_HP_R_AMP_OE_MASK, 0);
@@ -444,9 +454,8 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data)
444454
snd_soc_dapm_disable_pin(dapm, "Mic Bias");
445455
snd_soc_dapm_sync(dapm);
446456

447-
/* Cancel any pending work */
448-
cancel_work_sync(&da7219_aad->btn_det_work);
449-
cancel_work_sync(&da7219_aad->hptest_work);
457+
/* Enable ground switch */
458+
snd_soc_component_update_bits(component, 0xFB, 0x01, 0x01);
450459
}
451460
}
452461

@@ -899,6 +908,9 @@ int da7219_aad_init(struct snd_soc_component *component)
899908
snd_soc_component_update_bits(component, DA7219_ACCDET_CONFIG_1,
900909
DA7219_BUTTON_CONFIG_MASK, 0);
901910

911+
/* Enable ground switch */
912+
snd_soc_component_update_bits(component, 0xFB, 0x01, 0x01);
913+
902914
INIT_WORK(&da7219_aad->btn_det_work, da7219_aad_btn_det_work);
903915
INIT_WORK(&da7219_aad->hptest_work, da7219_aad_hptest_work);
904916

0 commit comments

Comments
 (0)