From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Patrick Lai <plai@codeaurora.org>, Mark Brown <broonie@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Banajit Goswami <bgoswami@codeaurora.org>,
Kenneth Westfield <kwestfie@codeaurora.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [RFC PATCH 09/14] ASoC: qcom: Add ability to handle interrupts per dma channel
Date: Thu, 30 Apr 2015 18:17:42 +0100 [thread overview]
Message-ID: <1430414262-11252-1-git-send-email-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <1430414148-10869-1-git-send-email-srinivas.kandagatla@linaro.org>
This patch adds ablity to lpass driver to handle interrupt per dma
channel. Without this patch its not possible to use multipl ports on the
lpass.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
sound/soc/qcom/lpass-platform.c | 89 +++++++++++++++++++++++++----------------
sound/soc/qcom/lpass.h | 4 ++
2 files changed, 58 insertions(+), 35 deletions(-)
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 8ab0ac1..c5907d5 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -356,27 +356,15 @@ static struct snd_pcm_ops lpass_platform_pcm_ops = {
.mmap = lpass_platform_pcmops_mmap,
};
-static irqreturn_t lpass_platform_lpaif_irq(int irq, void *data)
+static irqreturn_t lpass_dma_interrupt_handler(
+ struct snd_pcm_substream *substream,
+ struct lpass_data *drvdata,
+ int chan, u32 interrupts)
{
- struct snd_pcm_substream *substream = data;
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
- struct lpass_data *drvdata =
- snd_soc_platform_get_drvdata(soc_runtime->platform);
struct lpass_variant *v = drvdata->variant;
- struct lpass_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(soc_runtime);
- unsigned int interrupts;
irqreturn_t ret = IRQ_NONE;
- int rv, chan = pcm_data->rdma_ch;
-
- rv = regmap_read(drvdata->lpaif_map,
- LPAIF_IRQSTAT_REG(v, LPAIF_IRQ_PORT_HOST), &interrupts);
- if (rv) {
- dev_err(soc_runtime->dev, "%s() error reading from irqstat reg: %d\n",
- __func__, rv);
- return IRQ_NONE;
- }
-
- interrupts &= LPAIF_IRQ_ALL(chan);
+ int rv;
if (interrupts & LPAIF_IRQ_PER(chan)) {
rv = regmap_write(drvdata->lpaif_map,
@@ -422,6 +410,30 @@ static irqreturn_t lpass_platform_lpaif_irq(int irq, void *data)
return ret;
}
+static irqreturn_t lpass_platform_lpaif_irq(int irq, void *data)
+{
+ struct lpass_data *drvdata = data;
+ struct lpass_variant *v = drvdata->variant;
+ unsigned int irqs;
+ int rv, chan;
+
+ rv = regmap_read(drvdata->lpaif_map,
+ LPAIF_IRQSTAT_REG(v, LPAIF_IRQ_PORT_HOST), &irqs);
+ if (rv) {
+ pr_err("%s() error reading from irqstat reg: %d\n",
+ __func__, rv);
+ return IRQ_NONE;
+ }
+
+ /* Handle per channel interrupts */
+ for (chan = 0; chan < LPASS_MAX_DMA_CHANNELS; chan++)
+ if (irqs & LPAIF_IRQ_ALL(chan) && drvdata->substream[chan])
+ lpass_dma_interrupt_handler(drvdata->substream[chan],
+ drvdata, chan, irqs);
+
+ return IRQ_HANDLED;
+}
+
static int lpass_platform_alloc_buffer(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *soc_runtime)
{
@@ -477,6 +489,7 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
if (IS_ERR_VALUE(data->rdma_ch))
return data->rdma_ch;
+ drvdata->substream[data->rdma_ch] = substream;
data->i2s_port = cpu_dai->driver->id;
snd_soc_pcm_set_drvdata(soc_runtime, data);
@@ -488,29 +501,12 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
if (ret)
return ret;
- ret = devm_request_irq(soc_runtime->dev, drvdata->lpaif_irq,
- lpass_platform_lpaif_irq, IRQF_TRIGGER_RISING,
- "lpass-irq-lpaif", substream);
- if (ret) {
- dev_err(soc_runtime->dev, "%s() irq request failed: %d\n",
- __func__, ret);
- goto err_buf;
- }
-
- /* ensure audio hardware is disabled */
- ret = regmap_write(drvdata->lpaif_map,
- LPAIF_IRQEN_REG(v, LPAIF_IRQ_PORT_HOST), 0);
- if (ret) {
- dev_err(soc_runtime->dev, "%s() error writing to irqen reg: %d\n",
- __func__, ret);
- return ret;
- }
ret = regmap_write(drvdata->lpaif_map,
LPAIF_RDMACTL_REG(v, data->rdma_ch), 0);
if (ret) {
dev_err(soc_runtime->dev, "%s() error writing to rdmactl reg: %d\n",
__func__, ret);
- return ret;
+ goto err_buf;
}
return 0;
@@ -530,6 +526,8 @@ static void lpass_platform_pcm_free(struct snd_pcm *pcm)
struct lpass_pcm_data *data = snd_soc_pcm_get_drvdata(soc_runtime);
struct lpass_variant *v = drvdata->variant;
+ drvdata->substream[data->rdma_ch] = NULL;
+
if (v->free_dma_channel)
v->free_dma_channel(drvdata, data->rdma_ch);
@@ -545,6 +543,8 @@ static struct snd_soc_platform_driver lpass_platform_driver = {
int asoc_qcom_lpass_platform_register(struct platform_device *pdev)
{
struct lpass_data *drvdata = platform_get_drvdata(pdev);
+ struct lpass_variant *v = drvdata->variant;
+ int ret;
drvdata->lpaif_irq = platform_get_irq_byname(pdev, "lpass-irq-lpaif");
if (drvdata->lpaif_irq < 0) {
@@ -553,6 +553,25 @@ int asoc_qcom_lpass_platform_register(struct platform_device *pdev)
return -ENODEV;
}
+ ret = devm_request_irq(&pdev->dev, drvdata->lpaif_irq,
+ lpass_platform_lpaif_irq, IRQF_TRIGGER_RISING,
+ "lpass-irq-lpaif", drvdata);
+ if (ret) {
+ dev_err(&pdev->dev, "%s() irq request failed: %d\n",
+ __func__, ret);
+ return ret;
+ }
+
+ /* ensure audio hardware is disabled */
+ ret = regmap_write(drvdata->lpaif_map,
+ LPAIF_IRQEN_REG(v, LPAIF_IRQ_PORT_HOST), 0);
+ if (ret) {
+ dev_err(&pdev->dev, "%s() error writing to irqen reg: %d\n",
+ __func__, ret);
+ return ret;
+ }
+
+
return devm_snd_soc_register_platform(&pdev->dev,
&lpass_platform_driver);
}
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index e07ed52..c3016fe 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -23,6 +23,7 @@
#define LPASS_AHBIX_CLOCK_FREQUENCY 131072000
#define LPASS_MAX_MI2S_PORTS (4)
+#define LPASS_MAX_DMA_CHANNELS (8)
/* Both the CPU DAI and platform drivers will access this data */
struct lpass_data {
@@ -47,6 +48,9 @@ struct lpass_data {
/* SOC specific variations in the LPASS IP integration */
struct lpass_variant *variant;
+
+ /* used it for handling interrupt per dma channel */
+ struct snd_pcm_substream *substream[LPASS_MAX_DMA_CHANNELS];
};
/* Vairant data per each SOC */
--
1.9.1
next prev parent reply other threads:[~2015-04-30 17:17 UTC|newest]
Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-30 17:15 [RFC PATCH 00/14] ASoC: qcom: add support to apq8016 audio Srinivas Kandagatla
2015-04-30 17:16 ` [RFC PATCH 01/14] ASoC: qcom: Remove redundant error check Srinivas Kandagatla
2015-05-04 12:24 ` Mark Brown
2015-04-30 17:16 ` [RFC PATCH 02/14] ASoC: qcom: remove unnecessary header files Srinivas Kandagatla
2015-05-04 12:24 ` Mark Brown
2015-04-30 17:16 ` [RFC PATCH 03/14] ASoC: qcom: move ipq806x specific bits out of lpass driver Srinivas Kandagatla
2015-05-02 23:57 ` Kenneth Westfield
2015-05-05 5:19 ` Kenneth Westfield
2015-05-05 7:17 ` Srinivas Kandagatla
2015-05-06 5:43 ` [alsa-devel] " Kenneth Westfield
2015-05-05 7:16 ` Srinivas Kandagatla
2015-05-06 5:35 ` [alsa-devel] " Kenneth Westfield
2015-04-30 17:17 ` [RFC PATCH 04/14] ASoC: qcom: remove hardcoded i2s port number Srinivas Kandagatla
2015-04-30 17:17 ` [RFC PATCH 05/14] ASoC: qcom: remove hardcoded dma channel Srinivas Kandagatla
2015-04-30 17:17 ` [RFC PATCH 06/14] ASoC: qcom: support bitclk and osrclk per i2s port Srinivas Kandagatla
2015-04-30 17:17 ` [RFC PATCH 07/14] ASoC: qcom: add no osr clk flag to lpass variant Srinivas Kandagatla
2015-05-02 23:58 ` Kenneth Westfield
2015-05-05 7:17 ` Srinivas Kandagatla
2015-05-04 12:26 ` Mark Brown
2015-05-05 7:16 ` Srinivas Kandagatla
2015-04-30 17:17 ` [RFC PATCH 08/14] ASoC: qcom: add dma channel control offset to variant data Srinivas Kandagatla
2015-05-02 23:59 ` Kenneth Westfield
2015-05-05 7:16 ` Srinivas Kandagatla
2015-04-30 17:17 ` Srinivas Kandagatla [this message]
2015-05-03 0:00 ` [RFC PATCH 09/14] ASoC: qcom: Add ability to handle interrupts per dma channel Kenneth Westfield
2015-05-05 7:17 ` Srinivas Kandagatla
2015-04-30 17:17 ` [RFC PATCH 10/14] ASoC: qcom: add bit map to track static dma channel allocations Srinivas Kandagatla
2015-04-30 17:17 ` [RFC PATCH 11/14] ASoC: qcom: Add apq8016 lpass driver support Srinivas Kandagatla
2015-04-30 17:18 ` [RFC PATCH 12/14] ASoC: qcom: add apq8016 sound card support Srinivas Kandagatla
2015-05-03 0:01 ` Kenneth Westfield
2015-05-05 7:17 ` Srinivas Kandagatla
2015-04-30 17:18 ` [RFC PATCH 13/14] ASoC: qcom: Document apq8016 bindings Srinivas Kandagatla
2015-04-30 17:18 ` [RFC PATCH 14/14] ASoC: qcom: document apq8016 machine driver bindings Srinivas Kandagatla
2015-05-03 0:03 ` Kenneth Westfield
2015-05-03 3:59 ` Kenneth Westfield
2015-05-05 7:17 ` Srinivas Kandagatla
2015-05-06 5:41 ` [alsa-devel] " Kenneth Westfield
2015-05-02 23:57 ` [RFC PATCH 00/14] ASoC: qcom: add support to apq8016 audio Kenneth Westfield
2015-05-06 5:47 ` Kenneth Westfield
2015-05-06 6:54 ` Srinivas Kandagatla
2015-05-12 4:06 ` [alsa-devel] " Kenneth Westfield
2015-05-12 10:21 ` Srinivas Kandagatla
2015-05-12 17:04 ` Lars-Peter Clausen
2015-05-14 7:55 ` Srinivas Kandagatla
2015-05-12 13:11 ` Srinivas Kandagatla
2015-05-13 11:58 ` [PATCH v1 00/13] " Srinivas Kandagatla
2015-05-13 12:00 ` [PATCH v1 01/13] ASoC: qcom: make lpass driver depend on OF Srinivas Kandagatla
2015-05-13 12:00 ` [PATCH v1 02/13] ASoC: qcom: move ipq806x specific bits out of lpass driver Srinivas Kandagatla
2015-05-15 5:23 ` Kenneth Westfield
2015-05-15 8:48 ` Srinivas Kandagatla
2015-05-13 12:00 ` [PATCH v1 03/13] ASoC: qcom: remove hardcoded i2s port number Srinivas Kandagatla
2015-05-13 12:00 ` [PATCH v1 04/13] ASoC: qcom: remove hardcoded dma channel Srinivas Kandagatla
2015-05-13 12:00 ` [PATCH v1 05/13] ASoC: qcom: support bitclk and osrclk per i2s port Srinivas Kandagatla
2015-05-15 5:23 ` Kenneth Westfield
2015-05-15 8:44 ` Srinivas Kandagatla
2015-05-13 12:02 ` [PATCH v1 06/13] ASoC: qcom: make osr clock optional Srinivas Kandagatla
2015-05-13 12:02 ` [PATCH v1 07/13] ASoC: qcom: add dma channel control offset to variant data Srinivas Kandagatla
2015-05-13 12:02 ` [PATCH v1 08/13] ASoC: qcom: Add ability to handle interrupts per dma channel Srinivas Kandagatla
2015-05-13 12:02 ` [PATCH v1 09/13] ASoC: qcom: add bit map to track static dma channel allocations Srinivas Kandagatla
2015-05-13 12:03 ` [PATCH v1 10/13] ASoC: qcom: Add apq8016 lpass driver support Srinivas Kandagatla
2015-05-15 5:23 ` Kenneth Westfield
2015-05-15 8:46 ` Srinivas Kandagatla
2015-05-13 12:03 ` [PATCH v1 11/13] ASoC: qcom: add apq8016 sound card support Srinivas Kandagatla
2015-05-15 5:23 ` Kenneth Westfield
2015-05-15 8:47 ` Srinivas Kandagatla
2015-05-13 12:03 ` [PATCH v1 12/13] ASoC: qcom: Document apq8016 bindings Srinivas Kandagatla
2015-05-13 12:03 ` [PATCH v1 13/13] ASoC: qcom: document apq8016 sbc machine driver bindings Srinivas Kandagatla
2015-05-16 12:31 ` [PATCH v2 00/13] ASoC: qcom: add support to apq8016 audio Srinivas Kandagatla
2015-05-16 12:32 ` [PATCH v2 01/13] ASoC: qcom: make lpass driver depend on OF Srinivas Kandagatla
2015-05-21 20:10 ` Mark Brown
2015-05-16 12:32 ` [PATCH v2 02/13] ASoC: qcom: move ipq806x specific bits out of lpass driver Srinivas Kandagatla
2015-05-21 20:11 ` Mark Brown
2015-05-16 12:32 ` [PATCH v2 03/13] ASoC: qcom: remove hardcoded i2s port number Srinivas Kandagatla
2015-05-16 12:32 ` [PATCH v2 04/13] ASoC: qcom: remove hardcoded dma channel Srinivas Kandagatla
2015-05-21 20:12 ` Mark Brown
2015-05-16 12:32 ` [PATCH v2 05/13] ASoC: qcom: support bitclk and osrclk per i2s port Srinivas Kandagatla
2015-05-17 16:14 ` Kenneth Westfield
2015-05-16 12:32 ` [PATCH v2 06/13] ASoC: qcom: make osr clock optional Srinivas Kandagatla
2015-05-17 16:15 ` Kenneth Westfield
2015-05-16 12:32 ` [PATCH v2 07/13] ASoC: qcom: add dma channel control offset to variant data Srinivas Kandagatla
2015-05-16 12:33 ` [PATCH v2 08/13] ASoC: qcom: Add ability to handle interrupts per dma channel Srinivas Kandagatla
2015-05-16 12:33 ` [PATCH v2 09/13] ASoC: qcom: add bit map to track static dma channel allocations Srinivas Kandagatla
2015-05-16 12:33 ` [PATCH v2 10/13] ASoC: qcom: Add apq8016 lpass driver support Srinivas Kandagatla
2015-05-16 12:33 ` [PATCH v2 11/13] ASoC: qcom: add apq8016 sound card support Srinivas Kandagatla
2015-05-16 12:33 ` [PATCH v2 12/13] ASoC: qcom: Document apq8016 bindings Srinivas Kandagatla
2015-05-16 12:33 ` [PATCH v2 13/13] ASoC: qcom: document apq8016 sbc machine driver bindings Srinivas Kandagatla
2015-05-17 16:15 ` [PATCH v2 00/13] ASoC: qcom: add support to apq8016 audio Kenneth Westfield
2015-05-21 17:05 ` Mark Brown
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=1430414262-11252-1-git-send-email-srinivas.kandagatla@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=bgoswami@codeaurora.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=kwestfie@codeaurora.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pawel.moll@arm.com \
--cc=perex@perex.cz \
--cc=plai@codeaurora.org \
--cc=robh+dt@kernel.org \
--cc=tiwai@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).