Message ID | 20230615152631.224529-3-herve.codina@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp733433vqr; Thu, 15 Jun 2023 08:47:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7rw1R2NmhVAMuHGFHLpTAYHLWV6HX7ciVfTtM7//ySpTHYQNmZfMOVabx1Zf+ipMRLCyXB X-Received: by 2002:a17:907:2d22:b0:978:b94e:83dd with SMTP id gs34-20020a1709072d2200b00978b94e83ddmr19723683ejc.75.1686844068147; Thu, 15 Jun 2023 08:47:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686844068; cv=none; d=google.com; s=arc-20160816; b=Pqp7JUEfEF8S7x1iVIicydDYNtcnMYpJCWXvVf4PpHAYHGiqLnVsl5OoOWizqAaKu9 CKRAXAFRl8yBPtQmiR3jref8TXqYcaAnljQgrv3KLz8j51UXSgAWNHQQBbQ+84RiMort nBMdRJF1Ro9WKQd1jqDUK4vu3iCy6/SkKPW3QpJM1dCmFfQL6iGcezfVBPbfEYcbKo+T iX76kPQQ6E0Uvh6Y4H2anoviaYCcZcQisSm/sGYw2gc1kEOt6UsRUlpXfwCHqxSPaSHj jhNCyEGVy2svF8pic4G8MZqee5eJMWTfJw+K3oCjK+iexaki2xN16lnKt2kNW35HR97n 7JVw== 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=5N9NSA3ycLJUSucfBk1k0lUH03RfOeo/UXNYngARjpo=; b=LK3ETWQ8yxZLjl8b8bEpzsT5kAE5nycG1VZYnDQce8oi3H6H8j5mueSlkCRSXGisDA 7cEHXrIuQXKibG+f7GDgF0U/dNAGasym07c04smPRQ4gY0TmQzCjNOFLxfsuKdo56hGe 1QInEydbHnWm3TOg/63LuRpgRqsUlm0xYJvGyM5TL355qZXM+uhO0/blU/fofUsD6z2R CspIZitJvQwhkp+C3sqFGaHo/rRfKo8GDNPIG98p2KNsUI7It7irrRR+iAHKAqGGSmfN 2pasYQkH97prZ2leAt6wKSYFXd8hzQHHrh6crbm6+vHQWe+7T9aBxtLPcb9WqP0YiWKi sWRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="BFdWw2/K"; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qx13-20020a170906fccd00b009789477bac6si9849787ejb.853.2023.06.15.08.47.23; Thu, 15 Jun 2023 08:47:48 -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=@bootlin.com header.s=gm1 header.b="BFdWw2/K"; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345175AbjFOP0t (ORCPT <rfc822;n2h9z4@gmail.com> + 99 others); Thu, 15 Jun 2023 11:26:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345189AbjFOP0m (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 15 Jun 2023 11:26:42 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95FD6268A; Thu, 15 Jun 2023 08:26:40 -0700 (PDT) X-GND-Sasl: herve.codina@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1686842799; 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=5N9NSA3ycLJUSucfBk1k0lUH03RfOeo/UXNYngARjpo=; b=BFdWw2/K1RUuAJjTv5Ztq2i+YBUNqsxGBMKGaE+3tvwUClwcswQwvooZUb57sCUno18HU9 weoz40ZnMPVMcZ1huJvgCMseY25UqDL/NQhNN4rRQsdnf1f4RiHozMCmQ7CS9A4jW6LJB2 rBxhSdi/Uhojro4cbSEtKsp2HWPREi+sZ3i2JOtV/W+3yr7M/YGXaUrn+oM7cu749rVenb NK8NKFD30W+KjUDKkiLwIG39hyje7C70Qh9tMjQmqwolng329BUWEp4JbyURjImRlfw8e3 tWvMqIRidg4fk6uh+fAoDYFoWsuimcpOoRzAMFVz8myKz2fiPjZ4xzTwHbaDFA== X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPA id BA509FF80D; Thu, 15 Jun 2023 15:26:37 +0000 (UTC) From: Herve Codina <herve.codina@bootlin.com> To: Herve Codina <herve.codina@bootlin.com>, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Jonathan Cameron <jic23@kernel.org>, Lars-Peter Clausen <lars@metafoo.de>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>, Andy Shevchenko <andy.shevchenko@gmail.com> Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Christophe Leroy <christophe.leroy@csgroup.eu>, Thomas Petazzoni <thomas.petazzoni@bootlin.com> Subject: [PATCH v5 02/13] ASoC: dt-bindings: simple-card: Add additional-devs subnode Date: Thu, 15 Jun 2023 17:26:20 +0200 Message-Id: <20230615152631.224529-3-herve.codina@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230615152631.224529-1-herve.codina@bootlin.com> References: <20230615152631.224529-1-herve.codina@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768784205429380889?= X-GMAIL-MSGID: =?utf-8?q?1768784205429380889?= |
Series |
Add support for IIO devices in ASoC
|
|
Commit Message
Herve Codina
June 15, 2023, 3:26 p.m. UTC
The additional-devs subnode allows to declared some virtual devices
as sound card children.
These virtual devices can then be used by the sound card and so be
present in the audio path.
The first virtual device supported is the audio IIO auxiliary device
in order to support an IIO device as an audio auxiliary device.
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
.../bindings/sound/simple-card.yaml | 53 +++++++++++++++++++
1 file changed, 53 insertions(+)
Comments
On Thu, 15 Jun 2023 17:26:20 +0200 Herve Codina <herve.codina@bootlin.com> wrote: > The additional-devs subnode allows to declared some virtual devices > as sound card children. > These virtual devices can then be used by the sound card and so be > present in the audio path. > > The first virtual device supported is the audio IIO auxiliary device > in order to support an IIO device as an audio auxiliary device. > > Signed-off-by: Herve Codina <herve.codina@bootlin.com> Looks fine to me, but given it's not an area I know that much about (other than the iio consumer bits) take that with a pinch of salt. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > .../bindings/sound/simple-card.yaml | 53 +++++++++++++++++++ > 1 file changed, 53 insertions(+) > > diff --git a/Documentation/devicetree/bindings/sound/simple-card.yaml b/Documentation/devicetree/bindings/sound/simple-card.yaml > index b05e05c81cc4..59ac2d1d1ccf 100644 > --- a/Documentation/devicetree/bindings/sound/simple-card.yaml > +++ b/Documentation/devicetree/bindings/sound/simple-card.yaml > @@ -148,6 +148,15 @@ definitions: > required: > - sound-dai > > + additional-devs: > + type: object > + description: > + Additional devices used by the simple audio card. > + patternProperties: > + '^iio-aux(-.+)?$': > + type: object > + $ref: audio-iio-aux.yaml# > + > properties: > compatible: > contains: > @@ -187,6 +196,8 @@ properties: > $ref: "#/definitions/mclk-fs" > simple-audio-card,aux-devs: > $ref: "#/definitions/aux-devs" > + simple-audio-card,additional-devs: > + $ref: "#/definitions/additional-devs" > simple-audio-card,convert-rate: > $ref: "#/definitions/convert-rate" > simple-audio-card,convert-channels: > @@ -359,6 +370,48 @@ examples: > }; > }; > > +# -------------------- > +# route audio to/from a codec through an amplifier > +# designed with a potentiometer driven by IIO: > +# -------------------- > + - | > + sound { > + compatible = "simple-audio-card"; > + > + simple-audio-card,aux-devs = <&_in>, <&_out>; > + simple-audio-card,routing = > + "CODEC LEFTIN", "AMP_IN LEFT OUT", > + "CODEC RIGHTIN", "AMP_IN RIGHT OUT", > + "AMP_OUT LEFT IN", "CODEC LEFTOUT", > + "AMP_OUT RIGHT IN", "CODEC RIGHTOUT"; > + > + simple-audio-card,additional-devs { > + amp_out: iio-aux-out { > + compatible = "audio-iio-aux"; > + io-channels = <&pot_out 0>, <&pot_out 1>; > + io-channel-names = "LEFT", "RIGHT"; > + snd-control-invert-range = <1 1>; > + sound-name-prefix = "AMP_OUT"; > + }; > + > + amp_in: iio_aux-in { > + compatible = "audio-iio-aux"; > + io-channels = <&pot_in 0>, <&pot_in 1>; > + io-channel-names = "LEFT", "RIGHT"; > + sound-name-prefix = "AMP_IN"; > + }; > + }; > + > + simple-audio-card,cpu { > + sound-dai = <&cpu>; > + }; > + > + simple-audio-card,codec { > + sound-dai = <&codec>; > + clocks = <&clocks>; > + }; > + }; > + > # -------------------- > # Sampling Rate Conversion > # --------------------
On Thu, Jun 15, 2023 at 05:26:20PM +0200, Herve Codina wrote: > The additional-devs subnode allows to declared some virtual devices > as sound card children. > These virtual devices can then be used by the sound card and so be > present in the audio path. > > The first virtual device supported is the audio IIO auxiliary device > in order to support an IIO device as an audio auxiliary device. > > Signed-off-by: Herve Codina <herve.codina@bootlin.com> > --- > .../bindings/sound/simple-card.yaml | 53 +++++++++++++++++++ > 1 file changed, 53 insertions(+) > > diff --git a/Documentation/devicetree/bindings/sound/simple-card.yaml b/Documentation/devicetree/bindings/sound/simple-card.yaml > index b05e05c81cc4..59ac2d1d1ccf 100644 > --- a/Documentation/devicetree/bindings/sound/simple-card.yaml > +++ b/Documentation/devicetree/bindings/sound/simple-card.yaml > @@ -148,6 +148,15 @@ definitions: > required: > - sound-dai > > + additional-devs: > + type: object > + description: > + Additional devices used by the simple audio card. > + patternProperties: > + '^iio-aux(-.+)?$': > + type: object > + $ref: audio-iio-aux.yaml# > + > properties: > compatible: > contains: > @@ -187,6 +196,8 @@ properties: > $ref: "#/definitions/mclk-fs" > simple-audio-card,aux-devs: > $ref: "#/definitions/aux-devs" > + simple-audio-card,additional-devs: > + $ref: "#/definitions/additional-devs" Why do you need this under the card node? Can't you just use the existing aux-devs? > simple-audio-card,convert-rate: > $ref: "#/definitions/convert-rate" > simple-audio-card,convert-channels: > @@ -359,6 +370,48 @@ examples: > }; > }; > > +# -------------------- > +# route audio to/from a codec through an amplifier > +# designed with a potentiometer driven by IIO: > +# -------------------- > + - | > + sound { > + compatible = "simple-audio-card"; > + > + simple-audio-card,aux-devs = <&_in>, <&_out>; > + simple-audio-card,routing = > + "CODEC LEFTIN", "AMP_IN LEFT OUT", > + "CODEC RIGHTIN", "AMP_IN RIGHT OUT", > + "AMP_OUT LEFT IN", "CODEC LEFTOUT", > + "AMP_OUT RIGHT IN", "CODEC RIGHTOUT"; > + > + simple-audio-card,additional-devs { > + amp_out: iio-aux-out { > + compatible = "audio-iio-aux"; > + io-channels = <&pot_out 0>, <&pot_out 1>; > + io-channel-names = "LEFT", "RIGHT"; > + snd-control-invert-range = <1 1>; > + sound-name-prefix = "AMP_OUT"; > + }; > + > + amp_in: iio_aux-in { > + compatible = "audio-iio-aux"; > + io-channels = <&pot_in 0>, <&pot_in 1>; > + io-channel-names = "LEFT", "RIGHT"; > + sound-name-prefix = "AMP_IN"; > + }; > + }; > + > + simple-audio-card,cpu { > + sound-dai = <&cpu>; > + }; > + > + simple-audio-card,codec { > + sound-dai = <&codec>; > + clocks = <&clocks>; > + }; > + }; > + > # -------------------- > # Sampling Rate Conversion > # -------------------- > -- > 2.40.1 >
Hi Rob, On Tue, 20 Jun 2023 10:45:21 -0600 Rob Herring <robh@kernel.org> wrote: > On Thu, Jun 15, 2023 at 05:26:20PM +0200, Herve Codina wrote: > > The additional-devs subnode allows to declared some virtual devices > > as sound card children. > > These virtual devices can then be used by the sound card and so be > > present in the audio path. > > > > The first virtual device supported is the audio IIO auxiliary device > > in order to support an IIO device as an audio auxiliary device. > > > > Signed-off-by: Herve Codina <herve.codina@bootlin.com> > > --- > > .../bindings/sound/simple-card.yaml | 53 +++++++++++++++++++ > > 1 file changed, 53 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/sound/simple-card.yaml b/Documentation/devicetree/bindings/sound/simple-card.yaml > > index b05e05c81cc4..59ac2d1d1ccf 100644 > > --- a/Documentation/devicetree/bindings/sound/simple-card.yaml > > +++ b/Documentation/devicetree/bindings/sound/simple-card.yaml > > @@ -148,6 +148,15 @@ definitions: > > required: > > - sound-dai > > > > + additional-devs: > > + type: object > > + description: > > + Additional devices used by the simple audio card. > > + patternProperties: > > + '^iio-aux(-.+)?$': > > + type: object > > + $ref: audio-iio-aux.yaml# > > + > > properties: > > compatible: > > contains: > > @@ -187,6 +196,8 @@ properties: > > $ref: "#/definitions/mclk-fs" > > simple-audio-card,aux-devs: > > $ref: "#/definitions/aux-devs" > > + simple-audio-card,additional-devs: > > + $ref: "#/definitions/additional-devs" > > Why do you need this under the card node? Can't you just use the > existing aux-devs? aux-devs is a phandle array referencing auxiliary devices. I cannot define a node with just aux-devs, just reference. I need device auxiliary devices that are not defined somewhere else in the DT. A SPI amplifier is defined as a subnode of a SPI controler. But my IIO/ASoC virtual devices are not defined under some hardware bus. I need to define them here, as a simple-audio-card subnode. Several subnodes are already defined for a simple-audio-card subnode for other purpose. Instead of having virtual device nodes directly as chidren mixed with the other purpose nodes of the simple-audio-card, I group them under the additional-devs node in order to ease evolution and maintenance. Best regards, Hervé > > > simple-audio-card,convert-rate: > > $ref: "#/definitions/convert-rate" > > simple-audio-card,convert-channels: > > @@ -359,6 +370,48 @@ examples: > > }; > > }; > > > > +# -------------------- > > +# route audio to/from a codec through an amplifier > > +# designed with a potentiometer driven by IIO: > > +# -------------------- > > + - | > > + sound { > > + compatible = "simple-audio-card"; > > + > > + simple-audio-card,aux-devs = <&_in>, <&_out>; > > + simple-audio-card,routing = > > + "CODEC LEFTIN", "AMP_IN LEFT OUT", > > + "CODEC RIGHTIN", "AMP_IN RIGHT OUT", > > + "AMP_OUT LEFT IN", "CODEC LEFTOUT", > > + "AMP_OUT RIGHT IN", "CODEC RIGHTOUT"; > > + > > + simple-audio-card,additional-devs { > > + amp_out: iio-aux-out { > > + compatible = "audio-iio-aux"; > > + io-channels = <&pot_out 0>, <&pot_out 1>; > > + io-channel-names = "LEFT", "RIGHT"; > > + snd-control-invert-range = <1 1>; > > + sound-name-prefix = "AMP_OUT"; > > + }; > > + > > + amp_in: iio_aux-in { > > + compatible = "audio-iio-aux"; > > + io-channels = <&pot_in 0>, <&pot_in 1>; > > + io-channel-names = "LEFT", "RIGHT"; > > + sound-name-prefix = "AMP_IN"; > > + }; > > + }; > > + > > + simple-audio-card,cpu { > > + sound-dai = <&cpu>; > > + }; > > + > > + simple-audio-card,codec { > > + sound-dai = <&codec>; > > + clocks = <&clocks>; > > + }; > > + }; > > + > > # -------------------- > > # Sampling Rate Conversion > > # -------------------- > > -- > > 2.40.1 > >
diff --git a/Documentation/devicetree/bindings/sound/simple-card.yaml b/Documentation/devicetree/bindings/sound/simple-card.yaml index b05e05c81cc4..59ac2d1d1ccf 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.yaml +++ b/Documentation/devicetree/bindings/sound/simple-card.yaml @@ -148,6 +148,15 @@ definitions: required: - sound-dai + additional-devs: + type: object + description: + Additional devices used by the simple audio card. + patternProperties: + '^iio-aux(-.+)?$': + type: object + $ref: audio-iio-aux.yaml# + properties: compatible: contains: @@ -187,6 +196,8 @@ properties: $ref: "#/definitions/mclk-fs" simple-audio-card,aux-devs: $ref: "#/definitions/aux-devs" + simple-audio-card,additional-devs: + $ref: "#/definitions/additional-devs" simple-audio-card,convert-rate: $ref: "#/definitions/convert-rate" simple-audio-card,convert-channels: @@ -359,6 +370,48 @@ examples: }; }; +# -------------------- +# route audio to/from a codec through an amplifier +# designed with a potentiometer driven by IIO: +# -------------------- + - | + sound { + compatible = "simple-audio-card"; + + simple-audio-card,aux-devs = <&_in>, <&_out>; + simple-audio-card,routing = + "CODEC LEFTIN", "AMP_IN LEFT OUT", + "CODEC RIGHTIN", "AMP_IN RIGHT OUT", + "AMP_OUT LEFT IN", "CODEC LEFTOUT", + "AMP_OUT RIGHT IN", "CODEC RIGHTOUT"; + + simple-audio-card,additional-devs { + amp_out: iio-aux-out { + compatible = "audio-iio-aux"; + io-channels = <&pot_out 0>, <&pot_out 1>; + io-channel-names = "LEFT", "RIGHT"; + snd-control-invert-range = <1 1>; + sound-name-prefix = "AMP_OUT"; + }; + + amp_in: iio_aux-in { + compatible = "audio-iio-aux"; + io-channels = <&pot_in 0>, <&pot_in 1>; + io-channel-names = "LEFT", "RIGHT"; + sound-name-prefix = "AMP_IN"; + }; + }; + + simple-audio-card,cpu { + sound-dai = <&cpu>; + }; + + simple-audio-card,codec { + sound-dai = <&codec>; + clocks = <&clocks>; + }; + }; + # -------------------- # Sampling Rate Conversion # --------------------