From nobody Mon Feb 9 11:28:49 2026 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (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 42F3E2E0910 for ; Tue, 9 Dec 2025 09:32:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765272731; cv=none; b=a4pUyi93MknKtY+1pbviD0qeQjvQzVcnKOmvO6cV9ATlImTcT97elhQCmmgEg3b+Cy4wQ/wQRgX+rdA88+qUpvksjF6iHFMSFCIt1KaRyq1VO2FuDDzRYNlS7CYEU2q4B4G8p0HmPD27w+AfxdcVxXOMo+WNq8Tz4RVxHjSVYQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765272731; c=relaxed/simple; bh=9X7Ik0ab5d6Iz/18MVVGvVc22VgP6m21NK5Flfc6r74=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ib5IS2YsnzQ51WsBA/mVSf+W/tVEx5KYr1wDhuC7SbfWeZxo/NXzMCaKdBW8/ibJ5BI4i2jk7lkKF6S+pNGyfVmQ3kpkLRfyJgrEwDWrJB9iaOJlOY3sedyEXD8W7LIILFm9kQ0HBui3cHKHnhyWLLStHih8zGakZpwpcoWr5Hg= 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=ctO9zKQC; arc=none smtp.client-ip=209.85.216.50 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="ctO9zKQC" Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-3436a97f092so6889326a91.3 for ; Tue, 09 Dec 2025 01:32:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765272729; x=1765877529; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=wT5Tpa0cRknM+Vnr1JQ25hhT3yDeTWdGEabrHv7VB7g=; b=ctO9zKQCCcjO9oGYVTm1b1j2oT3lrbMQ9LRNkBrCjlAO5+DOC8BHoq7oEQbAcFqSs4 PAazpflPQqvokCfmocCikbAlSgqpCTIHU+Lw02E422diEfop9wb/RlG9hLR7h2j4r9YA IKuMYEft9EylZFvWz2Xm/cG4yUI2unMekipCM1OT9Xp4zI5KqYRI3k5C6WcM5BpY7JqL MhcqSMVuVBPGvmDduPOwMQ2fHoUW6LhuHSlGqijxikHdksMF58hoEW8QlNDIpmA5AJJy GcVr8SbLRgTqqETlPIjsdrF802M1nWANFhYVwg+Ow5JT9kmdYu3k/r8oVbiPI+AABhSO PBFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765272729; x=1765877529; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=wT5Tpa0cRknM+Vnr1JQ25hhT3yDeTWdGEabrHv7VB7g=; b=eyEYEIFmpji4vVXxddjEon6aUGm1pfiAzAEmtgrlFE+H7qbyYiI/JxygrbCayHEG60 gdx/TYuj0YPvBoU+KiPufd/vqtK14vZvYtXFFTY9RMmiQPycdMywhyt1ouVOegpdE2Gv kHqfP7CM7NcAITZsoSODtD9zOnTezcLuenMexs796pLBdvwE9i277PLSDxOoMxn/aqrW w9wQpaJK1LDHoCn0363e8b+cuiX5LJYE8U55+mGYCTKGwfgIZ2KNHGSB+gCC39PTaum8 njla2Th7S4HyCRO6AlAQQLeLB8U0JrsnXBY2Mgy25ZZoERDI9mnJ6UdHdF5PW0meQMZy LQOA== X-Forwarded-Encrypted: i=1; AJvYcCWWFxQktLteA5EvcOmlB1pNZZDvYX7x0u351UYrHBuiaQ3l0YCjazDfAKkNWMS2aiKl5IVgqxq3sYw0eKE=@vger.kernel.org X-Gm-Message-State: AOJu0YzgTdMRofsS4JFc3OFtzLFnALufXDB+UKqWBZo2oD/Ol86qFbUw F4PqtcfRDCxzuiE9pIQUmILEsj2d94hchypsjuxA+PXev8vNo0ssOlOh X-Gm-Gg: ASbGncuFir1F/3cBS6cuwgFyuRd83INOBLG1FeFfH/I1XCVlR++4fASMfH+fHeSZ+LG 9PT3I0aUN0Eqk0IVh+z8V3DweDbDH9RNjJbTQQ8ePkaN6GmZfboR6D19LstSc/i8CaKqymWuM2u Zs5iFY0gXOfuowUzEVahCTxaUX/QPFaDxgB7RtE5JnMAFzvGsfapYuXf95dCv0kbttKUotKjGuI tOY+/qKX/PJRMHSPO/ElURLA6PVxX3zDlYW49W0Up815fusmfOt25y8Es5zQfBiTYwvA3hB5+/W 1v/ElOAcDD+xGyrDrmGmTogU8jZekalhzGMzHq8XKanYg6bL8+334U1sMfXKms2jxls7bewJjGU yqKCDOgdQMNUDtvba1uDPt55EwdP/zF5z+xCqUFCVKBw/nc1rU9wPuDMv23adz/WQutiNEwxxQ+ tMhUE9/4UVKk4KblVbLpv70eNih+qYgJz9J4duqdIG1nRiBvtL9se5TyF6mrwQTcmRRcfb0vWmC ywrhyM0UqezTi8vYQq6mu3ovenZy2zJUn5dFCShLqFfC9Ard7QZJ0sC7E4Gub0i6Ymf+8spw4iG +26ohy5Q31vLbclZPbwOIq+bNp706TJapmulsDIB7d3Jk3NcAFo= X-Google-Smtp-Source: AGHT+IEf8k2cGwcYziNVTfhJRUNWm4Blk7mY9yN2+i0tDJn66zOZx4itoz7PdkJwqZ4b134kt4zn5Q== X-Received: by 2002:a17:90b:3506:b0:340:bde5:c9e8 with SMTP id 98e67ed59e1d1-349a2613605mr9150879a91.22.1765272729310; Tue, 09 Dec 2025 01:32:09 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-34a49658704sm1800408a91.6.2025.12.09.01.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Dec 2025 01:32:09 -0800 (PST) From: James Calligeros Date: Tue, 09 Dec 2025 19:31:18 +1000 Subject: [PATCH 5/7] ASoC: soc-dai: add common operation to set TDM idle mode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251209-tdm-idle-slots-v1-5-38dabf6bc01e@gmail.com> References: <20251209-tdm-idle-slots-v1-0-38dabf6bc01e@gmail.com> In-Reply-To: <20251209-tdm-idle-slots-v1-0-38dabf6bc01e@gmail.com> To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Kuninori Morimoto , Shengjiu Wang , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev, James Calligeros X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3549; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=9X7Ik0ab5d6Iz/18MVVGvVc22VgP6m21NK5Flfc6r74=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDJnmb7I1nvHsL9CcfHRpJM/b7PymxSXtYfH8PI94VRjWN Nop1LR1TGRhEONisBRTZNnQJOQx24jtZr9I5V6YOaxMIEOkRRoYgICFgS83Ma/USMdIz1TbUM/Q UMdYx4iBi1MApvpKJcP/hCPlHm6PuVo3nGwJWLYz+8wxVlu1PgahH335M3Z3v1DmYWR4cPhcbHe w4rJdj2QFo7h+m50xEP60+dIS0Qn7l+jL39VkAQA= X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 Some audio devices, like certain Texas Instruments codecs, can be configured to alter their behaviour when idle on the bus. Now that we have definitions for various idle modes, add a snd_soc_dai_set_tdm_idle() operation to control this in a standardised way. Signed-off-by: James Calligeros --- include/sound/soc-dai.h | 7 +++++ sound/soc/soc-dai.c | 40 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index a5784ef8e3f7..1f411237dde5 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -194,6 +194,10 @@ int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsig= ned int fmt); int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width); =20 +int snd_soc_dai_set_tdm_idle(struct snd_soc_dai *dai, + unsigned int tx_mask, unsigned int rx_mask, + int tx_mode, int rx_mode); + int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai, unsigned int tx_num, const unsigned int *tx_slot, unsigned int rx_num, const unsigned int *rx_slot); @@ -310,6 +314,9 @@ struct snd_soc_dai_ops { int (*set_tdm_slot)(struct snd_soc_dai *dai, unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width); + int (*set_tdm_idle)(struct snd_soc_dai *dai, + unsigned int tx_mask, unsigned int rx_mask, + int tx_mode, int rx_mode); int (*set_channel_map)(struct snd_soc_dai *dai, unsigned int tx_num, const unsigned int *tx_slot, unsigned int rx_num, const unsigned int *rx_slot); diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index a1e05307067d..2f370fda1266 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -282,6 +282,46 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, } EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_slot); =20 +/** + * snd_soc_dai_set_tdm_idle() - Configure a DAI's TDM idle mode + * @dai: The DAI to configure + * @tx_mask: bitmask representing idle TX slots. + * @rx_mask: bitmask representing idle RX slots. + * @tx_mode: idle mode to set for TX slots. + * @rx_mode: idle mode to set for RX slots. + * + * This function configures the DAI to handle idle TDM slots in the + * specified manner. @tx_mode and @rx_mode can be one of + * SND_SOC_DAI_TDM_IDLE_NONE, SND_SOC_DAI_TDM_IDLE_ZERO, + * SND_SOC_DAI_TDM_IDLE_PULLDOWN, or SND_SOC_DAI_TDM_IDLE_HIZ. + * SND_SOC_TDM_IDLE_NONE represents the DAI's default/unset idle slot + * handling state and could be any of the other modes depending on the + * hardware behind the DAI. It is therefore undefined behaviour when set + * explicitly. + * + * Mode and mask can be set independently for both the TX and RX direction. + * Some hardware may ignore both TX and RX masks depending on its + * capabilities. + */ +int snd_soc_dai_set_tdm_idle(struct snd_soc_dai *dai, + unsigned int tx_mask, unsigned int rx_mask, + int tx_mode, int rx_mode) +{ + int ret =3D -EOPNOTSUPP; + + /* You can't write to the RX line */ + if (rx_mode =3D=3D SND_SOC_DAI_TDM_IDLE_ZERO) + return soc_dai_ret(dai, -EINVAL); + + if (dai->driver->ops && + dai->driver->ops->set_tdm_idle) + ret =3D dai->driver->ops->set_tdm_idle(dai, tx_mask, rx_mask, + tx_mode, rx_mode); + + return soc_dai_ret(dai, ret); +} +EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_idle); + /** * snd_soc_dai_set_channel_map - configure DAI audio channel map * @dai: DAI --=20 2.52.0