From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Rohit Kumar <rohitkr@codeaurora.org>,
andy.gross@linaro.org, broonie@kernel.org,
linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
bgoswami@codeaurora.org, rohkumar@qti.qualcomm.com,
linux-kernel@vger.kernel.org, plai@codeaurora.org,
tiwai@suse.com, lgirdwood@gmail.com, david.brown@linaro.org,
robh+dt@kernel.org, spatakok@qti.qualcomm.com,
linux-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [alsa-devel] [PATCH v3 15/25] ASoC: qcom: qdsp6: Add support to q6asm dai driver
Date: Thu, 22 Feb 2018 11:16:26 +0000 [thread overview]
Message-ID: <d0f42d37-ed4b-fb19-17ce-d825bb78fe40@linaro.org> (raw)
In-Reply-To: <6ea65838-f01a-ecbf-70cd-0dc9299eae80@codeaurora.org>
Thanks for your review Rohit,
On 21/02/18 11:14, Rohit Kumar wrote:
>
>
> On 2/13/2018 10:28 PM, srinivas.kandagatla@linaro.org wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>>
>> This patch adds support to q6asm dai driver which configures Q6ASM
>> streams
>> to pass pcm data.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> [..]
>> diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c
>> b/sound/soc/qcom/qdsp6/q6asm-dai.c
>> new file mode 100644
>> index 000000000000..7c5e94b2ced4
>> --- /dev/null
>> +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
>> @@ -0,0 +1,621 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Copyright (c) 2011-2016, The Linux Foundation
>> + * Copyright (c) 2017, Linaro Limited
>> + */
>> +
>> +#include <linux/init.h>
>> +#include <linux/err.h>
>> +#include <linux/module.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/slab.h>
>> +#include <sound/soc.h>
>> +#include <sound/soc-dapm.h>
>> +#include <sound/pcm.h>
>> +#include <asm/dma.h>
> [..]
>> +static struct snd_pcm_hw_constraint_list constraints_sample_rates = {
>> + .count = ARRAY_SIZE(supported_sample_rates),
>> + .list = supported_sample_rates,
>> + .mask = 0,
>> +};
>> +
>> +static void event_handler(uint32_t opcode, uint32_t token,
>> + uint32_t *payload, void *priv)
>> +{
>> + struct q6asm_dai_rtd *prtd = priv;
>> + struct snd_pcm_substream *substream = prtd->substream;
>> +
>> + switch (opcode) {
>> + case ASM_CLIENT_EVENT_CMD_RUN_DONE:
> Need to add support for V2 version of opcodes
Makes sense, I will add them.
>> + q6asm_write_async(prtd->audio_client,
>> + prtd->pcm_count, 0, 0, NO_TIMESTAMP);
>> + break;
>> + case ASM_CLIENT_EVENT_CMD_EOS_DONE:
>> + prtd->state = Q6ASM_STREAM_STOPPED;
>> + break;
>> + case ASM_CLIENT_EVENT_DATA_WRITE_DONE: {
>> + prtd->pcm
> [..]
>> +
>> +static int q6asm_dai_trigger(struct snd_pcm_substream *substream, int
>> cmd)
>> +{
>> + int ret = 0;
>> + struct snd_pcm_runtime *runtime = substream->runtime;
>> + struct q6asm_dai_rtd *prtd = runtime->private_data;
>> +
>> + switch (cmd) {
>> + case SNDRV_PCM_TRIGGER_START:
>> + ret = q6asm_run_nowait(prtd->audio_client, 0, 0, 0);
>> + break;
> below two cases can be combined with START if no change
Yep, I will do that in next version.
>> + case SNDRV_PCM_TRIGGER_RESUME:
>> + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
>> + ret = q6asm_run_nowait(prtd->audio_client, 0, 0, 0);
>> + break;
>> + case SNDRV_PCM_TRIGGER_STOP:
>> + prtd->state = Q6ASM_STREAM_STOPPED;
>> + ret = q6asm_cmd_nowait(prtd->audio_client, CMD_EOS);
>> + break;
>> + case SNDRV_PCM_TRIGGER_SUSPEND:
>> + case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
>> + ret = q6asm_cmd_nowait(prtd->audio_client, CMD_PAUSE);
>> + break;
>> + default:
>> + ret = -EINVAL;
>> + break;
>> + }
>> +
>> + return ret;
>> +}
>> +
>> +static int q6asm_dai_open(struct snd_pcm_substream *substream)
>> +{
>> + struct snd_pcm_runtime *runtime = substream->runtime;
>> + struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
>> + struct snd_soc_dai *cpu_dai = soc_prtd->cpu_dai;
>> +
>> + struct q6asm_dai_rtd *prtd;
>> + struct q6asm_dai_data *pdata;
>> + struct device *dev = soc_prtd->platform->dev;
>> + int ret = 0;
>> + int stream_id;
>> +
>> + stream_id = cpu_dai->driver->id;
>> +
>> + pdata = q6asm_get_dai_data(dev);
>> + if (!pdata) {
>> + pr_err("Platform data not found ..\n");
>> + return -EINVAL;
>> + }
>> +
>> + prtd = kzalloc(sizeof(struct q6asm_dai_rtd), GFP_KERNEL);
>> + if (prtd == NULL)
>> + return -ENOMEM;
>> +
>> + prtd->substream = substream;
>> + prtd->audio_client = q6asm_audio_client_alloc(dev,
>> + (q6asm_cb)event_handler, prtd, stream_id);
>> + if (!prtd->audio_client) {
>> + pr_info("%s: Could not allocate memory\n", __func__);
>> + kfree(prtd);
>> + return -ENOMEM;
>> + }
>> +
>> +// prtd->audio_client->dev = dev;
> cleanup this
Sure!
>> +
>> + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
>> + runtime->hw = q6asm_dai_hardware_playback;
>> +
>> + ret = snd_pcm_hw_constraint_list(runtime, 0,
>> + SNDRV_PCM_HW_PARAM_RATE,
>> + &constraints_sample_rates);
> [..]
>> +
>> +static int q6asm_dai_pcm_new(struct snd_soc_pcm_runtime *rtd)
>> +{
>> + struct snd_pcm_substream *substream;
>> + struct of_phandle_args args;
>> + struct device_node *node;
>> + struct q6asm_dai_data *pdata;
>> + struct snd_pcm *pcm = rtd->pcm;
>> + struct device *dev;
>> + int size, ret;
>> +
>> + dev = rtd->platform->dev->parent;
>> + node = dev->of_node;
>> + pdata = q6asm_get_dai_data(rtd->platform->dev);
>> +
>> + ret = of_parse_phandle_with_fixed_args(node, "iommus", 1, 0, &args);
>> + if (ret < 0)
>> + pdata->sid = -1;
>> + else
>> + pdata->sid = args.args[0];
>> +
>> +
>> +
> iommus for sdm845 is 16bit value. we need to have sid_mask which is 0x1
> in sdm845. We need to mask sid with 0x1 to get proper sid.
> pdata->sid &= 0x1;
Okay, I will take closer look at sdm845 and other socs, and make it more
generic in next version.
>> + substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
>> + size = q6asm_dai_hardware_playback.buffer_bytes_max;
>> + ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, dev, size,
>> + &substream->dma_buffer);
>> + if (ret)
>> + dev_err(dev, "Cannot allocate buffer(s)\n");
>> +
>> + return ret;
>> +}
>> +
>
>
next prev parent reply other threads:[~2018-02-22 11:16 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 16:58 [PATCH v3 00/25] ASoC: qcom: Add support to QDSP based Audio srinivas.kandagatla
2018-02-13 16:58 ` [PATCH v3 01/25] dt-bindings: soc: qcom: Add bindings for APR bus srinivas.kandagatla
2018-02-13 23:12 ` Rob Herring
2018-02-14 9:13 ` Srinivas Kandagatla
2018-02-18 23:04 ` Rob Herring
2018-02-20 9:33 ` Srinivas Kandagatla
2018-02-22 0:14 ` Rob Herring
2018-02-22 10:03 ` Srinivas Kandagatla
2018-02-28 18:55 ` Srinivas Kandagatla
2018-03-01 20:34 ` Mark Brown
2018-03-02 13:13 ` Srinivas Kandagatla
2018-02-13 16:58 ` [PATCH v3 02/25] soc: qcom: add support to APR bus driver srinivas.kandagatla
2018-02-19 3:08 ` Rob Herring
2018-02-20 9:33 ` Srinivas Kandagatla
2018-02-13 16:58 ` [PATCH v3 03/25] ASoC: qcom: qdsp6: Add common qdsp6 helper functions srinivas.kandagatla
2018-03-01 21:04 ` Mark Brown
2018-02-13 16:58 ` [PATCH v3 04/25] dt-bindings: sound: qcom: Add bindings for q6afe srinivas.kandagatla
2018-03-01 20:41 ` Mark Brown
2018-02-13 16:58 ` [PATCH v3 05/25] ASoC: qcom: qdsp6: Add support to Q6AFE srinivas.kandagatla
2018-02-19 10:30 ` [alsa-devel] " Rohit Kumar
2018-02-20 9:34 ` Srinivas Kandagatla
2018-03-01 20:42 ` Mark Brown
2018-03-01 20:59 ` Mark Brown
2018-03-02 13:13 ` Srinivas Kandagatla
2018-03-02 17:54 ` Mark Brown
2018-03-02 18:51 ` Srinivas Kandagatla
2018-02-13 16:58 ` [PATCH v3 06/25] dt-bindings: sound: qcom: Add bindings for q6adm srinivas.kandagatla
2018-02-13 16:58 ` [PATCH v3 07/25] ASoC: qcom: qdsp6: Add support to Q6ADM srinivas.kandagatla
2018-03-01 21:24 ` Mark Brown
2018-03-06 9:26 ` Srinivas Kandagatla
2018-02-13 16:58 ` [PATCH v3 08/25] dt-bindings: sound: qcom: Add bindings for q6asm srinivas.kandagatla
2018-02-13 16:58 ` [PATCH v3 09/25] ASoC: qcom: qdsp6: Add support to Q6ASM srinivas.kandagatla
2018-02-13 16:58 ` [PATCH v3 10/25] ASoC: qcom: q6asm: Add support to memory map and unmap srinivas.kandagatla
2018-03-01 21:28 ` Mark Brown
2018-03-06 9:26 ` Srinivas Kandagatla
2018-02-13 16:58 ` [PATCH v3 11/25] ASoC: qcom: q6asm: add support to audio stream apis srinivas.kandagatla
2018-03-01 21:33 ` Mark Brown
2018-03-06 9:26 ` Srinivas Kandagatla
2018-02-13 16:58 ` [PATCH v3 12/25] ASoC: qcom: qdsp6: Add support to Q6CORE srinivas.kandagatla
2018-02-19 10:33 ` [alsa-devel] " Rohit Kumar
2018-02-13 16:58 ` [PATCH v3 13/25] ASoC: qcom: qdsp6: Add support to q6routing driver srinivas.kandagatla
2018-02-13 16:58 ` [PATCH v3 14/25] ASoC: qcom: qdsp6: Add support to q6afe dai driver srinivas.kandagatla
2018-02-19 10:32 ` [alsa-devel] " Rohit Kumar
2018-02-20 9:36 ` Srinivas Kandagatla
2018-03-02 12:50 ` Mark Brown
2018-03-02 13:52 ` Srinivas Kandagatla
2018-02-13 16:58 ` [PATCH v3 15/25] ASoC: qcom: qdsp6: Add support to q6asm " srinivas.kandagatla
2018-02-21 11:14 ` [alsa-devel] " Rohit Kumar
2018-02-22 11:16 ` Srinivas Kandagatla [this message]
2018-02-13 16:58 ` [PATCH v3 16/25] ASoC: qcom: q6afe: add SLIMBus port Support srinivas.kandagatla
2018-02-13 16:58 ` [PATCH v3 17/25] ASoC: qcom: q6afe-dai: add support to slim afe dais srinivas.kandagatla
2018-02-13 16:58 ` [PATCH v3 18/25] ASoC: qcom: q6routing: add support to all SLIMBus Mixers srinivas.kandagatla
2018-05-21 15:47 ` Applied "ASoC: qdsp6: q6routing: Add support to all SLIMBus Mixers" to the asoc tree Mark Brown
2018-02-13 16:58 ` [PATCH v3 19/25] ASoC: qcom: q6afe: add support to MI2S ports srinivas.kandagatla
2018-03-07 9:35 ` [alsa-devel] " Rohit Kumar
2018-02-13 16:58 ` [PATCH v3 20/25] ASoC: qcom: q6afe: add support to MI2S sysclks srinivas.kandagatla
2018-02-13 16:58 ` [PATCH v3 21/25] ASoC: qcom: q6afe-dai: add support to 4 MI2S ports srinivas.kandagatla
2018-02-13 16:58 ` [PATCH v3 22/25] ASoC: qcom: q6routing: add support to MI2S Mixers srinivas.kandagatla
2018-02-13 16:58 ` [PATCH v3 23/25] dt-bindings: sound: qcom: Add devicetree bindings for apq8096 srinivas.kandagatla
2018-02-13 16:58 ` [PATCH v3 24/25] ASoC: qcom: apq8096: Add db820c machine driver srinivas.kandagatla
2018-02-22 11:00 ` [alsa-devel] " Rohit Kumar
2018-02-22 11:13 ` Srinivas Kandagatla
2018-02-13 16:58 ` [PATCH v3 25/25] arm64: dts: msm8996: db820c: Add sound card support srinivas.kandagatla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d0f42d37-ed4b-fb19-17ce-d825bb78fe40@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=andy.gross@linaro.org \
--cc=bgoswami@codeaurora.org \
--cc=broonie@kernel.org \
--cc=david.brown@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-soc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=plai@codeaurora.org \
--cc=robh+dt@kernel.org \
--cc=rohitkr@codeaurora.org \
--cc=rohkumar@qti.qualcomm.com \
--cc=spatakok@qti.qualcomm.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®