Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67f0171e authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: qdsp6v2: Add mixer control to disable topology"

parents 3e5272bb 2a003c18
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -509,6 +509,28 @@ static int msm_voice_slowtalk_put(struct snd_kcontrol *kcontrol,
	return 0;
}

static int msm_voice_topology_disable_put(struct snd_kcontrol *kcontrol,
					  struct snd_ctl_elem_value *ucontrol)
{
	int ret = 0;
	int disable = ucontrol->value.integer.value[0];
	uint32_t session_id = ucontrol->value.integer.value[1];

	if ((disable < 0) || (disable > 1)) {
		pr_err(" %s Invalid arguments: %d\n", __func__, disable);

		ret = -EINVAL;
		goto done;
	}
	pr_debug("%s: disable = %d, session_id = %d\n", __func__, disable,
		 session_id);

	ret = voc_disable_topology(session_id, disable);

done:
	return ret;
}

static struct snd_kcontrol_new msm_voice_controls[] = {
	SOC_SINGLE_MULTI_EXT("Voice Rx Device Mute", SND_SOC_NOPM, 0, VSID_MAX,
				0, 3, NULL, msm_voice_rx_device_mute_put),
@@ -522,6 +544,9 @@ static struct snd_kcontrol_new msm_voice_controls[] = {
				msm_voice_tty_mode_put),
	SOC_SINGLE_MULTI_EXT("Slowtalk Enable", SND_SOC_NOPM, 0, VSID_MAX, 0, 2,
				NULL, msm_voice_slowtalk_put),
	SOC_SINGLE_MULTI_EXT("Voice Topology Disable", SND_SOC_NOPM, 0,
			     VSID_MAX, 0, 2, NULL,
			     msm_voice_topology_disable_put),
};

static struct snd_pcm_ops msm_pcm_ops = {
+25 −1
Original line number Diff line number Diff line
@@ -1875,7 +1875,7 @@ static void voc_get_tx_rx_topology(struct voice_data *v,
	uint32_t tx_id = 0;
	uint32_t rx_id = 0;

	if (v->lch_mode == VOICE_LCH_START) {
	if (v->lch_mode == VOICE_LCH_START || v->disable_topology) {
		pr_debug("%s: Setting TX and RX topology to NONE for LCH\n",
			 __func__);

@@ -3445,6 +3445,9 @@ static void voc_update_session_params(struct voice_data *v)
	/* reset LCH mode */
	v->lch_mode = 0;

	/* clear disable topology setting */
	v->disable_topology = false;

	/* clear mute setting */
	v->dev_rx.dev_mute =  common.default_mute_val;
	v->dev_tx.dev_mute =  common.default_mute_val;
@@ -4564,6 +4567,26 @@ fail:
	return ret;
}

int voc_disable_topology(uint32_t session_id, uint32_t disable)
{
	struct voice_data *v = voice_get_session(session_id);
	int ret = 0;

	if (v == NULL) {
		pr_err("%s: invalid session_id 0x%x\n", __func__, session_id);

		return -EINVAL;
	}

	mutex_lock(&v->lock);

	v->disable_topology = disable;

	mutex_unlock(&v->lock);

	return ret;
}

static int voice_set_packet_exchange_mode_and_config(uint32_t session_id,
						 uint32_t mode)
{
@@ -6389,6 +6412,7 @@ static int __init voice_init(void)
		common.voice[i].sidetone_gain = 0x512;
		common.voice[i].dtmf_rx_detect_en = 0;
		common.voice[i].lch_mode = 0;
		common.voice[i].disable_topology = false;

		common.voice[i].voc_state = VOC_INIT;

+3 −0
Original line number Diff line number Diff line
@@ -1408,6 +1408,8 @@ struct voice_data {

	struct mutex lock;

	bool disable_topology;

	uint16_t sidetone_gain;
	uint8_t tty_mode;
	/* slowtalk enable value */
@@ -1603,5 +1605,6 @@ int voc_update_amr_vocoder_rate(uint32_t session_id);
int voc_disable_device(uint32_t session_id);
int voc_enable_device(uint32_t session_id);
void voc_set_destroy_cvd_flag(bool is_destroy_cvd);
int voc_disable_topology(uint32_t session_id, uint32_t disable);

#endif