mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
ASoC: Add proper routing for vi ch and cdc dma format widgets
Add proper routing for vi ch and cdc dma format widgets when speaker protection is enabled. Change-Id: I7d6643dc8737bf6de3c14843ab6994ac8ccaf831 Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
This commit is contained in:
parent
deec79da50
commit
5d529a2751
2 changed files with 29 additions and 21 deletions
|
|
@ -427,11 +427,16 @@ static const struct soc_enum mi2s_config_enum[] = {
|
|||
|
||||
static const char *const cdc_dma_format[] = {
|
||||
"UNPACKED",
|
||||
"PACKED_16B",
|
||||
"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[] = {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue