Loading Documentation/devicetree/bindings/sound/qcom-audio-dev.txt +5 −2 Original line number Diff line number Diff line Loading @@ -351,6 +351,9 @@ Required properties: Required properties: - compatible : "qcom,msm-cpe-lsm" - qcom,msm-cpe-lsm-id : lsm afe port ID. CPE lsm driver uses this property to find out the input afe port ID. Currently only supported values are 1 and 3. * wcd_us_euro_gpio Loading Loading @@ -1367,12 +1370,12 @@ Example: qcom,mbhc-audio-jack-type = "6-pole-jack"; asoc-platform = <&pcm0>, <&pcm1>, <&pcm2>, <&voip>, <&voice>, <&loopback>, <&compress>, <&hostless>, <&afe>, <&lsm>, <&routing>, <&cpe>, <&compr>; <&afe>, <&lsm>, <&routing>, <&cpe>, <&compr>, <&cpe3>; asoc-platform-names = "msm-pcm-dsp.0", "msm-pcm-dsp.1", "msm-pcm-dsp.2", "msm-voip-dsp", "msm-pcm-voice", "msm-pcm-loopback", "msm-compress-dsp", "msm-pcm-hostless", "msm-pcm-afe", "msm-lsm-client", "msm-pcm-routing", "msm-cpe-lsm", "msm-compr-dsp"; "msm-compr-dsp", "msm-cpe-lsm.3"; asoc-cpu = <&dai_pri_auxpcm>, <&dai_sec_auxpcm>, <&dai_hdmi>, <&dai_mi2s>, <&sb_0_rx>, <&sb_0_tx>, <&sb_1_rx>, <&sb_1_tx>, <&sb_2_rx>, <&sb_2_tx>, <&sb_3_rx>, <&sb_3_tx>, Loading sound/soc/msm/msm-cpe-lsm.c +78 −22 Original line number Diff line number Diff line Loading @@ -28,7 +28,11 @@ #include <sound/pcm_params.h> #include <sound/msm-slim-dma.h> #define SAMPLE_RATE_48KHZ 48000 #define SAMPLE_RATE_16KHZ 16000 #define LSM_VOICE_WAKEUP_APP_V2 2 #define AFE_PORT_ID_1 1 #define AFE_PORT_ID_3 3 #define AFE_OUT_PORT_2 2 #define LISTEN_MIN_NUM_PERIODS 2 #define LISTEN_MAX_NUM_PERIODS 12 Loading Loading @@ -135,6 +139,7 @@ struct cpe_priv { struct wcd_cpe_lsm_ops lsm_ops; struct wcd_cpe_afe_ops afe_ops; bool afe_mad_ctl; u32 input_port_id; }; struct cpe_lsm_data { Loading Loading @@ -1156,12 +1161,6 @@ static int msm_cpe_lsm_ioctl_shared(struct snd_pcm_substream *substream, __func__, rc); return rc; } rc = lsm_ops->lsm_lab_control(cpe->core_handle, session, false); if (IS_ERR_VALUE(rc)) dev_err(rtd->dev, "%s: Lab Disable Failed rc %d\n", __func__, rc); /* * Buffer has to be de-allocated even if * lab_control failed. Loading Loading @@ -1390,14 +1389,6 @@ static int msm_cpe_lsm_ioctl_shared(struct snd_pcm_substream *substream, dev_dbg(rtd->dev, "%s: %s\n", __func__, "SNDRV_LSM_START"); rc = lsm_ops->lsm_get_afe_out_port_id(cpe->core_handle, session); if (rc != 0) { dev_err(rtd->dev, "%s: failed to get port id, err = %d\n", __func__, rc); return rc; } rc = lsm_ops->lsm_start(cpe->core_handle, session); if (rc != 0) { dev_err(rtd->dev, Loading Loading @@ -2680,6 +2671,8 @@ static int msm_cpe_lsm_prepare(struct snd_pcm_substream *substream) struct cpe_lsm_session *lsm_session; struct cpe_lsm_lab *lab_d = &lsm_d->lab; struct snd_pcm_runtime *runtime = substream->runtime; struct lsm_hw_params lsm_param; struct wcd_cpe_lsm_ops *lsm_ops; if (!cpe || !cpe->core_handle) { dev_err(rtd->dev, Loading Loading @@ -2712,23 +2705,74 @@ static int msm_cpe_lsm_prepare(struct snd_pcm_substream *substream) return 0; } lsm_ops = &cpe->lsm_ops; afe_ops = &cpe->afe_ops; afe_cfg = &(lsm_d->lsm_session->afe_port_cfg); afe_cfg->port_id = 1; switch (cpe->input_port_id) { case AFE_PORT_ID_3: afe_cfg->port_id = AFE_PORT_ID_3; afe_cfg->bit_width = 16; afe_cfg->num_channels = 1; afe_cfg->sample_rate = 16000; afe_cfg->sample_rate = SAMPLE_RATE_48KHZ; rc = afe_ops->afe_port_cmd_cfg(cpe->core_handle, afe_cfg); break; case AFE_PORT_ID_1: default: afe_cfg->port_id = AFE_PORT_ID_1; afe_cfg->bit_width = 16; afe_cfg->num_channels = 1; afe_cfg->sample_rate = SAMPLE_RATE_16KHZ; rc = afe_ops->afe_set_params(cpe->core_handle, afe_cfg, cpe->afe_mad_ctl); break; } if (rc != 0) { dev_err(rtd->dev, "%s: cpe afe params failed, err = %d\n", "%s: cpe afe params failed for port = %d, err = %d\n", __func__, afe_cfg->port_id, rc); return rc; } lsm_param.sample_rate = afe_cfg->sample_rate; lsm_param.num_chs = afe_cfg->num_channels; lsm_param.bit_width = afe_cfg->bit_width; rc = lsm_ops->lsm_set_media_fmt_params(cpe->core_handle, lsm_session, &lsm_param); if (rc) dev_dbg(rtd->dev, "%s: failed to set lsm media fmt params, err = %d\n", __func__, rc); /* Send connect to port (input) */ rc = lsm_ops->lsm_set_port(cpe->core_handle, lsm_session, &cpe->input_port_id); if (rc) { dev_err(rtd->dev, "%s: Failed to set connect input port, err=%d\n", __func__, rc); return rc; } if (cpe->input_port_id != 3) { rc = lsm_ops->lsm_get_afe_out_port_id(cpe->core_handle, lsm_session); if (rc != 0) { dev_err(rtd->dev, "%s: failed to get port id, err = %d\n", __func__, rc); return rc; } /* Send connect to port (output) */ rc = lsm_ops->lsm_set_port(cpe->core_handle, lsm_session, &lsm_session->afe_out_port_id); if (rc) { dev_err(rtd->dev, "%s: Failed to set connect output port, err=%d\n", __func__, rc); return rc; } } rc = msm_cpe_afe_port_cntl(substream, cpe->core_handle, afe_ops, afe_cfg, Loading Loading @@ -2978,6 +3022,9 @@ static int msm_asoc_cpe_lsm_probe(struct snd_soc_platform *platform) struct cpe_priv *cpe_priv; const struct snd_kcontrol_new *kcontrol; bool found_runtime = false; const char *cpe_dev_id = "qcom,msm-cpe-lsm-id"; u32 port_id = 0; int ret = 0; int i; if (!platform || !platform->component.card) { Loading Loading @@ -3007,6 +3054,14 @@ static int msm_asoc_cpe_lsm_probe(struct snd_soc_platform *platform) return -EINVAL; } ret = of_property_read_u32(platform->dev->of_node, cpe_dev_id, &port_id); if (ret) { dev_dbg(platform->dev, "%s: missing 0x%x in dt node\n", __func__, port_id); port_id = 1; } codec = rtd->codec; cpe_priv = kzalloc(sizeof(struct cpe_priv), Loading @@ -3019,6 +3074,7 @@ static int msm_asoc_cpe_lsm_probe(struct snd_soc_platform *platform) } cpe_priv->codec = codec; cpe_priv->input_port_id = port_id; wcd_cpe_get_lsm_ops(&cpe_priv->lsm_ops); wcd_cpe_get_afe_ops(&cpe_priv->afe_ops); Loading Loading
Documentation/devicetree/bindings/sound/qcom-audio-dev.txt +5 −2 Original line number Diff line number Diff line Loading @@ -351,6 +351,9 @@ Required properties: Required properties: - compatible : "qcom,msm-cpe-lsm" - qcom,msm-cpe-lsm-id : lsm afe port ID. CPE lsm driver uses this property to find out the input afe port ID. Currently only supported values are 1 and 3. * wcd_us_euro_gpio Loading Loading @@ -1367,12 +1370,12 @@ Example: qcom,mbhc-audio-jack-type = "6-pole-jack"; asoc-platform = <&pcm0>, <&pcm1>, <&pcm2>, <&voip>, <&voice>, <&loopback>, <&compress>, <&hostless>, <&afe>, <&lsm>, <&routing>, <&cpe>, <&compr>; <&afe>, <&lsm>, <&routing>, <&cpe>, <&compr>, <&cpe3>; asoc-platform-names = "msm-pcm-dsp.0", "msm-pcm-dsp.1", "msm-pcm-dsp.2", "msm-voip-dsp", "msm-pcm-voice", "msm-pcm-loopback", "msm-compress-dsp", "msm-pcm-hostless", "msm-pcm-afe", "msm-lsm-client", "msm-pcm-routing", "msm-cpe-lsm", "msm-compr-dsp"; "msm-compr-dsp", "msm-cpe-lsm.3"; asoc-cpu = <&dai_pri_auxpcm>, <&dai_sec_auxpcm>, <&dai_hdmi>, <&dai_mi2s>, <&sb_0_rx>, <&sb_0_tx>, <&sb_1_rx>, <&sb_1_tx>, <&sb_2_rx>, <&sb_2_tx>, <&sb_3_rx>, <&sb_3_tx>, Loading
sound/soc/msm/msm-cpe-lsm.c +78 −22 Original line number Diff line number Diff line Loading @@ -28,7 +28,11 @@ #include <sound/pcm_params.h> #include <sound/msm-slim-dma.h> #define SAMPLE_RATE_48KHZ 48000 #define SAMPLE_RATE_16KHZ 16000 #define LSM_VOICE_WAKEUP_APP_V2 2 #define AFE_PORT_ID_1 1 #define AFE_PORT_ID_3 3 #define AFE_OUT_PORT_2 2 #define LISTEN_MIN_NUM_PERIODS 2 #define LISTEN_MAX_NUM_PERIODS 12 Loading Loading @@ -135,6 +139,7 @@ struct cpe_priv { struct wcd_cpe_lsm_ops lsm_ops; struct wcd_cpe_afe_ops afe_ops; bool afe_mad_ctl; u32 input_port_id; }; struct cpe_lsm_data { Loading Loading @@ -1156,12 +1161,6 @@ static int msm_cpe_lsm_ioctl_shared(struct snd_pcm_substream *substream, __func__, rc); return rc; } rc = lsm_ops->lsm_lab_control(cpe->core_handle, session, false); if (IS_ERR_VALUE(rc)) dev_err(rtd->dev, "%s: Lab Disable Failed rc %d\n", __func__, rc); /* * Buffer has to be de-allocated even if * lab_control failed. Loading Loading @@ -1390,14 +1389,6 @@ static int msm_cpe_lsm_ioctl_shared(struct snd_pcm_substream *substream, dev_dbg(rtd->dev, "%s: %s\n", __func__, "SNDRV_LSM_START"); rc = lsm_ops->lsm_get_afe_out_port_id(cpe->core_handle, session); if (rc != 0) { dev_err(rtd->dev, "%s: failed to get port id, err = %d\n", __func__, rc); return rc; } rc = lsm_ops->lsm_start(cpe->core_handle, session); if (rc != 0) { dev_err(rtd->dev, Loading Loading @@ -2680,6 +2671,8 @@ static int msm_cpe_lsm_prepare(struct snd_pcm_substream *substream) struct cpe_lsm_session *lsm_session; struct cpe_lsm_lab *lab_d = &lsm_d->lab; struct snd_pcm_runtime *runtime = substream->runtime; struct lsm_hw_params lsm_param; struct wcd_cpe_lsm_ops *lsm_ops; if (!cpe || !cpe->core_handle) { dev_err(rtd->dev, Loading Loading @@ -2712,23 +2705,74 @@ static int msm_cpe_lsm_prepare(struct snd_pcm_substream *substream) return 0; } lsm_ops = &cpe->lsm_ops; afe_ops = &cpe->afe_ops; afe_cfg = &(lsm_d->lsm_session->afe_port_cfg); afe_cfg->port_id = 1; switch (cpe->input_port_id) { case AFE_PORT_ID_3: afe_cfg->port_id = AFE_PORT_ID_3; afe_cfg->bit_width = 16; afe_cfg->num_channels = 1; afe_cfg->sample_rate = 16000; afe_cfg->sample_rate = SAMPLE_RATE_48KHZ; rc = afe_ops->afe_port_cmd_cfg(cpe->core_handle, afe_cfg); break; case AFE_PORT_ID_1: default: afe_cfg->port_id = AFE_PORT_ID_1; afe_cfg->bit_width = 16; afe_cfg->num_channels = 1; afe_cfg->sample_rate = SAMPLE_RATE_16KHZ; rc = afe_ops->afe_set_params(cpe->core_handle, afe_cfg, cpe->afe_mad_ctl); break; } if (rc != 0) { dev_err(rtd->dev, "%s: cpe afe params failed, err = %d\n", "%s: cpe afe params failed for port = %d, err = %d\n", __func__, afe_cfg->port_id, rc); return rc; } lsm_param.sample_rate = afe_cfg->sample_rate; lsm_param.num_chs = afe_cfg->num_channels; lsm_param.bit_width = afe_cfg->bit_width; rc = lsm_ops->lsm_set_media_fmt_params(cpe->core_handle, lsm_session, &lsm_param); if (rc) dev_dbg(rtd->dev, "%s: failed to set lsm media fmt params, err = %d\n", __func__, rc); /* Send connect to port (input) */ rc = lsm_ops->lsm_set_port(cpe->core_handle, lsm_session, &cpe->input_port_id); if (rc) { dev_err(rtd->dev, "%s: Failed to set connect input port, err=%d\n", __func__, rc); return rc; } if (cpe->input_port_id != 3) { rc = lsm_ops->lsm_get_afe_out_port_id(cpe->core_handle, lsm_session); if (rc != 0) { dev_err(rtd->dev, "%s: failed to get port id, err = %d\n", __func__, rc); return rc; } /* Send connect to port (output) */ rc = lsm_ops->lsm_set_port(cpe->core_handle, lsm_session, &lsm_session->afe_out_port_id); if (rc) { dev_err(rtd->dev, "%s: Failed to set connect output port, err=%d\n", __func__, rc); return rc; } } rc = msm_cpe_afe_port_cntl(substream, cpe->core_handle, afe_ops, afe_cfg, Loading Loading @@ -2978,6 +3022,9 @@ static int msm_asoc_cpe_lsm_probe(struct snd_soc_platform *platform) struct cpe_priv *cpe_priv; const struct snd_kcontrol_new *kcontrol; bool found_runtime = false; const char *cpe_dev_id = "qcom,msm-cpe-lsm-id"; u32 port_id = 0; int ret = 0; int i; if (!platform || !platform->component.card) { Loading Loading @@ -3007,6 +3054,14 @@ static int msm_asoc_cpe_lsm_probe(struct snd_soc_platform *platform) return -EINVAL; } ret = of_property_read_u32(platform->dev->of_node, cpe_dev_id, &port_id); if (ret) { dev_dbg(platform->dev, "%s: missing 0x%x in dt node\n", __func__, port_id); port_id = 1; } codec = rtd->codec; cpe_priv = kzalloc(sizeof(struct cpe_priv), Loading @@ -3019,6 +3074,7 @@ static int msm_asoc_cpe_lsm_probe(struct snd_soc_platform *platform) } cpe_priv->codec = codec; cpe_priv->input_port_id = port_id; wcd_cpe_get_lsm_ops(&cpe_priv->lsm_ops); wcd_cpe_get_afe_ops(&cpe_priv->afe_ops); Loading