static int tegra_call_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct tegra_max98088 *machine = snd_kcontrol_chip(kcontrol); int is_call_mode_new = ucontrol->value.integer.value[0]; int codec_index; unsigned int i; if (machine->is_call_mode == is_call_mode_new) return 0; if (machine->is_device_bt) codec_index = BT_SCO; else codec_index = HIFI_CODEC; if (is_call_mode_new) { #ifndef CONFIG_ARCH_TEGRA_2x_SOC if (machine->codec_info[codec_index].rate == 0 || machine->codec_info[codec_index].channels == 0) return -EINVAL; for (i = 0; i < machine->pcard->num_links; i++) machine->pcard->dai_link[i].ignore_suspend = 1; tegra30_make_voice_call_connections( &machine->codec_info[codec_index], &machine->codec_info[BASEBAND]); #endif } else { #ifndef CONFIG_ARCH_TEGRA_2x_SOC tegra30_break_voice_call_connections( &machine->codec_info[codec_index], &machine->codec_info[BASEBAND]); for (i = 0; i < machine->pcard->num_links; i++) machine->pcard->dai_link[i].ignore_suspend = 0; #endif } machine->is_call_mode = is_call_mode_new; g_is_call_mode = machine->is_call_mode; return 1; }
static int tegra_aic326x_call_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct tegra_aic326x *machine = snd_kcontrol_chip(kcontrol); int is_call_mode_new = ucontrol->value.integer.value[0]; #ifdef CONFIG_ARCH_TEGRA_2x_SOC int codec_dap_id, codec_dap_sel, bb_dap_id, bb_dap_sel; #else /*assumes tegra3*/ int codec_index; unsigned int i; #endif if (machine->is_call_mode == is_call_mode_new) return 0; #ifdef CONFIG_ARCH_TEGRA_2x_SOC bb_dap_id = TEGRA20_DAS_DAP_ID_3; bb_dap_sel = TEGRA20_DAS_DAP_SEL_DAP3; if (machine->is_device_bt) { codec_dap_id = TEGRA20_DAS_DAP_ID_4; codec_dap_sel = TEGRA20_DAS_DAP_SEL_DAP4; } else { codec_dap_id = TEGRA20_DAS_DAP_ID_2; codec_dap_sel = TEGRA20_DAS_DAP_SEL_DAP2; } #else /*assumes tegra3*/ if (machine->is_device_bt) codec_index = BT_SCO; else codec_index = HIFI_CODEC; #endif if (is_call_mode_new) { #ifdef CONFIG_ARCH_TEGRA_2x_SOC tegra20_das_set_tristate(codec_dap_id, 1); tegra20_das_set_tristate(bb_dap_id, 1); tegra20_das_connect_dap_to_dap(codec_dap_id, bb_dap_sel, 0, 0, 0); tegra20_das_connect_dap_to_dap(bb_dap_id, codec_dap_sel, 1, 0, 0); tegra20_das_set_tristate(codec_dap_id, 0); tegra20_das_set_tristate(bb_dap_id, 0); #else /*assumes tegra3*/ if (machine->codec_info[codec_index].rate == 0 || machine->codec_info[codec_index].channels == 0) return -EINVAL; for (i = 0; i < machine->pcard->num_links; i++) machine->pcard->dai_link[i].ignore_suspend = 1; tegra30_make_voice_call_connections( &machine->codec_info[codec_index], &machine->codec_info[BASEBAND]); #endif } else { #ifdef CONFIG_ARCH_TEGRA_2x_SOC tegra20_das_set_tristate(codec_dap_id, 1); tegra20_das_set_tristate(bb_dap_id, 1); tegra20_das_connect_dap_to_dap(bb_dap_id, bb_dap_sel, 0, 0, 0); tegra20_das_connect_dap_to_dap(codec_dap_id, codec_dap_sel, 0, 0, 0); tegra20_das_set_tristate(codec_dap_id, 0); tegra20_das_set_tristate(bb_dap_id, 0); #else /*assumes tegra3*/ tegra30_break_voice_call_connections( &machine->codec_info[codec_index], &machine->codec_info[BASEBAND]); for (i = 0; i < machine->pcard->num_links; i++) machine->pcard->dai_link[i].ignore_suspend = 0; #endif } machine->is_call_mode = is_call_mode_new; g_is_call_mode = machine->is_call_mode; return 1; }