From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECF322BEFFE for ; Mon, 20 Jul 2026 06:41:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784529708; cv=none; b=iy11bU94SGGRSxqAulu+4B4EoqQn+IWC0UyP0ytthH5FsJ62vwx0Nh8kVMMlrw/1mOAU4qDJHRuJC+gggTh5Kq4Byk2IIHErcG7NwGRSeNgq4d8tU6K/ITmKIKLjoVBke7h327BkZXBxLs98d7FRosGkxRgMVwYETbqmOcEnzi4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784529708; c=relaxed/simple; bh=T8EbNBllvdOLhv6HbF6jlwWUvLjpmPFrMR1LokHWYu4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=g6ORLspUki0QG0OSUd1/jNHOjK6U5Io7e05kbcRpCM6Lt4hmcmY8Cux0hu9NraPhCsQKRqf3LC9dCafoM6a/oX9SJugXVtGf0kIjLxTDP1jJHtajQhtmT1IaICbfIlwb7O2cXExsUsIzq1Fn5QkYzifb6h/O70wabnnYPidqkwc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RYrqOZqf; arc=none smtp.client-ip=209.85.215.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RYrqOZqf" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-ca2fad0ae38so7627875a12.3 for ; Sun, 19 Jul 2026 23:41:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784529705; x=1785134505; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=elCYmb/Sg/JpLLjpyIpB3MPC/nkr3RkeAwjfLCjjezM=; b=RYrqOZqfiFENnmxBU7y4yX9R67UMZz0p9Bmbym6EWpymXSIh7nJcVFGhLseSXZwpQk PqCE5BEC/pl0+yyv0Z9RzowkjUtyPpVw8NaFFDd8e2omzSXCRd40TaBva+oIfuQJo7rU Hxev+l37iHALJf9XE2danzXV5cRrXQjRuAnQAecKs3PnqPd8hMfBAU/H6CfYwJvcq9TA yJJoYFRXNAYMW4G7ZJPMher0PTGHJkiHI31IpHJVmDkk8X+qexCdDkC11n0WHKjwr/r8 9ZLiKXaoR5ve3PpJRAnutzZwsioDADpuqL/hUpZGkVIAQuhJuGKKYCHqA9djvMiKT8cZ 6dCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784529705; x=1785134505; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=elCYmb/Sg/JpLLjpyIpB3MPC/nkr3RkeAwjfLCjjezM=; b=stCq4BDiX6VWJZksIgW45VaReWB47tCroPJ3MJN+RjevXVCe4yP0TlzigGs1STMJDO blzZASNk8VGsr9PIgzrHJvUMS61dADOKxTSxyYQbetkbZohPOqCXKGEgn/YuM48QWxEg r4Hj3bQFZWT0+lRYHgp7y9emhaPAmxMXdTHrPQfzxMlQAlhiRA2y+W1VdtUVceTQRsRh MUqAJws0MdSyFoxn5Ml2Xgs/fEBUWFXsUq63v7x7lDd+izt19PGXqDrU54VQAuTBci0h M+EP0gjiNTeQ0DZB43j3LRImnKddLb5dlQ93Xr3wVxnoVFnX+0JYxHhGjIkB1joBaIhM YDww== X-Gm-Message-State: AOJu0YyNvGkm+aJpzw7q/ddqdqUT0yg51ktLSxqVr7GzK6dKhpavZSdu ZxccVMIIUDiMZNiyjLeTkV23gcBOJV6YECsxpSd+NWEZzX7nAlBdZXzl X-Gm-Gg: AfdE7cnLg0KTyXVqMthnJKhiASO2wZtH4KuhMcg2wy3zLcgkjZ2U8lnR/tE/vm0jmKb ybZsOvVHsJ5iN8GfP35OiG6709BEIMg9ka5CkwrNI0nLOUqHvRhkUkzE+DyMFzFILLUL8FPAkzm XG7ecvDzh3Weq7RMsyuqbdqhKUT95LNX+QdX4usXHBu2t5psJ3ee2Np94JkehkUK31G6qy75do8 mBWx7V/DJQeSwW95lzL16EQ88oHb345iQ/F3Odj+S9kzEWX3e/bWTVNud5mmgSa9HP4nznVDrYo l5G6rUcA6es0fQMx1FoDX5JIlF3sVUAb7Yws9XmWMxD9RGhg9s44E0RyI8zPI7+PJ+uI9f9s63K VhRkJFbmUy58yEwIRw5Thilf7PWOZwEn7raJse5H/9BZyhOa7SR6mAEFTMaWjGbp+kA2cU77y/s /jIFoI9USjH2d1LAu4VNxs86IH2Eu18pbDPB4i9NDh7i4xGEw= X-Received: by 2002:a05:6a21:48f:b0:3c0:f772:8128 with SMTP id adf61e73a8af0-3c3ad9afdb9mr13009241637.54.1784529705263; Sun, 19 Jul 2026 23:41:45 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cb519ae8684sm4046703a12.17.2026.07.19.23.41.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jul 2026 23:41:44 -0700 (PDT) From: phucduc.bui@gmail.com To: Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Lars-Peter Clausen Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, bui duc phuc Subject: [PATCH v3] ASoC: soc-generic-dmaengine: Handle DMA channel request failures correctly Date: Mon, 20 Jul 2026 13:41:31 +0700 Message-ID: <20260720064131.75156-1-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: bui duc phuc 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. Improve the handling of these failures by: - reporting failures when a configured DMA channel cannot be requested; - failing probe if neither playback nor capture obtains a DMA channel, since the PCM device would be unusable. Devices that legitimately support only one DMA direction continue to work as before. Signed-off-by: bui duc phuc --- Changes in v3: - Drop has_legacy_config, since config->chan_names[] only provides the requested channel name and does not indicate legacy DMA mapping. Changes in v2: - Update the commit message and title. - Refine DMA channel request failure handling to match the dma_request_chan() implementation. sound/soc/soc-generic-dmaengine-pcm.c | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 467426d2b5e4..98ba9a836936 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -3,6 +3,7 @@ // Copyright (C) 2013, Analog Devices Inc. // Author: Lars-Peter Clausen +#include #include #include #include @@ -395,6 +396,27 @@ static int dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm, */ if (PTR_ERR(chan) == -EPROBE_DEFER) return -EPROBE_DEFER; + + bool has_fw_node = dev->of_node || is_acpi_device_node(dev->fwnode); + bool name_exists_in_fw = false; + + if (has_fw_node) + name_exists_in_fw = device_property_match_string(dev, + "dma-names", + name) >= 0; + + if (has_fw_node && name_exists_in_fw) + dev_warn(dev, "DTS/ACPI DMA channel '%s' request failed (%ld)\n", + name, PTR_ERR(chan)); + + if (has_fw_node && !name_exists_in_fw) + dev_warn(dev, "DTS/ACPI name '%s' not found, legacy failed (%ld)\n", + name, PTR_ERR(chan)); + + if (!has_fw_node) + dev_warn(dev, "Legacy DMA channel '%s' request failed (%ld)\n", + name, PTR_ERR(chan)); + pcm->chan[i] = NULL; } else { pcm->chan[i] = chan; @@ -406,6 +428,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[0] && + !pcm->chan[1]) { + dev_err(dev, "no DMA channel found for either playback or capture\n"); + return -ENODEV; + } + return 0; } -- 2.43.0