asoc: Update mixer control for island mode setting
Fix overwriting of port ID in island mode mixer control. Change-Id: Ibf650e94519ffde7655e14a88ccc9042b3a3544b Signed-off-by: Mangesh Kunchamwar <mangeshk@codeaurora.org>
This commit is contained in:
@@ -206,7 +206,6 @@ struct msm_dai_q6_dai_data {
|
|||||||
u16 afe_in_bitformat;
|
u16 afe_in_bitformat;
|
||||||
struct afe_enc_config enc_config;
|
struct afe_enc_config enc_config;
|
||||||
struct afe_dec_config dec_config;
|
struct afe_dec_config dec_config;
|
||||||
u32 island_enable;
|
|
||||||
union afe_port_config port_config;
|
union afe_port_config port_config;
|
||||||
u16 vi_feed_mono;
|
u16 vi_feed_mono;
|
||||||
};
|
};
|
||||||
@@ -1131,36 +1130,32 @@ static int msm_dai_q6_dai_auxpcm_remove(struct snd_soc_dai *dai)
|
|||||||
static int msm_dai_q6_island_mode_put(struct snd_kcontrol *kcontrol,
|
static int msm_dai_q6_island_mode_put(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct msm_dai_q6_dai_data *dai_data = kcontrol->private_data;
|
|
||||||
int value = ucontrol->value.integer.value[0];
|
int value = ucontrol->value.integer.value[0];
|
||||||
u16 port_id = ((struct soc_enum *) kcontrol->private_value)->reg;
|
u16 port_id = (u16)kcontrol->private_value;
|
||||||
|
|
||||||
dai_data->island_enable = value;
|
|
||||||
pr_debug("%s: island mode = %d\n", __func__, value);
|
pr_debug("%s: island mode = %d\n", __func__, value);
|
||||||
|
|
||||||
afe_set_island_mode_cfg(port_id, dai_data->island_enable);
|
afe_set_island_mode_cfg(port_id, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msm_dai_q6_island_mode_get(struct snd_kcontrol *kcontrol,
|
static int msm_dai_q6_island_mode_get(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct msm_dai_q6_dai_data *dai_data = kcontrol->private_data;
|
int value;
|
||||||
|
u16 port_id = (u16)kcontrol->private_value;
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] = dai_data->island_enable;
|
afe_get_island_mode_cfg(port_id, &value);
|
||||||
|
ucontrol->value.integer.value[0] = value;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct snd_kcontrol_new island_config_controls[] = {
|
static void island_mx_ctl_private_free(struct snd_kcontrol *kcontrol)
|
||||||
{
|
{
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
struct snd_kcontrol_new *knew = snd_kcontrol_chip(kcontrol);
|
||||||
.name = "?",
|
|
||||||
.info = snd_ctl_boolean_mono_info,
|
kfree(knew);
|
||||||
.get = msm_dai_q6_island_mode_get,
|
}
|
||||||
.put = msm_dai_q6_island_mode_put,
|
|
||||||
.private_value = SOC_SINGLE_VALUE(0, 0, 1, 0, 0)
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static int msm_dai_q6_add_island_mx_ctls(struct snd_card *card,
|
static int msm_dai_q6_add_island_mx_ctls(struct snd_card *card,
|
||||||
const char *dai_name,
|
const char *dai_name,
|
||||||
@@ -1170,6 +1165,8 @@ static int msm_dai_q6_add_island_mx_ctls(struct snd_card *card,
|
|||||||
char *mixer_str = NULL;
|
char *mixer_str = NULL;
|
||||||
int dai_str_len = 0, ctl_len = 0;
|
int dai_str_len = 0, ctl_len = 0;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
struct snd_kcontrol_new *knew = NULL;
|
||||||
|
struct snd_kcontrol *kctl = NULL;
|
||||||
|
|
||||||
dai_str_len = strlen(dai_name) + 1;
|
dai_str_len = strlen(dai_name) + 1;
|
||||||
|
|
||||||
@@ -1180,12 +1177,26 @@ static int msm_dai_q6_add_island_mx_ctls(struct snd_card *card,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
snprintf(mixer_str, ctl_len, "%s %s", dai_name, mx_ctl_name);
|
snprintf(mixer_str, ctl_len, "%s %s", dai_name, mx_ctl_name);
|
||||||
island_config_controls[0].name = mixer_str;
|
|
||||||
((struct soc_enum *) island_config_controls[0].private_value)->reg
|
knew = kzalloc(sizeof(struct snd_kcontrol_new), GFP_KERNEL);
|
||||||
= dai_id;
|
if (!knew) {
|
||||||
rc = snd_ctl_add(card,
|
kfree(mixer_str);
|
||||||
snd_ctl_new1(&island_config_controls[0],
|
return -ENOMEM;
|
||||||
dai_data));
|
}
|
||||||
|
knew->iface = SNDRV_CTL_ELEM_IFACE_MIXER;
|
||||||
|
knew->info = snd_ctl_boolean_mono_info;
|
||||||
|
knew->get = msm_dai_q6_island_mode_get;
|
||||||
|
knew->put = msm_dai_q6_island_mode_put;
|
||||||
|
knew->name = mixer_str;
|
||||||
|
knew->private_value = dai_id;
|
||||||
|
kctl = snd_ctl_new1(knew, knew);
|
||||||
|
if (!kctl) {
|
||||||
|
kfree(knew);
|
||||||
|
kfree(mixer_str);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
kctl->private_free = island_mx_ctl_private_free;
|
||||||
|
rc = snd_ctl_add(card, kctl);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
pr_err("%s: err add config ctl, DAI = %s\n",
|
pr_err("%s: err add config ctl, DAI = %s\n",
|
||||||
__func__, dai_name);
|
__func__, dai_name);
|
||||||
|
|||||||
26
dsp/q6afe.c
26
dsp/q6afe.c
@@ -3048,6 +3048,25 @@ void afe_set_vad_cfg(u32 vad_enable, u32 preroll_config,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(afe_set_vad_cfg);
|
EXPORT_SYMBOL(afe_set_vad_cfg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* afe_get_island_mode_cfg -
|
||||||
|
* get island mode configuration
|
||||||
|
*
|
||||||
|
* @port_id: AFE port id number
|
||||||
|
* @enable_flag: Enable or Disable
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void afe_get_island_mode_cfg(u16 port_id, u32 *enable_flag)
|
||||||
|
{
|
||||||
|
uint16_t port_index;
|
||||||
|
|
||||||
|
if (enable_flag) {
|
||||||
|
port_index = afe_get_port_index(port_id);
|
||||||
|
*enable_flag = this_afe.island_mode[port_index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(afe_get_island_mode_cfg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* afe_set_island_mode_cfg -
|
* afe_set_island_mode_cfg -
|
||||||
* set island mode configuration
|
* set island mode configuration
|
||||||
@@ -6239,6 +6258,13 @@ int afe_validate_port(u16 port_id)
|
|||||||
case AFE_PORT_ID_INT4_MI2S_TX:
|
case AFE_PORT_ID_INT4_MI2S_TX:
|
||||||
case AFE_PORT_ID_INT5_MI2S_TX:
|
case AFE_PORT_ID_INT5_MI2S_TX:
|
||||||
case AFE_PORT_ID_INT6_MI2S_TX:
|
case AFE_PORT_ID_INT6_MI2S_TX:
|
||||||
|
case AFE_PORT_ID_WSA_CODEC_DMA_RX_0:
|
||||||
|
case AFE_PORT_ID_WSA_CODEC_DMA_TX_0:
|
||||||
|
case AFE_PORT_ID_WSA_CODEC_DMA_RX_1:
|
||||||
|
case AFE_PORT_ID_WSA_CODEC_DMA_TX_1:
|
||||||
|
case AFE_PORT_ID_WSA_CODEC_DMA_TX_2:
|
||||||
|
case AFE_PORT_ID_VA_CODEC_DMA_TX_0:
|
||||||
|
case AFE_PORT_ID_VA_CODEC_DMA_TX_1:
|
||||||
{
|
{
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -342,6 +342,7 @@ void afe_set_cal_mode(u16 port_id, enum afe_cal_mode afe_cal_mode);
|
|||||||
void afe_set_vad_cfg(u32 vad_enable, u32 preroll_config,
|
void afe_set_vad_cfg(u32 vad_enable, u32 preroll_config,
|
||||||
u32 port_id);
|
u32 port_id);
|
||||||
void afe_set_island_mode_cfg(u16 port_id, u32 enable_flag);
|
void afe_set_island_mode_cfg(u16 port_id, u32 enable_flag);
|
||||||
|
void afe_get_island_mode_cfg(u16 port_id, u32 *enable_flag);
|
||||||
int afe_port_start(u16 port_id, union afe_port_config *afe_config,
|
int afe_port_start(u16 port_id, union afe_port_config *afe_config,
|
||||||
u32 rate);
|
u32 rate);
|
||||||
int afe_port_start_v2(u16 port_id, union afe_port_config *afe_config,
|
int afe_port_start_v2(u16 port_id, union afe_port_config *afe_config,
|
||||||
|
|||||||
Reference in New Issue
Block a user