Loading asoc/codecs/wcd937x/wcd937x.c +24 −2 Original line number Diff line number Diff line Loading @@ -27,8 +27,6 @@ #include "internal.h" #include "asoc/bolero-slave-internal.h" #define WCD9370_VARIANT 0 #define WCD9375_VARIANT 5 #define WCD937X_VARIANT_ENTRY_SIZE 32 #define NUM_SWRS_DT_PARAMS 5 Loading Loading @@ -2624,6 +2622,30 @@ static struct snd_info_entry_ops wcd937x_variant_ops = { .read = wcd937x_variant_read, }; /* * wcd937x_get_codec_variant * @component: component instance * * Return: codec variant or -EINVAL in error. */ int wcd937x_get_codec_variant(struct snd_soc_component *component) { struct wcd937x_priv *priv = NULL; if (!component) return -EINVAL; priv = snd_soc_component_get_drvdata(component); if (!priv) { dev_err(component->dev, "%s:wcd937x not probed\n", __func__); return -EINVAL; } return priv->variant; } EXPORT_SYMBOL(wcd937x_get_codec_variant); /* * wcd937x_info_create_codec_entry - creates wcd937x module * @codec_root: The parent directory Loading asoc/codecs/wcd937x/wcd937x.h +11 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,11 @@ struct wcd937x_swr_slave_ch_map { u8 index; }; enum { WCD9370_VARIANT = 0, WCD9375_VARIANT = 5, }; static const struct wcd937x_swr_slave_ch_map wcd937x_swr_slv_tx_ch_idx[] = { {ADC1, 0}, {ADC2, 1}, Loading Loading @@ -51,6 +56,8 @@ static int wcd937x_swr_master_ch_map[] = { extern int wcd937x_info_create_codec_entry(struct snd_info_entry *codec_root, struct snd_soc_component *component); extern int wcd937x_get_codec_variant(struct snd_soc_component *component); static inline int wcd937x_slave_get_master_ch_val(int ch) { int i; Loading Loading @@ -94,6 +101,10 @@ static inline int wcd937x_slave_get_slave_ch_val(int ch) { return 0; } static inline int wcd937x_get_codec_variant(struct snd_soc_component *component) { return 0; } #endif /* CONFIG_SND_SOC_WCD937X */ #endif asoc/lahaina-port-config.h +16 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,12 @@ static struct port_params tx_frame_params_shima_0p6MHz[SWR_MSTR_PORT_LEN] = { {1, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX3 */ }; static struct port_params tx_frame_params_wcd937x[SWR_MSTR_PORT_LEN] = { {3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0x00, 0x00}, /* TX1 */ {3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX2 */ {3, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX3 */ }; static struct swr_mstr_port_map sm_port_map[] = { {TX_MACRO, SWR_UC0, tx_frame_params_default}, {TX_MACRO, SWR_UC1, tx_frame_params_4p8MHz}, Loading @@ -116,4 +122,14 @@ static struct swr_mstr_port_map sm_port_map_shima[] = { {WSA_MACRO, SWR_UC0, wsa_frame_params_default}, }; static struct swr_mstr_port_map sm_port_map_wcd937x[] = { {TX_MACRO, SWR_UC0, tx_frame_params_wcd937x}, {TX_MACRO, SWR_UC1, tx_frame_params_wcd937x}, {TX_MACRO, SWR_UC2, tx_frame_params_wcd937x}, {RX_MACRO, SWR_UC0, rx_frame_params_default}, {RX_MACRO, SWR_UC1, rx_frame_params_dsd}, {RX_MACRO, SWR_UC2, rx_frame_params_44p1KHz}, {WSA_MACRO, SWR_UC0, wsa_frame_params_default}, }; #endif /* _LAHAINA_PORT_CONFIG */ asoc/lahaina.c +167 −24 Original line number Diff line number Diff line Loading @@ -31,8 +31,10 @@ #include "asoc/msm-cdc-pinctrl.h" #include "asoc/wcd-mbhc-v2.h" #include "codecs/wcd938x/wcd938x-mbhc.h" #include "codecs/wcd937x/wcd937x-mbhc.h" #include "codecs/wsa883x/wsa883x.h" #include "codecs/wcd938x/wcd938x.h" #include "codecs/wcd937x/wcd937x.h" #include "codecs/bolero/bolero-cdc.h" #include <dt-bindings/sound/audio-codec-port-types.h> #include "codecs/bolero/wsa-macro.h" Loading Loading @@ -828,6 +830,40 @@ static SOC_ENUM_SINGLE_EXT_DECL(va_cdc_dma_tx_1_sample_rate, static SOC_ENUM_SINGLE_EXT_DECL(va_cdc_dma_tx_2_sample_rate, cdc_dma_sample_rate_text); /* WCD9370 */ static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_0_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_1_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_2_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_3_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_5_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_0_sample_rate, cdc80_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_1_sample_rate, cdc80_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_2_sample_rate, cdc80_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_3_sample_rate, cdc80_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_5_sample_rate, cdc80_dma_sample_rate_text); /* WCD9375 */ static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_0_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_1_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_2_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_3_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_5_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_0_sample_rate, cdc_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_1_sample_rate, cdc_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_2_sample_rate, cdc_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_3_sample_rate, cdc_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_5_sample_rate, cdc_dma_sample_rate_text); /* WCD9380 */ static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc80_dma_rx_0_format, cdc80_bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc80_dma_rx_1_format, cdc80_bit_format_text); Loading Loading @@ -3769,6 +3805,72 @@ static const struct snd_kcontrol_new msm_int_snd_controls[] = { cdc_dma_tx_sample_rate_put), }; static const struct snd_kcontrol_new msm_int_wcd9370_snd_controls[] = { SOC_ENUM_EXT("RX_CDC_DMA_RX_0 Format", rx_cdc70_dma_rx_0_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_1 Format", rx_cdc70_dma_rx_1_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_2 Format", rx_cdc70_dma_rx_2_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_3 Format", rx_cdc70_dma_rx_3_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_5 Format", rx_cdc70_dma_rx_5_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_0 SampleRate", rx_cdc70_dma_rx_0_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_1 SampleRate", rx_cdc70_dma_rx_1_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_2 SampleRate", rx_cdc70_dma_rx_2_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_3 SampleRate", rx_cdc70_dma_rx_3_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_5 SampleRate", rx_cdc70_dma_rx_5_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), }; static const struct snd_kcontrol_new msm_int_wcd9375_snd_controls[] = { SOC_ENUM_EXT("RX_CDC_DMA_RX_0 Format", rx_cdc75_dma_rx_0_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_1 Format", rx_cdc75_dma_rx_1_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_2 Format", rx_cdc75_dma_rx_2_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_3 Format", rx_cdc75_dma_rx_3_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_5 Format", rx_cdc75_dma_rx_5_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_0 SampleRate", rx_cdc75_dma_rx_0_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_1 SampleRate", rx_cdc75_dma_rx_1_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_2 SampleRate", rx_cdc75_dma_rx_2_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_3 SampleRate", rx_cdc75_dma_rx_3_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_5 SampleRate", rx_cdc75_dma_rx_5_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), }; static const struct snd_kcontrol_new msm_int_wcd9380_snd_controls[] = { SOC_ENUM_EXT("RX_CDC_DMA_RX_0 Format", rx_cdc80_dma_rx_0_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), Loading Loading @@ -7407,6 +7509,7 @@ static int msm_snd_card_late_probe(struct snd_soc_card *card) struct msm_asoc_mach_data *pdata; int ret = 0; void *mbhc_calibration; bool is_wcd937x = false; pdata = snd_soc_card_get_drvdata(card); if (!pdata) Loading @@ -7424,16 +7527,24 @@ static int msm_snd_card_late_probe(struct snd_soc_card *card) } component = snd_soc_rtdcom_lookup(rtd, WCD938X_DRV_NAME); if (!component) { component = snd_soc_rtdcom_lookup(rtd, WCD937X_DRV_NAME); if (!component) { pr_err("%s component is NULL\n", __func__); return -EINVAL; } else { is_wcd937x = true; } } mbhc_calibration = def_wcd_mbhc_cal(); if (!mbhc_calibration) return -ENOMEM; wcd_mbhc_cfg.calibration = mbhc_calibration; if (!is_wcd937x) ret = wcd938x_mbhc_hs_detect(component, &wcd_mbhc_cfg); else ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg); if (ret) { dev_err(component->dev, "%s: mbhc hs detect failed, err:%d\n", __func__, ret); Loading Loading @@ -7690,6 +7801,7 @@ static int msm_int_wsa_init(struct snd_soc_pcm_runtime *rtd) static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_component *component = NULL; struct snd_soc_component *bolero_component = NULL; struct snd_soc_dapm_context *dapm = NULL; int ret = 0; int codec_variant = -1; Loading @@ -7706,6 +7818,8 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd) pr_err("%s: could not find component for bolero_codec\n", __func__); return ret; } else { bolero_component = component; } dapm = snd_soc_component_get_dapm(component); Loading Loading @@ -7752,13 +7866,6 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd) card = rtd->card->snd_card; if (strnstr(rtd->card->name, "shima", strlen(rtd->card->name)) != NULL) bolero_set_port_map(component, ARRAY_SIZE(sm_port_map_shima), sm_port_map_shima); else bolero_set_port_map(component, ARRAY_SIZE(sm_port_map), sm_port_map); if (!pdata->codec_root) { entry = msm_snd_info_create_subdir(card->module, "codecs", card->proc_root); Loading @@ -7777,10 +7884,13 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd) return 0; } component = snd_soc_rtdcom_lookup(rtd, WCD938X_DRV_NAME); if (!component) { component = snd_soc_rtdcom_lookup(rtd, WCD937X_DRV_NAME); if (!component) { pr_err("%s component is NULL\n", __func__); return -EINVAL; } } dapm = snd_soc_component_get_dapm(component); card = component->card->snd_card; Loading @@ -7794,10 +7904,29 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd) snd_soc_dapm_ignore_suspend(dapm, "AMIC4"); snd_soc_dapm_sync(dapm); if (!strncmp(component->driver->name, WCD937X_DRV_NAME, strlen(WCD937X_DRV_NAME))) { wcd937x_info_create_codec_entry(pdata->codec_root, component); codec_variant = wcd937x_get_codec_variant(component); dev_dbg(component->dev, "%s: variant %d\n", __func__, codec_variant); if (codec_variant == WCD9370_VARIANT) ret = snd_soc_add_component_controls(component, msm_int_wcd9370_snd_controls, ARRAY_SIZE(msm_int_wcd9370_snd_controls)); else if (codec_variant == WCD9375_VARIANT) ret = snd_soc_add_component_controls(component, msm_int_wcd9375_snd_controls, ARRAY_SIZE(msm_int_wcd9375_snd_controls)); bolero_set_port_map(bolero_component, ARRAY_SIZE(sm_port_map_wcd937x), sm_port_map_wcd937x); } else if (!strncmp(component->driver->name, WCD938X_DRV_NAME, strlen(WCD938X_DRV_NAME))) { wcd938x_info_create_codec_entry(pdata->codec_root, component); codec_variant = wcd938x_get_codec_variant(component); dev_dbg(component->dev, "%s: variant %d\n", __func__, codec_variant); dev_dbg(component->dev, "%s: variant %d\n", __func__, codec_variant); if (codec_variant == WCD9380) ret = snd_soc_add_component_controls(component, msm_int_wcd9380_snd_controls, Loading @@ -7807,6 +7936,20 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd) msm_int_wcd9385_snd_controls, ARRAY_SIZE(msm_int_wcd9385_snd_controls)); if ((strnstr(rtd->card->name, "shima", strlen(rtd->card->name)) != NULL) || (strnstr(rtd->card->name, "yupik", strlen(rtd->card->name)) != NULL)) bolero_set_port_map(bolero_component, ARRAY_SIZE(sm_port_map_shima), sm_port_map_shima); else bolero_set_port_map(bolero_component, ARRAY_SIZE(sm_port_map), sm_port_map); } else { bolero_set_port_map(bolero_component, ARRAY_SIZE(sm_port_map), sm_port_map); } if (ret < 0) { dev_err(component->dev, "%s: add codec specific snd controls failed: %d\n", __func__, ret); Loading asoc/msm_dailink.h +15 −7 Original line number Diff line number Diff line Loading @@ -209,7 +209,8 @@ SND_SOC_DAILINK_DEFS(slimbus8_hostless, SND_SOC_DAILINK_DEFS(tx_cdcdma5_tx, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45115")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "tx_macro_tx3"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-hostless"))); SND_SOC_DAILINK_DEFS(multimedia31, Loading Loading @@ -662,31 +663,36 @@ SND_SOC_DAILINK_DEFS(wsa_dma_tx1, SND_SOC_DAILINK_DEFS(rx_dma_rx0, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45104")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "rx_macro_rx1"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing"))); SND_SOC_DAILINK_DEFS(rx_dma_rx1, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45106")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "rx_macro_rx2"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing"))); SND_SOC_DAILINK_DEFS(rx_dma_rx2, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45108")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "rx_macro_rx3"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing"))); SND_SOC_DAILINK_DEFS(rx_dma_rx3, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45110")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "rx_macro_rx4"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing"))); SND_SOC_DAILINK_DEFS(rx_dma_rx5, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45114")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "rx_macro_rx5"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing"))); SND_SOC_DAILINK_DEFS(rx_dma_rx6, Loading @@ -698,13 +704,15 @@ SND_SOC_DAILINK_DEFS(rx_dma_rx6, SND_SOC_DAILINK_DEFS(tx_dma_tx3, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45111")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "tx_macro_tx1"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing"))); SND_SOC_DAILINK_DEFS(tx_dma_tx4, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45113")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "tx_macro_tx2"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc"), COMP_CODEC("swr-dmic.01", "swr_dmic_tx0"), COMP_CODEC("swr-dmic.02", "swr_dmic_tx1"), COMP_CODEC("swr-dmic.03", "swr_dmic_tx2"), Loading Loading
asoc/codecs/wcd937x/wcd937x.c +24 −2 Original line number Diff line number Diff line Loading @@ -27,8 +27,6 @@ #include "internal.h" #include "asoc/bolero-slave-internal.h" #define WCD9370_VARIANT 0 #define WCD9375_VARIANT 5 #define WCD937X_VARIANT_ENTRY_SIZE 32 #define NUM_SWRS_DT_PARAMS 5 Loading Loading @@ -2624,6 +2622,30 @@ static struct snd_info_entry_ops wcd937x_variant_ops = { .read = wcd937x_variant_read, }; /* * wcd937x_get_codec_variant * @component: component instance * * Return: codec variant or -EINVAL in error. */ int wcd937x_get_codec_variant(struct snd_soc_component *component) { struct wcd937x_priv *priv = NULL; if (!component) return -EINVAL; priv = snd_soc_component_get_drvdata(component); if (!priv) { dev_err(component->dev, "%s:wcd937x not probed\n", __func__); return -EINVAL; } return priv->variant; } EXPORT_SYMBOL(wcd937x_get_codec_variant); /* * wcd937x_info_create_codec_entry - creates wcd937x module * @codec_root: The parent directory Loading
asoc/codecs/wcd937x/wcd937x.h +11 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,11 @@ struct wcd937x_swr_slave_ch_map { u8 index; }; enum { WCD9370_VARIANT = 0, WCD9375_VARIANT = 5, }; static const struct wcd937x_swr_slave_ch_map wcd937x_swr_slv_tx_ch_idx[] = { {ADC1, 0}, {ADC2, 1}, Loading Loading @@ -51,6 +56,8 @@ static int wcd937x_swr_master_ch_map[] = { extern int wcd937x_info_create_codec_entry(struct snd_info_entry *codec_root, struct snd_soc_component *component); extern int wcd937x_get_codec_variant(struct snd_soc_component *component); static inline int wcd937x_slave_get_master_ch_val(int ch) { int i; Loading Loading @@ -94,6 +101,10 @@ static inline int wcd937x_slave_get_slave_ch_val(int ch) { return 0; } static inline int wcd937x_get_codec_variant(struct snd_soc_component *component) { return 0; } #endif /* CONFIG_SND_SOC_WCD937X */ #endif
asoc/lahaina-port-config.h +16 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,12 @@ static struct port_params tx_frame_params_shima_0p6MHz[SWR_MSTR_PORT_LEN] = { {1, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX3 */ }; static struct port_params tx_frame_params_wcd937x[SWR_MSTR_PORT_LEN] = { {3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0x00, 0x00}, /* TX1 */ {3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX2 */ {3, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0x00, 0x00}, /* TX3 */ }; static struct swr_mstr_port_map sm_port_map[] = { {TX_MACRO, SWR_UC0, tx_frame_params_default}, {TX_MACRO, SWR_UC1, tx_frame_params_4p8MHz}, Loading @@ -116,4 +122,14 @@ static struct swr_mstr_port_map sm_port_map_shima[] = { {WSA_MACRO, SWR_UC0, wsa_frame_params_default}, }; static struct swr_mstr_port_map sm_port_map_wcd937x[] = { {TX_MACRO, SWR_UC0, tx_frame_params_wcd937x}, {TX_MACRO, SWR_UC1, tx_frame_params_wcd937x}, {TX_MACRO, SWR_UC2, tx_frame_params_wcd937x}, {RX_MACRO, SWR_UC0, rx_frame_params_default}, {RX_MACRO, SWR_UC1, rx_frame_params_dsd}, {RX_MACRO, SWR_UC2, rx_frame_params_44p1KHz}, {WSA_MACRO, SWR_UC0, wsa_frame_params_default}, }; #endif /* _LAHAINA_PORT_CONFIG */
asoc/lahaina.c +167 −24 Original line number Diff line number Diff line Loading @@ -31,8 +31,10 @@ #include "asoc/msm-cdc-pinctrl.h" #include "asoc/wcd-mbhc-v2.h" #include "codecs/wcd938x/wcd938x-mbhc.h" #include "codecs/wcd937x/wcd937x-mbhc.h" #include "codecs/wsa883x/wsa883x.h" #include "codecs/wcd938x/wcd938x.h" #include "codecs/wcd937x/wcd937x.h" #include "codecs/bolero/bolero-cdc.h" #include <dt-bindings/sound/audio-codec-port-types.h> #include "codecs/bolero/wsa-macro.h" Loading Loading @@ -828,6 +830,40 @@ static SOC_ENUM_SINGLE_EXT_DECL(va_cdc_dma_tx_1_sample_rate, static SOC_ENUM_SINGLE_EXT_DECL(va_cdc_dma_tx_2_sample_rate, cdc_dma_sample_rate_text); /* WCD9370 */ static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_0_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_1_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_2_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_3_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_5_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_0_sample_rate, cdc80_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_1_sample_rate, cdc80_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_2_sample_rate, cdc80_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_3_sample_rate, cdc80_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc70_dma_rx_5_sample_rate, cdc80_dma_sample_rate_text); /* WCD9375 */ static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_0_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_1_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_2_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_3_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_5_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_0_sample_rate, cdc_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_1_sample_rate, cdc_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_2_sample_rate, cdc_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_3_sample_rate, cdc_dma_sample_rate_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc75_dma_rx_5_sample_rate, cdc_dma_sample_rate_text); /* WCD9380 */ static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc80_dma_rx_0_format, cdc80_bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(rx_cdc80_dma_rx_1_format, cdc80_bit_format_text); Loading Loading @@ -3769,6 +3805,72 @@ static const struct snd_kcontrol_new msm_int_snd_controls[] = { cdc_dma_tx_sample_rate_put), }; static const struct snd_kcontrol_new msm_int_wcd9370_snd_controls[] = { SOC_ENUM_EXT("RX_CDC_DMA_RX_0 Format", rx_cdc70_dma_rx_0_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_1 Format", rx_cdc70_dma_rx_1_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_2 Format", rx_cdc70_dma_rx_2_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_3 Format", rx_cdc70_dma_rx_3_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_5 Format", rx_cdc70_dma_rx_5_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_0 SampleRate", rx_cdc70_dma_rx_0_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_1 SampleRate", rx_cdc70_dma_rx_1_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_2 SampleRate", rx_cdc70_dma_rx_2_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_3 SampleRate", rx_cdc70_dma_rx_3_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_5 SampleRate", rx_cdc70_dma_rx_5_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), }; static const struct snd_kcontrol_new msm_int_wcd9375_snd_controls[] = { SOC_ENUM_EXT("RX_CDC_DMA_RX_0 Format", rx_cdc75_dma_rx_0_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_1 Format", rx_cdc75_dma_rx_1_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_2 Format", rx_cdc75_dma_rx_2_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_3 Format", rx_cdc75_dma_rx_3_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_5 Format", rx_cdc75_dma_rx_5_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_0 SampleRate", rx_cdc75_dma_rx_0_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_1 SampleRate", rx_cdc75_dma_rx_1_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_2 SampleRate", rx_cdc75_dma_rx_2_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_3 SampleRate", rx_cdc75_dma_rx_3_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), SOC_ENUM_EXT("RX_CDC_DMA_RX_5 SampleRate", rx_cdc75_dma_rx_5_sample_rate, cdc_dma_rx_sample_rate_get, cdc_dma_rx_sample_rate_put), }; static const struct snd_kcontrol_new msm_int_wcd9380_snd_controls[] = { SOC_ENUM_EXT("RX_CDC_DMA_RX_0 Format", rx_cdc80_dma_rx_0_format, cdc_dma_rx_format_get, cdc_dma_rx_format_put), Loading Loading @@ -7407,6 +7509,7 @@ static int msm_snd_card_late_probe(struct snd_soc_card *card) struct msm_asoc_mach_data *pdata; int ret = 0; void *mbhc_calibration; bool is_wcd937x = false; pdata = snd_soc_card_get_drvdata(card); if (!pdata) Loading @@ -7424,16 +7527,24 @@ static int msm_snd_card_late_probe(struct snd_soc_card *card) } component = snd_soc_rtdcom_lookup(rtd, WCD938X_DRV_NAME); if (!component) { component = snd_soc_rtdcom_lookup(rtd, WCD937X_DRV_NAME); if (!component) { pr_err("%s component is NULL\n", __func__); return -EINVAL; } else { is_wcd937x = true; } } mbhc_calibration = def_wcd_mbhc_cal(); if (!mbhc_calibration) return -ENOMEM; wcd_mbhc_cfg.calibration = mbhc_calibration; if (!is_wcd937x) ret = wcd938x_mbhc_hs_detect(component, &wcd_mbhc_cfg); else ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg); if (ret) { dev_err(component->dev, "%s: mbhc hs detect failed, err:%d\n", __func__, ret); Loading Loading @@ -7690,6 +7801,7 @@ static int msm_int_wsa_init(struct snd_soc_pcm_runtime *rtd) static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_component *component = NULL; struct snd_soc_component *bolero_component = NULL; struct snd_soc_dapm_context *dapm = NULL; int ret = 0; int codec_variant = -1; Loading @@ -7706,6 +7818,8 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd) pr_err("%s: could not find component for bolero_codec\n", __func__); return ret; } else { bolero_component = component; } dapm = snd_soc_component_get_dapm(component); Loading Loading @@ -7752,13 +7866,6 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd) card = rtd->card->snd_card; if (strnstr(rtd->card->name, "shima", strlen(rtd->card->name)) != NULL) bolero_set_port_map(component, ARRAY_SIZE(sm_port_map_shima), sm_port_map_shima); else bolero_set_port_map(component, ARRAY_SIZE(sm_port_map), sm_port_map); if (!pdata->codec_root) { entry = msm_snd_info_create_subdir(card->module, "codecs", card->proc_root); Loading @@ -7777,10 +7884,13 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd) return 0; } component = snd_soc_rtdcom_lookup(rtd, WCD938X_DRV_NAME); if (!component) { component = snd_soc_rtdcom_lookup(rtd, WCD937X_DRV_NAME); if (!component) { pr_err("%s component is NULL\n", __func__); return -EINVAL; } } dapm = snd_soc_component_get_dapm(component); card = component->card->snd_card; Loading @@ -7794,10 +7904,29 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd) snd_soc_dapm_ignore_suspend(dapm, "AMIC4"); snd_soc_dapm_sync(dapm); if (!strncmp(component->driver->name, WCD937X_DRV_NAME, strlen(WCD937X_DRV_NAME))) { wcd937x_info_create_codec_entry(pdata->codec_root, component); codec_variant = wcd937x_get_codec_variant(component); dev_dbg(component->dev, "%s: variant %d\n", __func__, codec_variant); if (codec_variant == WCD9370_VARIANT) ret = snd_soc_add_component_controls(component, msm_int_wcd9370_snd_controls, ARRAY_SIZE(msm_int_wcd9370_snd_controls)); else if (codec_variant == WCD9375_VARIANT) ret = snd_soc_add_component_controls(component, msm_int_wcd9375_snd_controls, ARRAY_SIZE(msm_int_wcd9375_snd_controls)); bolero_set_port_map(bolero_component, ARRAY_SIZE(sm_port_map_wcd937x), sm_port_map_wcd937x); } else if (!strncmp(component->driver->name, WCD938X_DRV_NAME, strlen(WCD938X_DRV_NAME))) { wcd938x_info_create_codec_entry(pdata->codec_root, component); codec_variant = wcd938x_get_codec_variant(component); dev_dbg(component->dev, "%s: variant %d\n", __func__, codec_variant); dev_dbg(component->dev, "%s: variant %d\n", __func__, codec_variant); if (codec_variant == WCD9380) ret = snd_soc_add_component_controls(component, msm_int_wcd9380_snd_controls, Loading @@ -7807,6 +7936,20 @@ static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd) msm_int_wcd9385_snd_controls, ARRAY_SIZE(msm_int_wcd9385_snd_controls)); if ((strnstr(rtd->card->name, "shima", strlen(rtd->card->name)) != NULL) || (strnstr(rtd->card->name, "yupik", strlen(rtd->card->name)) != NULL)) bolero_set_port_map(bolero_component, ARRAY_SIZE(sm_port_map_shima), sm_port_map_shima); else bolero_set_port_map(bolero_component, ARRAY_SIZE(sm_port_map), sm_port_map); } else { bolero_set_port_map(bolero_component, ARRAY_SIZE(sm_port_map), sm_port_map); } if (ret < 0) { dev_err(component->dev, "%s: add codec specific snd controls failed: %d\n", __func__, ret); Loading
asoc/msm_dailink.h +15 −7 Original line number Diff line number Diff line Loading @@ -209,7 +209,8 @@ SND_SOC_DAILINK_DEFS(slimbus8_hostless, SND_SOC_DAILINK_DEFS(tx_cdcdma5_tx, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45115")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "tx_macro_tx3"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-hostless"))); SND_SOC_DAILINK_DEFS(multimedia31, Loading Loading @@ -662,31 +663,36 @@ SND_SOC_DAILINK_DEFS(wsa_dma_tx1, SND_SOC_DAILINK_DEFS(rx_dma_rx0, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45104")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "rx_macro_rx1"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing"))); SND_SOC_DAILINK_DEFS(rx_dma_rx1, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45106")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "rx_macro_rx2"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing"))); SND_SOC_DAILINK_DEFS(rx_dma_rx2, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45108")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "rx_macro_rx3"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing"))); SND_SOC_DAILINK_DEFS(rx_dma_rx3, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45110")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "rx_macro_rx4"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing"))); SND_SOC_DAILINK_DEFS(rx_dma_rx5, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45114")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "rx_macro_rx5"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing"))); SND_SOC_DAILINK_DEFS(rx_dma_rx6, Loading @@ -698,13 +704,15 @@ SND_SOC_DAILINK_DEFS(rx_dma_rx6, SND_SOC_DAILINK_DEFS(tx_dma_tx3, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45111")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "tx_macro_tx1"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc")), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc")), DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing"))); SND_SOC_DAILINK_DEFS(tx_dma_tx4, DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-cdc-dma-dev.45113")), DAILINK_COMP_ARRAY(COMP_CODEC("bolero_codec", "tx_macro_tx2"), COMP_CODEC("wcd938x_codec", "wcd938x_cdc"), COMP_CODEC("wcd937x_codec", "wcd937x_cdc"), COMP_CODEC("swr-dmic.01", "swr_dmic_tx0"), COMP_CODEC("swr-dmic.02", "swr_dmic_tx1"), COMP_CODEC("swr-dmic.03", "swr_dmic_tx2"), Loading