diff --git a/drivers/mfd/wcd9xxx-core.c b/drivers/mfd/wcd9xxx-core.c index b373acb110..232c290bfb 100644 --- a/drivers/mfd/wcd9xxx-core.c +++ b/drivers/mfd/wcd9xxx-core.c @@ -228,7 +228,7 @@ static int wcd9xxx_slim_read_device(struct wcd9xxx *wcd9xxx, unsigned short reg, if (!wcd9xxx->dev_up) { dev_dbg_ratelimited( - wcd9xxx->dev, "%s: No read allowed. dev_up = %d\n", + wcd9xxx->dev, "%s: No read allowed. dev_up = %lu\n", __func__, wcd9xxx->dev_up); return 0; } @@ -268,7 +268,7 @@ static int wcd9xxx_slim_write_device(struct wcd9xxx *wcd9xxx, if (!wcd9xxx->dev_up) { dev_dbg_ratelimited( - wcd9xxx->dev, "%s: No write allowed. dev_up = %d\n", + wcd9xxx->dev, "%s: No write allowed. dev_up = %lu\n", __func__, wcd9xxx->dev_up); return 0; } @@ -345,7 +345,7 @@ int wcd9xxx_slim_write_repeat(struct wcd9xxx *wcd9xxx, unsigned short reg, if (!wcd9xxx->dev_up) { dev_dbg_ratelimited( - wcd9xxx->dev, "%s: No write allowed. dev_up = %d\n", + wcd9xxx->dev, "%s: No write allowed. dev_up = %lu\n", __func__, wcd9xxx->dev_up); ret = 0; goto done; @@ -426,7 +426,7 @@ int wcd9xxx_slim_bulk_write(struct wcd9xxx *wcd9xxx, if (!wcd9xxx->dev_up) { dev_dbg_ratelimited( - wcd9xxx->dev, "%s: No write allowed. dev_up = %d\n", + wcd9xxx->dev, "%s: No write allowed. dev_up = %lu\n", __func__, wcd9xxx->dev_up); return 0; } @@ -1479,12 +1479,27 @@ static int wcd9xxx_slim_device_reset(struct slim_device *sldev) return -EINVAL; } - dev_info(wcd9xxx->dev, "%s: device reset, dev_up = %d\n", - __func__, wcd9xxx->dev_up); - if (wcd9xxx->dev_up) - return 0; + /* + * Wait for 500 ms for device down to complete. Observed delay + * of ~200ms for device down to complete after being called, + * due to context switch issue. + */ + ret = wait_on_bit_timeout(&wcd9xxx->dev_up, 0, + TASK_INTERRUPTIBLE, + msecs_to_jiffies(500)); + if (ret) + pr_err("%s: slim device down not complete in 500 msec\n", + __func__); mutex_lock(&wcd9xxx->reset_lock); + + dev_info(wcd9xxx->dev, "%s: device reset, dev_up = %lu\n", + __func__, wcd9xxx->dev_up); + if (wcd9xxx->dev_up) { + mutex_unlock(&wcd9xxx->reset_lock); + return 0; + } + ret = wcd9xxx_reset(wcd9xxx->dev); if (ret) dev_err(wcd9xxx->dev, "%s: Resetting Codec failed\n", __func__); @@ -1502,8 +1517,8 @@ static int wcd9xxx_slim_device_up(struct slim_device *sldev) pr_err("%s: wcd9xxx is NULL\n", __func__); return -EINVAL; } - dev_info(wcd9xxx->dev, "%s: slim device up, dev_up = %d\n", - __func__, wcd9xxx->dev_up); + dev_info(wcd9xxx->dev, "%s: slim device up, dev_up = %lu\n", + __func__, wcd9xxx->dev_up); if (wcd9xxx->dev_up) return 0; @@ -1525,18 +1540,20 @@ static int wcd9xxx_slim_device_down(struct slim_device *sldev) return -EINVAL; } - dev_info(wcd9xxx->dev, "%s: device down, dev_up = %d\n", - __func__, wcd9xxx->dev_up); - if (!wcd9xxx->dev_up) - return 0; - - wcd9xxx->dev_up = false; - mutex_lock(&wcd9xxx->reset_lock); + + dev_info(wcd9xxx->dev, "%s: device down, dev_up = %lu\n", + __func__, wcd9xxx->dev_up); + if (!wcd9xxx->dev_up) { + mutex_unlock(&wcd9xxx->reset_lock); + return 0; + } + if (wcd9xxx->dev_down) wcd9xxx->dev_down(wcd9xxx); wcd9xxx_irq_exit(&wcd9xxx->core_res); wcd9xxx_reset_low(wcd9xxx->dev); + wcd9xxx->dev_up = false; mutex_unlock(&wcd9xxx->reset_lock); return 0; diff --git a/drivers/pinctrl/qcom/pinctrl-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpi.c index fedd5f0aee..11f954e1eb 100644 --- a/drivers/pinctrl/qcom/pinctrl-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-lpi.c @@ -448,6 +448,7 @@ static void lpi_gpio_dbg_show_one(struct seq_file *s, unsigned int offset, unsigned int gpio) { + struct lpi_gpio_state *state = gpiochip_get_data(chip); struct pinctrl_pin_desc pindesc; struct lpi_gpio_pad *pad; unsigned int func; @@ -463,7 +464,7 @@ static void lpi_gpio_dbg_show_one(struct seq_file *s, "pull up" }; - pctldev = pctldev ? : to_gpio_state(chip)->ctrl; + pctldev = pctldev ? : state->ctrl; pindesc = pctldev->desc->pins[offset]; pad = pctldev->desc->pins[offset].drv_data; ctl_reg = lpi_gpio_read(pad, LPI_GPIO_REG_DIR_CTL); diff --git a/include/linux/mfd/wcd9xxx/core.h b/include/linux/mfd/wcd9xxx/core.h index b4c1be40ff..b994010f52 100644 --- a/include/linux/mfd/wcd9xxx/core.h +++ b/include/linux/mfd/wcd9xxx/core.h @@ -350,7 +350,7 @@ struct wcd9xxx { int (*post_reset)(struct wcd9xxx *wcd9xxx); void *ssr_priv; - bool dev_up; + unsigned long dev_up; u32 num_of_supplies; struct regulator_bulk_data *supplies; diff --git a/include/uapi/sound/devdep_params.h b/include/uapi/sound/devdep_params.h index 6697eca288..66a9cacfca 100644 --- a/include/uapi/sound/devdep_params.h +++ b/include/uapi/sound/devdep_params.h @@ -53,4 +53,14 @@ struct dts_eagle_param_desc { uint32_t device; } __packed; +#define HWDEP_FE_BASE 3000 /*unique base for FE hw dep nodes*/ +struct snd_pcm_mmap_fd { + int32_t dir; + int32_t fd; + int32_t size; + int32_t actual_size; +}; + +#define SNDRV_PCM_IOCTL_MMAP_DATA_FD _IOWR('U', 0xd2, struct snd_pcm_mmap_fd) + #endif diff --git a/sound/soc/codecs/sdm660_cdc/msm-analog-cdc.c b/sound/soc/codecs/sdm660_cdc/msm-analog-cdc.c index a8fcd347b3..f126d35dee 100644 --- a/sound/soc/codecs/sdm660_cdc/msm-analog-cdc.c +++ b/sound/soc/codecs/sdm660_cdc/msm-analog-cdc.c @@ -2055,6 +2055,9 @@ static const char * const rdac2_mux_text[] = { "ZERO", "RX2", "RX1" }; +static const struct snd_kcontrol_new adc1_switch = + SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0); + static const struct soc_enum rdac2_mux_enum = SOC_ENUM_SINGLE(MSM89XX_PMIC_DIGITAL_CDC_CONN_HPHR_DAC_CTL, 0, 3, rdac2_mux_text); @@ -3105,7 +3108,8 @@ static const struct snd_soc_dapm_route audio_map[] = { {"ADC2 MUX", "INP2", "ADC2_INP2"}, {"ADC2 MUX", "INP3", "ADC2_INP3"}, - {"ADC1", NULL, "AMIC1"}, + {"ADC1", NULL, "ADC1_INP1"}, + {"ADC1_INP1", "Switch", "AMIC1"}, {"ADC2_INP2", NULL, "AMIC2"}, {"ADC2_INP3", NULL, "AMIC3"}, @@ -3446,6 +3450,8 @@ static const struct snd_soc_dapm_widget msm_anlg_cdc_dapm_widgets[] = { SND_SOC_DAPM_SPK("Ext Spk", msm_anlg_cdc_codec_enable_spk_ext_pa), + SND_SOC_DAPM_SWITCH("ADC1_INP1", SND_SOC_NOPM, 0, 0, + &adc1_switch), SND_SOC_DAPM_SUPPLY("RX1 CLK", MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL, 0, 0, NULL, 0), SND_SOC_DAPM_SUPPLY("RX2 CLK", MSM89XX_PMIC_DIGITAL_CDC_DIG_CLK_CTL, @@ -4052,7 +4058,7 @@ int msm_anlg_codec_info_create_codec_entry(struct snd_info_entry *codec_root, sdm660_cdc_priv = snd_soc_codec_get_drvdata(codec); card = codec->component.card; - sdm660_cdc_priv->entry = snd_register_module_info(codec_root->module, + sdm660_cdc_priv->entry = snd_info_create_subdir(codec_root->module, "spmi0-03", codec_root); if (!sdm660_cdc_priv->entry) { @@ -4320,13 +4326,15 @@ static struct snd_soc_codec_driver soc_codec_dev_sdm660_cdc = { .suspend = msm_anlg_cdc_suspend, .resume = msm_anlg_cdc_resume, .reg_word_size = 1, - .controls = msm_anlg_cdc_snd_controls, - .num_controls = ARRAY_SIZE(msm_anlg_cdc_snd_controls), - .dapm_widgets = msm_anlg_cdc_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(msm_anlg_cdc_dapm_widgets), - .dapm_routes = audio_map, - .num_dapm_routes = ARRAY_SIZE(audio_map), .get_regmap = msm_anlg_get_regmap, + .component_driver = { + .controls = msm_anlg_cdc_snd_controls, + .num_controls = ARRAY_SIZE(msm_anlg_cdc_snd_controls), + .dapm_widgets = msm_anlg_cdc_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(msm_anlg_cdc_dapm_widgets), + .dapm_routes = audio_map, + .num_dapm_routes = ARRAY_SIZE(audio_map), + }, }; static int msm_anlg_cdc_init_supplies(struct sdm660_cdc_priv *sdm660_cdc, diff --git a/sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c b/sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c index 3f9c0b4a5b..68a1d8d47b 100644 --- a/sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c +++ b/sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c @@ -1157,7 +1157,7 @@ int msm_dig_codec_info_create_codec_entry(struct snd_info_entry *codec_root, msm_dig = snd_soc_codec_get_drvdata(codec); card = codec->component.card; - msm_dig->entry = snd_register_module_info(codec_root->module, + msm_dig->entry = snd_info_create_subdir(codec_root->module, "msm_digital_codec", codec_root); if (!msm_dig->entry) { @@ -2037,13 +2037,15 @@ static struct snd_soc_codec_driver soc_msm_dig_codec = { .remove = msm_dig_cdc_soc_remove, .suspend = msm_dig_cdc_suspend, .resume = msm_dig_cdc_resume, - .controls = msm_dig_snd_controls, - .num_controls = ARRAY_SIZE(msm_dig_snd_controls), - .dapm_widgets = msm_dig_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(msm_dig_dapm_widgets), - .dapm_routes = audio_dig_map, - .num_dapm_routes = ARRAY_SIZE(audio_dig_map), .get_regmap = msm_digital_get_regmap, + .component_driver = { + .controls = msm_dig_snd_controls, + .num_controls = ARRAY_SIZE(msm_dig_snd_controls), + .dapm_widgets = msm_dig_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(msm_dig_dapm_widgets), + .dapm_routes = audio_dig_map, + .num_dapm_routes = ARRAY_SIZE(audio_dig_map), + }, }; const struct regmap_config msm_digital_regmap_config = { diff --git a/sound/soc/codecs/wcd-dsp-mgr.c b/sound/soc/codecs/wcd-dsp-mgr.c index 661db2b663..a6d46aef97 100644 --- a/sound/soc/codecs/wcd-dsp-mgr.c +++ b/sound/soc/codecs/wcd-dsp-mgr.c @@ -26,7 +26,8 @@ static char *wdsp_get_cmpnt_type_string(enum wdsp_cmpnt_type); /* Component related macros */ -#define WDSP_GET_COMPONENT(wdsp, x) (&(wdsp->cmpnts[x])) +#define WDSP_GET_COMPONENT(wdsp, x) ((x >= WDSP_CMPNT_TYPE_MAX || x < 0) ? \ + NULL : (&(wdsp->cmpnts[x]))) #define WDSP_GET_CMPNT_TYPE_STR(x) wdsp_get_cmpnt_type_string(x) /* diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c index 3b2426dc72..eb67de9287 100644 --- a/sound/soc/codecs/wcd-mbhc-v2.c +++ b/sound/soc/codecs/wcd-mbhc-v2.c @@ -329,6 +329,7 @@ out_micb_en: /* Disable micbias, pullup & enable cs */ wcd_enable_curr_micbias(mbhc, WCD_MBHC_EN_CS); mutex_unlock(&mbhc->hphl_pa_lock); + clear_bit(WCD_MBHC_ANC0_OFF_ACK, &mbhc->hph_anc_state); break; case WCD_EVENT_PRE_HPHR_PA_OFF: mutex_lock(&mbhc->hphr_pa_lock); @@ -346,6 +347,7 @@ out_micb_en: /* Disable micbias, pullup & enable cs */ wcd_enable_curr_micbias(mbhc, WCD_MBHC_EN_CS); mutex_unlock(&mbhc->hphr_pa_lock); + clear_bit(WCD_MBHC_ANC1_OFF_ACK, &mbhc->hph_anc_state); break; case WCD_EVENT_PRE_HPHL_PA_ON: set_bit(WCD_MBHC_EVENT_PA_HPHL, &mbhc->event_state); @@ -439,6 +441,25 @@ static void wcd_mbhc_clr_and_turnon_hph_padac(struct wcd_mbhc *mbhc) __func__); usleep_range(wg_time * 1000, wg_time * 1000 + 50); } + + if (test_and_clear_bit(WCD_MBHC_ANC0_OFF_ACK, + &mbhc->hph_anc_state)) { + usleep_range(20000, 20100); + pr_debug("%s: HPHL ANC clear flag and enable ANC_EN\n", + __func__); + if (mbhc->mbhc_cb->update_anc_state) + mbhc->mbhc_cb->update_anc_state(mbhc->codec, true, 0); + } + + if (test_and_clear_bit(WCD_MBHC_ANC1_OFF_ACK, + &mbhc->hph_anc_state)) { + usleep_range(20000, 20100); + pr_debug("%s: HPHR ANC clear flag and enable ANC_EN\n", + __func__); + if (mbhc->mbhc_cb->update_anc_state) + mbhc->mbhc_cb->update_anc_state(mbhc->codec, true, 1); + } + } static bool wcd_mbhc_is_hph_pa_on(struct wcd_mbhc *mbhc) @@ -471,6 +492,20 @@ static void wcd_mbhc_set_and_turnoff_hph_padac(struct wcd_mbhc *mbhc) } WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_HPH_PA_EN, 0); usleep_range(wg_time * 1000, wg_time * 1000 + 50); + + + if (mbhc->mbhc_cb->is_anc_on && mbhc->mbhc_cb->is_anc_on(mbhc)) { + usleep_range(20000, 20100); + pr_debug("%s ANC is on, setting ANC_OFF_ACK\n", __func__); + set_bit(WCD_MBHC_ANC0_OFF_ACK, &mbhc->hph_anc_state); + set_bit(WCD_MBHC_ANC1_OFF_ACK, &mbhc->hph_anc_state); + if (mbhc->mbhc_cb->update_anc_state) { + mbhc->mbhc_cb->update_anc_state(mbhc->codec, false, 0); + mbhc->mbhc_cb->update_anc_state(mbhc->codec, false, 1); + } else { + pr_debug("%s ANC is off\n", __func__); + } + } } int wcd_mbhc_get_impedance(struct wcd_mbhc *mbhc, uint32_t *zl, @@ -581,7 +616,8 @@ static void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion, jack_type == SND_JACK_LINEOUT) && (mbhc->hph_status && mbhc->hph_status != jack_type)) { - if (mbhc->micbias_enable) { + if (mbhc->micbias_enable && + mbhc->hph_status == SND_JACK_HEADSET) { if (mbhc->mbhc_cb->mbhc_micbias_control) mbhc->mbhc_cb->mbhc_micbias_control( codec, MIC_BIAS_2, @@ -1108,7 +1144,7 @@ static irqreturn_t wcd_mbhc_release_handler(int irq, void *data) * For ADC MBHC, ADC_COMPLETE interrupt will be generated * in this case. So skip the check here. */ - if (!WCD_MBHC_DETECTION && + if (mbhc->mbhc_detection_logic == WCD_DETECTION_LEGACY && mbhc->current_plug == MBHC_PLUG_TYPE_HEADPHONE) { wcd_mbhc_find_plug_and_report(mbhc, MBHC_PLUG_TYPE_HEADSET); goto exit; @@ -1922,7 +1958,7 @@ int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec, init_waitqueue_head(&mbhc->wait_btn_press); mutex_init(&mbhc->codec_resource_lock); - switch (WCD_MBHC_DETECTION) { + switch (mbhc->mbhc_detection_logic) { case WCD_DETECTION_LEGACY: wcd_mbhc_legacy_init(mbhc); break; @@ -1931,7 +1967,7 @@ int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec, break; default: pr_err("%s: Unknown detection logic type %d\n", - __func__, WCD_MBHC_DETECTION); + __func__, mbhc->mbhc_detection_logic); break; } diff --git a/sound/soc/codecs/wcd-mbhc-v2.h b/sound/soc/codecs/wcd-mbhc-v2.h index 7ed06c3559..c8714fc3ab 100644 --- a/sound/soc/codecs/wcd-mbhc-v2.h +++ b/sound/soc/codecs/wcd-mbhc-v2.h @@ -157,12 +157,6 @@ enum wcd_mbhc_detect_logic { WCD_DETECTION_ADC, }; -#ifdef CONFIG_SND_SOC_WCD_MBHC_ADC -#define WCD_MBHC_DETECTION WCD_DETECTION_ADC -#else -#define WCD_MBHC_DETECTION WCD_DETECTION_LEGACY -#endif - enum wcd_mbhc_cs_mb_en_flag { WCD_MBHC_EN_CS = 0, WCD_MBHC_EN_MB, @@ -240,6 +234,11 @@ enum pa_dac_ack_flags { WCD_MBHC_HPHR_PA_OFF_ACK, }; +enum anc_ack_flags { + WCD_MBHC_ANC0_OFF_ACK = 0, + WCD_MBHC_ANC1_OFF_ACK, +}; + enum wcd_mbhc_btn_det_mem { WCD_MBHC_BTN_DET_V_BTN_LOW, WCD_MBHC_BTN_DET_V_BTN_HIGH @@ -488,6 +487,9 @@ struct wcd_mbhc_cb { void (*hph_pull_down_ctrl)(struct snd_soc_codec *, bool); void (*mbhc_moisture_config)(struct wcd_mbhc *); bool (*hph_register_recovery)(struct wcd_mbhc *); + void (*update_anc_state)(struct snd_soc_codec *codec, + bool enable, int anc_num); + bool (*is_anc_on)(struct wcd_mbhc *mbhc); }; struct wcd_mbhc_fn { @@ -538,6 +540,7 @@ struct wcd_mbhc { /* track PA/DAC state to sync with userspace */ unsigned long hph_pa_dac_state; + unsigned long hph_anc_state; unsigned long event_state; unsigned long jiffies_atreport; @@ -565,6 +568,9 @@ struct wcd_mbhc { struct mutex hphl_pa_lock; struct mutex hphr_pa_lock; + /* Holds mbhc detection method - ADC/Legacy */ + unsigned int mbhc_detection_logic; + unsigned long intr_status; bool is_hph_ocp_pending; diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index 329aa7a4c4..dedeaea556 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -348,7 +348,6 @@ enum { AUDIO_NOMINAL, CPE_NOMINAL, HPH_PA_DELAY, - SB_CLK_GEAR, ANC_MIC_AMIC1, ANC_MIC_AMIC2, ANC_MIC_AMIC3, @@ -818,7 +817,10 @@ struct tasha_priv { int rx_8_count; bool clk_mode; bool clk_internal; - + /* Lock to prevent multiple functions voting at same time */ + struct mutex sb_clk_gear_lock; + /* Count for functions voting or un-voting */ + u32 ref_count; /* Lock to protect mclk enablement */ struct mutex mclk_lock; }; @@ -2012,6 +2014,32 @@ static void tasha_mbhc_moisture_config(struct wcd_mbhc *mbhc) tasha_mbhc_hph_l_pull_up_control(codec, mbhc->moist_iref); } +static void tasha_update_anc_state(struct snd_soc_codec *codec, bool enable, + int anc_num) +{ + if (enable) + snd_soc_update_bits(codec, WCD9335_CDC_RX1_RX_PATH_CFG0 + + (20 * anc_num), 0x10, 0x10); + else + snd_soc_update_bits(codec, WCD9335_CDC_RX1_RX_PATH_CFG0 + + (20 * anc_num), 0x10, 0x00); +} + +static bool tasha_is_anc_on(struct wcd_mbhc *mbhc) +{ + bool anc_on = false; + u16 ancl, ancr; + + ancl = + (snd_soc_read(mbhc->codec, WCD9335_CDC_RX1_RX_PATH_CFG0)) & 0x10; + ancr = + (snd_soc_read(mbhc->codec, WCD9335_CDC_RX2_RX_PATH_CFG0)) & 0x10; + + anc_on = !!(ancl | ancr); + + return anc_on; +} + static const struct wcd_mbhc_cb mbhc_cb = { .request_irq = tasha_mbhc_request_irq, .irq_control = tasha_mbhc_irq_control, @@ -2034,6 +2062,8 @@ static const struct wcd_mbhc_cb mbhc_cb = { .mbhc_gnd_det_ctrl = tasha_mbhc_gnd_det_ctrl, .hph_pull_down_ctrl = tasha_mbhc_hph_pull_down_ctrl, .mbhc_moisture_config = tasha_mbhc_moisture_config, + .update_anc_state = tasha_update_anc_state, + .is_anc_on = tasha_is_anc_on, }; static int tasha_get_anc_slot(struct snd_kcontrol *kcontrol, @@ -2948,10 +2978,7 @@ static int tasha_codec_enable_slimrx(struct snd_soc_dapm_widget *w, &dai->grph); break; case SND_SOC_DAPM_PRE_PMD: - if (!test_bit(SB_CLK_GEAR, &tasha_p->status_mask)) { - tasha_codec_vote_max_bw(codec, true); - set_bit(SB_CLK_GEAR, &tasha_p->status_mask); - } + tasha_codec_vote_max_bw(codec, true); break; case SND_SOC_DAPM_POST_PMD: ret = wcd9xxx_disconnect_port(core, &dai->wcd9xxx_ch_list, @@ -5263,10 +5290,7 @@ static int tasha_codec_enable_interpolator(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_PRE_PMU: - if (!test_bit(SB_CLK_GEAR, &tasha->status_mask)) { - tasha_codec_vote_max_bw(codec, true); - set_bit(SB_CLK_GEAR, &tasha->status_mask); - } + tasha_codec_vote_max_bw(codec, true); /* Reset if needed */ tasha_codec_enable_prim_interpolator(codec, reg, event); break; @@ -11127,11 +11151,8 @@ static void tasha_shutdown(struct snd_pcm_substream *substream, if (tasha->intf_type == WCD9XXX_INTERFACE_TYPE_I2C) return; - if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) && - test_bit(SB_CLK_GEAR, &tasha->status_mask)) { + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) tasha_codec_vote_max_bw(dai->codec, false); - clear_bit(SB_CLK_GEAR, &tasha->status_mask); - } } static int tasha_set_decimator_rate(struct snd_soc_dai *dai, @@ -11366,15 +11387,11 @@ prim_rate: static int tasha_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct tasha_priv *tasha = snd_soc_codec_get_drvdata(dai->codec); - pr_debug("%s(): substream = %s stream = %d\n", __func__, substream->name, substream->stream); - if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) && - test_bit(SB_CLK_GEAR, &tasha->status_mask)) { + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) tasha_codec_vote_max_bw(dai->codec, false); - clear_bit(SB_CLK_GEAR, &tasha->status_mask); - } return 0; } @@ -13082,13 +13099,29 @@ static int tasha_codec_vote_max_bw(struct snd_soc_codec *codec, if (tasha->intf_type == WCD9XXX_INTERFACE_TYPE_I2C) return 0; - if (vote) - bw_ops = SLIM_BW_CLK_GEAR_9; - else - bw_ops = SLIM_BW_UNVOTE; + mutex_lock(&tasha->sb_clk_gear_lock); + if (vote) { + tasha->ref_count++; + if (tasha->ref_count == 1) { + bw_ops = SLIM_BW_CLK_GEAR_9; + tasha_codec_slim_reserve_bw(codec, + bw_ops, true); + } + } else if (!vote && tasha->ref_count > 0) { + tasha->ref_count--; + if (tasha->ref_count == 0) { + bw_ops = SLIM_BW_UNVOTE; + tasha_codec_slim_reserve_bw(codec, + bw_ops, true); + } + }; - return tasha_codec_slim_reserve_bw(codec, - bw_ops, true); + dev_dbg(codec->dev, "%s Value of counter after vote or un-vote is %d\n", + __func__, tasha->ref_count); + + mutex_unlock(&tasha->sb_clk_gear_lock); + + return 0; } static int tasha_cpe_err_irq_control(struct snd_soc_codec *codec, @@ -13271,6 +13304,8 @@ static int tasha_post_reset_cb(struct wcd9xxx *wcd9xxx) if (ret < 0) dev_err(codec->dev, "%s: invalid pdata\n", __func__); + /* Reset reference counter for voting for max bw */ + tasha->ref_count = 0; /* MBHC Init */ wcd_mbhc_deinit(&tasha->mbhc); tasha->mbhc_started = false; @@ -14053,6 +14088,7 @@ static int tasha_probe(struct platform_device *pdev) mutex_init(&tasha->swr_read_lock); mutex_init(&tasha->swr_write_lock); mutex_init(&tasha->swr_clk_lock); + mutex_init(&tasha->sb_clk_gear_lock); mutex_init(&tasha->mclk_lock); cdc_pwr = devm_kzalloc(&pdev->dev, sizeof(struct wcd9xxx_power_region), @@ -14157,6 +14193,7 @@ static int tasha_remove(struct platform_device *pdev) mutex_destroy(&tasha->mclk_lock); devm_kfree(&pdev->dev, tasha); snd_soc_unregister_codec(&pdev->dev); + mutex_destroy(&tasha->sb_clk_gear_lock); return 0; } diff --git a/sound/soc/codecs/wcd934x/wcd934x-mbhc.c b/sound/soc/codecs/wcd934x/wcd934x-mbhc.c index a1a5e2d650..ea19caa14f 100644 --- a/sound/soc/codecs/wcd934x/wcd934x-mbhc.c +++ b/sound/soc/codecs/wcd934x/wcd934x-mbhc.c @@ -829,6 +829,32 @@ static bool tavil_hph_register_recovery(struct wcd_mbhc *mbhc) return wcd934x_mbhc->is_hph_recover; } +static void tavil_update_anc_state(struct snd_soc_codec *codec, bool enable, + int anc_num) +{ + if (enable) + snd_soc_update_bits(codec, WCD934X_CDC_RX1_RX_PATH_CFG0 + + (20 * anc_num), 0x10, 0x10); + else + snd_soc_update_bits(codec, WCD934X_CDC_RX1_RX_PATH_CFG0 + + (20 * anc_num), 0x10, 0x00); +} + +static bool tavil_is_anc_on(struct wcd_mbhc *mbhc) +{ + bool anc_on = false; + u16 ancl, ancr; + + ancl = + (snd_soc_read(mbhc->codec, WCD934X_CDC_RX1_RX_PATH_CFG0)) & 0x10; + ancr = + (snd_soc_read(mbhc->codec, WCD934X_CDC_RX2_RX_PATH_CFG0)) & 0x10; + + anc_on = !!(ancl | ancr); + + return anc_on; +} + static const struct wcd_mbhc_cb mbhc_cb = { .request_irq = tavil_mbhc_request_irq, .irq_control = tavil_mbhc_irq_control, @@ -852,6 +878,8 @@ static const struct wcd_mbhc_cb mbhc_cb = { .hph_pull_down_ctrl = tavil_mbhc_hph_pull_down_ctrl, .mbhc_moisture_config = tavil_mbhc_moisture_config, .hph_register_recovery = tavil_hph_register_recovery, + .update_anc_state = tavil_update_anc_state, + .is_anc_on = tavil_is_anc_on, }; static struct regulator *tavil_codec_find_ondemand_regulator( @@ -998,19 +1026,26 @@ int tavil_mbhc_post_ssr_init(struct wcd934x_mbhc *mbhc, struct snd_soc_codec *codec) { int ret; + struct wcd_mbhc *wcd_mbhc; if (!mbhc || !codec) return -EINVAL; - wcd_mbhc_deinit(&mbhc->wcd_mbhc); - ret = wcd_mbhc_init(&mbhc->wcd_mbhc, codec, &mbhc_cb, &intr_ids, + wcd_mbhc = &mbhc->wcd_mbhc; + if (wcd_mbhc == NULL) { + pr_err("%s: wcd_mbhc is NULL\n", __func__); + return -EINVAL; + } + + wcd_mbhc_deinit(wcd_mbhc); + ret = wcd_mbhc_init(wcd_mbhc, codec, &mbhc_cb, &intr_ids, wcd_mbhc_registers, TAVIL_ZDET_SUPPORTED); if (ret) { dev_err(codec->dev, "%s: mbhc initialization failed\n", __func__); goto done; } - if (!WCD_MBHC_DETECTION) { + if (wcd_mbhc->mbhc_detection_logic == WCD_DETECTION_LEGACY) { snd_soc_update_bits(codec, WCD934X_MBHC_NEW_CTL_1, 0x04, 0x04); snd_soc_update_bits(codec, WCD934X_MBHC_CTL_BCS, 0x01, 0x01); } @@ -1033,6 +1068,7 @@ int tavil_mbhc_init(struct wcd934x_mbhc **mbhc, struct snd_soc_codec *codec, { struct regulator *supply; struct wcd934x_mbhc *wcd934x_mbhc; + struct wcd_mbhc *wcd_mbhc; int ret; wcd934x_mbhc = devm_kzalloc(codec->dev, sizeof(struct wcd934x_mbhc), @@ -1043,8 +1079,18 @@ int tavil_mbhc_init(struct wcd934x_mbhc **mbhc, struct snd_soc_codec *codec, wcd934x_mbhc->wcd9xxx = dev_get_drvdata(codec->dev->parent); wcd934x_mbhc->fw_data = fw_data; BLOCKING_INIT_NOTIFIER_HEAD(&wcd934x_mbhc->notifier); + wcd_mbhc = &wcd934x_mbhc->wcd_mbhc; + if (wcd_mbhc == NULL) { + pr_err("%s: wcd_mbhc is NULL\n", __func__); + ret = -EINVAL; + goto err; + } - ret = wcd_mbhc_init(&wcd934x_mbhc->wcd_mbhc, codec, &mbhc_cb, + + /* Setting default mbhc detection logic to ADC for Tavil */ + wcd_mbhc->mbhc_detection_logic = WCD_DETECTION_ADC; + + ret = wcd_mbhc_init(wcd_mbhc, codec, &mbhc_cb, &intr_ids, wcd_mbhc_registers, TAVIL_ZDET_SUPPORTED); if (ret) { @@ -1070,7 +1116,7 @@ int tavil_mbhc_init(struct wcd934x_mbhc **mbhc, struct snd_soc_codec *codec, snd_soc_add_codec_controls(codec, hph_type_detect_controls, ARRAY_SIZE(hph_type_detect_controls)); - if (!WCD_MBHC_DETECTION) { + if (wcd_mbhc->mbhc_detection_logic == WCD_DETECTION_LEGACY) { snd_soc_update_bits(codec, WCD934X_MBHC_NEW_CTL_1, 0x04, 0x04); snd_soc_update_bits(codec, WCD934X_MBHC_CTL_BCS, 0x01, 0x01); } diff --git a/sound/soc/codecs/wcd934x/wcd934x-routing.h b/sound/soc/codecs/wcd934x/wcd934x-routing.h index afd93b2cf5..93a1ad3bab 100644 --- a/sound/soc/codecs/wcd934x/wcd934x-routing.h +++ b/sound/soc/codecs/wcd934x/wcd934x-routing.h @@ -117,6 +117,70 @@ const struct snd_soc_dapm_route tavil_slim_audio_map[] = { const struct snd_soc_dapm_route tavil_audio_map[] = { + /* WDMA3 */ + {"WDMA3 PORT0 MUX", "DEC0", "ADC MUX0"}, + {"WDMA3 PORT0 MUX", "RX_MIX_TX0", "RX MIX TX0 MUX"}, + {"WDMA3 PORT1 MUX", "DEC1", "ADC MUX1"}, + {"WDMA3 PORT1 MUX", "RX_MIX_TX1", "RX MIX TX1 MUX"}, + {"WDMA3 PORT2 MUX", "DEC2", "ADC MUX2"}, + {"WDMA3 PORT2 MUX", "RX_MIX_TX2", "RX MIX TX2 MUX"}, + {"WDMA3 PORT3 MUX", "DEC3", "ADC MUX3"}, + {"WDMA3 PORT3 MUX", "RX_MIX_TX3", "RX MIX TX3 MUX"}, + {"WDMA3 PORT4 MUX", "DEC4", "ADC MUX4"}, + {"WDMA3 PORT4 MUX", "RX_MIX_TX4", "RX MIX TX4 MUX"}, + {"WDMA3 PORT5 MUX", "DEC5", "ADC MUX5"}, + {"WDMA3 PORT5 MUX", "RX_MIX_TX5", "RX MIX TX5 MUX"}, + {"WDMA3 PORT6 MUX", "DEC6", "ADC MUX6"}, + {"WDMA3 PORT6 MUX", "RX_MIX_TX6", "RX MIX TX6 MUX"}, + + {"WDMA3 CH0 MUX", "PORT_0", "WDMA3 PORT0 MUX"}, + {"WDMA3 CH0 MUX", "PORT_1", "WDMA3 PORT1 MUX"}, + {"WDMA3 CH0 MUX", "PORT_2", "WDMA3 PORT2 MUX"}, + {"WDMA3 CH0 MUX", "PORT_3", "WDMA3 PORT3 MUX"}, + {"WDMA3 CH0 MUX", "PORT_4", "WDMA3 PORT4 MUX"}, + {"WDMA3 CH0 MUX", "PORT_5", "WDMA3 PORT5 MUX"}, + {"WDMA3 CH0 MUX", "PORT_6", "WDMA3 PORT6 MUX"}, + {"WDMA3 CH0 MUX", "PORT_7", "ADC MUX7"}, + {"WDMA3 CH0 MUX", "PORT_8", "ADC MUX8"}, + + {"WDMA3 CH1 MUX", "PORT_0", "WDMA3 PORT0 MUX"}, + {"WDMA3 CH1 MUX", "PORT_1", "WDMA3 PORT1 MUX"}, + {"WDMA3 CH1 MUX", "PORT_2", "WDMA3 PORT2 MUX"}, + {"WDMA3 CH1 MUX", "PORT_3", "WDMA3 PORT3 MUX"}, + {"WDMA3 CH1 MUX", "PORT_4", "WDMA3 PORT4 MUX"}, + {"WDMA3 CH1 MUX", "PORT_5", "WDMA3 PORT5 MUX"}, + {"WDMA3 CH1 MUX", "PORT_6", "WDMA3 PORT6 MUX"}, + {"WDMA3 CH1 MUX", "PORT_7", "ADC MUX7"}, + {"WDMA3 CH1 MUX", "PORT_8", "ADC MUX8"}, + + {"WDMA3 CH2 MUX", "PORT_0", "WDMA3 PORT0 MUX"}, + {"WDMA3 CH2 MUX", "PORT_1", "WDMA3 PORT1 MUX"}, + {"WDMA3 CH2 MUX", "PORT_2", "WDMA3 PORT2 MUX"}, + {"WDMA3 CH2 MUX", "PORT_3", "WDMA3 PORT3 MUX"}, + {"WDMA3 CH2 MUX", "PORT_4", "WDMA3 PORT4 MUX"}, + {"WDMA3 CH2 MUX", "PORT_5", "WDMA3 PORT5 MUX"}, + {"WDMA3 CH2 MUX", "PORT_6", "WDMA3 PORT6 MUX"}, + {"WDMA3 CH2 MUX", "PORT_7", "ADC MUX7"}, + {"WDMA3 CH2 MUX", "PORT_8", "ADC MUX8"}, + + {"WDMA3 CH3 MUX", "PORT_0", "WDMA3 PORT0 MUX"}, + {"WDMA3 CH3 MUX", "PORT_1", "WDMA3 PORT1 MUX"}, + {"WDMA3 CH3 MUX", "PORT_2", "WDMA3 PORT2 MUX"}, + {"WDMA3 CH3 MUX", "PORT_3", "WDMA3 PORT3 MUX"}, + {"WDMA3 CH3 MUX", "PORT_4", "WDMA3 PORT4 MUX"}, + {"WDMA3 CH3 MUX", "PORT_5", "WDMA3 PORT5 MUX"}, + {"WDMA3 CH3 MUX", "PORT_6", "WDMA3 PORT6 MUX"}, + {"WDMA3 CH3 MUX", "PORT_7", "ADC MUX7"}, + {"WDMA3 CH3 MUX", "PORT_8", "ADC MUX8"}, + + {"WDMA3_CH_MIXER", NULL, "WDMA3 CH0 MUX"}, + {"WDMA3_CH_MIXER", NULL, "WDMA3 CH1 MUX"}, + {"WDMA3_CH_MIXER", NULL, "WDMA3 CH2 MUX"}, + {"WDMA3_CH_MIXER", NULL, "WDMA3 CH3 MUX"}, + + {"WDMA3_ON_OFF", "Switch", "WDMA3_CH_MIXER"}, + {"WDMA3_OUT", NULL, "WDMA3_ON_OFF"}, + /* MAD */ {"MAD_SEL MUX", "SPE", "MAD_CPE_INPUT"}, {"MAD_SEL MUX", "MSM", "MADINPUT"}, diff --git a/sound/soc/codecs/wcd934x/wcd934x.c b/sound/soc/codecs/wcd934x/wcd934x.c index ca16ed8c8a..3079cca65e 100644 --- a/sound/soc/codecs/wcd934x/wcd934x.c +++ b/sound/soc/codecs/wcd934x/wcd934x.c @@ -180,6 +180,8 @@ enum { ANC_MIC_AMIC2, ANC_MIC_AMIC3, ANC_MIC_AMIC4, + CLK_INTERNAL, + CLK_MODE, }; enum { @@ -1071,6 +1073,40 @@ err: return ret; } +static int tavil_get_clkmode(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); + struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec); + + if (test_bit(CLK_MODE, &tavil_p->status_mask)) + ucontrol->value.enumerated.item[0] = 1; + else + ucontrol->value.enumerated.item[0] = 0; + + dev_dbg(codec->dev, "%s: is_low_power_clock: %s\n", __func__, + test_bit(CLK_MODE, &tavil_p->status_mask) ? "true" : "false"); + + return 0; +} + +static int tavil_put_clkmode(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); + struct tavil_priv *tavil_p = snd_soc_codec_get_drvdata(codec); + + if (ucontrol->value.enumerated.item[0]) + set_bit(CLK_MODE, &tavil_p->status_mask); + else + clear_bit(CLK_MODE, &tavil_p->status_mask); + + dev_dbg(codec->dev, "%s: is_low_power_clock: %s\n", __func__, + test_bit(CLK_MODE, &tavil_p->status_mask) ? "true" : "false"); + + return 0; +} + static int tavil_vi_feed_mixer_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { @@ -2809,6 +2845,35 @@ static int tavil_get_asrc_mode(struct tavil_priv *tavil, int asrc, return asrc_mode; } +static int tavil_codec_wdma3_ctl(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); + + switch (event) { + case SND_SOC_DAPM_PRE_PMU: + /* Fix to 16KHz */ + snd_soc_update_bits(codec, WCD934X_DMA_WDMA_CTL_3, + 0xF0, 0x10); + /* Select mclk_1 */ + snd_soc_update_bits(codec, WCD934X_DMA_WDMA_CTL_3, + 0x02, 0x00); + /* Enable DMA */ + snd_soc_update_bits(codec, WCD934X_DMA_WDMA_CTL_3, + 0x01, 0x01); + break; + + case SND_SOC_DAPM_POST_PMD: + /* Disable DMA */ + snd_soc_update_bits(codec, WCD934X_DMA_WDMA_CTL_3, + 0x01, 0x00); + break; + + }; + + return 0; +} + static int tavil_codec_enable_asrc(struct snd_soc_codec *codec, int asrc_in, int event) { @@ -5547,6 +5612,9 @@ static const char *const tavil_anc_func_text[] = {"OFF", "ON"}; static const struct soc_enum tavil_anc_func_enum = SOC_ENUM_SINGLE_EXT(2, tavil_anc_func_text); +static const char *const tavil_clkmode_text[] = {"EXTERNAL", "INTERNAL"}; +static SOC_ENUM_SINGLE_EXT_DECL(tavil_clkmode_enum, tavil_clkmode_text); + /* Cutoff frequency for high pass filter */ static const char * const cf_text[] = { "CF_NEG_3DB_4HZ", "CF_NEG_3DB_75HZ", "CF_NEG_3DB_150HZ" @@ -5726,6 +5794,9 @@ static const struct snd_kcontrol_new tavil_snd_controls[] = { SOC_ENUM_EXT("ANC Function", tavil_anc_func_enum, tavil_get_anc_func, tavil_put_anc_func), + SOC_ENUM_EXT("CLK MODE", tavil_clkmode_enum, tavil_get_clkmode, + tavil_put_clkmode), + SOC_ENUM("TX0 HPF cut off", cf_dec0_enum), SOC_ENUM("TX1 HPF cut off", cf_dec1_enum), SOC_ENUM("TX2 HPF cut off", cf_dec2_enum), @@ -6165,6 +6236,39 @@ static const char * const native_mux_text[] = { "OFF", "ON", }; +static const char *const wdma3_port0_text[] = { + "RX_MIX_TX0", "DEC0" +}; + +static const char *const wdma3_port1_text[] = { + "RX_MIX_TX1", "DEC1" +}; + +static const char *const wdma3_port2_text[] = { + "RX_MIX_TX2", "DEC2" +}; + +static const char *const wdma3_port3_text[] = { + "RX_MIX_TX3", "DEC3" +}; + +static const char *const wdma3_port4_text[] = { + "RX_MIX_TX4", "DEC4" +}; + +static const char *const wdma3_port5_text[] = { + "RX_MIX_TX5", "DEC5" +}; + +static const char *const wdma3_port6_text[] = { + "RX_MIX_TX6", "DEC6" +}; + +static const char *const wdma3_ch_text[] = { + "PORT_0", "PORT_1", "PORT_2", "PORT_3", "PORT_4", + "PORT_5", "PORT_6", "PORT_7", "PORT_8", +}; + static const struct snd_kcontrol_new aif4_vi_mixer[] = { SOC_SINGLE_EXT("SPKR_VI_1", SND_SOC_NOPM, WCD934X_TX14, 1, 0, tavil_vi_feed_mixer_get, tavil_vi_feed_mixer_put), @@ -6570,6 +6674,20 @@ WCD_DAPM_ENUM(int8_2_native, SND_SOC_NOPM, 0, native_mux_text); WCD_DAPM_ENUM(anc0_fb, WCD934X_CDC_RX_INP_MUX_ANC_CFG0, 0, anc0_fb_mux_text); WCD_DAPM_ENUM(anc1_fb, WCD934X_CDC_RX_INP_MUX_ANC_CFG0, 3, anc1_fb_mux_text); + +WCD_DAPM_ENUM(wdma3_port0, WCD934X_DMA_WDMA3_PRT_CFG, 0, wdma3_port0_text); +WCD_DAPM_ENUM(wdma3_port1, WCD934X_DMA_WDMA3_PRT_CFG, 1, wdma3_port1_text); +WCD_DAPM_ENUM(wdma3_port2, WCD934X_DMA_WDMA3_PRT_CFG, 2, wdma3_port2_text); +WCD_DAPM_ENUM(wdma3_port3, WCD934X_DMA_WDMA3_PRT_CFG, 3, wdma3_port3_text); +WCD_DAPM_ENUM(wdma3_port4, WCD934X_DMA_WDMA3_PRT_CFG, 4, wdma3_port4_text); +WCD_DAPM_ENUM(wdma3_port5, WCD934X_DMA_WDMA3_PRT_CFG, 5, wdma3_port5_text); +WCD_DAPM_ENUM(wdma3_port6, WCD934X_DMA_WDMA3_PRT_CFG, 6, wdma3_port6_text); + +WCD_DAPM_ENUM(wdma3_ch0, WCD934X_DMA_CH_0_1_CFG_WDMA_3, 0, wdma3_ch_text); +WCD_DAPM_ENUM(wdma3_ch1, WCD934X_DMA_CH_0_1_CFG_WDMA_3, 4, wdma3_ch_text); +WCD_DAPM_ENUM(wdma3_ch2, WCD934X_DMA_CH_2_3_CFG_WDMA_3, 0, wdma3_ch_text); +WCD_DAPM_ENUM(wdma3_ch3, WCD934X_DMA_CH_2_3_CFG_WDMA_3, 4, wdma3_ch_text); + static const struct snd_kcontrol_new anc_ear_switch = SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0); @@ -6637,6 +6755,9 @@ static const struct snd_kcontrol_new rx_int4_asrc_switch[] = { SOC_DAPM_SINGLE("LO2 Switch", SND_SOC_NOPM, 0, 1, 0), }; +static const struct snd_kcontrol_new wdma3_onoff_switch = + SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0); + static int tavil_dsd_mixer_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { @@ -7319,6 +7440,28 @@ static const struct snd_soc_dapm_widget tavil_dapm_widgets[] = { SND_SOC_DAPM_MUX_E("ASRC3 MUX", SND_SOC_NOPM, ASRC3, 0, &asrc3_mux, tavil_codec_enable_asrc_resampler, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), + + /* WDMA3 widgets */ + WCD_DAPM_MUX("WDMA3 PORT0 MUX", 0, wdma3_port0), + WCD_DAPM_MUX("WDMA3 PORT1 MUX", 1, wdma3_port1), + WCD_DAPM_MUX("WDMA3 PORT2 MUX", 2, wdma3_port2), + WCD_DAPM_MUX("WDMA3 PORT3 MUX", 3, wdma3_port3), + WCD_DAPM_MUX("WDMA3 PORT4 MUX", 4, wdma3_port4), + WCD_DAPM_MUX("WDMA3 PORT5 MUX", 5, wdma3_port5), + WCD_DAPM_MUX("WDMA3 PORT6 MUX", 6, wdma3_port6), + + WCD_DAPM_MUX("WDMA3 CH0 MUX", 0, wdma3_ch0), + WCD_DAPM_MUX("WDMA3 CH1 MUX", 4, wdma3_ch1), + WCD_DAPM_MUX("WDMA3 CH2 MUX", 0, wdma3_ch2), + WCD_DAPM_MUX("WDMA3 CH3 MUX", 4, wdma3_ch3), + + SND_SOC_DAPM_MIXER("WDMA3_CH_MIXER", SND_SOC_NOPM, 0, 0, NULL, 0), + + SND_SOC_DAPM_SWITCH_E("WDMA3_ON_OFF", SND_SOC_NOPM, 0, 0, + &wdma3_onoff_switch, tavil_codec_wdma3_ctl, + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), + + SND_SOC_DAPM_OUTPUT("WDMA3_OUT"), }; static int tavil_get_channel_map(struct snd_soc_dai *dai, @@ -8316,6 +8459,50 @@ static int tavil_codec_internal_rco_ctrl(struct snd_soc_codec *codec, return ret; } +/* + * tavil_cdc_mclk_tx_enable: Enable/Disable codec's clock for TX path + * @codec: Handle to codec + * @enable: Indicates whether clock should be enabled or disabled + */ +int tavil_cdc_mclk_tx_enable(struct snd_soc_codec *codec, bool enable) +{ + struct tavil_priv *tavil_p; + int ret = 0; + bool clk_mode; + bool clk_internal; + + if (!codec) + return -EINVAL; + + tavil_p = snd_soc_codec_get_drvdata(codec); + clk_mode = test_bit(CLK_MODE, &tavil_p->status_mask); + clk_internal = test_bit(CLK_INTERNAL, &tavil_p->status_mask); + + dev_dbg(codec->dev, "%s: clkmode: %d, enable: %d, clk_internal: %d\n", + __func__, clk_mode, enable, clk_internal); + + if (clk_mode || clk_internal) { + if (enable) { + wcd_resmgr_enable_master_bias(tavil_p->resmgr); + tavil_dig_core_power_collapse(tavil_p, POWER_RESUME); + tavil_vote_svs(tavil_p, true); + ret = tavil_codec_internal_rco_ctrl(codec, enable); + set_bit(CLK_INTERNAL, &tavil_p->status_mask); + } else { + clear_bit(CLK_INTERNAL, &tavil_p->status_mask); + tavil_codec_internal_rco_ctrl(codec, enable); + tavil_vote_svs(tavil_p, false); + tavil_dig_core_power_collapse(tavil_p, POWER_COLLAPSE); + wcd_resmgr_disable_master_bias(tavil_p->resmgr); + } + } else { + ret = __tavil_cdc_mclk_enable(tavil_p, enable); + } + + return ret; +} +EXPORT_SYMBOL(tavil_cdc_mclk_tx_enable); + static const struct wcd_resmgr_cb tavil_resmgr_cb = { .cdc_rco_ctrl = __tavil_codec_internal_rco_ctrl, }; diff --git a/sound/soc/codecs/wcd934x/wcd934x.h b/sound/soc/codecs/wcd934x/wcd934x.h index c3bf50a4ff..27c21f1035 100644 --- a/sound/soc/codecs/wcd934x/wcd934x.h +++ b/sound/soc/codecs/wcd934x/wcd934x.h @@ -137,6 +137,7 @@ struct tavil_reg_mask_val { extern void *tavil_get_afe_config(struct snd_soc_codec *codec, enum afe_config_type config_type); extern int tavil_cdc_mclk_enable(struct snd_soc_codec *codec, bool enable); +extern int tavil_cdc_mclk_tx_enable(struct snd_soc_codec *codec, bool enable); extern int tavil_set_spkr_mode(struct snd_soc_codec *codec, int mode); extern int tavil_set_spkr_gain_offset(struct snd_soc_codec *codec, int offset); extern struct wcd_dsp_cntl *tavil_get_wcd_dsp_cntl(struct device *dev); diff --git a/sound/soc/codecs/wcd_cpe_services.c b/sound/soc/codecs/wcd_cpe_services.c index 0028ebc08d..ad8962b6f1 100644 --- a/sound/soc/codecs/wcd_cpe_services.c +++ b/sound/soc/codecs/wcd_cpe_services.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include "wcd_cpe_services.h" #include "wcd_cmi_api.h" @@ -46,9 +45,6 @@ #define LISTEN_CTL_SPE_VAL 0x0 #define LISTEN_CTL_MSM_VAL 0x1 -#define TOMTOM_A_SVASS_SPE_INBOX(N) (TOMTOM_A_SVASS_SPE_INBOX_0 + (N)) -#define TOMTOM_A_SVASS_SPE_OUTBOX(N) (TOMTOM_A_SVASS_SPE_OUTBOX_0 + (N)) - #define WCD9335_CPE_SS_SPE_DRAM_OFFSET 0x48000 #define WCD9335_CPE_SS_SPE_DRAM_SIZE 0x34000 #define WCD9335_CPE_SS_SPE_IRAM_OFFSET 0x80000 @@ -316,8 +312,7 @@ static int cpe_register_write(u32 reg, u32 val) { int ret = 0; - if (reg != TOMTOM_A_SVASS_MEM_BANK && - reg != WCD9335_CPE_SS_MEM_BANK_0) + if (reg != WCD9335_CPE_SS_MEM_BANK_0) pr_debug("%s: reg = 0x%x, value = 0x%x\n", __func__, reg, val); @@ -2149,73 +2144,27 @@ fail_cmd: static enum cpe_svc_result cpe_tgt_tomtom_boot(int debug_mode) { - enum cpe_svc_result rc = CPE_SVC_SUCCESS; - - if (!debug_mode) - rc = cpe_update_bits(TOMTOM_A_SVASS_CPAR_WDOG_CFG, - 0x3F, 0x31); - else - pr_info("%s: CPE in debug mode, WDOG disabled\n", - __func__); - - rc = cpe_update_bits(TOMTOM_A_SVASS_CLKRST_CTL, - 0x02, 0x00); - rc = cpe_update_bits(TOMTOM_A_SVASS_CLKRST_CTL, - 0x0C, 0x04); - rc = cpe_update_bits(TOMTOM_A_SVASS_CPAR_CFG, - 0x01, 0x01); - - return rc; + return CPE_SVC_SUCCESS; } static u32 cpe_tgt_tomtom_is_cpar_init_done(void) { - u8 status = 0; - - cpe_register_read(TOMTOM_A_SVASS_STATUS, &status); - return status & 0x01; + return 0; } static u32 cpe_tgt_tomtom_is_active(void) { - u8 status = 0; - - cpe_register_read(TOMTOM_A_SVASS_STATUS, &status); - return status & 0x04; + return 0; } static enum cpe_svc_result cpe_tgt_tomtom_reset(void) { - enum cpe_svc_result rc = CPE_SVC_SUCCESS; - - rc = cpe_update_bits(TOMTOM_A_SVASS_CPAR_WDOG_CFG, - 0x30, 0x00); - - rc = cpe_update_bits(TOMTOM_A_SVASS_CPAR_CFG, - 0x01, 0x00); - rc = cpe_update_bits(TOMTOM_A_MEM_LEAKAGE_CTL, - 0x07, 0x03); - rc = cpe_update_bits(TOMTOM_A_SVASS_CLKRST_CTL, - 0x08, 0x08); - rc = cpe_update_bits(TOMTOM_A_SVASS_CLKRST_CTL, - 0x02, 0x02); - return rc; + return CPE_SVC_SUCCESS; } enum cpe_svc_result cpe_tgt_tomtom_voicetx(bool enable) { - enum cpe_svc_result rc = CPE_SVC_SUCCESS; - u8 val = 0; - - if (enable) - val = 0x02; - else - val = 0x00; - rc = cpe_update_bits(TOMTOM_A_SVASS_CFG, - 0x02, val); - val = 0; - cpe_register_read(TOMTOM_A_SVASS_CFG, &val); - return rc; + return CPE_SVC_SUCCESS; } enum cpe_svc_result cpe_svc_toggle_lab(void *cpe_handle, bool enable) @@ -2235,251 +2184,37 @@ enum cpe_svc_result cpe_svc_toggle_lab(void *cpe_handle, bool enable) static enum cpe_svc_result cpe_tgt_tomtom_read_mailbox(u8 *buffer, size_t size) { - enum cpe_svc_result rc = CPE_SVC_SUCCESS; - u32 cnt = 0; - - if (size >= TOMTOM_A_SVASS_SPE_OUTBOX_SIZE) - size = TOMTOM_A_SVASS_SPE_OUTBOX_SIZE - 1; - for (cnt = 0; (cnt < size) && (rc == CPE_SVC_SUCCESS); cnt++) { - rc = cpe_register_read(TOMTOM_A_SVASS_SPE_OUTBOX(cnt), - &(buffer[cnt])); - } - return rc; + return CPE_SVC_SUCCESS; } static enum cpe_svc_result cpe_tgt_tomtom_write_mailbox(u8 *buffer, size_t size) { - enum cpe_svc_result rc = CPE_SVC_SUCCESS; - u32 cnt = 0; - - if (size >= TOMTOM_A_SVASS_SPE_INBOX_SIZE) - size = TOMTOM_A_SVASS_SPE_INBOX_SIZE - 1; - for (cnt = 0; (cnt < size) && (rc == CPE_SVC_SUCCESS); cnt++) { - rc = cpe_register_write(TOMTOM_A_SVASS_SPE_INBOX(cnt), - buffer[cnt]); - } - - if (rc == CPE_SVC_SUCCESS) - rc = cpe_register_write(TOMTOM_A_SVASS_SPE_INBOX_TRG, 1); - - return rc; -} - -static enum cpe_svc_result cpe_get_mem_addr(struct cpe_info *t_info, - const struct cpe_svc_mem_segment *mem_seg, - u32 *addr, u8 *mem) -{ - enum cpe_svc_result rc = CPE_SVC_SUCCESS; - u32 offset, mem_sz, address; - u8 mem_type; - - switch (mem_seg->type) { - - case CPE_SVC_DATA_MEM: - mem_type = MEM_ACCESS_DRAM_VAL; - offset = TOMTOM_A_SVASS_SPE_DRAM_OFFSET; - mem_sz = TOMTOM_A_SVASS_SPE_DRAM_SIZE; - break; - - case CPE_SVC_INSTRUCTION_MEM: - mem_type = MEM_ACCESS_IRAM_VAL; - offset = TOMTOM_A_SVASS_SPE_IRAM_OFFSET; - mem_sz = TOMTOM_A_SVASS_SPE_IRAM_SIZE; - break; - - default: - pr_err("%s: Invalid mem type = %u\n", - __func__, mem_seg->type); - return CPE_SVC_INVALID_HANDLE; - } - - if (mem_seg->cpe_addr < offset) { - pr_err("%s: Invalid addr %x for mem type %u\n", - __func__, mem_seg->cpe_addr, mem_type); - return CPE_SVC_INVALID_HANDLE; - } - - address = mem_seg->cpe_addr - offset; - if (address + mem_seg->size > mem_sz) { - pr_err("%s: wrong size %zu, start address %x, mem_type %u\n", - __func__, mem_seg->size, address, mem_type); - return CPE_SVC_INVALID_HANDLE; - } - - (*addr) = address; - (*mem) = mem_type; - - return rc; + return CPE_SVC_SUCCESS; } static enum cpe_svc_result cpe_tgt_tomtom_read_RAM(struct cpe_info *t_info, struct cpe_svc_mem_segment *mem_seg) { - enum cpe_svc_result rc = CPE_SVC_SUCCESS; - u8 mem_reg_val = 0; - u32 cnt = 0; - bool autoinc; - u8 mem = MEM_ACCESS_NONE_VAL; - u32 addr = 0; - u32 ptr_update = true; - - if (!mem_seg) { - pr_err("%s: Invalid mem segment\n", - __func__); - return CPE_SVC_INVALID_HANDLE; - } - - rc = cpe_get_mem_addr(t_info, mem_seg, &addr, &mem); - - if (rc != CPE_SVC_SUCCESS) { - pr_err("%s: Cannot obtain address, mem_type %u\n", - __func__, mem_seg->type); - return rc; - } - - rc = cpe_register_write(TOMTOM_A_SVASS_MEM_CTL, 0); - autoinc = cpe_register_read_autoinc_supported(); - if (autoinc) - mem_reg_val |= 0x04; - - mem_reg_val |= 0x08; - mem_reg_val |= mem; - - do { - if (!autoinc || ptr_update) { - rc = cpe_register_write(TOMTOM_A_SVASS_MEM_PTR0, - (addr & 0xFF)); - rc = cpe_register_write(TOMTOM_A_SVASS_MEM_PTR1, - ((addr >> 8) & 0xFF)); - rc = cpe_register_write(TOMTOM_A_SVASS_MEM_PTR2, - ((addr >> 16) & 0xFF)); - - rc = cpe_register_write(TOMTOM_A_SVASS_MEM_CTL, - mem_reg_val); - - ptr_update = false; - } - rc = cpe_register_read(TOMTOM_A_SVASS_MEM_BANK, - &mem_seg->data[cnt]); - - if (!autoinc) - rc = cpe_register_write(TOMTOM_A_SVASS_MEM_CTL, 0); - } while (++cnt < mem_seg->size); - - rc = cpe_register_write(TOMTOM_A_SVASS_MEM_CTL, 0); - - return rc; + return CPE_SVC_SUCCESS; } static enum cpe_svc_result cpe_tgt_tomtom_write_RAM(struct cpe_info *t_info, const struct cpe_svc_mem_segment *mem_seg) { - enum cpe_svc_result rc = CPE_SVC_SUCCESS; - u8 mem_reg_val = 0; - u8 mem = MEM_ACCESS_NONE_VAL; - u32 addr = 0; - u8 *temp_ptr = NULL; - u32 temp_size = 0; - bool autoinc; - - if (!mem_seg) { - pr_err("%s: Invalid mem segment\n", - __func__); - return CPE_SVC_INVALID_HANDLE; - } - - rc = cpe_get_mem_addr(t_info, mem_seg, &addr, &mem); - - if (rc != CPE_SVC_SUCCESS) { - pr_err("%s: Cannot obtain address, mem_type %u\n", - __func__, mem_seg->type); - return rc; - } - - autoinc = cpe_register_read_autoinc_supported(); - if (autoinc) - mem_reg_val |= 0x04; - mem_reg_val |= mem; - - rc = cpe_update_bits(TOMTOM_A_SVASS_MEM_CTL, - 0x0F, mem_reg_val); - - rc = cpe_register_write(TOMTOM_A_SVASS_MEM_PTR0, - (addr & 0xFF)); - rc = cpe_register_write(TOMTOM_A_SVASS_MEM_PTR1, - ((addr >> 8) & 0xFF)); - - rc = cpe_register_write(TOMTOM_A_SVASS_MEM_PTR2, - ((addr >> 16) & 0xFF)); - - temp_size = 0; - temp_ptr = mem_seg->data; - - while (temp_size <= mem_seg->size) { - u32 to_write = (mem_seg->size >= temp_size+CHUNK_SIZE) - ? CHUNK_SIZE : (mem_seg->size-temp_size); - - if (t_info->state == CPE_STATE_OFFLINE) { - pr_err("%s: CPE is offline\n", __func__); - return CPE_SVC_FAILED; - } - - cpe_register_write_repeat(TOMTOM_A_SVASS_MEM_BANK, - temp_ptr, to_write); - temp_size += CHUNK_SIZE; - temp_ptr += CHUNK_SIZE; - } - - rc = cpe_register_write(TOMTOM_A_SVASS_MEM_CTL, 0); - return rc; + return CPE_SVC_SUCCESS; } static enum cpe_svc_result cpe_tgt_tomtom_route_notification( enum cpe_svc_module module, enum cpe_svc_route_dest dest) { - enum cpe_svc_result rc = CPE_SVC_SUCCESS; - u8 ctl_reg_val = 0; - - switch (module) { - case CPE_SVC_LISTEN_PROC: - switch (dest) { - case CPE_SVC_EXTERNAL: - ctl_reg_val = LISTEN_CTL_MSM_VAL; - break; - case CPE_SVC_INTERNAL: - ctl_reg_val = LISTEN_CTL_SPE_VAL; - break; - default: - pr_err("%s: Invalid dest %d\n", - __func__, dest); - return CPE_SVC_FAILED; - } - - rc = cpe_update_bits(TOMTOM_A_SVASS_CFG, - 0x01, ctl_reg_val); - break; - default: - pr_err("%s: Invalid module %d\n", - __func__, module); - rc = CPE_SVC_FAILED; - break; - } - - return rc; + return CPE_SVC_SUCCESS; } static enum cpe_svc_result cpe_tgt_tomtom_set_debug_mode(u32 enable) { - enum cpe_svc_result rc = CPE_SVC_SUCCESS; - u8 dbg_reg_val = 0x00; - - if (enable) - dbg_reg_val = 0x08; - rc = cpe_update_bits(TOMTOM_A_SVASS_DEBUG, - 0x08, dbg_reg_val); - return rc; + return CPE_SVC_SUCCESS; } static const struct cpe_svc_hw_cfg *cpe_tgt_tomtom_get_cpe_info(void) diff --git a/sound/soc/msm/qdsp6v2/audio_calibration.c b/sound/soc/msm/qdsp6v2/audio_calibration.c index 808a0e4b72..d709b091a7 100644 --- a/sound/soc/msm/qdsp6v2/audio_calibration.c +++ b/sound/soc/msm/qdsp6v2/audio_calibration.c @@ -460,6 +460,12 @@ static long audio_cal_shared_ioctl(struct file *file, unsigned int cmd, data->cal_type.cal_hdr.buffer_number); ret = -EINVAL; goto done; + } else if ((data->hdr.cal_type_size + sizeof(data->hdr)) > size) { + pr_err("%s: cal type hdr size %zd + cal type size %d is greater than user buffer size %d\n", + __func__, sizeof(data->hdr), data->hdr.cal_type_size, + size); + ret = -EFAULT; + goto done; } @@ -497,13 +503,7 @@ static long audio_cal_shared_ioctl(struct file *file, unsigned int cmd, goto unlock; if (data == NULL) goto unlock; - if ((sizeof(data->hdr) + data->hdr.cal_type_size) > size) { - pr_err("%s: header size %zd plus cal type size %d are greater than data buffer size %d\n", - __func__, sizeof(data->hdr), - data->hdr.cal_type_size, size); - ret = -EFAULT; - goto unlock; - } else if (copy_to_user((void *)arg, data, + if (copy_to_user(arg, data, sizeof(data->hdr) + data->hdr.cal_type_size)) { pr_err("%s: Could not copy cal type to user\n", __func__); diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c index 325d642b7d..75a2bffaa3 100644 --- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c +++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c @@ -30,9 +30,12 @@ #include #include #include +#include + #include #include #include +#include #include "msm-pcm-q6-v2.h" #include "msm-pcm-routing-v2.h" @@ -421,6 +424,42 @@ static int msm_pcm_trigger(struct snd_pcm_substream *substream, int cmd) return ret; } + +static int msm_pcm_mmap_fd(struct snd_pcm_substream *substream, + struct snd_pcm_mmap_fd *mmap_fd) +{ + struct msm_audio *prtd; + struct audio_port_data *apd; + struct audio_buffer *ab; + int dir = -1; + + if (!substream->runtime) { + pr_err("%s substream runtime not found\n", __func__); + return -EFAULT; + } + + prtd = substream->runtime->private_data; + if (!prtd || !prtd->audio_client || !prtd->mmap_flag) { + pr_err("%s no audio client or not an mmap session\n", __func__); + return -EINVAL; + } + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + dir = IN; + else + dir = OUT; + + apd = prtd->audio_client->port; + ab = &(apd[dir].buf[0]); + mmap_fd->fd = ion_share_dma_buf_fd(ab->client, ab->handle); + if (mmap_fd->fd >= 0) { + mmap_fd->dir = dir; + mmap_fd->actual_size = ab->actual_size; + mmap_fd->size = ab->size; + } + return mmap_fd->fd < 0 ? -EFAULT : 0; +} + static int msm_pcm_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg) { @@ -445,6 +484,15 @@ static int msm_pcm_ioctl(struct snd_pcm_substream *substream, return snd_pcm_lib_ioctl(substream, cmd, arg); } +#ifdef CONFIG_COMPAT +static int msm_pcm_compat_ioctl(struct snd_pcm_substream *substream, + unsigned int cmd, void *arg) +{ + /* we only handle RESET which is common for both modes */ + return msm_pcm_ioctl(substream, cmd, arg); +} +#endif + static snd_pcm_uframes_t msm_pcm_pointer(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; @@ -994,6 +1042,101 @@ static int msm_pcm_add_app_type_controls(struct snd_soc_pcm_runtime *rtd) return 0; } +static int msm_pcm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, + unsigned int cmd, unsigned long arg) +{ + int ret = 0; + struct snd_pcm *pcm = hw->private_data; + struct snd_pcm_mmap_fd __user *_mmap_fd = NULL; + struct snd_pcm_mmap_fd mmap_fd; + struct snd_pcm_substream *substream = NULL; + int32_t dir = -1; + + switch (cmd) { + case SNDRV_PCM_IOCTL_MMAP_DATA_FD: + _mmap_fd = (struct snd_pcm_mmap_fd __user *)arg; + if (get_user(dir, (int32_t __user *)&(_mmap_fd->dir))) { + pr_err("%s: error copying mmap_fd from user\n", + __func__); + ret = -EFAULT; + break; + } + if (dir != OUT && dir != IN) { + pr_err("%s invalid stream dir\n", __func__); + ret = -EINVAL; + break; + } + substream = pcm->streams[dir].substream; + if (!substream) { + pr_err("%s substream not found\n", __func__); + ret = -ENODEV; + break; + } + pr_debug("%s : %s MMAP Data fd\n", __func__, + dir == 0 ? "P" : "C"); + if (msm_pcm_mmap_fd(substream, &mmap_fd) < 0) { + pr_err("%s: error getting fd\n", + __func__); + ret = -EFAULT; + break; + } + if (put_user(mmap_fd.fd, &_mmap_fd->fd) || + put_user(mmap_fd.size, &_mmap_fd->size) || + put_user(mmap_fd.actual_size, &_mmap_fd->actual_size)) { + pr_err("%s: error copying fd\n", __func__); + return -EFAULT; + } + break; + default: + ret = -EINVAL; + break; + } + return ret; +} + +#ifdef CONFIG_COMPAT +static int msm_pcm_hwdep_compat_ioctl(struct snd_hwdep *hw, + struct file *file, + unsigned int cmd, + unsigned long arg) +{ + /* we only support mmap fd. Handling is common in both modes */ + return msm_pcm_hwdep_ioctl(hw, file, cmd, arg); +} +#else +static int msm_pcm_hwdep_compat_ioctl(struct snd_hwdep *hw, + struct file *file, + unsigned int cmd, + unsigned long arg) +{ + return -EINVAL; +} +#endif + +static int msm_pcm_add_hwdep_dev(struct snd_soc_pcm_runtime *runtime) +{ + struct snd_hwdep *hwdep; + int rc; + char id[] = "NOIRQ_NN"; + + snprintf(id, sizeof(id), "NOIRQ_%d", runtime->pcm->device); + pr_debug("%s: pcm dev %d\n", __func__, runtime->pcm->device); + rc = snd_hwdep_new(runtime->card->snd_card, + &id[0], + HWDEP_FE_BASE + runtime->pcm->device, + &hwdep); + if (!hwdep || rc < 0) { + pr_err("%s: hwdep intf failed to create %s - hwdep\n", __func__, + id); + return rc; + } + + hwdep->iface = SNDRV_HWDEP_IFACE_AUDIO_BE; /* for lack of a FE iface */ + hwdep->private_data = runtime->pcm; /* of type struct snd_pcm */ + hwdep->ops.ioctl = msm_pcm_hwdep_ioctl; + hwdep->ops.ioctl_compat = msm_pcm_hwdep_compat_ioctl; + return 0; +} static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd) { @@ -1027,7 +1170,9 @@ static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd) pr_err("%s: Could not add app type controls failed %d\n", __func__, ret); } - + ret = msm_pcm_add_hwdep_dev(rtd); + if (ret) + pr_err("%s: Could not add hw dep node\n", __func__); pcm->nonatomic = true; exit: return ret; @@ -1040,6 +1185,9 @@ static const struct snd_pcm_ops msm_pcm_ops = { .copy = msm_pcm_copy, .hw_params = msm_pcm_hw_params, .ioctl = msm_pcm_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = msm_pcm_compat_ioctl, +#endif .trigger = msm_pcm_trigger, .pointer = msm_pcm_pointer, .mmap = msm_pcm_mmap, diff --git a/sound/soc/msm/sdm660-common.c b/sound/soc/msm/sdm660-common.c index eddcb45e91..b34b04b830 100644 --- a/sound/soc/msm/sdm660-common.c +++ b/sound/soc/msm/sdm660-common.c @@ -12,6 +12,9 @@ #include #include +#include +#include +#include #include #include #include @@ -190,7 +193,7 @@ struct msm_wsa881x_dev_info { static struct snd_soc_aux_dev *msm_aux_dev; static struct snd_soc_codec_conf *msm_codec_conf; -static bool msm_swap_gnd_mic(struct snd_soc_codec *codec); +static bool msm_swap_gnd_mic(struct snd_soc_codec *codec, bool active); static struct wcd_mbhc_config mbhc_cfg = { .read_fw_bin = false, @@ -2038,16 +2041,16 @@ static void param_set_mask(struct snd_pcm_hw_params *p, int n, unsigned int bit) } } -static int msm_ext_disp_get_idx_from_beid(int32_t be_id) +static int msm_ext_disp_get_idx_from_beid(int32_t id) { int idx; - switch (be_id) { + switch (id) { case MSM_BACKEND_DAI_DISPLAY_PORT_RX: idx = DP_RX_IDX; break; default: - pr_err("%s: Incorrect ext_disp be_id %d\n", __func__, be_id); + pr_err("%s: Incorrect ext_disp id %d\n", __func__, id); idx = -EINVAL; break; } @@ -2077,7 +2080,7 @@ int msm_common_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, pr_debug("%s: format = %d, rate = %d\n", __func__, params_format(params), params_rate(params)); - switch (dai_link->be_id) { + switch (dai_link->id) { case MSM_BACKEND_DAI_USB_RX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, usb_rx_cfg.bit_format); @@ -2093,8 +2096,8 @@ int msm_common_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, break; case MSM_BACKEND_DAI_DISPLAY_PORT_RX: - idx = msm_ext_disp_get_idx_from_beid(dai_link->be_id); - if (IS_ERR_VALUE(idx)) { + idx = msm_ext_disp_get_idx_from_beid(dai_link->id); + if (idx < 0) { pr_err("%s: Incorrect ext disp idx %d\n", __func__, idx); rc = idx; @@ -2341,11 +2344,11 @@ void msm_aux_pcm_snd_shutdown(struct snd_pcm_substream *substream) } EXPORT_SYMBOL(msm_aux_pcm_snd_shutdown); -static int msm_get_port_id(int be_id) +static int msm_get_port_id(int id) { int afe_port_id; - switch (be_id) { + switch (id) { case MSM_BACKEND_DAI_PRI_MI2S_RX: afe_port_id = AFE_PORT_ID_PRIMARY_MI2S_RX; break; @@ -2371,7 +2374,7 @@ static int msm_get_port_id(int be_id) afe_port_id = AFE_PORT_ID_QUATERNARY_MI2S_TX; break; default: - pr_err("%s: Invalid be_id: %d\n", __func__, be_id); + pr_err("%s: Invalid id: %d\n", __func__, id); afe_port_id = -EINVAL; } @@ -2422,7 +2425,7 @@ static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable) int port_id = 0; int index = cpu_dai->id; - port_id = msm_get_port_id(rtd->dai_link->be_id); + port_id = msm_get_port_id(rtd->dai_link->id); if (port_id < 0) { dev_err(rtd->card->dev, "%s: Invalid port_id\n", __func__); ret = port_id; @@ -2461,7 +2464,7 @@ int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) int ret = 0; struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; - int port_id = msm_get_port_id(rtd->dai_link->be_id); + int port_id = msm_get_port_id(rtd->dai_link->id); int index = cpu_dai->id; unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS; @@ -2539,7 +2542,7 @@ void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream) { int ret; struct snd_soc_pcm_runtime *rtd = substream->private_data; - int port_id = msm_get_port_id(rtd->dai_link->be_id); + int port_id = msm_get_port_id(rtd->dai_link->id); int index = rtd->cpu_dai->id; pr_debug("%s(): substream = %s stream = %d\n", __func__, @@ -2594,7 +2597,7 @@ static int msm_prepare_us_euro(struct snd_soc_card *card) return ret; } -static bool msm_swap_gnd_mic(struct snd_soc_codec *codec) +static bool msm_swap_gnd_mic(struct snd_soc_codec *codec, bool active) { struct snd_soc_card *card = codec->component.card; struct msm_asoc_mach_data *pdata = @@ -2699,13 +2702,13 @@ codec_dai: dai_link[i].codec_name = NULL; } if (pdata->snd_card_val == INT_SND_CARD) { - if ((dai_link[i].be_id == + if ((dai_link[i].id == MSM_BACKEND_DAI_INT0_MI2S_RX) || - (dai_link[i].be_id == + (dai_link[i].id == MSM_BACKEND_DAI_INT1_MI2S_RX) || - (dai_link[i].be_id == + (dai_link[i].id == MSM_BACKEND_DAI_INT2_MI2S_TX) || - (dai_link[i].be_id == + (dai_link[i].id == MSM_BACKEND_DAI_INT3_MI2S_TX)) { index = of_property_match_string(cdev->of_node, "asoc-codec-names", diff --git a/sound/soc/msm/sdm660-ext-dai-links.c b/sound/soc/msm/sdm660-ext-dai-links.c index 1c03d8c9e7..77d3875d0a 100644 --- a/sound/soc/msm/sdm660-ext-dai-links.c +++ b/sound/soc/msm/sdm660-ext-dai-links.c @@ -86,8 +86,8 @@ static int msm_wcn_hw_params(struct snd_pcm_substream *substream, goto exit; } - dev_dbg(rtd->dev, "%s: tx_ch_cnt(%d) be_id %d\n", - __func__, tx_ch_cnt, dai_link->be_id); + dev_dbg(rtd->dev, "%s: tx_ch_cnt(%d) id %d\n", + __func__, tx_ch_cnt, dai_link->id); ret = snd_soc_dai_set_channel_map(cpu_dai, tx_ch_cnt, tx_ch, rx_ch_cnt, rx_ch); @@ -279,7 +279,7 @@ static struct snd_soc_dai_link msm_ext_tasha_fe_dai[] = { .platform_name = "msm-pcm-hostless", .codec_name = "tasha_codec", .codec_dai_name = "tasha_vifeedback", - .be_id = MSM_BACKEND_DAI_SLIMBUS_4_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_4_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, @@ -368,7 +368,7 @@ static struct snd_soc_dai_link msm_ext_tavil_fe_dai[] = { .platform_name = "msm-pcm-hostless", .codec_name = "tavil_codec", .codec_dai_name = "tavil_vifeedback", - .be_id = MSM_BACKEND_DAI_SLIMBUS_4_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_4_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, @@ -411,7 +411,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = { .codec_dai_name = "tasha_mix_rx1", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_0_RX, .init = &msm_audrx_init, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, /* this dainlink has playback support */ @@ -428,7 +428,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = { .codec_dai_name = "tasha_tx1", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_0_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ignore_suspend = 1, .ops = &msm_ext_slimbus_be_ops, @@ -442,7 +442,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = { .codec_dai_name = "tasha_mix_rx1", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_1_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_1_RX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, /* dai link has playback support */ @@ -458,7 +458,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = { .codec_dai_name = "tasha_tx3", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_1_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_1_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, .ignore_suspend = 1, @@ -472,7 +472,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = { .codec_dai_name = "tasha_mix_rx1", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_3_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_3_RX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, /* dai link has playback support */ @@ -489,7 +489,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = { .no_pcm = 1, .dpcm_capture = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_3_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_3_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, .ignore_suspend = 1, @@ -503,7 +503,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = { .codec_dai_name = "tasha_mix_rx1", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_4_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_4_RX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, /* dai link has playback support */ @@ -519,7 +519,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = { .codec_dai_name = "tasha_rx3", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_5_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_5_RX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, /* dai link has playback support */ @@ -536,7 +536,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = { .codec_dai_name = "tasha_mad1", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_5_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_5_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, .ignore_suspend = 1, @@ -550,7 +550,7 @@ static struct snd_soc_dai_link msm_ext_tasha_be_dai[] = { .codec_dai_name = "tasha_rx4", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_6_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_6_RX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, /* dai link has playback support */ @@ -569,7 +569,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = { .codec_dai_name = "tavil_rx1", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_0_RX, .init = &msm_audrx_init, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, /* this dainlink has playback support */ @@ -586,7 +586,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = { .codec_dai_name = "tavil_tx1", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_0_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ignore_suspend = 1, .ops = &msm_ext_slimbus_be_ops, @@ -600,7 +600,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = { .codec_dai_name = "tavil_rx1", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_1_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_1_RX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, /* dai link has playback support */ @@ -616,7 +616,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = { .codec_dai_name = "tavil_tx3", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_1_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_1_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, .ignore_suspend = 1, @@ -630,7 +630,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = { .codec_dai_name = "tavil_rx2", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_2_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_2_RX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, .ignore_pmdown_time = 1, @@ -645,7 +645,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = { .codec_dai_name = "tavil_rx1", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_3_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_3_RX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, /* dai link has playback support */ @@ -661,7 +661,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = { .codec_dai_name = "tavil_tx1", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_3_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_3_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, .ignore_suspend = 1, @@ -675,7 +675,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = { .codec_dai_name = "tavil_rx1", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_4_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_4_RX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, /* dai link has playback support */ @@ -691,7 +691,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = { .codec_dai_name = "tavil_rx3", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_5_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_5_RX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, /* dai link has playback support */ @@ -708,7 +708,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = { .codec_dai_name = "tavil_mad1", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_5_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_5_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, .ignore_suspend = 1, @@ -722,7 +722,7 @@ static struct snd_soc_dai_link msm_ext_tavil_be_dai[] = { .codec_dai_name = "tavil_rx4", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_6_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_6_RX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_ext_slimbus_be_ops, /* dai link has playback support */ @@ -748,7 +748,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .dpcm_capture = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA1 + .id = MSM_FRONTEND_DAI_MULTIMEDIA1 }, {/* hw:x,1 */ .name = MSM_DAILINK_NAME(Media2), @@ -765,7 +765,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA2, + .id = MSM_FRONTEND_DAI_MULTIMEDIA2, }, {/* hw:x,2 */ .name = "VoiceMMode1", @@ -782,7 +782,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_VOICEMMODE1, + .id = MSM_FRONTEND_DAI_VOICEMMODE1, }, {/* hw:x,3 */ .name = "MSM VoIP", @@ -799,7 +799,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, - .be_id = MSM_FRONTEND_DAI_VOIP, + .id = MSM_FRONTEND_DAI_VOIP, }, {/* hw:x,4 */ .name = MSM_DAILINK_NAME(ULL), @@ -815,7 +815,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA3, + .id = MSM_FRONTEND_DAI_MULTIMEDIA3, }, /* Hostless PCM purpose */ {/* hw:x,5 */ @@ -871,7 +871,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA4, + .id = MSM_FRONTEND_DAI_MULTIMEDIA4, }, {/* hw:x,9*/ .name = "AUXPCM Hostless", @@ -953,7 +953,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA5, + .id = MSM_FRONTEND_DAI_MULTIMEDIA5, }, /* LSM FE */ {/* hw:x,14 */ @@ -970,7 +970,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM1, + .id = MSM_FRONTEND_DAI_LSM1, }, {/* hw:x,15 */ .name = MSM_DAILINK_NAME(Compress2), @@ -987,7 +987,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA7, + .id = MSM_FRONTEND_DAI_MULTIMEDIA7, }, {/* hw:x,16 */ .name = MSM_DAILINK_NAME(Compress3), @@ -1004,7 +1004,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA10, + .id = MSM_FRONTEND_DAI_MULTIMEDIA10, }, {/* hw:x,17 */ .name = MSM_DAILINK_NAME(ULL_NOIRQ), @@ -1021,7 +1021,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA8, + .id = MSM_FRONTEND_DAI_MULTIMEDIA8, }, {/* hw:x,18 */ .name = "HDMI_RX_HOSTLESS", @@ -1053,7 +1053,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_VOICEMMODE2, + .id = MSM_FRONTEND_DAI_VOICEMMODE2, }, {/* hw:x,20 */ .name = "Listen 2 Audio Service", @@ -1069,7 +1069,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM2, + .id = MSM_FRONTEND_DAI_LSM2, }, {/* hw:x,21 */ .name = "Listen 3 Audio Service", @@ -1085,7 +1085,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM3, + .id = MSM_FRONTEND_DAI_LSM3, }, {/* hw:x,22 */ .name = "Listen 4 Audio Service", @@ -1101,7 +1101,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM4, + .id = MSM_FRONTEND_DAI_LSM4, }, {/* hw:x,23 */ .name = "Listen 5 Audio Service", @@ -1117,7 +1117,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM5, + .id = MSM_FRONTEND_DAI_LSM5, }, {/* hw:x,24 */ .name = "Listen 6 Audio Service", @@ -1133,7 +1133,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM6 + .id = MSM_FRONTEND_DAI_LSM6 }, {/* hw:x,25 */ .name = "Listen 7 Audio Service", @@ -1149,7 +1149,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM7, + .id = MSM_FRONTEND_DAI_LSM7, }, {/* hw:x,26 */ .name = "Listen 8 Audio Service", @@ -1165,7 +1165,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM8, + .id = MSM_FRONTEND_DAI_LSM8, }, {/* hw:x,27 */ .name = MSM_DAILINK_NAME(Media9), @@ -1182,7 +1182,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA9, + .id = MSM_FRONTEND_DAI_MULTIMEDIA9, }, {/* hw:x,28 */ .name = MSM_DAILINK_NAME(Compress4), @@ -1199,7 +1199,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA11, + .id = MSM_FRONTEND_DAI_MULTIMEDIA11, }, {/* hw:x,29 */ .name = MSM_DAILINK_NAME(Compress5), @@ -1216,7 +1216,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA12, + .id = MSM_FRONTEND_DAI_MULTIMEDIA12, }, {/* hw:x,30 */ .name = MSM_DAILINK_NAME(Compress6), @@ -1233,7 +1233,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA13, + .id = MSM_FRONTEND_DAI_MULTIMEDIA13, }, {/* hw:x,31 */ .name = MSM_DAILINK_NAME(Compress7), @@ -1250,7 +1250,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA14, + .id = MSM_FRONTEND_DAI_MULTIMEDIA14, }, {/* hw:x,32 */ .name = MSM_DAILINK_NAME(Compress8), @@ -1267,7 +1267,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA15, + .id = MSM_FRONTEND_DAI_MULTIMEDIA15, }, {/* hw:x,33 */ .name = MSM_DAILINK_NAME(Compress9), @@ -1284,7 +1284,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA16, + .id = MSM_FRONTEND_DAI_MULTIMEDIA16, }, {/* hw:x,34 */ .name = "SLIMBUS_8 Hostless", @@ -1332,7 +1332,7 @@ static struct snd_soc_dai_link msm_ext_common_fe_dai[] = { .ignore_suspend = 1, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ignore_pmdown_time = 1, - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA6, + .id = MSM_FRONTEND_DAI_MULTIMEDIA6, }, }; @@ -1346,7 +1346,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_AFE_PCM_RX, + .id = MSM_BACKEND_DAI_AFE_PCM_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, /* this dai link has playback support */ .ignore_pmdown_time = 1, @@ -1361,7 +1361,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_AFE_PCM_TX, + .id = MSM_BACKEND_DAI_AFE_PCM_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_suspend = 1, }, @@ -1375,7 +1375,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_INCALL_RECORD_TX, + .id = MSM_BACKEND_DAI_INCALL_RECORD_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ignore_suspend = 1, }, @@ -1389,7 +1389,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_INCALL_RECORD_RX, + .id = MSM_BACKEND_DAI_INCALL_RECORD_RX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ignore_suspend = 1, }, @@ -1403,7 +1403,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX, + .id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ignore_suspend = 1, }, @@ -1417,7 +1417,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_VOICE2_PLAYBACK_TX, + .id = MSM_BACKEND_DAI_VOICE2_PLAYBACK_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ignore_suspend = 1, }, @@ -1430,7 +1430,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_USB_RX, + .id = MSM_BACKEND_DAI_USB_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, @@ -1444,7 +1444,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_USB_TX, + .id = MSM_BACKEND_DAI_USB_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_suspend = 1, }, @@ -1457,7 +1457,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_PRI_TDM_RX_0, + .id = MSM_BACKEND_DAI_PRI_TDM_RX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -1471,7 +1471,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_PRI_TDM_TX_0, + .id = MSM_BACKEND_DAI_PRI_TDM_TX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -1485,7 +1485,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SEC_TDM_RX_0, + .id = MSM_BACKEND_DAI_SEC_TDM_RX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -1499,7 +1499,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SEC_TDM_TX_0, + .id = MSM_BACKEND_DAI_SEC_TDM_TX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -1513,7 +1513,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_TERT_TDM_RX_0, + .id = MSM_BACKEND_DAI_TERT_TDM_RX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -1527,7 +1527,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_TERT_TDM_TX_0, + .id = MSM_BACKEND_DAI_TERT_TDM_TX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -1541,7 +1541,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_QUAT_TDM_RX_0, + .id = MSM_BACKEND_DAI_QUAT_TDM_RX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -1555,7 +1555,7 @@ static struct snd_soc_dai_link msm_ext_common_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_QUAT_TDM_TX_0, + .id = MSM_BACKEND_DAI_QUAT_TDM_TX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -1572,7 +1572,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_PRI_MI2S_RX, + .id = MSM_BACKEND_DAI_PRI_MI2S_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -1587,7 +1587,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_PRI_MI2S_TX, + .id = MSM_BACKEND_DAI_PRI_MI2S_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -1601,7 +1601,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SECONDARY_MI2S_RX, + .id = MSM_BACKEND_DAI_SECONDARY_MI2S_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -1616,7 +1616,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SECONDARY_MI2S_TX, + .id = MSM_BACKEND_DAI_SECONDARY_MI2S_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -1630,7 +1630,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_TERTIARY_MI2S_RX, + .id = MSM_BACKEND_DAI_TERTIARY_MI2S_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -1645,7 +1645,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_TERTIARY_MI2S_TX, + .id = MSM_BACKEND_DAI_TERTIARY_MI2S_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -1659,7 +1659,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_QUATERNARY_MI2S_RX, + .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -1674,7 +1674,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_QUATERNARY_MI2S_TX, + .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -1692,7 +1692,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_AUXPCM_RX, + .id = MSM_BACKEND_DAI_AUXPCM_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, @@ -1707,7 +1707,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_AUXPCM_TX, + .id = MSM_BACKEND_DAI_AUXPCM_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, @@ -1723,7 +1723,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SEC_AUXPCM_RX, + .id = MSM_BACKEND_DAI_SEC_AUXPCM_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, @@ -1738,7 +1738,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SEC_AUXPCM_TX, + .id = MSM_BACKEND_DAI_SEC_AUXPCM_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_suspend = 1, .ignore_pmdown_time = 1, @@ -1754,7 +1754,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_TERT_AUXPCM_RX, + .id = MSM_BACKEND_DAI_TERT_AUXPCM_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, @@ -1769,7 +1769,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_TERT_AUXPCM_TX, + .id = MSM_BACKEND_DAI_TERT_AUXPCM_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_suspend = 1, .ignore_pmdown_time = 1, @@ -1785,7 +1785,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_QUAT_AUXPCM_RX, + .id = MSM_BACKEND_DAI_QUAT_AUXPCM_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, @@ -1800,7 +1800,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_QUAT_AUXPCM_TX, + .id = MSM_BACKEND_DAI_QUAT_AUXPCM_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_suspend = 1, .ignore_pmdown_time = 1, @@ -1822,7 +1822,7 @@ static struct snd_soc_dai_link msm_wcn_be_dai_links[] = { .codec_dai_name = "btfm_bt_sco_a2dp_slim_rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_7_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_7_RX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_wcn_ops, /* dai link has playback support */ @@ -1838,7 +1838,7 @@ static struct snd_soc_dai_link msm_wcn_be_dai_links[] = { .codec_dai_name = "btfm_bt_sco_slim_tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_7_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_7_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .ops = &msm_wcn_ops, .ignore_suspend = 1, @@ -1852,7 +1852,7 @@ static struct snd_soc_dai_link msm_wcn_be_dai_links[] = { .codec_dai_name = "btfm_fm_slim_tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_8_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_8_TX, .be_hw_params_fixup = msm_ext_be_hw_params_fixup, .init = &msm_wcn_init, .ops = &msm_wcn_ops, @@ -1871,7 +1871,7 @@ static struct snd_soc_dai_link ext_disp_be_dai_link[] = { .codec_dai_name = "msm_dp_audio_codec_rx_dai", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_DISPLAY_PORT_RX, + .id = MSM_BACKEND_DAI_DISPLAY_PORT_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, diff --git a/sound/soc/msm/sdm660-external.c b/sound/soc/msm/sdm660-external.c index 2c3d7fc3e6..84d1c2ea9b 100644 --- a/sound/soc/msm/sdm660-external.c +++ b/sound/soc/msm/sdm660-external.c @@ -747,11 +747,11 @@ static const struct snd_kcontrol_new msm_snd_controls[] = { msm_bt_sample_rate_put), }; -static int msm_slim_get_ch_from_beid(int32_t be_id) +static int msm_slim_get_ch_from_beid(int32_t id) { int ch_id = 0; - switch (be_id) { + switch (id) { case MSM_BACKEND_DAI_SLIMBUS_0_RX: ch_id = SLIM_RX_0; break; @@ -821,14 +821,14 @@ int msm_ext_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, pr_debug("%s: format = %d, rate = %d\n", __func__, params_format(params), params_rate(params)); - switch (dai_link->be_id) { + switch (dai_link->id) { case MSM_BACKEND_DAI_SLIMBUS_0_RX: case MSM_BACKEND_DAI_SLIMBUS_1_RX: case MSM_BACKEND_DAI_SLIMBUS_2_RX: case MSM_BACKEND_DAI_SLIMBUS_3_RX: case MSM_BACKEND_DAI_SLIMBUS_4_RX: case MSM_BACKEND_DAI_SLIMBUS_6_RX: - idx = msm_slim_get_ch_from_beid(dai_link->be_id); + idx = msm_slim_get_ch_from_beid(dai_link->id); param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, slim_rx_cfg[idx].bit_format); rate->min = rate->max = slim_rx_cfg[idx].sample_rate; @@ -837,7 +837,7 @@ int msm_ext_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, case MSM_BACKEND_DAI_SLIMBUS_0_TX: case MSM_BACKEND_DAI_SLIMBUS_3_TX: - idx = msm_slim_get_ch_from_beid(dai_link->be_id); + idx = msm_slim_get_ch_from_beid(dai_link->id); param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, slim_tx_cfg[idx].bit_format); rate->min = rate->max = slim_tx_cfg[idx].sample_rate; @@ -938,15 +938,15 @@ int msm_snd_hw_params(struct snd_pcm_substream *substream, __func__, ret); goto err_ch_map; } - if (dai_link->be_id == MSM_BACKEND_DAI_SLIMBUS_5_RX) { + if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_5_RX) { pr_debug("%s: rx_5_ch=%d\n", __func__, slim_rx_cfg[5].channels); rx_ch_count = slim_rx_cfg[5].channels; - } else if (dai_link->be_id == MSM_BACKEND_DAI_SLIMBUS_2_RX) { + } else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_2_RX) { pr_debug("%s: rx_2_ch=%d\n", __func__, slim_rx_cfg[2].channels); rx_ch_count = slim_rx_cfg[2].channels; - } else if (dai_link->be_id == MSM_BACKEND_DAI_SLIMBUS_6_RX) { + } else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_6_RX) { pr_debug("%s: rx_6_ch=%d\n", __func__, slim_rx_cfg[6].channels); rx_ch_count = slim_rx_cfg[6].channels; @@ -973,19 +973,19 @@ int msm_snd_hw_params(struct snd_pcm_substream *substream, goto err_ch_map; } /* For _tx1 case */ - if (dai_link->be_id == MSM_BACKEND_DAI_SLIMBUS_0_TX) + if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_0_TX) user_set_tx_ch = slim_tx_cfg[0].channels; /* For _tx3 case */ - else if (dai_link->be_id == MSM_BACKEND_DAI_SLIMBUS_1_TX) + else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_1_TX) user_set_tx_ch = slim_tx_cfg[1].channels; - else if (dai_link->be_id == MSM_BACKEND_DAI_SLIMBUS_4_TX) + else if (dai_link->id == MSM_BACKEND_DAI_SLIMBUS_4_TX) user_set_tx_ch = msm_vi_feed_tx_ch; else user_set_tx_ch = tx_ch_cnt; - pr_debug("%s: msm_slim_0_tx_ch(%d) user_set_tx_ch(%d) tx_ch_cnt(%d), be_id (%d)\n", + pr_debug("%s: msm_slim_0_tx_ch(%d) user_set_tx_ch(%d) tx_ch_cnt(%d), id (%d)\n", __func__, slim_tx_cfg[0].channels, user_set_tx_ch, - tx_ch_cnt, dai_link->be_id); + tx_ch_cnt, dai_link->id); ret = snd_soc_dai_set_channel_map(cpu_dai, user_set_tx_ch, tx_ch, 0, 0); @@ -1097,8 +1097,8 @@ int msm_snd_cpe_hw_params(struct snd_pcm_substream *substream, goto end; } - pr_debug("%s: tx_ch_cnt(%d) be_id %d\n", - __func__, tx_ch_cnt, dai_link->be_id); + pr_debug("%s: tx_ch_cnt(%d) id %d\n", + __func__, tx_ch_cnt, dai_link->id); ret = snd_soc_dai_set_channel_map(cpu_dai, tx_ch_cnt, tx_ch, 0, 0); @@ -1495,7 +1495,7 @@ int msm_audrx_init(struct snd_soc_pcm_runtime *rtd) snd_soc_codec_get_dapm(codec); struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai; - struct snd_soc_pcm_runtime *rtd_aux = rtd->card->rtd_aux; + struct snd_soc_component *aux_comp; struct snd_card *card; struct snd_info_entry *entry; struct msm_asoc_mach_data *pdata = @@ -1678,13 +1678,20 @@ int msm_audrx_init(struct snd_soc_pcm_runtime *rtd) * Send speaker configuration only for WSA8810. * Defalut configuration is for WSA8815. */ + pr_debug("%s: Number of aux devices: %d\n", + __func__, rtd->card->num_aux_devs); + if (!strcmp(dev_name(codec_dai->dev), "tavil_codec")) { - if (rtd_aux && rtd_aux->component) - if (!strcmp(rtd_aux->component->name, WSA8810_NAME_1) || - !strcmp(rtd_aux->component->name, WSA8810_NAME_2)) { + if (rtd->card->num_aux_devs && + !list_empty(&rtd->card->aux_comp_list)) { + aux_comp = list_first_entry(&rtd->card->aux_comp_list, + struct snd_soc_component, list_aux); + if (!strcmp(aux_comp->name, WSA8810_NAME_1) || + !strcmp(aux_comp->name, WSA8810_NAME_2)) { tavil_set_spkr_mode(rtd->codec, SPKR_MODE_1); tavil_set_spkr_gain_offset(rtd->codec, RX_GAIN_OFFSET_M1P5_DB); + } } card = rtd->card->snd_card; entry = snd_info_create_subdir(card->module, "codecs", @@ -1698,12 +1705,16 @@ int msm_audrx_init(struct snd_soc_pcm_runtime *rtd) pdata->codec_root = entry; tavil_codec_info_create_codec_entry(pdata->codec_root, codec); } else { - if (rtd_aux && rtd_aux->component) - if (!strcmp(rtd_aux->component->name, WSA8810_NAME_1) || - !strcmp(rtd_aux->component->name, WSA8810_NAME_2)) { + if (rtd->card->num_aux_devs && + !list_empty(&rtd->card->aux_comp_list)) { + aux_comp = list_first_entry(&rtd->card->aux_comp_list, + struct snd_soc_component, list_aux); + if (!strcmp(aux_comp->name, WSA8810_NAME_1) || + !strcmp(aux_comp->name, WSA8810_NAME_2)) { tasha_set_spkr_mode(rtd->codec, SPKR_MODE_1); tasha_set_spkr_gain_offset(rtd->codec, RX_GAIN_OFFSET_M1P5_DB); + } } card = rtd->card->snd_card; entry = snd_info_create_subdir(card->module, "codecs", diff --git a/sound/soc/msm/sdm660-internal.c b/sound/soc/msm/sdm660-internal.c index 802137ba4b..a57d6f6119 100644 --- a/sound/soc/msm/sdm660-internal.c +++ b/sound/soc/msm/sdm660-internal.c @@ -539,11 +539,11 @@ static int enable_spk_ext_pa(struct snd_soc_codec *codec, int enable) return 0; } -static int int_mi2s_get_idx_from_beid(int32_t be_id) +static int int_mi2s_get_idx_from_beid(int32_t id) { int idx = 0; - switch (be_id) { + switch (id) { case MSM_BACKEND_DAI_INT0_MI2S_RX: idx = INT0_MI2S; break; @@ -596,13 +596,13 @@ static int int_mi2s_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, pr_debug("%s: format = %d, rate = %d\n", __func__, params_format(params), params_rate(params)); - switch (dai_link->be_id) { + switch (dai_link->id) { case MSM_BACKEND_DAI_INT0_MI2S_RX: case MSM_BACKEND_DAI_INT2_MI2S_TX: case MSM_BACKEND_DAI_INT3_MI2S_TX: case MSM_BACKEND_DAI_INT4_MI2S_RX: case MSM_BACKEND_DAI_INT5_MI2S_TX: - idx = int_mi2s_get_idx_from_beid(dai_link->be_id); + idx = int_mi2s_get_idx_from_beid(dai_link->id); rate->min = rate->max = int_mi2s_cfg[idx].sample_rate; channels->min = channels->max = int_mi2s_cfg[idx].channels; @@ -625,7 +625,7 @@ static int msm_btfm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); - switch (dai_link->be_id) { + switch (dai_link->id) { case MSM_BACKEND_DAI_SLIMBUS_7_RX: case MSM_BACKEND_DAI_SLIMBUS_7_TX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, @@ -982,11 +982,11 @@ static int msm_int_mclk0_event(struct snd_soc_dapm_widget *w, return 0; } -static int int_mi2s_get_port_id(int be_id) +static int int_mi2s_get_port_id(int id) { int afe_port_id; - switch (be_id) { + switch (id) { case MSM_BACKEND_DAI_INT0_MI2S_RX: afe_port_id = AFE_PORT_ID_INT0_MI2S_RX; break; @@ -1003,7 +1003,7 @@ static int int_mi2s_get_port_id(int be_id) afe_port_id = AFE_PORT_ID_INT5_MI2S_TX; break; default: - pr_err("%s: Invalid be_id: %d\n", __func__, be_id); + pr_err("%s: Invalid id: %d\n", __func__, id); afe_port_id = -EINVAL; } @@ -1073,7 +1073,7 @@ static int int_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable) int port_id = 0; int index; - port_id = int_mi2s_get_port_id(rtd->dai_link->be_id); + port_id = int_mi2s_get_port_id(rtd->dai_link->id); if (port_id < 0) { dev_err(rtd->card->dev, "%s: Invalid port_id\n", __func__); ret = port_id; @@ -1303,7 +1303,7 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd) card = rtd->card->snd_card; if (!codec_root) - codec_root = snd_register_module_info(card->module, "codecs", + codec_root = snd_info_create_subdir(card->module, "codecs", card->proc_root); if (!codec_root) { pr_debug("%s: Cannot create codecs module entry\n", @@ -1323,7 +1323,7 @@ static int msm_sdw_audrx_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(rtd->card); - struct snd_soc_pcm_runtime *rtd_aux = rtd->card->rtd_aux; + struct snd_soc_component *aux_comp; struct snd_card *card; snd_soc_add_codec_controls(codec, msm_sdw_controls, @@ -1342,16 +1342,22 @@ static int msm_sdw_audrx_init(struct snd_soc_pcm_runtime *rtd) * Send speaker configuration only for WSA8810. * Default configuration is for WSA8815. */ - if (rtd_aux && rtd_aux->component) - if (!strcmp(rtd_aux->component->name, WSA8810_NAME_1) || - !strcmp(rtd_aux->component->name, WSA8810_NAME_2)) { + pr_debug("%s: Number of aux devices: %d\n", + __func__, rtd->card->num_aux_devs); + if (rtd->card->num_aux_devs && + !list_empty(&rtd->card->aux_comp_list)) { + aux_comp = list_first_entry(&rtd->card->aux_comp_list, + struct snd_soc_component, list_aux); + if (!strcmp(aux_comp->name, WSA8810_NAME_1) || + !strcmp(aux_comp->name, WSA8810_NAME_2)) { msm_sdw_set_spkr_mode(rtd->codec, SPKR_MODE_1); msm_sdw_set_spkr_gain_offset(rtd->codec, RX_GAIN_OFFSET_M1P5_DB); + } } card = rtd->card->snd_card; if (!codec_root) - codec_root = snd_register_module_info(card->module, "codecs", + codec_root = snd_info_create_subdir(card->module, "codecs", card->proc_root); if (!codec_root) { pr_debug("%s: Cannot create codecs module entry\n", @@ -1396,8 +1402,8 @@ static int msm_wcn_hw_params(struct snd_pcm_substream *substream, goto exit; } - dev_dbg(rtd->dev, "%s: tx_ch_cnt(%d) be_id %d\n", - __func__, tx_ch_cnt, dai_link->be_id); + dev_dbg(rtd->dev, "%s: tx_ch_cnt(%d) id %d\n", + __func__, tx_ch_cnt, dai_link->id); ret = snd_soc_dai_set_channel_map(cpu_dai, tx_ch_cnt, tx_ch, rx_ch_cnt, rx_ch); @@ -1669,7 +1675,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .dpcm_capture = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA1 + .id = MSM_FRONTEND_DAI_MULTIMEDIA1 }, {/* hw:x,1 */ .name = MSM_DAILINK_NAME(Media2), @@ -1686,7 +1692,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA2, + .id = MSM_FRONTEND_DAI_MULTIMEDIA2, }, {/* hw:x,2 */ .name = "VoiceMMode1", @@ -1703,7 +1709,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_VOICEMMODE1, + .id = MSM_FRONTEND_DAI_VOICEMMODE1, }, {/* hw:x,3 */ .name = "MSM VoIP", @@ -1720,7 +1726,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, - .be_id = MSM_FRONTEND_DAI_VOIP, + .id = MSM_FRONTEND_DAI_VOIP, }, {/* hw:x,4 */ .name = MSM_DAILINK_NAME(ULL), @@ -1736,7 +1742,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA3, + .id = MSM_FRONTEND_DAI_MULTIMEDIA3, }, /* Hostless PCM purpose */ {/* hw:x,5 */ @@ -1792,7 +1798,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA4, + .id = MSM_FRONTEND_DAI_MULTIMEDIA4, }, {/* hw:x,9*/ .name = "AUXPCM Hostless", @@ -1873,7 +1879,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, /* this dai link has playback support */ .ignore_pmdown_time = 1, - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA5, + .id = MSM_FRONTEND_DAI_MULTIMEDIA5, }, /* LSM FE */ {/* hw:x,14 */ @@ -1890,7 +1896,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM1, + .id = MSM_FRONTEND_DAI_LSM1, }, {/* hw:x,15 */ .name = MSM_DAILINK_NAME(Compress2), @@ -1905,7 +1911,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .ignore_suspend = 1, - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA7, + .id = MSM_FRONTEND_DAI_MULTIMEDIA7, }, {/* hw:x,16 */ .name = MSM_DAILINK_NAME(Compress3), @@ -1922,7 +1928,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA10, + .id = MSM_FRONTEND_DAI_MULTIMEDIA10, }, {/* hw:x,17 */ .name = MSM_DAILINK_NAME(ULL_NOIRQ), @@ -1939,7 +1945,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA8, + .id = MSM_FRONTEND_DAI_MULTIMEDIA8, }, {/* hw:x,18 */ .name = "HDMI_RX_HOSTLESS", @@ -1971,7 +1977,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_VOICEMMODE2, + .id = MSM_FRONTEND_DAI_VOICEMMODE2, }, {/* hw:x,20 */ .name = "Listen 2 Audio Service", @@ -1987,7 +1993,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM2, + .id = MSM_FRONTEND_DAI_LSM2, }, {/* hw:x,21 */ .name = "Listen 3 Audio Service", @@ -2003,7 +2009,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM3, + .id = MSM_FRONTEND_DAI_LSM3, }, {/* hw:x,22 */ .name = "Listen 4 Audio Service", @@ -2019,7 +2025,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM4, + .id = MSM_FRONTEND_DAI_LSM4, }, {/* hw:x,23 */ .name = "Listen 5 Audio Service", @@ -2035,7 +2041,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM5, + .id = MSM_FRONTEND_DAI_LSM5, }, {/* hw:x,24 */ .name = "Listen 6 Audio Service", @@ -2051,7 +2057,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM6 + .id = MSM_FRONTEND_DAI_LSM6 }, {/* hw:x,25 */ .name = "Listen 7 Audio Service", @@ -2067,7 +2073,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM7, + .id = MSM_FRONTEND_DAI_LSM7, }, {/* hw:x,26 */ .name = "Listen 8 Audio Service", @@ -2083,7 +2089,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_pmdown_time = 1, .codec_dai_name = "snd-soc-dummy-dai", .codec_name = "snd-soc-dummy", - .be_id = MSM_FRONTEND_DAI_LSM8, + .id = MSM_FRONTEND_DAI_LSM8, }, {/* hw:x,27 */ .name = MSM_DAILINK_NAME(Media9), @@ -2100,7 +2106,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA9, + .id = MSM_FRONTEND_DAI_MULTIMEDIA9, }, {/* hw:x,28 */ .name = MSM_DAILINK_NAME(Compress4), @@ -2117,7 +2123,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA11, + .id = MSM_FRONTEND_DAI_MULTIMEDIA11, }, {/* hw:x,29 */ .name = MSM_DAILINK_NAME(Compress5), @@ -2134,7 +2140,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA12, + .id = MSM_FRONTEND_DAI_MULTIMEDIA12, }, {/* hw:x,30 */ .name = MSM_DAILINK_NAME(Compress6), @@ -2151,7 +2157,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA13, + .id = MSM_FRONTEND_DAI_MULTIMEDIA13, }, {/* hw:x,31 */ .name = MSM_DAILINK_NAME(Compress7), @@ -2168,7 +2174,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA14, + .id = MSM_FRONTEND_DAI_MULTIMEDIA14, }, {/* hw:x,32 */ .name = MSM_DAILINK_NAME(Compress8), @@ -2185,7 +2191,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA15, + .id = MSM_FRONTEND_DAI_MULTIMEDIA15, }, {/* hw:x,33 */ .name = MSM_DAILINK_NAME(Compress9), @@ -2202,7 +2208,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, .ignore_pmdown_time = 1, /* this dai link has playback support */ - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA16, + .id = MSM_FRONTEND_DAI_MULTIMEDIA16, }, {/* hw:x,34 */ .name = "SLIMBUS_8 Hostless", @@ -2302,7 +2308,7 @@ static struct snd_soc_dai_link msm_int_dai[] = { .ignore_suspend = 1, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, .ignore_pmdown_time = 1, - .be_id = MSM_FRONTEND_DAI_MULTIMEDIA6, + .id = MSM_FRONTEND_DAI_MULTIMEDIA6, }, }; @@ -2315,7 +2321,7 @@ static struct snd_soc_dai_link msm_int_wsa_dai[] = { .platform_name = "msm-pcm-hostless", .codec_name = "msm_sdw_codec", .codec_dai_name = "msm_sdw_vifeedback", - .be_id = MSM_BACKEND_DAI_INT5_MI2S_TX, + .id = MSM_BACKEND_DAI_INT5_MI2S_TX, .be_hw_params_fixup = int_mi2s_be_hw_params_fixup, .ops = &msm_sdw_mi2s_be_ops, .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, @@ -2338,7 +2344,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .dpcm_playback = 1, .async_ops = ASYNC_DPCM_SND_SOC_PREPARE | ASYNC_DPCM_SND_SOC_HW_PARAMS, - .be_id = MSM_BACKEND_DAI_INT0_MI2S_RX, + .id = MSM_BACKEND_DAI_INT0_MI2S_RX, .init = &msm_audrx_init, .be_hw_params_fixup = int_mi2s_be_hw_params_fixup, .ops = &msm_int_mi2s_be_ops, @@ -2355,7 +2361,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .dpcm_capture = 1, .async_ops = ASYNC_DPCM_SND_SOC_PREPARE | ASYNC_DPCM_SND_SOC_HW_PARAMS, - .be_id = MSM_BACKEND_DAI_INT3_MI2S_TX, + .id = MSM_BACKEND_DAI_INT3_MI2S_TX, .be_hw_params_fixup = int_mi2s_be_hw_params_fixup, .ops = &msm_int_mi2s_be_ops, .ignore_suspend = 1, @@ -2371,7 +2377,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .dpcm_capture = 1, .async_ops = ASYNC_DPCM_SND_SOC_PREPARE | ASYNC_DPCM_SND_SOC_HW_PARAMS, - .be_id = MSM_BACKEND_DAI_INT2_MI2S_TX, + .id = MSM_BACKEND_DAI_INT2_MI2S_TX, .be_hw_params_fixup = int_mi2s_be_hw_params_fixup, .ops = &msm_int_mi2s_be_ops, .ignore_suspend = 1, @@ -2385,7 +2391,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_AFE_PCM_RX, + .id = MSM_BACKEND_DAI_AFE_PCM_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, /* this dainlink has playback support */ .ignore_pmdown_time = 1, @@ -2400,7 +2406,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_AFE_PCM_TX, + .id = MSM_BACKEND_DAI_AFE_PCM_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_suspend = 1, }, @@ -2414,7 +2420,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_INCALL_RECORD_TX, + .id = MSM_BACKEND_DAI_INCALL_RECORD_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, }, @@ -2428,7 +2434,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_INCALL_RECORD_RX, + .id = MSM_BACKEND_DAI_INCALL_RECORD_RX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, }, @@ -2442,7 +2448,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX, + .id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, }, @@ -2456,7 +2462,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_VOICE2_PLAYBACK_TX, + .id = MSM_BACKEND_DAI_VOICE2_PLAYBACK_TX, .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, }, @@ -2469,7 +2475,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_USB_RX, + .id = MSM_BACKEND_DAI_USB_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, @@ -2483,7 +2489,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_USB_TX, + .id = MSM_BACKEND_DAI_USB_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_suspend = 1, }, @@ -2496,7 +2502,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_PRI_TDM_RX_0, + .id = MSM_BACKEND_DAI_PRI_TDM_RX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -2510,7 +2516,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_PRI_TDM_TX_0, + .id = MSM_BACKEND_DAI_PRI_TDM_TX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -2524,7 +2530,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SEC_TDM_RX_0, + .id = MSM_BACKEND_DAI_SEC_TDM_RX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -2538,7 +2544,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SEC_TDM_TX_0, + .id = MSM_BACKEND_DAI_SEC_TDM_TX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -2552,7 +2558,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_TERT_TDM_RX_0, + .id = MSM_BACKEND_DAI_TERT_TDM_RX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -2566,7 +2572,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_TERT_TDM_TX_0, + .id = MSM_BACKEND_DAI_TERT_TDM_TX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -2580,7 +2586,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_QUAT_TDM_RX_0, + .id = MSM_BACKEND_DAI_QUAT_TDM_RX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -2594,7 +2600,7 @@ static struct snd_soc_dai_link msm_int_be_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_QUAT_TDM_TX_0, + .id = MSM_BACKEND_DAI_QUAT_TDM_TX_0, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_tdm_be_ops, .ignore_suspend = 1, @@ -2611,7 +2617,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_PRI_MI2S_RX, + .id = MSM_BACKEND_DAI_PRI_MI2S_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -2626,7 +2632,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_PRI_MI2S_TX, + .id = MSM_BACKEND_DAI_PRI_MI2S_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -2640,7 +2646,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SECONDARY_MI2S_RX, + .id = MSM_BACKEND_DAI_SECONDARY_MI2S_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -2655,7 +2661,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SECONDARY_MI2S_TX, + .id = MSM_BACKEND_DAI_SECONDARY_MI2S_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -2669,7 +2675,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_TERTIARY_MI2S_RX, + .id = MSM_BACKEND_DAI_TERTIARY_MI2S_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -2684,7 +2690,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_TERTIARY_MI2S_TX, + .id = MSM_BACKEND_DAI_TERTIARY_MI2S_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -2698,7 +2704,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_QUATERNARY_MI2S_RX, + .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -2713,7 +2719,7 @@ static struct snd_soc_dai_link msm_mi2s_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_QUATERNARY_MI2S_TX, + .id = MSM_BACKEND_DAI_QUATERNARY_MI2S_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ops = &msm_mi2s_be_ops, .ignore_suspend = 1, @@ -2731,7 +2737,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_AUXPCM_RX, + .id = MSM_BACKEND_DAI_AUXPCM_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, @@ -2746,7 +2752,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_AUXPCM_TX, + .id = MSM_BACKEND_DAI_AUXPCM_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, @@ -2762,7 +2768,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SEC_AUXPCM_RX, + .id = MSM_BACKEND_DAI_SEC_AUXPCM_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, @@ -2777,7 +2783,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SEC_AUXPCM_TX, + .id = MSM_BACKEND_DAI_SEC_AUXPCM_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_suspend = 1, .ignore_pmdown_time = 1, @@ -2793,7 +2799,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_TERT_AUXPCM_RX, + .id = MSM_BACKEND_DAI_TERT_AUXPCM_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, @@ -2808,7 +2814,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_TERT_AUXPCM_TX, + .id = MSM_BACKEND_DAI_TERT_AUXPCM_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_suspend = 1, .ignore_pmdown_time = 1, @@ -2824,7 +2830,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_QUAT_AUXPCM_RX, + .id = MSM_BACKEND_DAI_QUAT_AUXPCM_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, @@ -2839,7 +2845,7 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_QUAT_AUXPCM_TX, + .id = MSM_BACKEND_DAI_QUAT_AUXPCM_TX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_suspend = 1, .ignore_pmdown_time = 1, @@ -2862,7 +2868,7 @@ static struct snd_soc_dai_link msm_wcn_be_dai_links[] = { .codec_dai_name = "btfm_bt_sco_a2dp_slim_rx", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_7_RX, + .id = MSM_BACKEND_DAI_SLIMBUS_7_RX, .be_hw_params_fixup = msm_btfm_be_hw_params_fixup, .ops = &msm_wcn_ops, /* dai link has playback support */ @@ -2878,7 +2884,7 @@ static struct snd_soc_dai_link msm_wcn_be_dai_links[] = { .codec_dai_name = "btfm_bt_sco_slim_tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_7_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_7_TX, .be_hw_params_fixup = msm_btfm_be_hw_params_fixup, .ops = &msm_wcn_ops, .ignore_suspend = 1, @@ -2892,7 +2898,7 @@ static struct snd_soc_dai_link msm_wcn_be_dai_links[] = { .codec_dai_name = "btfm_fm_slim_tx", .no_pcm = 1, .dpcm_capture = 1, - .be_id = MSM_BACKEND_DAI_SLIMBUS_8_TX, + .id = MSM_BACKEND_DAI_SLIMBUS_8_TX, .be_hw_params_fixup = msm_btfm_be_hw_params_fixup, .init = &msm_wcn_init, .ops = &msm_wcn_ops, @@ -2910,7 +2916,7 @@ static struct snd_soc_dai_link msm_wsa_be_dai_links[] = { .codec_dai_name = "msm_sdw_i2s_rx1", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_INT4_MI2S_RX, + .id = MSM_BACKEND_DAI_INT4_MI2S_RX, .init = &msm_sdw_audrx_init, .be_hw_params_fixup = int_mi2s_be_hw_params_fixup, .ops = &msm_sdw_mi2s_be_ops, @@ -2929,7 +2935,7 @@ static struct snd_soc_dai_link ext_disp_be_dai_link[] = { .codec_dai_name = "msm_dp_audio_codec_rx_dai", .no_pcm = 1, .dpcm_playback = 1, - .be_id = MSM_BACKEND_DAI_DISPLAY_PORT_RX, + .id = MSM_BACKEND_DAI_DISPLAY_PORT_RX, .be_hw_params_fixup = msm_common_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, diff --git a/sound/soc/msm/sdm845.c b/sound/soc/msm/sdm845.c index d3c4e05c65..3be194cdc4 100644 --- a/sound/soc/msm/sdm845.c +++ b/sound/soc/msm/sdm845.c @@ -495,6 +495,8 @@ static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_rx_chs, mi2s_ch_text); static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_tx_chs, mi2s_ch_text); static SOC_ENUM_SINGLE_EXT_DECL(mi2s_rx_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(mi2s_tx_format, bit_format_text); +static SOC_ENUM_SINGLE_EXT_DECL(aux_pcm_rx_format, bit_format_text); +static SOC_ENUM_SINGLE_EXT_DECL(aux_pcm_tx_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(hifi_function, hifi_text); static struct platform_device *spdev; @@ -538,10 +540,10 @@ static struct wcd_mbhc_config wcd_mbhc_cfg = { }; static struct snd_soc_dapm_route wcd_audio_paths[] = { - {"MIC BIAS1", NULL, "MCLK"}, - {"MIC BIAS2", NULL, "MCLK"}, - {"MIC BIAS3", NULL, "MCLK"}, - {"MIC BIAS4", NULL, "MCLK"}, + {"MIC BIAS1", NULL, "MCLK TX"}, + {"MIC BIAS2", NULL, "MCLK TX"}, + {"MIC BIAS3", NULL, "MCLK TX"}, + {"MIC BIAS4", NULL, "MCLK TX"}, }; static struct afe_clk_set mi2s_clk[MI2S_MAX] = { @@ -2252,7 +2254,7 @@ static int mi2s_get_sample_rate(int value) return sample_rate; } -static int mi2s_get_format(int value) +static int mi2s_auxpcm_get_format(int value) { int format; @@ -2276,7 +2278,7 @@ static int mi2s_get_format(int value) return format; } -static int mi2s_get_format_value(int format) +static int mi2s_auxpcm_get_format_value(int format) { int value; @@ -2441,7 +2443,7 @@ static int msm_mi2s_rx_format_get(struct snd_kcontrol *kcontrol, return idx; ucontrol->value.enumerated.item[0] = - mi2s_get_format_value(mi2s_rx_cfg[idx].bit_format); + mi2s_auxpcm_get_format_value(mi2s_rx_cfg[idx].bit_format); pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__, idx, mi2s_rx_cfg[idx].bit_format, @@ -2459,7 +2461,7 @@ static int msm_mi2s_rx_format_put(struct snd_kcontrol *kcontrol, return idx; mi2s_rx_cfg[idx].bit_format = - mi2s_get_format(ucontrol->value.enumerated.item[0]); + mi2s_auxpcm_get_format(ucontrol->value.enumerated.item[0]); pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__, idx, mi2s_rx_cfg[idx].bit_format, @@ -2477,7 +2479,7 @@ static int msm_mi2s_tx_format_get(struct snd_kcontrol *kcontrol, return idx; ucontrol->value.enumerated.item[0] = - mi2s_get_format_value(mi2s_tx_cfg[idx].bit_format); + mi2s_auxpcm_get_format_value(mi2s_tx_cfg[idx].bit_format); pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__, idx, mi2s_tx_cfg[idx].bit_format, @@ -2495,7 +2497,7 @@ static int msm_mi2s_tx_format_put(struct snd_kcontrol *kcontrol, return idx; mi2s_tx_cfg[idx].bit_format = - mi2s_get_format(ucontrol->value.enumerated.item[0]); + mi2s_auxpcm_get_format(ucontrol->value.enumerated.item[0]); pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__, idx, mi2s_tx_cfg[idx].bit_format, @@ -2504,6 +2506,78 @@ static int msm_mi2s_tx_format_put(struct snd_kcontrol *kcontrol, return 0; } +static int msm_aux_pcm_rx_format_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + int idx = aux_pcm_get_port_idx(kcontrol); + + if (idx < 0) + return idx; + + ucontrol->value.enumerated.item[0] = + mi2s_auxpcm_get_format_value(aux_pcm_rx_cfg[idx].bit_format); + + pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__, + idx, aux_pcm_rx_cfg[idx].bit_format, + ucontrol->value.enumerated.item[0]); + + return 0; +} + +static int msm_aux_pcm_rx_format_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + int idx = aux_pcm_get_port_idx(kcontrol); + + if (idx < 0) + return idx; + + aux_pcm_rx_cfg[idx].bit_format = + mi2s_auxpcm_get_format(ucontrol->value.enumerated.item[0]); + + pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__, + idx, aux_pcm_rx_cfg[idx].bit_format, + ucontrol->value.enumerated.item[0]); + + return 0; +} + +static int msm_aux_pcm_tx_format_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + int idx = aux_pcm_get_port_idx(kcontrol); + + if (idx < 0) + return idx; + + ucontrol->value.enumerated.item[0] = + mi2s_auxpcm_get_format_value(aux_pcm_tx_cfg[idx].bit_format); + + pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__, + idx, aux_pcm_tx_cfg[idx].bit_format, + ucontrol->value.enumerated.item[0]); + + return 0; +} + +static int msm_aux_pcm_tx_format_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + int idx = aux_pcm_get_port_idx(kcontrol); + + if (idx < 0) + return idx; + + aux_pcm_tx_cfg[idx].bit_format = + mi2s_auxpcm_get_format(ucontrol->value.enumerated.item[0]); + + pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__, + idx, aux_pcm_tx_cfg[idx].bit_format, + ucontrol->value.enumerated.item[0]); + + return 0; +} + static int msm_hifi_ctrl(struct snd_soc_codec *codec) { struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); @@ -2765,6 +2839,22 @@ static const struct snd_kcontrol_new msm_snd_controls[] = { msm_mi2s_rx_format_get, msm_mi2s_rx_format_put), SOC_ENUM_EXT("QUAT_MI2S_TX Format", mi2s_tx_format, msm_mi2s_tx_format_get, msm_mi2s_tx_format_put), + SOC_ENUM_EXT("PRIM_AUX_PCM_RX Format", aux_pcm_rx_format, + msm_aux_pcm_rx_format_get, msm_aux_pcm_rx_format_put), + SOC_ENUM_EXT("PRIM_AUX_PCM_TX Format", aux_pcm_tx_format, + msm_aux_pcm_tx_format_get, msm_aux_pcm_tx_format_put), + SOC_ENUM_EXT("SEC_AUX_PCM_RX Format", aux_pcm_rx_format, + msm_aux_pcm_rx_format_get, msm_aux_pcm_rx_format_put), + SOC_ENUM_EXT("SEC_AUX_PCM_TX Format", aux_pcm_tx_format, + msm_aux_pcm_tx_format_get, msm_aux_pcm_tx_format_put), + SOC_ENUM_EXT("TERT_AUX_PCM_RX Format", aux_pcm_rx_format, + msm_aux_pcm_rx_format_get, msm_aux_pcm_rx_format_put), + SOC_ENUM_EXT("TERT_AUX_PCM_TX Format", aux_pcm_tx_format, + msm_aux_pcm_tx_format_get, msm_aux_pcm_tx_format_put), + SOC_ENUM_EXT("QUAT_AUX_PCM_RX Format", aux_pcm_rx_format, + msm_aux_pcm_rx_format_get, msm_aux_pcm_rx_format_put), + SOC_ENUM_EXT("QUAT_AUX_PCM_TX Format", aux_pcm_tx_format, + msm_aux_pcm_tx_format_get, msm_aux_pcm_tx_format_put), SOC_ENUM_EXT("HiFi Function", hifi_function, msm_hifi_get, msm_hifi_put), }; @@ -2784,6 +2874,38 @@ static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec, return ret; } +static int msm_snd_enable_codec_ext_tx_clk(struct snd_soc_codec *codec, + int enable, bool dapm) +{ + int ret = 0; + + if (!strcmp(dev_name(codec->dev), "tavil_codec")) { + ret = tavil_cdc_mclk_tx_enable(codec, enable); + } else { + dev_err(codec->dev, "%s: unknown codec to enable TX ext clk\n", + __func__); + ret = -EINVAL; + } + + return ret; +} + +static int msm_mclk_tx_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); + + pr_debug("%s: event = %d\n", __func__, event); + + switch (event) { + case SND_SOC_DAPM_PRE_PMU: + return msm_snd_enable_codec_ext_tx_clk(codec, 1, true); + case SND_SOC_DAPM_POST_PMD: + return msm_snd_enable_codec_ext_tx_clk(codec, 0, true); + } + return 0; +} + static int msm_mclk_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { @@ -2840,7 +2962,7 @@ static const struct snd_soc_dapm_widget msm_dapm_widgets[] = { SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_SUPPLY("MCLK TX", SND_SOC_NOPM, 0, 0, - NULL, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), + msm_mclk_tx_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_SPK("Lineout_1 amp", NULL), SND_SOC_DAPM_SPK("Lineout_2 amp", NULL), @@ -3134,6 +3256,8 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, break; case MSM_BACKEND_DAI_AUXPCM_RX: + param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, + aux_pcm_rx_cfg[PRIM_AUX_PCM].bit_format); rate->min = rate->max = aux_pcm_rx_cfg[PRIM_AUX_PCM].sample_rate; channels->min = channels->max = @@ -3141,6 +3265,8 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, break; case MSM_BACKEND_DAI_AUXPCM_TX: + param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, + aux_pcm_tx_cfg[PRIM_AUX_PCM].bit_format); rate->min = rate->max = aux_pcm_tx_cfg[PRIM_AUX_PCM].sample_rate; channels->min = channels->max = @@ -3148,6 +3274,8 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, break; case MSM_BACKEND_DAI_SEC_AUXPCM_RX: + param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, + aux_pcm_rx_cfg[SEC_AUX_PCM].bit_format); rate->min = rate->max = aux_pcm_rx_cfg[SEC_AUX_PCM].sample_rate; channels->min = channels->max = @@ -3155,6 +3283,8 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, break; case MSM_BACKEND_DAI_SEC_AUXPCM_TX: + param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, + aux_pcm_tx_cfg[SEC_AUX_PCM].bit_format); rate->min = rate->max = aux_pcm_tx_cfg[SEC_AUX_PCM].sample_rate; channels->min = channels->max = @@ -3162,6 +3292,8 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, break; case MSM_BACKEND_DAI_TERT_AUXPCM_RX: + param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, + aux_pcm_rx_cfg[TERT_AUX_PCM].bit_format); rate->min = rate->max = aux_pcm_rx_cfg[TERT_AUX_PCM].sample_rate; channels->min = channels->max = @@ -3169,6 +3301,8 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, break; case MSM_BACKEND_DAI_TERT_AUXPCM_TX: + param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, + aux_pcm_tx_cfg[TERT_AUX_PCM].bit_format); rate->min = rate->max = aux_pcm_tx_cfg[TERT_AUX_PCM].sample_rate; channels->min = channels->max = @@ -3176,6 +3310,8 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, break; case MSM_BACKEND_DAI_QUAT_AUXPCM_RX: + param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, + aux_pcm_rx_cfg[QUAT_AUX_PCM].bit_format); rate->min = rate->max = aux_pcm_rx_cfg[QUAT_AUX_PCM].sample_rate; channels->min = channels->max = @@ -3183,6 +3319,8 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, break; case MSM_BACKEND_DAI_QUAT_AUXPCM_TX: + param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, + aux_pcm_tx_cfg[QUAT_AUX_PCM].bit_format); rate->min = rate->max = aux_pcm_tx_cfg[QUAT_AUX_PCM].sample_rate; channels->min = channels->max =