]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ASoC: dmaengine: Make the pcm->name equal to pcm->id if the name is not set
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Fri, 6 Sep 2019 05:55:24 +0000 (08:55 +0300)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 18 Oct 2019 08:26:00 +0000 (04:26 -0400)
BugLink: https://bugs.launchpad.net/bugs/1848046
[ Upstream commit 2ec42f3147e1610716f184b02e65d7f493eed925 ]

Some tools use the snd_pcm_info_get_name() to try to identify PCMs or for
other purposes.

Currently it is left empty with the dmaengine-pcm, in this case copy the
pcm->id string as pcm->name.

For example IGT is using this to find the HDMI PCM for testing audio on it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reported-by: Arthur She <arthur.she@linaro.org>
Link: https://lore.kernel.org/r/20190906055524.7393-1-peter.ujfalusi@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
sound/soc/soc-generic-dmaengine-pcm.c

index 748f5f641002e91f0ab9e8246734b84a4af72083..d93db2c2b527029a37ae869abf6e222de2751eff 100644 (file)
@@ -306,6 +306,12 @@ 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;
+
+               if (rtd->pcm->streams[i].pcm->name[0] == '\0') {
+                       strncpy(rtd->pcm->streams[i].pcm->name,
+                               rtd->pcm->streams[i].pcm->id,
+                               sizeof(rtd->pcm->streams[i].pcm->name));
+               }
        }
 
        return 0;