Skip to content

Commit

Permalink
ASoC: cpcap: HACK: force on the PGA nodes in voice call
Browse files Browse the repository at this point in the history
This is required for mic to function in earpiece/handset and headset
modes (headset won't output sound from the remote party yet)

The Headset Charge Pump is required for headset mode to work (with
output to headphones, mic from phone, not headset)

The ADC Left I just added because I think I saw it was necessary at some
point (once I had a call with no audio, and that was the only reg diff.)
  • Loading branch information
IMbackK committed May 4, 2024
1 parent 0dd4478 commit 72b337c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions sound/soc/codecs/cpcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,49 @@ static int cpcap_voice_call(struct cpcap_audio *cpcap, struct snd_soc_dai *dai,
err = regmap_update_bits(cpcap->regmap, CPCAP_REG_CDI,
mask, voice_call ? mask : 0);

printk("VOICE CALL %i\n", voice_call);

if (voice_call)
{
struct snd_soc_dapm_widget *w;

w = snd_soc_dai_get_widget(dai, SNDRV_PCM_STREAM_PLAYBACK);

snd_soc_dai_activate(dai, SNDRV_PCM_STREAM_PLAYBACK);
snd_soc_dapm_force_enable_pin(w->dapm, w->name);
snd_soc_dapm_force_enable_pin(w->dapm, "Voice PGA");
snd_soc_dapm_force_enable_pin(w->dapm, "Speaker Right PGA");
snd_soc_dapm_force_enable_pin(w->dapm, "Headset Left PGA");
snd_soc_dapm_force_enable_pin(w->dapm, "Headset Right PGA");
snd_soc_dapm_force_enable_pin(w->dapm, "Earpiece PGA");
snd_soc_dapm_force_enable_pin(w->dapm, "Microphone 1 PGA");
snd_soc_dapm_force_enable_pin(w->dapm, "Microphone 2 PGA");
snd_soc_dapm_force_enable_pin(w->dapm, "ADC Right");
snd_soc_dapm_force_enable_pin(w->dapm, "ADC Left");
snd_soc_dapm_force_enable_pin(w->dapm, "Headset Charge Pump");
snd_soc_dapm_sync(w->dapm);
}
else
{
struct snd_soc_dapm_widget *w;

w = snd_soc_dai_get_widget(dai, SNDRV_PCM_STREAM_PLAYBACK);

snd_soc_dai_deactivate(dai, SNDRV_PCM_STREAM_PLAYBACK);
snd_soc_dapm_disable_pin(w->dapm, w->name);
snd_soc_dapm_disable_pin(w->dapm, "Voice PGA");
snd_soc_dapm_disable_pin(w->dapm, "Speaker Right PGA");
snd_soc_dapm_disable_pin(w->dapm, "Headset Left PGA");
snd_soc_dapm_disable_pin(w->dapm, "Headset Right PGA");
snd_soc_dapm_disable_pin(w->dapm, "Earpiece PGA");
snd_soc_dapm_disable_pin(w->dapm, "Microphone 1 PGA");
snd_soc_dapm_disable_pin(w->dapm, "Microphone 2 PGA");
snd_soc_dapm_disable_pin(w->dapm, "ADC Right");
snd_soc_dapm_disable_pin(w->dapm, "ADC Left");
snd_soc_dapm_disable_pin(w->dapm, "Headset Charge Pump");
snd_soc_dapm_sync(w->dapm);
}

return err;
}

Expand Down

0 comments on commit 72b337c

Please sign in to comment.