From patchwork Mon Jun 12 12:29:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 106558 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2557570vqr; Mon, 12 Jun 2023 05:42:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6I09di+JmNWGT8kxK+YGapp+2hC59t75DuXjTd9vGankqP4/7nGZHlHodG4i9oaSWTfrnW X-Received: by 2002:a17:907:70a:b0:96f:a935:8997 with SMTP id xb10-20020a170907070a00b0096fa9358997mr10138371ejb.12.1686573746506; Mon, 12 Jun 2023 05:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686573746; cv=none; d=google.com; s=arc-20160816; b=c5FlmpBYbTtyUxCqoqiXfX5ZXXUwIlc11ca/eTs29u+kfzpf3cZXfaMq4CbzyXBHNb 9RJGYQYShcSOLuxL7Tetx/jm8QBdYU9GroEaDvrA4zcT1gWGgay4tiztxriWkvLg4+Mu NAqWot6TzB8TTbTDmba3b7rR/jUnsrgQkrtWUXyx5au5mdneVdv9VZOMrk+cRP8X4ILs iHAgchgWnfJ0VkpBn6Ex4WmzS8YBQe5NjJUJaQ6S0InLxVOSM+ogE0tQmIhB0FPwEWNT ahZX8/BHGnYTrxvVOpAoALleM+76uHTR02BzceNds2DQ76zRDpaX/YnUBz/OyDmXCC15 ZrJg== 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=I5cNp+GgB7yUfLoJLPaXuDCyt6LLwDyt7j0qhTt+FTrFRQLmTDTuQ6ZF8dqozANPHD tm3aYvL3yhQsQ5s3B3Gxqb/yY2InMUeMydbj5TFsEUE80nwxbUvaSQR7GM2+1incFAz9 NwGoMTTpbVuEQwauU9bQEUQujVhNdFMQTIxO4Op5iz6Us0NIlQg3QpCwxY26oiviPF+5 bdLStvJNTktdEDjpharp5C5T6biH2/fv+WjwC3Ut1mFQShxNSHEWKTQVOOHf6qMJK3SJ 7g8XzisNioEb+/ETNqHT1T21DcTtoCjeuKijcMEmiY5BDkzUDrDU2hNzLBIcIrWdyV8n BZPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=YGKZRu7k; 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 p9-20020a170906614900b00977cc3d4bf2si5056582ejl.1007.2023.06.12.05.42.02; Mon, 12 Jun 2023 05:42:26 -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=YGKZRu7k; 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 S233871AbjFLMaM (ORCPT + 99 others); Mon, 12 Jun 2023 08:30:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbjFLMaB (ORCPT ); Mon, 12 Jun 2023 08:30:01 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FC551B8; Mon, 12 Jun 2023 05:29:59 -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=1686572998; 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=YGKZRu7kczGFyQhYuKljB2H0wcRlSjCvrJZD4Qt0DkQMhhwcwYyKzpVCyOiSfd3DUbq1dA owP7TbiaJxnSfH3BxuJjA2hBU1KnPzVQrAjGXk6ZpqcISmaJY+Vby6UV/n43ekKfT8Y00s JSoPUt86Nc2LGk+pMT1Lo7cMFpx+zFlPoNqHOHJEArYidq3hEcNydXzLK+BPbwpnHCBaPi 7Sr0d9LJ73yLetnEHdtS/mEDtI7LMP8BRAx+/ZK3Fjn10OoEeMXTeXBUmMLV+ad4Xmg7WZ BmLCeKt2lu9csLU2P/+zQlHhqEHWdKiono4xRrViTOUDbsKfgmEvR/qdiQe3nA== 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 1036424000C; Mon, 12 Jun 2023 12:29:57 +0000 (UTC) From: Herve Codina To: Herve Codina , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Cameron , Lars-Peter Clausen , Jaroslav Kysela , Takashi Iwai , Kuninori Morimoto , Andy Shevchenko Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Christophe Leroy , Thomas Petazzoni Subject: [PATCH v3 02/12] ASoC: dt-bindings: simple-card: Add additional-devs subnode Date: Mon, 12 Jun 2023 14:29:16 +0200 Message-Id: <20230612122926.107333-3-herve.codina@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612122926.107333-1-herve.codina@bootlin.com> References: <20230612122926.107333-1-herve.codina@bootlin.com> MIME-Version: 1.0 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_NONE, 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768500752760923235?= X-GMAIL-MSGID: =?utf-8?q?1768500752760923235?= 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 --- .../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 # --------------------