Loading Documentation/devicetree/bindings/sound/qcom-audio-dev.txt +8 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,14 @@ Required properties: - compatible : "qcom,msm-compress-dsp" Optional properties - qcom,adsp-version: This property can be used to specify the ADSP version/name. Based on ADSP version, we decide if we have to use older ADSP APIs or newer. Right now we are adding "MDSP 1.2" for 8909 purpose.If the ADSP version is anything other than this we use new ADSP APIs. * msm-voip-dsp Required properties: Loading arch/arm/boot/dts/qcom/msm8909.dtsi +1 −0 Original line number Diff line number Diff line Loading @@ -1268,6 +1268,7 @@ compress: qcom,msm-compress-dsp { compatible = "qcom,msm-compress-dsp"; qcom,adsp-version = "MDSP 1.2"; }; voip: qcom,msm-voip-dsp { Loading include/sound/q6asm-v2.h +3 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -456,6 +456,8 @@ int q6asm_set_mute(struct audio_client *ac, int muteflag); int q6asm_get_session_time(struct audio_client *ac, uint64_t *tstamp); int q6asm_get_session_time_legacy(struct audio_client *ac, uint64_t *tstamp); int q6asm_send_audio_effects_params(struct audio_client *ac, char *params, uint32_t params_length); Loading sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c +31 −4 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ struct msm_compr_pdata { uint32_t volume[MSM_FRONTEND_DAI_MAX][2]; /* For both L & R */ struct msm_compr_audio_effects *audio_effects[MSM_FRONTEND_DAI_MAX]; bool use_dsp_gapless_mode; bool use_legacy_api; /* indicates use older asm apis*/ struct msm_compr_dec_params *dec_params[MSM_FRONTEND_DAI_MAX]; struct msm_compr_ch_map *ch_map[MSM_FRONTEND_DAI_MAX]; }; Loading Loading @@ -1748,8 +1749,14 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd) /* * Cache this time as last known time */ if (pdata->use_legacy_api) q6asm_get_session_time_legacy( prtd->audio_client, &prtd->marker_timestamp); else q6asm_get_session_time(prtd->audio_client, &prtd->marker_timestamp); spin_lock_irqsave(&prtd->lock, flags); /* * Don't reset these as these vars map to Loading Loading @@ -1879,13 +1886,16 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream, struct snd_compr_tstamp *arg) { struct snd_compr_runtime *runtime = cstream->runtime; struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct msm_compr_audio *prtd = runtime->private_data; struct msm_compr_pdata *pdata = NULL; struct snd_compr_tstamp tstamp; uint64_t timestamp = 0; int rc = 0, first_buffer; unsigned long flags; uint32_t gapless_transition; pdata = snd_soc_platform_get_drvdata(rtd->platform); pr_debug("%s\n", __func__); memset(&tstamp, 0x0, sizeof(struct snd_compr_tstamp)); Loading Loading @@ -1918,8 +1928,12 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream, if (gapless_transition) pr_debug("%s session time in gapless transition", __func__); rc = q6asm_get_session_time(prtd->audio_client, ×tamp); if (pdata->use_legacy_api) rc = q6asm_get_session_time_legacy(prtd->audio_client, ×tamp); else rc = q6asm_get_session_time(prtd->audio_client, ×tamp); if (rc < 0) { pr_err("%s: Get Session Time return value =%lld\n", __func__, timestamp); Loading Loading @@ -2767,6 +2781,8 @@ static int msm_compr_probe(struct snd_soc_platform *platform) { struct msm_compr_pdata *pdata; int i; int rc; const char *qdsp_version; pr_debug("%s\n", __func__); pdata = (struct msm_compr_pdata *) Loading @@ -2788,6 +2804,17 @@ static int msm_compr_probe(struct snd_soc_platform *platform) snd_soc_add_platform_controls(platform, msm_compr_gapless_controls, ARRAY_SIZE(msm_compr_gapless_controls)); rc = of_property_read_string(platform->dev->of_node, "qcom,adsp-version", &qdsp_version); if (!rc) { if (!strcmp(qdsp_version, "MDSP 1.2")) pdata->use_legacy_api = true; else pdata->use_legacy_api = false; } else pdata->use_legacy_api = false; pr_debug("%s: use legacy api %d\n", __func__, pdata->use_legacy_api); /* * use_dsp_gapless_mode part of platform data(pdata) is updated from HAL * through a mixer control before compress driver is opened. The mixer Loading sound/soc/msm/qdsp6v2/q6asm.c +47 −0 Original line number Diff line number Diff line Loading @@ -5979,6 +5979,53 @@ fail_cmd: return -EINVAL; } int q6asm_get_session_time_legacy(struct audio_client *ac, uint64_t *tstamp) { struct apr_hdr hdr; int rc; if (ac == NULL) { pr_err("%s: APR handle NULL\n", __func__); return -EINVAL; } if (ac->apr == NULL) { pr_err("%s: AC APR handle NULL\n", __func__); return -EINVAL; } if (tstamp == NULL) { pr_err("%s: tstamp NULL\n", __func__); return -EINVAL; } q6asm_add_hdr(ac, &hdr, sizeof(hdr), TRUE); hdr.opcode = ASM_SESSION_CMD_GET_SESSIONTIME_V3; atomic_set(&ac->time_flag, 1); dev_vdbg(ac->dev, "%s: session[%d]opcode[0x%x]\n", __func__, ac->session, hdr.opcode); rc = apr_send_pkt(ac->apr, (uint32_t *) &hdr); if (rc < 0) { pr_err("%s: Commmand 0x%x failed %d\n", __func__, hdr.opcode, rc); goto fail_cmd; } rc = wait_event_timeout(ac->time_wait, (atomic_read(&ac->time_flag) == 0), 5*HZ); if (!rc) { pr_err("%s: timeout in getting session time from DSP\n", __func__); goto fail_cmd; } *tstamp = ac->time_stamp; return 0; fail_cmd: return -EINVAL; } int q6asm_send_audio_effects_params(struct audio_client *ac, char *params, uint32_t params_length) { Loading Loading
Documentation/devicetree/bindings/sound/qcom-audio-dev.txt +8 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,14 @@ Required properties: - compatible : "qcom,msm-compress-dsp" Optional properties - qcom,adsp-version: This property can be used to specify the ADSP version/name. Based on ADSP version, we decide if we have to use older ADSP APIs or newer. Right now we are adding "MDSP 1.2" for 8909 purpose.If the ADSP version is anything other than this we use new ADSP APIs. * msm-voip-dsp Required properties: Loading
arch/arm/boot/dts/qcom/msm8909.dtsi +1 −0 Original line number Diff line number Diff line Loading @@ -1268,6 +1268,7 @@ compress: qcom,msm-compress-dsp { compatible = "qcom,msm-compress-dsp"; qcom,adsp-version = "MDSP 1.2"; }; voip: qcom,msm-voip-dsp { Loading
include/sound/q6asm-v2.h +3 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -456,6 +456,8 @@ int q6asm_set_mute(struct audio_client *ac, int muteflag); int q6asm_get_session_time(struct audio_client *ac, uint64_t *tstamp); int q6asm_get_session_time_legacy(struct audio_client *ac, uint64_t *tstamp); int q6asm_send_audio_effects_params(struct audio_client *ac, char *params, uint32_t params_length); Loading
sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c +31 −4 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ struct msm_compr_pdata { uint32_t volume[MSM_FRONTEND_DAI_MAX][2]; /* For both L & R */ struct msm_compr_audio_effects *audio_effects[MSM_FRONTEND_DAI_MAX]; bool use_dsp_gapless_mode; bool use_legacy_api; /* indicates use older asm apis*/ struct msm_compr_dec_params *dec_params[MSM_FRONTEND_DAI_MAX]; struct msm_compr_ch_map *ch_map[MSM_FRONTEND_DAI_MAX]; }; Loading Loading @@ -1748,8 +1749,14 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd) /* * Cache this time as last known time */ if (pdata->use_legacy_api) q6asm_get_session_time_legacy( prtd->audio_client, &prtd->marker_timestamp); else q6asm_get_session_time(prtd->audio_client, &prtd->marker_timestamp); spin_lock_irqsave(&prtd->lock, flags); /* * Don't reset these as these vars map to Loading Loading @@ -1879,13 +1886,16 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream, struct snd_compr_tstamp *arg) { struct snd_compr_runtime *runtime = cstream->runtime; struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct msm_compr_audio *prtd = runtime->private_data; struct msm_compr_pdata *pdata = NULL; struct snd_compr_tstamp tstamp; uint64_t timestamp = 0; int rc = 0, first_buffer; unsigned long flags; uint32_t gapless_transition; pdata = snd_soc_platform_get_drvdata(rtd->platform); pr_debug("%s\n", __func__); memset(&tstamp, 0x0, sizeof(struct snd_compr_tstamp)); Loading Loading @@ -1918,8 +1928,12 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream, if (gapless_transition) pr_debug("%s session time in gapless transition", __func__); rc = q6asm_get_session_time(prtd->audio_client, ×tamp); if (pdata->use_legacy_api) rc = q6asm_get_session_time_legacy(prtd->audio_client, ×tamp); else rc = q6asm_get_session_time(prtd->audio_client, ×tamp); if (rc < 0) { pr_err("%s: Get Session Time return value =%lld\n", __func__, timestamp); Loading Loading @@ -2767,6 +2781,8 @@ static int msm_compr_probe(struct snd_soc_platform *platform) { struct msm_compr_pdata *pdata; int i; int rc; const char *qdsp_version; pr_debug("%s\n", __func__); pdata = (struct msm_compr_pdata *) Loading @@ -2788,6 +2804,17 @@ static int msm_compr_probe(struct snd_soc_platform *platform) snd_soc_add_platform_controls(platform, msm_compr_gapless_controls, ARRAY_SIZE(msm_compr_gapless_controls)); rc = of_property_read_string(platform->dev->of_node, "qcom,adsp-version", &qdsp_version); if (!rc) { if (!strcmp(qdsp_version, "MDSP 1.2")) pdata->use_legacy_api = true; else pdata->use_legacy_api = false; } else pdata->use_legacy_api = false; pr_debug("%s: use legacy api %d\n", __func__, pdata->use_legacy_api); /* * use_dsp_gapless_mode part of platform data(pdata) is updated from HAL * through a mixer control before compress driver is opened. The mixer Loading
sound/soc/msm/qdsp6v2/q6asm.c +47 −0 Original line number Diff line number Diff line Loading @@ -5979,6 +5979,53 @@ fail_cmd: return -EINVAL; } int q6asm_get_session_time_legacy(struct audio_client *ac, uint64_t *tstamp) { struct apr_hdr hdr; int rc; if (ac == NULL) { pr_err("%s: APR handle NULL\n", __func__); return -EINVAL; } if (ac->apr == NULL) { pr_err("%s: AC APR handle NULL\n", __func__); return -EINVAL; } if (tstamp == NULL) { pr_err("%s: tstamp NULL\n", __func__); return -EINVAL; } q6asm_add_hdr(ac, &hdr, sizeof(hdr), TRUE); hdr.opcode = ASM_SESSION_CMD_GET_SESSIONTIME_V3; atomic_set(&ac->time_flag, 1); dev_vdbg(ac->dev, "%s: session[%d]opcode[0x%x]\n", __func__, ac->session, hdr.opcode); rc = apr_send_pkt(ac->apr, (uint32_t *) &hdr); if (rc < 0) { pr_err("%s: Commmand 0x%x failed %d\n", __func__, hdr.opcode, rc); goto fail_cmd; } rc = wait_event_timeout(ac->time_wait, (atomic_read(&ac->time_flag) == 0), 5*HZ); if (!rc) { pr_err("%s: timeout in getting session time from DSP\n", __func__); goto fail_cmd; } *tstamp = ac->time_stamp; return 0; fail_cmd: return -EINVAL; } int q6asm_send_audio_effects_params(struct audio_client *ac, char *params, uint32_t params_length) { Loading