From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 EA0E43DE453 for ; Wed, 5 Aug 2026 06:44:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785912249; cv=none; b=gyCaHVs2EBbg7hLEYY3m24FKdK9INcQnv3QoUksioGsCWw2mK424SmxoTVlo4QMn712EJ1KSS9OfNgfWBDH7/rmgArvnnpGNnt5OaRNKpR3n6RRVFLTii59TRSjhz6v6IbemoJ9o6urRIbc2nICtcW5kHEvE7bTD365jbSY6KD4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785912249; c=relaxed/simple; bh=ONk4+ySJ6/04rtJi3tnz+Bcm2WtGNmnRsdHa+ACx5DI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XIryKe2Q4K0MVLeFCePuDknsYbp77hAgIPj4FHv3ODLLR9uzfmFVkLZiUmyY5SM7JHkxgHn9p4Bla3J09psTpV0zdwT070pnP2R2N35uIVToLgAqw9cqMDdKsN+jO/emBM1BW6llDwTzQyCvpb0AY2d0p3bIZYYHy0x6fznwajY= 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=GEgdldOh; arc=none smtp.client-ip=209.85.214.170 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="GEgdldOh" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2caced6038eso8441845ad.0 for ; Tue, 04 Aug 2026 23:44:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785912247; x=1786517047; 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=jFfF9vOjPIRrYjKrW5dKD1o7wgpldgxBl11pAMSS8hY=; b=GEgdldOhYKqcrx0dYUvS/UBHI7MAQn8Sw/KQfUB9nhRezwg4XsyfyGWtlhrcP+e9z8 /iteFJ79WQ3bEr2M6TLuIwICmieZvIERba9YeE4vI3JsIVoYWsTZu8UfIeEkbXhmkMe/ 1wqXOTBSVYhyjxwjVQt47nbwEhhXNn0gMddfQHn1P+dbf4w904XLjTgFXx/7cyjCv5t6 PxUwGAixwTjpKh0n986yBDU2LGg2k/RfqY3pqEKSMmhVkYDlam9yU0rK+Ux/H5yU1Oap ZkdfykuAxu7Ws6MYOkrTyfq57AtV7oEz84rKbRVHPtk/b/GlJIMtJlRBzCBTY+iclJg0 mfqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785912247; x=1786517047; 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=jFfF9vOjPIRrYjKrW5dKD1o7wgpldgxBl11pAMSS8hY=; b=HExLp9KMIBhN4VARxPNfE377vMoOTrxOOiAXHLF3Gchg/ilDFSyWA63+KmP5rMNIbl IT3lJfvj/t5dE7TuLuJPV/2p0RNk78pmaPFvj00kcTYvz/wNak8BJxwBjHTU/9RRGii1 hXlGfbU4s/0d2edYV87Xzd2AgT79N5Y8qRD13ALW/YVugbxP+tq/zL+ZrDqV8nRG5B3L pGePLlpbMDOdLY5SqALkalMUAD/5nuWWQPfGGAnfnINc/u5kcGBQaF6dnRfD6QD4RIAU FCbwIbhW/R9frKos3Je2tu7ovgRvLdwwaXj7FBK4l+u6Tf6q+v4ol31OdFEcsm8HXqwp LORQ== X-Forwarded-Encrypted: i=1; AHgh+RqryKEClz6A4ZoZi28Z/z7gZmhSgir83LAfDGhzuLyX9n+0GjisugIHHGnNg1iMl5eZMyiMJ+bTAk7bcr8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1P4tLLxIRw8wnt2tI4KYaXao+oarz5OF1/EmBujpaaUC2W5Le uaMu3G2k74OfpQUJFS8liho9+h1m+PitSZuSEKHGsumfccM1vlCgF+8L X-Gm-Gg: AR+sD11ueqQwLOwF1vofH9n3xW8mULbEmrQ4jk2Lv1IF+tfGOYaOCM9ncgOl3DuIhnP f4Q+nr71ANZ/uxv4pq/w4sxvFTKshQBotoMGBnfgiiRtL+hWPx3n9IrqBrudKE0F7GvEk2UCyLO P12aIJH9GnIDBR5y8Am6DxW6lMqQVSkG2ILL4dXccm/BPecyX9NQQPKvMMBolEvHJ8c5nih5n3g dKMiodkafPE74fgbjT4SDYWIE54kA5HA1VaK8+E/X/MCH7kEPlu5R95Zu6cN6MfB8DkHscXnZzl ywyfiL9E6QzJJAZPEuuCLKHmbx8DyYWgV3pmxsAlkhSDmLa6H3umg0DoFDU6AY/zhIEcRtTSjTe Qc1BofzdKQvkW4/xj7lLE6RQ96nxGhRHPCJRJKfgvmNHlPbj4zMoXeHGKFZKNNfnT6H0+TK2bju 9bb0XqPS3ZY45d89pzcbIrboC4b9WbCYu/It6N09iHl4HivqiEmVJotxgf95PrSyvaiGaJINDd1 pHKE6Cb6P2jBorevS2miuM+QuAJ0atkv2aqcn0p4+UpIGLRzI/LsUPtaMxq4LVRzYfBWNRD5eBj H7dQ3A== X-Received: by 2002:a17:902:e551:b0:2d0:401c:2edc with SMTP id d9443c01a7336-2d08aa1c85bmr95025355ad.1.1785912247199; Tue, 04 Aug 2026 23:44:07 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d0aa491747sm14094435ad.39.2026.08.04.23.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Aug 2026 23:44:06 -0700 (PDT) From: phucduc.bui@gmail.com To: Yixun Lan , Takashi Iwai , Mark Brown , Jaroslav Kysela , Liam Girdwood Cc: Troy Mitchell , Goko Mell , Jinmei Wei , linux-riscv@lists.infradead.org, spacemit@lists.linux.dev, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, bui duc phuc Subject: [PATCH v2] ASoC: spacemit: advertise only DMA-backed DAI streams Date: Wed, 5 Aug 2026 13:43:48 +0700 Message-ID: <20260805064348.44283-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 The static DAI template initializes both playback and capture stream capabilities before dma-names is examined. As a result, snd_soc_dai_stream_valid() considers both directions valid even when the device only provides a single DMA channel. Move the playback and capture capability initialization into spacemit_i2s_init_dai(), where it is performed only for the stream directions backed by a corresponding DMA channel. This preserves the existing capabilities for devices with both "tx" and "rx" DMA channels, while preventing unsupported stream directions from being advertised. Initialize rate_min and rate_max together with the other stream capabilities to preserve the existing rate constraints. Fixes: fce217449075 ("ASoC: spacemit: add i2s support for K1 SoC") Signed-off-by: bui duc phuc --- Changes in v2: - Update the commit message to describe the functional fix as suggested by Troy. Link v1 : https://lore.kernel.org/all/20260804043036.22065-1-phucduc.bui@gmail.com/ sound/soc/spacemit/k1_i2s.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/sound/soc/spacemit/k1_i2s.c b/sound/soc/spacemit/k1_i2s.c index 2d5ea1fd5d49..28a762769253 100644 --- a/sound/soc/spacemit/k1_i2s.c +++ b/sound/soc/spacemit/k1_i2s.c @@ -354,22 +354,6 @@ static const struct snd_soc_dai_ops spacemit_i2s_dai_ops = { static struct snd_soc_dai_driver spacemit_i2s_dai = { .ops = &spacemit_i2s_dai_ops, - .playback = { - .channels_min = 1, - .channels_max = 2, - .rates = SPACEMIT_PCM_RATES, - .rate_min = SNDRV_PCM_RATE_8000, - .rate_max = SNDRV_PCM_RATE_48000, - .formats = SPACEMIT_PCM_FORMATS, - }, - .capture = { - .channels_min = 1, - .channels_max = 2, - .rates = SPACEMIT_PCM_RATES, - .rate_min = SNDRV_PCM_RATE_8000, - .rate_max = SNDRV_PCM_RATE_48000, - .formats = SPACEMIT_PCM_FORMATS, - }, .symmetric_rate = 1, }; @@ -399,6 +383,8 @@ static int spacemit_i2s_init_dai(struct spacemit_i2s_dev *i2s, dai->playback.channels_min = 1; dai->playback.channels_max = 2; dai->playback.rates = SPACEMIT_PCM_RATES; + dai->playback.rate_min = SNDRV_PCM_RATE_8000; + dai->playback.rate_max = SNDRV_PCM_RATE_48000; dai->playback.formats = SPACEMIT_PCM_FORMATS; i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; @@ -411,6 +397,8 @@ static int spacemit_i2s_init_dai(struct spacemit_i2s_dev *i2s, dai->capture.channels_min = 1; dai->capture.channels_max = 2; dai->capture.rates = SPACEMIT_PCM_RATES; + dai->capture.rate_min = SNDRV_PCM_RATE_8000; + dai->capture.rate_max = SNDRV_PCM_RATE_48000; dai->capture.formats = SPACEMIT_PCM_FORMATS; i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; -- 2.43.0