Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1210081rdg; Fri, 11 Aug 2023 13:32:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZ/SN1yJukUzMvMMv3uMLrcUqS0FRapV/KJNNaLeSlAc/DhkWt118DFDFFZ74Xxnq1sv1d X-Received: by 2002:a05:6512:acd:b0:4fd:faa1:fefc with SMTP id n13-20020a0565120acd00b004fdfaa1fefcmr2167703lfu.56.1691785954019; Fri, 11 Aug 2023 13:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691785953; cv=none; d=google.com; s=arc-20160816; b=pvoPswsnhGvs584K7nE9xbcccneox0wPZcJFRUujUeiLXnky52rO4DNaZk7sIBM4Uq lmRPSlhI3L35ammtlUiCIEwOaVGsIshvqlNLdVkNAiM5CGRzFlGyrXMIS//AttTi92rR MaL2XjTxyxRZRKiBA2oYKmfG4Iwqhg/SscyuyBR9pfdj/AchHeZn+yqqGoq8lRRacJYu ozop8RLj3ugl6FZ5OYRwBk5qRjBUvaipE6X0Z7iuinPB08ZAofA0LyGKS+mAstRDArz/ t++NwGobo/MCyqL8IKS2kymaJOKveSYdaqZ7hzgO+6g0rZ/oB75raMZ2+ftuC58CKvCT ZTqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=c760wkxPLczuI7tECzLOiGz+mznMFHiURmBp9IfloLs=; fh=I2+cRdOi+5kEg31kmXDPfOMZarcf60s2JZeRBWoy9GY=; b=oJHB+M1br+fRdKnoXCAmjn7e1hNv3I+z5Bv4ty/D/R7IDGx2zPnkPlcdrywYuaLb2m PHPBWkEkafzJRFrwEG8SEdETP+qgMm2W3puO+TWybEpKDlZzNun6ETVTYQ97gXWZAHl0 HvcZASziUrA6+ONRIiyc8y1tPWsH+5cXpGC9UBsJpKz3dnpnuqGaaO+skUBxhTAoWB7l f7bB+BvaUh4AkPbAGv6Noi4uya8O19sRxdNLDp3UJT2Sub2w0tmtPpNBaKnAmZdit+UM ikjsl2a/uvowv6fik5TbfkRq9nr1pOykWqJ7Lor96l5AByBQ8efGDxsXt4P8tCm+L1DN 5dNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jookia.org header.s=key1 header.b=SF7GQFQI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=jookia.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b22-20020a1709065e5600b0097d7282c899si4085239eju.534.2023.08.11.13.32.09; Fri, 11 Aug 2023 13:32:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@jookia.org header.s=key1 header.b=SF7GQFQI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=jookia.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236718AbjHKUO5 (ORCPT + 99 others); Fri, 11 Aug 2023 16:14:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235970AbjHKUOz (ORCPT ); Fri, 11 Aug 2023 16:14:55 -0400 Received: from out-108.mta0.migadu.com (out-108.mta0.migadu.com [IPv6:2001:41d0:1004:224b::6c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C84535A2 for ; Fri, 11 Aug 2023 13:14:51 -0700 (PDT) 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?Uwe=20Kleine-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 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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; } -- 2.41.0