From patchwork Fri Aug 11 20:14:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Watts X-Patchwork-Id: 13351390 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4CCDC04A6A for ; Fri, 11 Aug 2023 20:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Y2HU9DU3ZMbj5d4Fom8Kk33uCzhrotqxiRYOgnMCmsw=; b=Y5vtNRwzayDmsz y3AxXfUBfuAjNJtWymlUZaeSg23TsvrL8Aa89luokX/g4+dLKUDTe0KYnkMcyLu3mDOIV3nKR7ZRc Bmi311VQqr67pqi/19+eWgakDTRVp/dB5JYD5YHoNd280vOazcTxKWJ23TZSW660PuxeX+w/cbQsg 4+W53A6XgeVhevOT+FxEaS2pR1pNMRUiyPghQqheH8DXH+HmXSGvtLM0QZHrRd09TrSV5gHi0odMe 0bty6fW27DWzdFmISydbPABcyUWtjL4FLklCe22PNHMMRtE/feuiVxA7HFamuVXtD5paW1KwqLac2 wRkIrGtDtTgONFSJzNDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qUYWj-00BXqZ-1z; Fri, 11 Aug 2023 20:14:29 +0000 Received: from out-93.mta1.migadu.com ([95.215.58.93]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qUYWf-00BXpJ-2B for linux-arm-kernel@lists.infradead.org; Fri, 11 Aug 2023 20:14:27 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jookia.org; s=key1; t=1691784863; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gXxLpbwnK2iER9aMBTnDKfRuAwj+8nGNCQhtYFkwJrs=; b=fOEGh3YG4Ed6CywSJa3zIzGH2UVPJ+thdSdatxaiyOcU9nDq8LREc/TvthapaRnzpBYlnG FkZ+uW225LdaA9JsXIeD5pOY9Rx70nNzbDvQkHyx4EZkch9XQTJ+q+Trt3jDSQ0HaXCLWM 4TNb6SgeURSj5+UtJy+h5JVwtLu9vuMthKYiutq26Ba0xvfEQSeWgHXfXoIXu0HtFLiMf9 kKijtcXvYSnpNQ/MVYktvL6GvO1DSGUTJWvhaVC7DleXPcqp14j6KzM9nheB19wcrGJnhQ M6Y7kj7j4/qNa4Mbt+bxVFjD7KRyMATH5Ja2J+Lsga4DJsrlT78qDjwMeGd7LA== From: John Watts To: alsa-devel@alsa-project.org Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Jaroslav Kysela , Takashi Iwai , John Watts , =?utf-8?q?U?= =?utf-8?q?we_Kleine-K=C3=B6nig?= , Maxime Ripard , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/7] ASoC: sunxi: sun4i-i2s: Prepare for runtime DIN pin selection Date: Sat, 12 Aug 2023 06:14:00 +1000 Message-ID: <20230811201406.4096210-2-contact@jookia.org> In-Reply-To: <20230811201406.4096210-1-contact@jookia.org> References: <20230811201406.4096210-1-contact@jookia.org> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230811_131425_863862_33ACC984 X-CRM114-Status: GOOD ( 17.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The R329 and D1 support multiple I2S data input pins, but to use these they require explicit mapping to channels. Add a mapping of DIN pins to the 16 channels in the sun4i_i2s struct then use that to write the channel mapping register. For now the mapping is always to DIN0, identical to the previous behaviour. Signed-off-by: John Watts --- sound/soc/sunxi/sun4i-i2s.c | 40 +++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index 669d712bbe9f..d8f999ecaf05 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -216,6 +216,7 @@ struct sun4i_i2s { unsigned int mclk_freq; unsigned int slots; unsigned int slot_width; + u8 channel_dins[16]; struct snd_dmaengine_dai_dma_data capture_dma_data; struct snd_dmaengine_dai_dma_data playback_dma_data; @@ -233,6 +234,13 @@ struct sun4i_i2s_clk_div { u8 val; }; +static int sun4i_i2s_read_channel_dins(struct device *dev, struct sun4i_i2s *i2s) +{ + /* Use DIN pin 0 by default */ + memset(i2s->channel_dins, 0, sizeof(i2s->channel_dins)); + return 0; +} + static const struct sun4i_i2s_clk_div sun4i_i2s_bclk_div[] = { { .div = 2, .val = 0 }, { .div = 4, .val = 1 }, @@ -527,6 +535,25 @@ static int sun8i_i2s_set_chan_cfg(const struct sun4i_i2s *i2s, return 0; } +static void sun50i_h6_write_channel_map(const struct sun4i_i2s *i2s, + unsigned int reg, + unsigned int channel_start) +{ + unsigned int reg_value = 0; + + /* Loop backwards so we can shift values in */ + for (int i = 3; i >= 0; i--) { + int channel = channel_start + i; + u8 din = i2s->channel_dins[channel]; + u8 slot = channel; /* Map slot to channel */ + + reg_value <<= 8; + reg_value |= (din << 4) | slot; + } + + regmap_write(i2s->regmap, reg, reg_value); +} + static int sun50i_h6_i2s_set_chan_cfg(const struct sun4i_i2s *i2s, unsigned int channels, unsigned int slots, unsigned int slot_width) @@ -537,10 +564,10 @@ static int sun50i_h6_i2s_set_chan_cfg(const struct sun4i_i2s *i2s, regmap_write(i2s->regmap, SUN50I_H6_I2S_TX_CHAN_MAP0_REG(0), 0xFEDCBA98); regmap_write(i2s->regmap, SUN50I_H6_I2S_TX_CHAN_MAP1_REG(0), 0x76543210); if (i2s->variant->num_din_pins > 1) { - regmap_write(i2s->regmap, SUN50I_R329_I2S_RX_CHAN_MAP0_REG, 0x0F0E0D0C); - regmap_write(i2s->regmap, SUN50I_R329_I2S_RX_CHAN_MAP1_REG, 0x0B0A0908); - regmap_write(i2s->regmap, SUN50I_R329_I2S_RX_CHAN_MAP2_REG, 0x07060504); - regmap_write(i2s->regmap, SUN50I_R329_I2S_RX_CHAN_MAP3_REG, 0x03020100); + sun50i_h6_write_channel_map(i2s, SUN50I_R329_I2S_RX_CHAN_MAP0_REG, 12); + sun50i_h6_write_channel_map(i2s, SUN50I_R329_I2S_RX_CHAN_MAP1_REG, 8); + sun50i_h6_write_channel_map(i2s, SUN50I_R329_I2S_RX_CHAN_MAP2_REG, 4); + sun50i_h6_write_channel_map(i2s, SUN50I_R329_I2S_RX_CHAN_MAP3_REG, 0); } else { regmap_write(i2s->regmap, SUN50I_H6_I2S_RX_CHAN_MAP0_REG, 0xFEDCBA98); regmap_write(i2s->regmap, SUN50I_H6_I2S_RX_CHAN_MAP1_REG, 0x76543210); @@ -1559,6 +1586,11 @@ static int sun4i_i2s_probe(struct platform_device *pdev) } } + if (sun4i_i2s_read_channel_dins(&pdev->dev, i2s)) { + dev_err(&pdev->dev, "Invalid channel DINs\n"); + return -EINVAL; + } + i2s->playback_dma_data.addr = res->start + i2s->variant->reg_offset_txdata; i2s->playback_dma_data.maxburst = 8; From patchwork Fri Aug 11 20:14:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Watts X-Patchwork-Id: 13351391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5771CC0015E for ; Fri, 11 Aug 2023 20:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kW3Em3fscv53zt3hsTjHgd9L3BI8u9P6wqzVcrg0DaU=; b=uby8Woc7wfeFD4 GtgS21hrs0wG+w2cLlL7TQBJvxeSymOEGY5QAp83TF5RbNLd/J8FvfaDSXGAcaEoud+ceOBUHQlwa y5V0riZfJdS8N3rgistCs1HB3YEts3stlp2xaYS4gWMsej5823VRVFBdIJCWqA5NK/jdHr8O2YyVC iIGt5VBs+05E3Pu1SGggZGER6PbnGtrntgxiHMgfpXKLMASwPVn5XMzqllIg4xRSrTeYKwXR8uKVH KA4K7+dijDurWWWSMWJC/0LmGdpTqPHytn8qGiBJueWtAo2pr/wBRIxCRdTffSaQldOq3CQwP+S+r omtr0XjkXSCod9Orhh5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qUYWr-00BXrv-0v; Fri, 11 Aug 2023 20:14:37 +0000 Received: from out-78.mta1.migadu.com ([2001:41d0:203:375::4e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qUYWo-00BXr5-1s for linux-arm-kernel@lists.infradead.org; Fri, 11 Aug 2023 20:14:35 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jookia.org; s=key1; t=1691784872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DhYtgX26LvJBhk6rq6uv3xTzs4w5PTKDtDH5ARnA/4A=; b=G3FR1BhYf+QYeepS8uWwGULIaRbKottmRdYsDjusazmWtWiDg8fF5tcuc4FuZXcRMNF2Mo ieoy9oUrsQeJSeROCAv/695QGWwCOuZAuV7fs5AWXgdfEsc6UgpJpBjuPRS2Hofz0af/VT tmBpbOYnVZpR6BIbJBm8dYGC0gUvtemdTvaRXMkVzbJLGzE4MTaO1SXq/PmfzOvOwrqO9H tXOGIlA2GciINGlf4QK/fJ4JFnwS/FO+t48g2Sg9qwwBMjwkhOkNqm5iTPO+TSAU4Rx84E dVyExjbZ389fkoZxoqmDquJNbI2ASpqJqqKj3A1P+Sy1ou5RNvSxx8guWMrfog== From: John Watts To: alsa-devel@alsa-project.org Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Jaroslav Kysela , Takashi Iwai , John Watts , =?utf-8?q?U?= =?utf-8?q?we_Kleine-K=C3=B6nig?= , Maxime Ripard , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [RFC PATCH 2/7] ASoC: sunxi: sun4i-i2s: Use channel-dins device tree property Date: Sat, 12 Aug 2023 06:14:01 +1000 Message-ID: <20230811201406.4096210-3-contact@jookia.org> In-Reply-To: <20230811201406.4096210-1-contact@jookia.org> References: <20230811201406.4096210-1-contact@jookia.org> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230811_131434_767608_492DE234 X-CRM114-Status: GOOD ( 14.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Instead of using DIN pin 0 for all pins, allow changing this using the device tree property. As an example: &i2s2 { channel-dins = /bits/ 8 <0 0 1 1 2 2>; }; This sets channels 0 and 1 to DIN pin 0, channels 1 and 2 to DIN pin 1, and channels 3 and 4 to DIN pin 3 respectively. Signed-off-by: John Watts --- sound/soc/sunxi/sun4i-i2s.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index d8f999ecaf05..cf66f21646a4 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -236,8 +236,33 @@ struct sun4i_i2s_clk_div { static int sun4i_i2s_read_channel_dins(struct device *dev, struct sun4i_i2s *i2s) { + struct device_node *np = dev->of_node; + int max_channels = ARRAY_SIZE(i2s->channel_dins); + int ret; + /* Use DIN pin 0 by default */ memset(i2s->channel_dins, 0, sizeof(i2s->channel_dins)); + + if (!np) + return 0; + + ret = of_property_read_variable_u8_array(np, "channel-dins", + i2s->channel_dins, + 1, max_channels); + + if (ret == -EINVAL) + return 0; + + if (ret < 0) + return ret; + + for (int i = 0; i < ret; ++i) { + u8 din = i2s->channel_dins[i]; + + if (din >= i2s->variant->num_din_pins) + return -EINVAL; + } + return 0; } From patchwork Fri Aug 11 20:14:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Watts X-Patchwork-Id: 13351392 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D54EC0015E for ; Fri, 11 Aug 2023 20:15:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VoyyFuvQzwBxxKGw0XBd047lT1wyHmoPaMQUACmLkAI=; b=IxrFkgXMtFEaxm GZp3YHJenqQdVm7SqRVnUuALrp8C3UQtF7CFPEW8WUq6Eav2L0ndpQP3n4JtTkClKdmAICwqUy5TY 5qu1MjNNpacYSSW4AWpitDIZfdy+GUI36BooyR/jnl8yFMuudNxZqu0GKAmlF5KFmACrZ5CtMs5cZ A/lBjC8W+Z5ztcu40GsaKNcRjdoTodB55ieIuAeFR7hGJDgCOhO9gFaCofCEt+a9fWGXqnP7md0K6 WjIGzHI8rll5VzR5iNAYsrv401TgRVyZNEEDyP4NnolrJIpZqPewaBQ9KqAZazMnUg0H8TZrfapx6 zPUnsdJDH/tbj7r6UHZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qUYX1-00BXuR-08; Fri, 11 Aug 2023 20:14:47 +0000 Received: from out-108.mta1.migadu.com ([95.215.58.108]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qUYWx-00BXt3-2H for linux-arm-kernel@lists.infradead.org; Fri, 11 Aug 2023 20:14:45 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jookia.org; s=key1; t=1691784880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KohIP0ksHXxdx+GVUlJOfMvQCC6gcPhr/Z2zQUgwBik=; b=b+X1lQvdVhoQYU2XhhOyNGjflc23TRX6lpdQ4j3TVZPlsuUKRMU+OpZQaiDS13YPvo+Gag srOdPv0LV4WyVDiGbaOwKk/3WyOs2rlMkTR0lV3mh4EVr0rPjdTAgIvJxr6aaOPBWEh2/X nqesEmlNJGzzk6D9VQaz2yT3iRwRBq4rS9h58rGcfz/05bwCfeuo8YweYJqoScg0fw0DDe ZqaXU+vo2rLuDoUP1fOskzn8svSeJFPncg0PpgpBHvIpnIihbYRYERlAU8sL1dRIh3pTHO HWQ0HeRwYvp3S7Lcge1dubVrRGxaDvUpc6XOqdcdZXu6kYIPajrkAEiFFJXifQ== From: John Watts To: alsa-devel@alsa-project.org Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Jaroslav Kysela , Takashi Iwai , John Watts , =?utf-8?q?U?= =?utf-8?q?we_Kleine-K=C3=B6nig?= , Maxime Ripard , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [RFC PATCH 3/7] ASoC: sunxi: sun4i-i2s: Prepare for runtime channel slot selection Date: Sat, 12 Aug 2023 06:14:02 +1000 Message-ID: <20230811201406.4096210-4-contact@jookia.org> In-Reply-To: <20230811201406.4096210-1-contact@jookia.org> References: <20230811201406.4096210-1-contact@jookia.org> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230811_131443_885191_23AB4588 X-CRM114-Status: GOOD ( 17.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The sun4i I2S controller supports mapping channels to specific TDM slots. This is usually done in a 1:1 mapping because there's not really a reason to re-order the TDM slots in software. On the R329 and D1 multiplexing can be done using pins as well as TDM. Here's an example of using 3 pins and 2 slots (left and right): Channel 0 -> DIN0 -> ADC0, TDM slot 0 Channel 1 -> DIN0 -> ADC0, TDM slot 1 Channel 2 -> DIN1 -> ADC1, TDM slot 0 Channel 3 -> DIN1 -> ADC1, TDM slot 1 Channel 4 -> DIN2 -> ADC2, TDM slot 0 Channel 5 -> DIN2 -> ADC2, TDM slot 1 This connects 3 separate TDM-unaware ADCs to the I2S controller. Likewise, multiple TDM slots could be used to run two sets of TDM-aware ADCs on one I2S controller. Prepare for configurable slot selection by adding a channel to slot mapping array and using that in the R329 code if we multiple DIN pins. Signed-off-by: John Watts --- sound/soc/sunxi/sun4i-i2s.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index cf66f21646a4..627bf319e1cc 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -217,6 +217,7 @@ struct sun4i_i2s { unsigned int slots; unsigned int slot_width; u8 channel_dins[16]; + u8 channel_slots[16]; struct snd_dmaengine_dai_dma_data capture_dma_data; struct snd_dmaengine_dai_dma_data playback_dma_data; @@ -266,6 +267,17 @@ static int sun4i_i2s_read_channel_dins(struct device *dev, struct sun4i_i2s *i2s return 0; } +static int sun4i_i2s_read_channel_slots(struct device *dev, struct sun4i_i2s *i2s) +{ + int max_channels = ARRAY_SIZE(i2s->channel_dins); + + /* Use a 1:1 mapping by default */ + for (int i = 0; i < max_channels; ++i) + i2s->channel_slots[i] = i; + + return 0; +} + static const struct sun4i_i2s_clk_div sun4i_i2s_bclk_div[] = { { .div = 2, .val = 0 }, { .div = 4, .val = 1 }, @@ -570,7 +582,7 @@ static void sun50i_h6_write_channel_map(const struct sun4i_i2s *i2s, for (int i = 3; i >= 0; i--) { int channel = channel_start + i; u8 din = i2s->channel_dins[channel]; - u8 slot = channel; /* Map slot to channel */ + u8 slot = i2s->channel_slots[channel]; reg_value <<= 8; reg_value |= (din << 4) | slot; @@ -1616,6 +1628,11 @@ static int sun4i_i2s_probe(struct platform_device *pdev) return -EINVAL; } + if (sun4i_i2s_read_channel_slots(&pdev->dev, i2s)) { + dev_err(&pdev->dev, "Invalid channel slots\n"); + return -EINVAL; + } + i2s->playback_dma_data.addr = res->start + i2s->variant->reg_offset_txdata; i2s->playback_dma_data.maxburst = 8; From patchwork Fri Aug 11 20:14:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Watts X-Patchwork-Id: 13351393 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F7CCC0015E for ; Fri, 11 Aug 2023 20:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=x85D+Sd4ezDiDPfuHZcgD3Iwy/DO0UqQ6sCgClL5Yuo=; b=h7UQT9KHReiQdF kUEiTGpfO7OtJN+RLb5p++En5XpjSJ4tPZLtVJTTBFhdy2+rBH/LAgtOWIcHKc3za8bYhMioArJad D1RkeraKio70ehLBLw7DCq/XWmXf1u3hIcxX3MxYyHBk5kBW6YtRPXPqYW+scXRJ2le1HTamhXCA3 dhnUyTCVN50+G816xcrnU/vJeeuaNAfR3TfUJjEDSFOj8hOOlHqZ8FPuFt4CovZD1pqWx9S9PV/9E NsZQtDjVWNv+PqGc5fSPBn0tv2SxL8DCY4Ls8DfKANWjhP7d6hgPVk9x/hrihR94qGSOwYF1Bgsov HkCK7vxCbsNEgqdG+oQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qUYX9-00BXxc-1G; Fri, 11 Aug 2023 20:14:55 +0000 Received: from out-77.mta0.migadu.com ([91.218.175.77]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qUYX6-00BXvx-02 for linux-arm-kernel@lists.infradead.org; Fri, 11 Aug 2023 20:14:53 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jookia.org; s=key1; t=1691784889; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c760wkxPLczuI7tECzLOiGz+mznMFHiURmBp9IfloLs=; b=SF7GQFQIMbGSIRIbDdfcfm1/Ln1i/WscUwrTn0q7g9Z2FxkvffM46DLW+yosRia5C+01hO nSO9wHJ/nCkY+BuHCKtIPRhAvlQ26+RjFiLI3/9+ZRCUZU2QEYAs9tMPvWJLEALKgYLQcr DXWIy6JF3NZOOctaC6Rs+MK3rVAx64b2TffmFFG3FEaGNLX9rj59OoEnqqcuvwluBe52LX YHzSeZ9+eDwjs+4n980y4xyfurS640oORu3/5Co+ieSypxHceQZLOxxpOShOjqpjQSaoD1 TkEoo/NHBMJqeVdbqUaF3VscGKV8A8XKNogDdt3TwOKPlMVigfFEWFhfkC/d5Q== From: John Watts To: alsa-devel@alsa-project.org Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Jaroslav Kysela , Takashi Iwai , John Watts , =?utf-8?q?U?= =?utf-8?q?we_Kleine-K=C3=B6nig?= , Maxime Ripard , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [RFC PATCH 4/7] ASoC: sunxi: sun4i-i2s: Use channel-slots device tree property Date: Sat, 12 Aug 2023 06:14:03 +1000 Message-ID: <20230811201406.4096210-5-contact@jookia.org> In-Reply-To: <20230811201406.4096210-1-contact@jookia.org> References: <20230811201406.4096210-1-contact@jookia.org> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230811_131452_194811_CA5BC68E X-CRM114-Status: GOOD ( 14.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On R329 I2S variants with multiple pins it's useful to read from multiple devices within a single TDM slot. Allow changing the assignment of slots through a device tree property. As an example: &i2s2 { channel-dins = /bits/ 8 <0 0 1 1 2 2>; channel-slots = /bits/ 8 <0 1 0 1 0 1>; }; In addition to configuring the first 6 channels to use different DIN pins for three separate ADCs, the addition of channel-slots allows all three ADCs to be sampled within the first two TDM slots. Signed-off-by: John Watts --- sound/soc/sunxi/sun4i-i2s.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index 627bf319e1cc..019a4856c90b 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -269,12 +269,27 @@ static int sun4i_i2s_read_channel_dins(struct device *dev, struct sun4i_i2s *i2s static int sun4i_i2s_read_channel_slots(struct device *dev, struct sun4i_i2s *i2s) { + struct device_node *np = dev->of_node; int max_channels = ARRAY_SIZE(i2s->channel_dins); + int ret; /* Use a 1:1 mapping by default */ for (int i = 0; i < max_channels; ++i) i2s->channel_slots[i] = i; + if (!np) + return 0; + + ret = of_property_read_variable_u8_array(np, "channel-slots", + i2s->channel_slots, + 1, max_channels); + + if (ret == -EINVAL) + return 0; + + if (ret < 0) + return ret; + return 0; } From patchwork Fri Aug 11 20:14:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Watts X-Patchwork-Id: 13351394 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B66D8C0015E for ; Fri, 11 Aug 2023 20:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WCczBIdL1v9BLi5ZtgCbt+jbryCuWXkEM9a6F08hGwY=; b=UjZ/N5FCqmLRNh CLQyP4QbQP2Ygzoxwzrwh5WWRjLte8jSoxEuHf35R2+rAVMTFuEgodWJGxQUzNi6NBxzhUbBYwuGp brJwc8L007AdELOALCfmA1hQ0tmT1Sr5/BnjvqrLr9o0bJoFR0F6uKupadYq+J8E/S9AeF1yzs3/m 2b8DQxydS1HUa7tJ9jA2cIh6CP0is7b7kniWoi1w8n0DB6OhUoCGX2b1/29ynzIv5NCEI4wfmmgn3 T8NXKEBRhH+ElNq3+qDzjPtIRqyd47cKKTrzwcpt5ryG/d/3F+F/jxSpXw0cagM/OfApLdE2pycTh qehfoShI8iaXwrSVxQhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qUYXJ-00BY1Z-10; Fri, 11 Aug 2023 20:15:05 +0000 Received: from out-68.mta1.migadu.com ([2001:41d0:203:375::44]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qUYXF-00BXyz-2n for linux-arm-kernel@lists.infradead.org; Fri, 11 Aug 2023 20:15:03 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jookia.org; s=key1; t=1691784898; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QeLKekQPGIWeXPPUTKz0UKXYLZ76J8hy48F28uG+rX0=; b=LToGtkDrOCSOVpZih3iIpGEia0EWeKKZmc8sXDwvIDst79QFhcJMmKPTrN3sDyjY1Wy2V+ 6d5pHC5gzuuL+DV3YeuRE4CYWcZnwxcupNJ3tJ80rEWDQ6JfN4SLY7DiGJYwKfqWtUjjJo hlQ3qR7G7/W+ktYvQSU1ELwD75mHRMwo2GrfLValj+Rr+pHqoyjnO1uKCyC4tQbuSZ0b23 oJrlGZFLUvH42hPAC5gr/y6pY7gbYWeaM2Q7ApnKbPjjkWEH2BueC6PRj0KLdKAGt0IrlZ 4qb39dtKKzPT7NmuAjpPVfonV6xd//g4n3/p05BnPMSkG5/Ihe01O7RRs5AdGw== From: John Watts To: alsa-devel@alsa-project.org Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Jaroslav Kysela , Takashi Iwai , John Watts , =?utf-8?q?U?= =?utf-8?q?we_Kleine-K=C3=B6nig?= , Maxime Ripard , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [RFC PATCH 5/7] ASoC: sunxi: sun4i-i2s: Detect TDM slots based on channel slots Date: Sat, 12 Aug 2023 06:14:04 +1000 Message-ID: <20230811201406.4096210-6-contact@jookia.org> In-Reply-To: <20230811201406.4096210-1-contact@jookia.org> References: <20230811201406.4096210-1-contact@jookia.org> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230811_131502_049191_CC708FD1 X-CRM114-Status: GOOD ( 15.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The current controller code assumes a 1:1 relationship between audio channel and TDM slot. This may not be the case when slots are set explicitly. Instead figure out how many slots we need based on the number of slots used in the channel map. This allows the case of reading multiple data pins on a single slot. Signed-off-by: John Watts --- sound/soc/sunxi/sun4i-i2s.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index 019a4856c90b..6347aaaed016 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -271,6 +271,7 @@ static int sun4i_i2s_read_channel_slots(struct device *dev, struct sun4i_i2s *i2 { struct device_node *np = dev->of_node; int max_channels = ARRAY_SIZE(i2s->channel_dins); + int slot_max; int ret; /* Use a 1:1 mapping by default */ @@ -290,6 +291,16 @@ static int sun4i_i2s_read_channel_slots(struct device *dev, struct sun4i_i2s *i2 if (ret < 0) return ret; + for (int i = 0; i < ret; ++i) { + int slot = i2s->channel_slots[i]; + + if (slot_max < slot) + slot_max = slot; + } + + /* Add 1 to be inclusive of slot 0 */ + i2s->slots = slot_max + 1; + return 0; } From patchwork Fri Aug 11 20:14:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Watts X-Patchwork-Id: 13351395 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45838C0015E for ; Fri, 11 Aug 2023 20:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xt/NfUBbneezj20JefvZwI3TLMFj3HWupD3xXfkJSk0=; b=mITOyAf/IF5FnU XNup3Iieb+pKHYESEmTuS3EfAWdYffZgt7X98KjtUnOIhQuHQ63A5CQsQ5LzO3HmMVCna8zBc4AW+ LKuAhKCQ9gyZdSiQklCzS9F5mH/eyX6nGqeQEJEizyz8CZgP8JNtV5KwwhAh+IlbMsqKJRbjg4wyg zIVo1r9Xlg/5CgMNJVePfO7Tmd05UvCJ3YNP4Eq02d/iKG0EwcmOYdNpDVRU7AfksI7eCw5HpHxJN VosHA7aCB/tQONtrlUFBHId1Y9m2ziOqEGdzGBH1PfV41XygeOlk7A3fOJ2ZfsgMNLYQPWrEOuEUX Be15kl84d4kYlsRDNQmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qUYXT-00BY5X-0T; Fri, 11 Aug 2023 20:15:15 +0000 Received: from out-110.mta1.migadu.com ([2001:41d0:203:375::6e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qUYXQ-00BY2I-1g for linux-arm-kernel@lists.infradead.org; Fri, 11 Aug 2023 20:15:14 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jookia.org; s=key1; t=1691784906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/hW1ak8KgoejCSW9QrrxKnaZZBYUUgvs8EvZwonWW7Q=; b=CD4lRSohS0DnXE6VQTtKXerkV30clc05gHhy1KjszANLvk8PDxlFSV7Qua/nro9kKonJHc e8eoHeaLZp5s7KZlNwDK34rkKsUWBfUCmWTCwRWVwy5QVgHHMZM8sSork3+go0HP+WS2zL +wBm7nWZHqrkbT8zDGGfazKRPg1VK2rWYNYP0YW6raQ/isdg1uta45WuZX3DZboZBPOXsr DA0c5ijB5Kpf3Kj+R7DF+Ni0j9/bqE9IkI7pP9wCtKYgDEMMQjTSXd1APKUViWkkroB+Sh CrJoPs2fjzC35iszArbzoMgCTxYKK2L00BJPuquI4sL0bH08DFY/JDbOupdFfg== From: John Watts To: alsa-devel@alsa-project.org Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Jaroslav Kysela , Takashi Iwai , John Watts , =?utf-8?q?U?= =?utf-8?q?we_Kleine-K=C3=B6nig?= , Maxime Ripard , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [RFC PATCH 6/7] dt-bindings: sound: sun4i-i2s: Add channel-dins property Date: Sat, 12 Aug 2023 06:14:05 +1000 Message-ID: <20230811201406.4096210-7-contact@jookia.org> In-Reply-To: <20230811201406.4096210-1-contact@jookia.org> References: <20230811201406.4096210-1-contact@jookia.org> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230811_131512_711204_712E09AE X-CRM114-Status: GOOD ( 11.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The R329 variant of the sun4i I2S controller supports multiple data input pins (din pins) for receiving data. Each channel can have its data input pin configured. Allow this to be configured using a new channel-dins property. Signed-off-by: John Watts --- .../sound/allwinner,sun4i-a10-i2s.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-i2s.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-i2s.yaml index 739114fb6549..402549f9941c 100644 --- a/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-i2s.yaml +++ b/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-i2s.yaml @@ -52,6 +52,13 @@ properties: - const: apb - const: mod + channel-dins: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: + This is a list of DIN pin numbers, each used for a receiving I2S + channel. Pins are mapped to channels based on array index. + Channel 0 is the first number, then channel 1, and so on. + # Even though it only applies to subschemas under the conditionals, # not listing them here will trigger a warning because of the # additionalsProperties set to false. @@ -144,4 +151,19 @@ examples: dma-names = "rx", "tx"; }; + - | + i2s0_d1: i2s@2032000 { + #sound-dai-cells = <0>; + compatible = "allwinner,sun20i-d1-i2s", + "allwinner,sun50i-r329-i2s"; + reg = <0x2032000 0x1000>; + interrupts = <0 26 0>; + clocks = <&ccu 86>, <&ccu 82>; + clock-names = "apb", "mod"; + resets = <&ccu 34>; + dmas = <&dma 3>, <&dma 3>; + dma-names = "rx", "tx"; + channel-dins = /bits/ 8 <0 0 1 1 2 2>; + }; + ... From patchwork Fri Aug 11 20:14:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Watts X-Patchwork-Id: 13351396 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82E7FC001DE for ; Fri, 11 Aug 2023 20:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=y2oa8jkQvnnFrjgSmOMdyGs7x86Cwt6GIFGEcqKf4F8=; b=Qtu4MKUM3MqGkR yBzCG1B0CPQiZX2+47W8CyD5ub1GaM6eseI1pn88zPk/yFVFGwelpFQInm58uU2YYFghhVShJ8CM5 ygnzpZaOQu0OLpmQNxK8Bx/PHQzKsLZuV9vxn4pC6zQ7U5mRKUI7CBBNZLzIJSE8sGqudZ7wGdf3f 3J3zuY/F+tk/b56hBmKnz4Yv+bic0kfhfZipcLSJBopNqQJOe3cSn1CYiDq+o/85W0ZSjxE/RmOnQ YHwF+Q8ChbYOfOOLdiS+f5RVv0ibhnNIwc9GyCrPSTl1BmnLbxM0wdM8Gjq7BqxrkVXU7BUfOISM6 awbVpiiyCYX8qjpS9S5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qUYXZ-00BY8O-2m; Fri, 11 Aug 2023 20:15:21 +0000 Received: from out-76.mta1.migadu.com ([2001:41d0:203:375::4c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qUYXW-00BY5f-2u for linux-arm-kernel@lists.infradead.org; Fri, 11 Aug 2023 20:15:20 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jookia.org; s=key1; t=1691784914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iYu4Dz4hSNyn9kJzzK4p3lb9piHB7a9wwJ9aGUktfD0=; b=B7i/2R3iHC2ro6I9YUbHM1FvoB39fIf9DPTD/SmZey33EEFmx1QnK5KHPYfPpGFyrVjy6b j1F4S4QKVceyrPo4Rt7R42KM8h/+TKatWo9+iY0nazcL7pPZEniFrdFx+6CNXbZ/AdhHf1 aRDDIdWVuexKugvOjAH2RfxfuJ2ScwKgnOPsxfNcWV01LvTPJzC6zhsT8ahXRey2kbzFog XARZ1uI/K6YTATMTxZ4Pu/UsKVkoiC0oWJXwIcyBPoIMAmJvHj5xCx5Ep6EoNezVeeUs/h FlmeZ8gYKpenjqwDlrWOZV7PwrOv/uXUQBHKCbg5jRabvsDkoOvwzk+kscj/Vw== From: John Watts To: alsa-devel@alsa-project.org Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Jaroslav Kysela , Takashi Iwai , John Watts , =?utf-8?q?U?= =?utf-8?q?we_Kleine-K=C3=B6nig?= , Maxime Ripard , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [RFC PATCH 7/7] dt-bindings: sound: sun4i-i2s: Add channel-slots property Date: Sat, 12 Aug 2023 06:14:06 +1000 Message-ID: <20230811201406.4096210-8-contact@jookia.org> In-Reply-To: <20230811201406.4096210-1-contact@jookia.org> References: <20230811201406.4096210-1-contact@jookia.org> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230811_131519_078515_44637A0D X-CRM114-Status: GOOD ( 12.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The sun4i I2S controller supports mapping arbitrary TDM slots to each channel. Allow this to be expressed in the device tree. This is currently only implemented in the R329 I2S variant. Allow this to be configured using a new channel-dins property. Signed-off-by: John Watts --- .../bindings/sound/allwinner,sun4i-a10-i2s.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-i2s.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-i2s.yaml index 402549f9941c..a74b02387d8a 100644 --- a/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-i2s.yaml +++ b/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-i2s.yaml @@ -59,6 +59,13 @@ properties: channel. Pins are mapped to channels based on array index. Channel 0 is the first number, then channel 1, and so on. + channel-slots: + $ref: /schemas/types.yaml#/definitions/uint8-array + description: + This is a list of channel I2S TDM slot numbers. Slots are mapped + to channels based on array index. + Channel 0 is the first number, then channel 1, and so on. + # Even though it only applies to subschemas under the conditionals, # not listing them here will trigger a warning because of the # additionalsProperties set to false. @@ -164,6 +171,7 @@ examples: dmas = <&dma 3>, <&dma 3>; dma-names = "rx", "tx"; channel-dins = /bits/ 8 <0 0 1 1 2 2>; + channel-slots = /bits/ 8 <0 1 0 1 0 1>; }; ...