summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/sound/qcom-audio-dev.txt23
-rw-r--r--arch/arm/boot/dts/qcom/msm8996-mtp.dtsi17
-rw-r--r--include/sound/q6core.h4
-rw-r--r--sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c43
-rw-r--r--sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c45
-rw-r--r--sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.h1
6 files changed, 128 insertions, 5 deletions
diff --git a/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt b/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt
index 102857a13a86..2a737bb69bc9 100644
--- a/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt
+++ b/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt
@@ -8,6 +8,15 @@ Required properties:
- qcom,msm-pcm-dsp-id : device node id
+ Optional properties
+
+ - qcom,avs-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 using "AVS 2.7" for
+ 8996 purpose.If the ADSP version is anything other than this
+ we use new ADSP APIs.
+
* msm-pcm-low-latency
Required properties:
@@ -28,6 +37,13 @@ Required properties:
ultra : ultra low latency stream
ull-pp : ultra low latency stream with post-processing capability
+ - qcom,avs-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 using "AVS 2.7" for
+ 8996 purpose.If the ADSP version is anything other than this
+ we use new ADSP APIs.
+
* msm-pcm-dsp-noirq
Required properties:
@@ -75,6 +91,13 @@ Optional properties
8909 purpose.If the ADSP version is anything other than this
we use new ADSP APIs.
+ - qcom,avs-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 using "AVS 2.7" for
+ 8996 purpose.If the ADSP version is anything other than this
+ we use new ADSP APIs.
+
* msm-voip-dsp
Required properties:
diff --git a/arch/arm/boot/dts/qcom/msm8996-mtp.dtsi b/arch/arm/boot/dts/qcom/msm8996-mtp.dtsi
index d3350deba5d2..38f3715973cd 100644
--- a/arch/arm/boot/dts/qcom/msm8996-mtp.dtsi
+++ b/arch/arm/boot/dts/qcom/msm8996-mtp.dtsi
@@ -813,6 +813,23 @@
qcom,wsa-aux-dev-prefix = "SpkrLeft", "SpkrRight",
"SpkrLeft", "SpkrRight";
};
+
+ qcom,msm-pcm {
+ qcom,avs-version;
+ };
+
+ qcom,msm-pcm-low-latency {
+ qcom,avs-version;
+ };
+
+ qcom,msm-ultra-low-latency {
+ qcom,avs-version;
+ };
+
+ qcom,msm-compress-dsp {
+ qcom,avs-version;
+ };
+
qcom,msm-dai-tdm-tert-rx {
qcom,msm-cpudai-tdm-clk-internal = <1>;
qcom,msm-cpudai-tdm-sync-mode = <0>;
diff --git a/include/sound/q6core.h b/include/sound/q6core.h
index f4e048d0aa6f..773fc45a6734 100644
--- a/include/sound/q6core.h
+++ b/include/sound/q6core.h
@@ -185,13 +185,17 @@ struct avcs_cmd_get_version_result {
#define AVCS_CMDRSP_Q6_ID_2_6 0x00040000
#define AVCS_CMDRSP_Q6_ID_2_7 0x00040001
#define AVCS_CMDRSP_Q6_ID_2_8 0x00040002
+#define AVCS_CMDRSP_Q6_ID_2_9 0x00040003
enum q6_subsys_image {
Q6_SUBSYS_AVS2_6 = 1,
Q6_SUBSYS_AVS2_7,
Q6_SUBSYS_AVS2_8,
+ Q6_SUBSYS_AVS2_9,
Q6_SUBSYS_INVALID,
};
+
enum q6_subsys_image q6core_get_avs_version(void);
+
int core_get_adsp_ver(void);
#endif /* __Q6CORE_H__ */
diff --git a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
index baca08f3923b..3746a201b23c 100644
--- a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
@@ -106,6 +106,7 @@ struct msm_compr_pdata {
struct msm_compr_ch_map *ch_map[MSM_FRONTEND_DAI_MAX];
int32_t ion_fd[MSM_FRONTEND_DAI_MAX];
bool is_in_use[MSM_FRONTEND_DAI_MAX];
+ bool avs_ver;
};
struct msm_compr_audio {
@@ -1017,7 +1018,18 @@ static int msm_compr_send_media_format_block(struct snd_compr_stream *cstream,
sample_word_size = 16;
break;
}
- ret = q6asm_media_format_block_pcm_format_support_v4(
+ if (pdata->avs_ver &&
+ (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7))
+ ret = q6asm_media_format_block_pcm_format_support_v3(
+ prtd->audio_client,
+ prtd->sample_rate,
+ prtd->num_channels,
+ bit_width, stream_id,
+ use_default_chmap,
+ chmap,
+ sample_word_size);
+ else
+ ret = q6asm_media_format_block_pcm_format_support_v4(
prtd->audio_client,
prtd->sample_rate,
prtd->num_channels,
@@ -1273,6 +1285,8 @@ static int msm_compr_configure_dsp_for_playback
uint16_t bits_per_sample = 16;
int dir = IN, ret = 0;
struct audio_client *ac = prtd->audio_client;
+ struct msm_compr_pdata *pdata =
+ snd_soc_platform_get_drvdata(soc_prtd->platform);
uint32_t stream_index;
struct asm_softpause_params softpause = {
.enable = SOFT_PAUSE_ENABLE,
@@ -1323,7 +1337,14 @@ static int msm_compr_configure_dsp_for_playback
} else {
pr_debug("%s: stream_id %d bits_per_sample %d\n",
__func__, ac->stream_id, bits_per_sample);
- ret = q6asm_stream_open_write_v4(ac,
+ if (pdata->avs_ver &&
+ (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7))
+ ret = q6asm_stream_open_write_v3(ac,
+ prtd->codec, bits_per_sample,
+ ac->stream_id,
+ prtd->gapless_state.use_dsp_gapless_mode);
+ else
+ ret = q6asm_stream_open_write_v4(ac,
prtd->codec, bits_per_sample,
ac->stream_id,
prtd->gapless_state.use_dsp_gapless_mode);
@@ -2639,7 +2660,14 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
pr_debug("%s: open_write stream_id %d bits_per_sample %d",
__func__, stream_id, bits_per_sample);
- rc = q6asm_stream_open_write_v4(prtd->audio_client,
+ if (pdata->avs_ver &&
+ (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7))
+ rc = q6asm_stream_open_write_v3(prtd->audio_client,
+ prtd->codec, bits_per_sample,
+ stream_id,
+ prtd->gapless_state.use_dsp_gapless_mode);
+ else
+ rc = q6asm_stream_open_write_v4(prtd->audio_client,
prtd->codec, bits_per_sample,
stream_id,
prtd->gapless_state.use_dsp_gapless_mode);
@@ -4091,6 +4119,15 @@ static int msm_compr_probe(struct snd_soc_platform *platform)
pdata->use_legacy_api = false;
pr_debug("%s: use legacy api %d\n", __func__, pdata->use_legacy_api);
+
+ if (of_property_read_bool(platform->dev->of_node,
+ "qcom,avs-version"))
+ pdata->avs_ver = true;
+ else
+ pdata->avs_ver = false;
+
+ pr_debug("%s: avs_ver = %d\n", __func__, pdata->avs_ver);
+
/*
* use_dsp_gapless_mode part of platform data(pdata) is updated from HAL
* through a mixer control before compress driver is opened. The mixer
diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
index ad921f778b12..a7aab839e6db 100644
--- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
@@ -384,6 +384,17 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
prtd->audio_client = NULL;
return -ENOMEM;
}
+ } else if (pdata->avs_ver &&
+ (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7)) {
+ ret = q6asm_open_write_v3(prtd->audio_client,
+ FORMAT_LINEAR_PCM, bits_per_sample);
+ if (ret < 0) {
+ pr_err("%s: q6asm_open_write_v3 failed (%d)\n",
+ __func__, ret);
+ q6asm_audio_client_free(prtd->audio_client);
+ prtd->audio_client = NULL;
+ return -ENOMEM;
+ }
} else {
ret = q6asm_open_write_with_retry(prtd->audio_client,
fmt_type, bits_per_sample);
@@ -433,6 +444,14 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
prtd->channel_map, bits_per_sample,
sample_word_size, ASM_LITTLE_ENDIAN,
DEFAULT_QF);
+ else if (pdata->avs_ver &&
+ (q6core_get_avs_version() ==
+ Q6_SUBSYS_AVS2_7))
+ ret = q6asm_media_format_block_multi_ch_pcm_v3(
+ prtd->audio_client, runtime->rate,
+ runtime->channels, !prtd->set_channel_map,
+ prtd->channel_map, bits_per_sample,
+ sample_word_size);
else
ret = q6asm_media_format_block_multi_ch_pcm_v4(
prtd->audio_client, runtime->rate,
@@ -497,8 +516,13 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
pr_debug("%s Opening %d-ch PCM read stream, perf_mode %d\n",
__func__, params_channels(params),
prtd->audio_client->perf_mode);
-
- ret = q6asm_open_read_with_retry(prtd->audio_client,
+ if (pdata->avs_ver &&
+ (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7))
+ ret = q6asm_open_read_v3(prtd->audio_client,
+ FORMAT_LINEAR_PCM,
+ bits_per_sample);
+ else
+ ret = q6asm_open_read_with_retry(prtd->audio_client,
FORMAT_LINEAR_PCM,
bits_per_sample, false);
if (ret < 0) {
@@ -577,6 +601,15 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
sample_word_size,
ASM_LITTLE_ENDIAN,
DEFAULT_QF);
+ else if (pdata->avs_ver &&
+ (q6core_get_avs_version() ==
+ Q6_SUBSYS_AVS2_7))
+ ret = q6asm_enc_cfg_blk_pcm_format_support_v3(
+ prtd->audio_client,
+ prtd->samp_rate,
+ prtd->channel_mode,
+ bits_per_sample,
+ sample_word_size);
else
ret = q6asm_enc_cfg_blk_pcm_format_support_v4(
prtd->audio_client,
@@ -3048,6 +3081,14 @@ static int msm_pcm_probe(struct platform_device *pdev)
pdata->perf_mode = LEGACY_PCM_MODE;
}
+ if (of_property_read_bool(pdev->dev.of_node,
+ "qcom,avs-version"))
+ pdata->avs_ver = true;
+ else
+ pdata->avs_ver = false;
+
+ pr_debug("%s: avs_ver = %d\n", __func__, pdata->avs_ver);
+
dev_set_drvdata(&pdev->dev, pdata);
dev_dbg(&pdev->dev, "%s: dev name %s\n",
diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.h b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.h
index afe314455fbf..a90e9f7d4fc9 100644
--- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.h
+++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.h
@@ -123,6 +123,7 @@ struct output_meta_data_st {
struct msm_plat_data {
int perf_mode;
+ bool avs_ver;
struct snd_pcm *pcm;
struct snd_pcm *pcm_device[MSM_FRONTEND_DAI_MM_SIZE];
struct msm_pcm_channel_mixer chmixer_pspd[MSM_FRONTEND_DAI_MM_SIZE][2];