All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: soc-generic-dmaengine: report DMA channel request failures more clearly
@ 2026-07-16  8:04 phucduc.bui
  0 siblings, 0 replies; only message in thread
From: phucduc.bui @ 2026-07-16  8:04 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Lars-Peter Clausen
  Cc: linux-kernel, linux-sound, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

Currently any dma_request_chan() failure other than -EPROBE_DEFER is
silently ignored, since a missing channel is expected for devices that
only support one DMA direction. This makes two real problems
indistinguishable from that normal case:

1. If the channel name is actually present in "dma-names" but the
request still fails, that is a genuine error, not a missing direction
warn about it instead of staying silent.

2. If neither direction ends up with a channel, the PCM device is
entirely unusable. Unlike missing just one direction, this is never
expected, so fail probe with a clear error instead of registering a
non-functional PCM device.

No change for the still-silent, still-supported case of a device that
legitimately onlysupports one direction.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/soc/soc-generic-dmaengine-pcm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index 467426d2b5e4..c15c2d8248fa 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -395,6 +395,11 @@ static int dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm,
 			 */
 			if (PTR_ERR(chan) == -EPROBE_DEFER)
 				return -EPROBE_DEFER;
+
+			if (device_property_match_string(dev, "dma-names", name) >= 0)
+				dev_warn(dev, "dma-names has '%s' but request failed (%ld)\n",
+					 name, PTR_ERR(chan));
+
 			pcm->chan[i] = NULL;
 		} else {
 			pcm->chan[i] = chan;
@@ -406,6 +411,12 @@ 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];
 
+	if (!pcm->chan[SNDRV_PCM_STREAM_PLAYBACK] &&
+	    !pcm->chan[SNDRV_PCM_STREAM_CAPTURE]) {
+		dev_err(dev, "no DMA chanel found for either playback or capture\n");
+		return -ENODEV;
+	}
+
 	return 0;
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-16  8:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-16  8:04 [PATCH] ASoC: soc-generic-dmaengine: report DMA channel request failures more clearly phucduc.bui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.