devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herve Codina <herve.codina@bootlin.com>
To: Mark Brown <broonie@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	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: Re: [PATCH 1/4] dt-bindings: sound: Add simple-iio-aux
Date: Thu, 11 May 2023 09:19:07 +0200	[thread overview]
Message-ID: <20230511091907.6794457b@bootlin.com> (raw)
In-Reply-To: <ZFMzC7OBrcL9l5AH@finisterre.sirena.org.uk>

Hi Rob, Krzysztof, Mark,

On Thu, 4 May 2023 13:22:35 +0900
Mark Brown <broonie@kernel.org> wrote:

> On Tue, May 02, 2023 at 09:26:32AM +0200, Krzysztof Kozlowski wrote:
> > On 26/04/2023 09:36, Herve Codina wrote:  
> > > Rob Herring <robh@kernel.org> wrote:  
> > >> On Fri, Apr 21, 2023 at 02:41:19PM +0200, Herve Codina wrote:  
> 
> > >>> simple-iio-aux allows to consider these Industrial I/O devices as
> > >>> auxliary audio devices.    
> 
> > >> What makes it simple? Any binding called simple or generic is a trigger 
> > >> for me. Best to avoid those terms. :)  
> 
> > > I choose simple-iio-aux because some simple-* already exists.
> > > For instance simple-audio-amplifier or simple-audio-mux.  
> 
> > > Do you prefer audio-iio-aux ?
> > > Let me know if I should change.  
> 
> > It means that often what people call "simple" and "generic" works only
> > for their specific case, because it is not really simple and generic.
> > After some time the "simple" and "generic" becomes "complicated" and
> > "huge". Conclusion: sometimes simple and generic bindings are bad idea
> > and you should have something specific.  
> 
> > Your description in the binding also does not help to match it to
> > specific, real device. Provide the examples, as Rob asked.  
> 
> I don't understand what you are looking for here.  IIO is a subsystem
> which represents generic DACs and ADCs (along with other I/O things).
> Audio devices also have DACs and ADCs, somewhat specialised for use in
> audio but more limited by specs and interfaces than by anything
> fundamental.  The goal here is to map DACs and ADCs described as IIO for
> use in an audio context.
> 
> ADCs are devices that convert analog signals into digital values, DACs
> are devices that convert digital values into analog signals.
> 
> > >> How do support multiple instances? Say you have 2 sound cards (or 1 
> > >> sound card with multiple audio paths) each with different sets of IIO 
> > >> channels associated with it. You'd need a link to each 'aux' node. Why 
> > >> not just add io-channels to the sound card nodes directly? That's 
> > >> already just a virtual, top-level container node grouping all the 
> > >> components. I don't see why we need another virtual node grouping a 
> > >> subset of them.  
> 
> > > I don't see what you mean.
> > > I use a simple-audio-card and here is a full example using several
> > > instances:  
> 
> > Just like Rob said: "You'd need a link to each 'aux' node"  
> 
> > and you did it...  
> 
> > So now the rest of Rob's answer:  
> 
> > "Why not just add io-channels to the sound card nodes directly? That's
> > already just a virtual, top-level container node grouping all the
> > components. I don't see why we need another virtual node grouping a
> > subset of them."  
> 
> > Why do you need another node if it is not really representing a real,
> > separate device?  
> 
> If nothing else I would expect it to be useful from a comprehensibility
> point of view to bundle multiple IIO devices into a single multi-channel
> audio stream, an individual IIO device is likely to only present a
> single channel of data but it is common to group multiple channels of
> audio data.

I cannot simply add io-channels to the sound card directly. I need a node
to set at least the sound-name-prefix property. Further more having a node
and a related compatible string can be easier to maintain and add future
evolution related to these "virtual" devices.

As some subnodes are already defined for a sound card node, I propose to
group these "virtual" audio devices node in a specific bundle node.
This lead to the following example:
---- 8< ----
    spi {
        #address-cells = <1>;
        #size-cells = <0>;
	/* potentiometers present in an input amplifier design */
        pot_in: potentiometer@0 {
            compatible = "foo,xxx";
            reg = <0>;
            #io-channel-cells = <1>;
        };
	/* potentiometers present in an output amplifier design */
	pot_out: potentiometer@1 {
            compatible = "foo,xxx";
            reg = <1>;
            #io-channel-cells = <1>;
        };
	/* A codec */
        codec: codec@2 {
            compatible = "bar,yyy";
            reg = <2>;
            sound-name-prefix = "CODEC";
        };

    };

    sound {
        compatible = "simple-audio-card";
        #address-cells = <1>;
        #size-cells = <0>;
        simple-audio-card,name = "My Sound Card";

        simple-audio-card,aux-devs = <&amp_in>, <&amp_out>;
        simple-audio-card,routing =
            "CODEC IN0", "AMP_IN CH0 OUT",
            "CODEC IN1", "AMP_IN CH1 OUT",
            "AMP_OUT CH0 IN", "CODEC OUT0",
            "AMP_OUT CH1 IN", "CODEC OUT1";

        simple-audio-card,dai-link@0 {
            ...
        };

        ...

        /* A bundle for the additional devices */
        simple-audio-card,additional-devs { 
            amp_out: aux-out {
                compatible = "audio-iio-aux";    /* Instead of "simple-iio-aux */
                io-channels = <&pot_out 0>, <&pot_out 1>,
                io-channel-names = "CH0", "CH1";
                snd-control-invert-range = <1 1>;  /* Old 'invert' renamed */
                sound-name-prefix = "AMP_OUT";
            };

            amp_in: aux-in {
	       compatible = "audio-iio-aux";
               io-channels = <&pot_in 0>, <&pot_in 1>;
	       io-channel-names = "CH0", "CH1";
	       sound-name-prefix = "AMP_IN";
            };
	};
    };
---- 8< ----

What do you think about this new binding ?

Best regards,
Hervé

  reply	other threads:[~2023-05-11  7:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21 12:41 [PATCH 0/4] Add support for IIO devices in ASoC Herve Codina
2023-04-21 12:41 ` [PATCH 1/4] dt-bindings: sound: Add simple-iio-aux Herve Codina
2023-04-25 17:30   ` Rob Herring
2023-04-25 17:33     ` Mark Brown
2023-04-26  7:36     ` Herve Codina
2023-05-02  7:26       ` Krzysztof Kozlowski
2023-05-04  4:22         ` Mark Brown
2023-05-11  7:19           ` Herve Codina [this message]
2023-04-21 12:41 ` [PATCH 2/4] iio: inkern: Add a helper to query an available minimum raw value Herve Codina
2023-04-22 16:49   ` Jonathan Cameron
2023-04-24  7:50     ` Herve Codina
2023-05-01 15:15       ` Jonathan Cameron
2023-04-21 12:41 ` [PATCH 3/4] ASoC: soc-dapm.h: Add a helper to build a DAPM widget dynamically Herve Codina
2023-04-21 12:41 ` [PATCH 4/4] ASoC: codecs: Add support for the generic IIO auxiliary devices Herve Codina
2023-04-22 17:08   ` Jonathan Cameron
2023-04-24 10:52     ` Herve Codina
2023-05-01 15:24       ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230511091907.6794457b@bootlin.com \
    --to=herve.codina@bootlin.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).