aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2017-09-20 09:10:20 +0200
committerLinus Walleij <linus.walleij@linaro.org>2018-02-20 14:42:57 +0100
commit44796a0f54a06bf8508415a96085d3c890eef7df (patch)
treed61c53dc236b8ed279351bbd66bd955727c9da7a
parent47f093caebf0678a277f814b2c2ac8bf00e8ce0d (diff)
downloadlinux-stericsson-ux500-audio-rewrite.tar.gz
-rw-r--r--drivers/dma/ste_dma40.c34
-rw-r--r--sound/soc/soc-generic-dmaengine-pcm.c33
2 files changed, 59 insertions, 8 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index b630323fc905..cdbde5582e81 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1840,6 +1840,8 @@ static int d40_allocate_channel(struct d40_chan *d40c, bool *first_phy_user)
bool is_src;
bool is_log = d40c->dma_cfg.mode == STEDMA40_MODE_LOGICAL;
+ dev_info(chan2dev(d40c), "ENTER %s\n", __func__);
+
phys = d40c->base->phy_res;
num_phy_chans = d40c->base->num_phy_chans;
@@ -1950,6 +1952,8 @@ out:
else
d40c->base->lookup_phy_chans[d40c->phy_chan->num] = d40c;
+ dev_info(chan2dev(d40c), "EXIT OK %s\n", __func__);
+
return 0;
}
@@ -1958,6 +1962,8 @@ static int d40_config_memcpy(struct d40_chan *d40c)
{
dma_cap_mask_t cap = d40c->chan.device->cap_mask;
+ dev_info(chan2dev(d40c), "ENTER %s\n", __func__);
+
if (dma_has_cap(DMA_MEMCPY, cap) && !dma_has_cap(DMA_SLAVE, cap)) {
d40c->dma_cfg = dma40_memcpy_conf_log;
d40c->dma_cfg.dev_type = dma40_memcpy_channels[d40c->chan.chan_id];
@@ -1977,10 +1983,12 @@ static int d40_config_memcpy(struct d40_chan *d40c)
d40c->dst_def_cfg |= BIT(D40_SREG_CFG_EIM_POS);
} else {
- chan_err(d40c, "No memcpy\n");
+ chan_err(d40c, "EXIT No memcpy\n");
return -EINVAL;
}
+ dev_info(chan2dev(d40c), "EXIT OK %s\n", __func__);
+
return 0;
}
@@ -2273,6 +2281,7 @@ bool stedma40_filter(struct dma_chan *chan, void *data)
int err;
if (data) {
+ dev_info(chan2dev(d40c), "VALIDATE CONF %s\n", __func__);
err = d40_validate_conf(d40c, info);
if (!err)
d40c->dma_cfg = *info;
@@ -2355,17 +2364,25 @@ static struct dma_chan *d40_xlate(struct of_phandle_args *dma_spec,
flags = dma_spec->args[2];
switch (D40_DT_FLAGS_MODE(flags)) {
- case 0: cfg.mode = STEDMA40_MODE_LOGICAL; break;
- case 1: cfg.mode = STEDMA40_MODE_PHYSICAL; break;
+ case 0:
+ cfg.mode = STEDMA40_MODE_LOGICAL;
+ pr_info("d40_xlate: logical channel device %d\n", cfg.dev_type);
+ break;
+ case 1:
+ cfg.mode = STEDMA40_MODE_PHYSICAL;
+ pr_info("d40_xlate: physical channel device %d\n", cfg.dev_type);
+ break;
}
switch (D40_DT_FLAGS_DIR(flags)) {
case 0:
cfg.dir = DMA_MEM_TO_DEV;
+ pr_info("d40_xlate: memory to device\n");
cfg.dst_info.big_endian = D40_DT_FLAGS_BIG_ENDIAN(flags);
break;
case 1:
cfg.dir = DMA_DEV_TO_MEM;
+ pr_info("d40_xlate: device to memory\n");
cfg.src_info.big_endian = D40_DT_FLAGS_BIG_ENDIAN(flags);
break;
}
@@ -2373,10 +2390,15 @@ static struct dma_chan *d40_xlate(struct of_phandle_args *dma_spec,
if (D40_DT_FLAGS_FIXED_CHAN(flags)) {
cfg.phy_channel = dma_spec->args[1];
cfg.use_fixed_channel = true;
+ pr_info("d40_xlate: use fixed physical channel %d\n", cfg.phy_channel);
+ } else {
+ pr_info("d40_xlate: use any channel, ignore arg %d\n", dma_spec->args[1]);
}
- if (D40_DT_FLAGS_HIGH_PRIO(flags))
+ if (D40_DT_FLAGS_HIGH_PRIO(flags)) {
+ pr_info("d40_xlate: high prio channel\n");
cfg.high_priority = true;
+ }
return dma_request_channel(cap, stedma40_filter, &cfg);
}
@@ -2389,6 +2411,9 @@ static int d40_alloc_chan_resources(struct dma_chan *chan)
struct d40_chan *d40c =
container_of(chan, struct d40_chan, chan);
bool is_free_phy;
+
+ dev_info(chan2dev(d40c), "ENTER %s\n", __func__);
+
spin_lock_irqsave(&d40c->lock, flags);
dma_cookie_init(chan);
@@ -2444,6 +2469,7 @@ static int d40_alloc_chan_resources(struct dma_chan *chan)
pm_runtime_mark_last_busy(d40c->base->dev);
pm_runtime_put_autosuspend(d40c->base->dev);
spin_unlock_irqrestore(&d40c->lock, flags);
+ dev_info(chan2dev(d40c), "EXIT %s %d\n", __func__, err);
return err;
}
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index d53786498b61..0ea70b68d2f2 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -286,13 +286,18 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
if (!pcm->chan[i] &&
- (pcm->flags & SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME))
+ (pcm->flags & SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME)) {
pcm->chan[i] = dma_request_slave_channel(dev,
dma_data->chan_name);
+ dev_info(rtd->platform->dev,
+ "Requested custom channel name %s for stream: %d\n", dma_data->chan_name, i);
+ }
if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) {
pcm->chan[i] = dmaengine_pcm_compat_request_channel(rtd,
substream);
+ dev_info(rtd->platform->dev,
+ "Requested compat channel for stream: %d\n", i);
}
if (!pcm->chan[i]) {
@@ -311,6 +316,8 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i]))
pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE;
+ dev_info(rtd->platform->dev,
+ "OK requested dma channel for stream: %d\n", i);
}
return 0;
@@ -363,6 +370,8 @@ static int dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm,
!dev->of_node)
return 0;
+ dev_info(dev, "%s ENTER\n", __func__);
+
if (config && config->dma_dev) {
/*
* If this warning is seen, it probably means that your Linux
@@ -388,8 +397,10 @@ static int dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm,
if (PTR_ERR(chan) == -EPROBE_DEFER)
return -EPROBE_DEFER;
pcm->chan[i] = NULL;
+ dev_info(dev, "%s NULL channel %d name \"%s\"\n", __func__, i, name);
} else {
pcm->chan[i] = chan;
+ dev_info(dev, "%s OK got channel %d name \"%s\"\n", __func__, i, name);
}
if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
break;
@@ -398,21 +409,28 @@ static int dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm,
if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
pcm->chan[1] = pcm->chan[0];
+ dev_info(dev, "%s EXIT OK\n", __func__);
+
return 0;
}
-static void dmaengine_pcm_release_chan(struct dmaengine_pcm *pcm)
+static void dmaengine_pcm_release_chan(struct device *dev, struct dmaengine_pcm *pcm)
{
unsigned int i;
+ dev_info(dev, "%s ENTER\n", __func__);
+
for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE;
i++) {
if (!pcm->chan[i])
continue;
dma_release_channel(pcm->chan[i]);
+ dev_info(dev, "%s release channel %d\n", __func__, i);
if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
break;
}
+
+ dev_info(dev, "%s EXIT OK\n", __func__);
}
/**
@@ -427,6 +445,8 @@ int snd_dmaengine_pcm_register(struct device *dev,
struct dmaengine_pcm *pcm;
int ret;
+ dev_info(dev, "%s ENTER\n", __func__);
+
pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
if (!pcm)
return -ENOMEM;
@@ -443,10 +463,12 @@ int snd_dmaengine_pcm_register(struct device *dev,
if (ret)
goto err_free_dma;
+ dev_info(dev, "%s EXIT OK\n", __func__);
+
return 0;
err_free_dma:
- dmaengine_pcm_release_chan(pcm);
+ dmaengine_pcm_release_chan(dev, pcm);
kfree(pcm);
return ret;
}
@@ -464,6 +486,8 @@ void snd_dmaengine_pcm_unregister(struct device *dev)
struct snd_soc_platform *platform;
struct dmaengine_pcm *pcm;
+ dev_info(dev, "%s ENTER\n", __func__);
+
platform = snd_soc_lookup_platform(dev);
if (!platform)
return;
@@ -471,8 +495,9 @@ void snd_dmaengine_pcm_unregister(struct device *dev)
pcm = soc_platform_to_pcm(platform);
snd_soc_remove_platform(platform);
- dmaengine_pcm_release_chan(pcm);
+ dmaengine_pcm_release_chan(dev, pcm);
kfree(pcm);
+ dev_info(dev, "%s EXIT OK\n", __func__);
}
EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_unregister);