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

Commit 2be4537a authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: Add proper routing for vi ch and cdc dma format widgets"

parents 5b6268cf 5d529a27
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -427,11 +427,16 @@ static const struct soc_enum mi2s_config_enum[] = {

static const char *const cdc_dma_format[] = {
	"UNPACKED",
	"UNPACKED_NON_LINEAR",
	"PACKED_LINEAR_60958",
	"PACKED_NON_LINEAR_60958",
	"NULL",
	"NULL",
        "PACKED_16B",
};

static const struct soc_enum cdc_dma_config_enum[] = {
	SOC_ENUM_SINGLE_EXT(2, cdc_dma_format),
	SOC_ENUM_SINGLE_EXT(7, cdc_dma_format),
};

static const char *const sb_format[] = {
+22 −19
Original line number Diff line number Diff line
@@ -83,6 +83,8 @@ static uint16_t msm_ec_ref_ch_weights[PCM_FORMAT_MAX_NUM_CHANNEL_V8]
				[PCM_FORMAT_MAX_NUM_CHANNEL_V8];
static uint32_t voc_session_id = ALL_SESSION_VSID;
static int vi_lch_port;
static int vi_rch_port;
static int msm_route_ext_ec_ref;
static bool is_custom_stereo_on;
static bool is_ds2_on;
@@ -32454,33 +32456,33 @@ static int spkr_prot_put_vi_lch_port(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{
	int ret = 0;
	int item;
	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
	pr_debug("%s item is %d\n", __func__,
		   ucontrol->value.enumerated.item[0]);
	mutex_lock(&routing_lock);
	item = ucontrol->value.enumerated.item[0];
	if (item < e->items) {
	vi_lch_port = ucontrol->value.enumerated.item[0];
	if (vi_lch_port < e->items) {
		pr_debug("%s RX DAI ID %d TX DAI id %d\n",
			__func__, e->shift_l, e->values[item]);
			__func__, e->shift_l, e->values[vi_lch_port]);
		if (e->shift_l < MSM_BACKEND_DAI_MAX &&
			e->values[item] < MSM_BACKEND_DAI_MAX)
			e->values[vi_lch_port] < MSM_BACKEND_DAI_MAX)
			/* Enable feedback TX path */
			ret = afe_spk_prot_feed_back_cfg(
			   msm_bedais[e->values[item]].port_id,
			   msm_bedais[e->values[vi_lch_port]].port_id,
			   msm_bedais[e->shift_l].port_id, 1, 0, 1);
		else {
			pr_debug("%s values are out of range item %d\n",
			__func__, e->values[item]);
			__func__, e->values[vi_lch_port]);
			/* Disable feedback TX path */
			if (e->values[item] == MSM_BACKEND_DAI_MAX)
			if (e->values[vi_lch_port] == MSM_BACKEND_DAI_MAX)
				ret = afe_spk_prot_feed_back_cfg(0, 0, 0, 0, 0);
			else
				ret = -EINVAL;
		}
	} else {
		pr_err("%s item value is out of range item\n", __func__);
		pr_err("%s item value is out of range items = %d\n", __func__,
			vi_lch_port);
		ret = -EINVAL;
	}
	mutex_unlock(&routing_lock);
@@ -32491,35 +32493,35 @@ static int spkr_prot_put_vi_rch_port(struct snd_kcontrol *kcontrol,
		struct snd_ctl_elem_value *ucontrol)
{
	int ret = 0;
	int item;
	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
	pr_debug("%s item is %d\n", __func__,
			ucontrol->value.enumerated.item[0]);
	mutex_lock(&routing_lock);
	item = ucontrol->value.enumerated.item[0];
	if (item < e->items) {
	vi_rch_port = ucontrol->value.enumerated.item[0];
	if (vi_rch_port < e->items) {
		pr_debug("%s RX DAI ID %d TX DAI id %d\n",
				__func__, e->shift_l, e->values[item]);
				__func__, e->shift_l, e->values[vi_rch_port]);
		if (e->shift_l < MSM_BACKEND_DAI_MAX &&
				e->values[item] < MSM_BACKEND_DAI_MAX)
				e->values[vi_rch_port] < MSM_BACKEND_DAI_MAX)
			/* Enable feedback TX path */
			ret = afe_spk_prot_feed_back_cfg(
					msm_bedais[e->values[item]].port_id,
					msm_bedais[e->values[vi_rch_port]].port_id,
					msm_bedais[e->shift_l].port_id,
					1, 1, 1);
		else {
			pr_debug("%s values are out of range item %d\n",
					__func__, e->values[item]);
					__func__, e->values[vi_rch_port]);
			/* Disable feedback TX path */
			if (e->values[item] == MSM_BACKEND_DAI_MAX)
			if (e->values[vi_rch_port] == MSM_BACKEND_DAI_MAX)
				ret = afe_spk_prot_feed_back_cfg(0,
						0, 0, 0, 0);
			else
				ret = -EINVAL;
		}
	} else {
		pr_err("%s item value is out of range item\n", __func__);
		pr_err("%s item value is out of range items = %d\n", __func__,
			vi_rch_port);
		ret = -EINVAL;
	}
	mutex_unlock(&routing_lock);
@@ -32529,6 +32531,7 @@ static int spkr_prot_put_vi_rch_port(struct snd_kcontrol *kcontrol,
static int spkr_prot_get_vi_lch_port(struct snd_kcontrol *kcontrol,
	struct snd_ctl_elem_value *ucontrol)
{
	ucontrol->value.enumerated.item[0] = vi_lch_port;
	pr_debug("%s\n", __func__);
	return 0;
}
@@ -32537,7 +32540,7 @@ static int spkr_prot_get_vi_rch_port(struct snd_kcontrol *kcontrol,
		struct snd_ctl_elem_value *ucontrol)
{
	pr_debug("%s\n", __func__);
	ucontrol->value.enumerated.item[0] = 0;
	ucontrol->value.enumerated.item[0] = vi_rch_port;
	return 0;
}