diff mbox series

[v4,09/22] arm64: dts: allwinner: h6: Add HDMI audio node

Message ID 20200921102731.747736-10-peron.clem@gmail.com (mailing list archive)
State Superseded
Headers show
Series Add Allwinner H3/H5/H6/A64 HDMI audio | expand

Commit Message

Clément Péron Sept. 21, 2020, 10:27 a.m. UTC
From: Jernej Skrabec <jernej.skrabec@siol.net>

Add a simple-soundcard to link audio between HDMI and I2S.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Signed-off-by: Clément Péron <peron.clem@gmail.com>
---
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 33 ++++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Maxime Ripard Sept. 21, 2020, 1:59 p.m. UTC | #1
On Mon, Sep 21, 2020 at 12:27:18PM +0200, Clément Péron wrote:
> From: Jernej Skrabec <jernej.skrabec@siol.net>
> 
> Add a simple-soundcard to link audio between HDMI and I2S.
> 
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> Signed-off-by: Marcus Cooper <codekipper@gmail.com>
> Signed-off-by: Clément Péron <peron.clem@gmail.com>
> ---
>  arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 33 ++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> index 28c77d6872f6..a8853ee7885a 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> @@ -67,6 +67,25 @@ de: display-engine {
>  		status = "disabled";
>  	};
>  
> +	hdmi_sound: hdmi-sound {
> +		compatible = "simple-audio-card";
> +		simple-audio-card,format = "i2s";
> +		simple-audio-card,name = "sun50i-h6-hdmi";
> +		simple-audio-card,mclk-fs = <128>;
> +		simple-audio-card,frame-inversion;
> +		status = "disabled";
> +
> +		simple-audio-card,codec {
> +			sound-dai = <&hdmi>;
> +		};
> +
> +		simple-audio-card,cpu {
> +			sound-dai = <&i2s1>;
> +			dai-tdm-slot-num = <2>;
> +			dai-tdm-slot-width = <32>;

It looks weird to have both some TDM setup here, and yet the format in
i2s?

Maxime
Clément Péron Sept. 21, 2020, 5:23 p.m. UTC | #2
Hi Maxime,

On Mon, 21 Sep 2020 at 15:59, Maxime Ripard <maxime@cerno.tech> wrote:
>
> On Mon, Sep 21, 2020 at 12:27:18PM +0200, Clément Péron wrote:
> > From: Jernej Skrabec <jernej.skrabec@siol.net>
> >
> > Add a simple-soundcard to link audio between HDMI and I2S.
> >
> > Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> > Signed-off-by: Marcus Cooper <codekipper@gmail.com>
> > Signed-off-by: Clément Péron <peron.clem@gmail.com>
> > ---
> >  arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 33 ++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > index 28c77d6872f6..a8853ee7885a 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > @@ -67,6 +67,25 @@ de: display-engine {
> >               status = "disabled";
> >       };
> >
> > +     hdmi_sound: hdmi-sound {
> > +             compatible = "simple-audio-card";
> > +             simple-audio-card,format = "i2s";
> > +             simple-audio-card,name = "sun50i-h6-hdmi";
> > +             simple-audio-card,mclk-fs = <128>;
> > +             simple-audio-card,frame-inversion;
> > +             status = "disabled";
> > +
> > +             simple-audio-card,codec {
> > +                     sound-dai = <&hdmi>;
> > +             };
> > +
> > +             simple-audio-card,cpu {
> > +                     sound-dai = <&i2s1>;
> > +                     dai-tdm-slot-num = <2>;
> > +                     dai-tdm-slot-width = <32>;
>
> It looks weird to have both some TDM setup here, and yet the format in
> i2s?

Yes, I agree I will check if it's really needed.

Clement

>
> Maxime
Mark Brown Sept. 21, 2020, 6:29 p.m. UTC | #3
On Mon, Sep 21, 2020 at 12:27:18PM +0200, Clément Péron wrote:
> From: Jernej Skrabec <jernej.skrabec@siol.net>
> 
> Add a simple-soundcard to link audio between HDMI and I2S.

It makes life a lot easier if you batch all the DTS changes together
rather than randomly mixing them in with code changes, it both makes
it clearer what's going on and makes things easier to handle.
Jernej Škrabec Sept. 21, 2020, 6:37 p.m. UTC | #4
Dne ponedeljek, 21. september 2020 ob 19:23:49 CEST je Clément Péron 
napisal(a):
> Hi Maxime,
> 
> On Mon, 21 Sep 2020 at 15:59, Maxime Ripard <maxime@cerno.tech> wrote:
> >
> > On Mon, Sep 21, 2020 at 12:27:18PM +0200, Clément Péron wrote:
> > > From: Jernej Skrabec <jernej.skrabec@siol.net>
> > >
> > > Add a simple-soundcard to link audio between HDMI and I2S.
> > >
> > > Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> > > Signed-off-by: Marcus Cooper <codekipper@gmail.com>
> > > Signed-off-by: Clément Péron <peron.clem@gmail.com>
> > > ---
> > >  arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 33 ++++++++++++++++++++
> > >  1 file changed, 33 insertions(+)
> > >
> > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/
boot/dts/allwinner/sun50i-h6.dtsi
> > > index 28c77d6872f6..a8853ee7885a 100644
> > > --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > @@ -67,6 +67,25 @@ de: display-engine {
> > >               status = "disabled";
> > >       };
> > >
> > > +     hdmi_sound: hdmi-sound {
> > > +             compatible = "simple-audio-card";
> > > +             simple-audio-card,format = "i2s";
> > > +             simple-audio-card,name = "sun50i-h6-hdmi";
> > > +             simple-audio-card,mclk-fs = <128>;
> > > +             simple-audio-card,frame-inversion;
> > > +             status = "disabled";
> > > +
> > > +             simple-audio-card,codec {
> > > +                     sound-dai = <&hdmi>;
> > > +             };
> > > +
> > > +             simple-audio-card,cpu {
> > > +                     sound-dai = <&i2s1>;
> > > +                     dai-tdm-slot-num = <2>;
> > > +                     dai-tdm-slot-width = <32>;
> >
> > It looks weird to have both some TDM setup here, and yet the format in
> > i2s?
> 
> Yes, I agree I will check if it's really needed.

I think this was explained before. Anyway, this is needed to force width to 
32, no matter actual sample width. That's a requirement of HDMI codec. I 
believe Marcus Cooper have another codec which also needs fixed width.

There is no similar property for I2S, so TDM one is used here.

Best regards,
Jernej

> 
> Clement
> 
> >
> > Maxime
>
Maxime Ripard Sept. 28, 2020, 8:43 a.m. UTC | #5
On Mon, Sep 21, 2020 at 08:37:09PM +0200, Jernej Škrabec wrote:
> Dne ponedeljek, 21. september 2020 ob 19:23:49 CEST je Clément Péron 
> napisal(a):
> > Hi Maxime,
> > 
> > On Mon, 21 Sep 2020 at 15:59, Maxime Ripard <maxime@cerno.tech> wrote:
> > >
> > > On Mon, Sep 21, 2020 at 12:27:18PM +0200, Clément Péron wrote:
> > > > From: Jernej Skrabec <jernej.skrabec@siol.net>
> > > >
> > > > Add a simple-soundcard to link audio between HDMI and I2S.
> > > >
> > > > Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> > > > Signed-off-by: Marcus Cooper <codekipper@gmail.com>
> > > > Signed-off-by: Clément Péron <peron.clem@gmail.com>
> > > > ---
> > > >  arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 33 ++++++++++++++++++++
> > > >  1 file changed, 33 insertions(+)
> > > >
> > > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/
> boot/dts/allwinner/sun50i-h6.dtsi
> > > > index 28c77d6872f6..a8853ee7885a 100644
> > > > --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > > @@ -67,6 +67,25 @@ de: display-engine {
> > > >               status = "disabled";
> > > >       };
> > > >
> > > > +     hdmi_sound: hdmi-sound {
> > > > +             compatible = "simple-audio-card";
> > > > +             simple-audio-card,format = "i2s";
> > > > +             simple-audio-card,name = "sun50i-h6-hdmi";
> > > > +             simple-audio-card,mclk-fs = <128>;
> > > > +             simple-audio-card,frame-inversion;
> > > > +             status = "disabled";
> > > > +
> > > > +             simple-audio-card,codec {
> > > > +                     sound-dai = <&hdmi>;
> > > > +             };
> > > > +
> > > > +             simple-audio-card,cpu {
> > > > +                     sound-dai = <&i2s1>;
> > > > +                     dai-tdm-slot-num = <2>;
> > > > +                     dai-tdm-slot-width = <32>;
> > >
> > > It looks weird to have both some TDM setup here, and yet the format in
> > > i2s?
> > 
> > Yes, I agree I will check if it's really needed.
> 
> I think this was explained before.

Possibly, but this should be in a comment or at least the commit log

> Anyway, this is needed to force width to 32, no matter actual sample
> width. That's a requirement of HDMI codec. I believe Marcus Cooper
> have another codec which also needs fixed width.
> 
> There is no similar property for I2S, so TDM one is used here.

Except it's really dedicated to the TDM mode and doesn't really make
much sense here.

If we have special requirements like this on the codec setup, that
sounds like a good justification for creating a custom codec instead of
shoehorning it into simple-card

Maxime
Clément Péron Sept. 28, 2020, 2:27 p.m. UTC | #6
Hi Maxime,

On Mon, 28 Sep 2020 at 10:43, Maxime Ripard <maxime@cerno.tech> wrote:
>
> On Mon, Sep 21, 2020 at 08:37:09PM +0200, Jernej Škrabec wrote:
> > Dne ponedeljek, 21. september 2020 ob 19:23:49 CEST je Clément Péron
> > napisal(a):
> > > Hi Maxime,
> > >
> > > On Mon, 21 Sep 2020 at 15:59, Maxime Ripard <maxime@cerno.tech> wrote:
> > > >
> > > > On Mon, Sep 21, 2020 at 12:27:18PM +0200, Clément Péron wrote:
> > > > > From: Jernej Skrabec <jernej.skrabec@siol.net>
> > > > >
> > > > > Add a simple-soundcard to link audio between HDMI and I2S.
> > > > >
> > > > > Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> > > > > Signed-off-by: Marcus Cooper <codekipper@gmail.com>
> > > > > Signed-off-by: Clément Péron <peron.clem@gmail.com>
> > > > > ---
> > > > >  arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 33 ++++++++++++++++++++
> > > > >  1 file changed, 33 insertions(+)
> > > > >
> > > > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/
> > boot/dts/allwinner/sun50i-h6.dtsi
> > > > > index 28c77d6872f6..a8853ee7885a 100644
> > > > > --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > > > @@ -67,6 +67,25 @@ de: display-engine {
> > > > >               status = "disabled";
> > > > >       };
> > > > >
> > > > > +     hdmi_sound: hdmi-sound {
> > > > > +             compatible = "simple-audio-card";
> > > > > +             simple-audio-card,format = "i2s";
> > > > > +             simple-audio-card,name = "sun50i-h6-hdmi";
> > > > > +             simple-audio-card,mclk-fs = <128>;
> > > > > +             simple-audio-card,frame-inversion;
> > > > > +             status = "disabled";
> > > > > +
> > > > > +             simple-audio-card,codec {
> > > > > +                     sound-dai = <&hdmi>;
> > > > > +             };
> > > > > +
> > > > > +             simple-audio-card,cpu {
> > > > > +                     sound-dai = <&i2s1>;
> > > > > +                     dai-tdm-slot-num = <2>;
> > > > > +                     dai-tdm-slot-width = <32>;
> > > >
> > > > It looks weird to have both some TDM setup here, and yet the format in
> > > > i2s?
> > >
> > > Yes, I agree I will check if it's really needed.
> >
> > I think this was explained before.
>
> Possibly, but this should be in a comment or at least the commit log
>
> > Anyway, this is needed to force width to 32, no matter actual sample
> > width. That's a requirement of HDMI codec. I believe Marcus Cooper
> > have another codec which also needs fixed width.
> >
> > There is no similar property for I2S, so TDM one is used here.
>
> Except it's really dedicated to the TDM mode and doesn't really make
> much sense here.
>
> If we have special requirements like this on the codec setup, that
> sounds like a good justification for creating a custom codec instead of
> shoehorning it into simple-card

When all the remarks are fixed would it be possible to merge the rest
of the series without the dts changes ?

I will propose another series to introduce a dedicated codec for that.

>
> Maxime
Maxime Ripard Sept. 30, 2020, 10:19 a.m. UTC | #7
On Mon, Sep 28, 2020 at 04:27:42PM +0200, Clément Péron wrote:
> On Mon, 28 Sep 2020 at 10:43, Maxime Ripard <maxime@cerno.tech> wrote:
> >
> > On Mon, Sep 21, 2020 at 08:37:09PM +0200, Jernej Škrabec wrote:
> > > Dne ponedeljek, 21. september 2020 ob 19:23:49 CEST je Clément Péron
> > > napisal(a):
> > > > Hi Maxime,
> > > >
> > > > On Mon, 21 Sep 2020 at 15:59, Maxime Ripard <maxime@cerno.tech> wrote:
> > > > >
> > > > > On Mon, Sep 21, 2020 at 12:27:18PM +0200, Clément Péron wrote:
> > > > > > From: Jernej Skrabec <jernej.skrabec@siol.net>
> > > > > >
> > > > > > Add a simple-soundcard to link audio between HDMI and I2S.
> > > > > >
> > > > > > Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> > > > > > Signed-off-by: Marcus Cooper <codekipper@gmail.com>
> > > > > > Signed-off-by: Clément Péron <peron.clem@gmail.com>
> > > > > > ---
> > > > > >  arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 33 ++++++++++++++++++++
> > > > > >  1 file changed, 33 insertions(+)
> > > > > >
> > > > > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/
> > > boot/dts/allwinner/sun50i-h6.dtsi
> > > > > > index 28c77d6872f6..a8853ee7885a 100644
> > > > > > --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > > > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > > > > @@ -67,6 +67,25 @@ de: display-engine {
> > > > > >               status = "disabled";
> > > > > >       };
> > > > > >
> > > > > > +     hdmi_sound: hdmi-sound {
> > > > > > +             compatible = "simple-audio-card";
> > > > > > +             simple-audio-card,format = "i2s";
> > > > > > +             simple-audio-card,name = "sun50i-h6-hdmi";
> > > > > > +             simple-audio-card,mclk-fs = <128>;
> > > > > > +             simple-audio-card,frame-inversion;
> > > > > > +             status = "disabled";
> > > > > > +
> > > > > > +             simple-audio-card,codec {
> > > > > > +                     sound-dai = <&hdmi>;
> > > > > > +             };
> > > > > > +
> > > > > > +             simple-audio-card,cpu {
> > > > > > +                     sound-dai = <&i2s1>;
> > > > > > +                     dai-tdm-slot-num = <2>;
> > > > > > +                     dai-tdm-slot-width = <32>;
> > > > >
> > > > > It looks weird to have both some TDM setup here, and yet the format in
> > > > > i2s?
> > > >
> > > > Yes, I agree I will check if it's really needed.
> > >
> > > I think this was explained before.
> >
> > Possibly, but this should be in a comment or at least the commit log
> >
> > > Anyway, this is needed to force width to 32, no matter actual sample
> > > width. That's a requirement of HDMI codec. I believe Marcus Cooper
> > > have another codec which also needs fixed width.
> > >
> > > There is no similar property for I2S, so TDM one is used here.
> >
> > Except it's really dedicated to the TDM mode and doesn't really make
> > much sense here.
> >
> > If we have special requirements like this on the codec setup, that
> > sounds like a good justification for creating a custom codec instead of
> > shoehorning it into simple-card
> 
> When all the remarks are fixed would it be possible to merge the rest
> of the series without the dts changes ?
> 
> I will propose another series to introduce a dedicated codec for that.

Yeah, sure

Maxime
Clément Péron Nov. 1, 2020, 3:27 p.m. UTC | #8
Hi Maxime,


On Wed, 30 Sep 2020 at 12:19, Maxime Ripard <maxime@cerno.tech> wrote:
>
> On Mon, Sep 28, 2020 at 04:27:42PM +0200, Clément Péron wrote:
> > On Mon, 28 Sep 2020 at 10:43, Maxime Ripard <maxime@cerno.tech> wrote:
> > >
> > > On Mon, Sep 21, 2020 at 08:37:09PM +0200, Jernej Škrabec wrote:
> > > > Dne ponedeljek, 21. september 2020 ob 19:23:49 CEST je Clément Péron
> > > > napisal(a):
> > > > > Hi Maxime,
> > > > >
> > > > > On Mon, 21 Sep 2020 at 15:59, Maxime Ripard <maxime@cerno.tech> wrote:
> > > > > >
> > > > > > On Mon, Sep 21, 2020 at 12:27:18PM +0200, Clément Péron wrote:
> > > > > > > From: Jernej Skrabec <jernej.skrabec@siol.net>
> > > > > > >
> > > > > > > Add a simple-soundcard to link audio between HDMI and I2S.
> > > > > > >
> > > > > > > Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> > > > > > > Signed-off-by: Marcus Cooper <codekipper@gmail.com>
> > > > > > > Signed-off-by: Clément Péron <peron.clem@gmail.com>
> > > > > > > ---
> > > > > > >  arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 33 ++++++++++++++++++++
> > > > > > >  1 file changed, 33 insertions(+)
> > > > > > >
> > > > > > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/
> > > > boot/dts/allwinner/sun50i-h6.dtsi
> > > > > > > index 28c77d6872f6..a8853ee7885a 100644
> > > > > > > --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > > > > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > > > > > @@ -67,6 +67,25 @@ de: display-engine {
> > > > > > >               status = "disabled";
> > > > > > >       };
> > > > > > >
> > > > > > > +     hdmi_sound: hdmi-sound {
> > > > > > > +             compatible = "simple-audio-card";
> > > > > > > +             simple-audio-card,format = "i2s";
> > > > > > > +             simple-audio-card,name = "sun50i-h6-hdmi";
> > > > > > > +             simple-audio-card,mclk-fs = <128>;
> > > > > > > +             simple-audio-card,frame-inversion;
> > > > > > > +             status = "disabled";
> > > > > > > +
> > > > > > > +             simple-audio-card,codec {
> > > > > > > +                     sound-dai = <&hdmi>;
> > > > > > > +             };
> > > > > > > +
> > > > > > > +             simple-audio-card,cpu {
> > > > > > > +                     sound-dai = <&i2s1>;
> > > > > > > +                     dai-tdm-slot-num = <2>;
> > > > > > > +                     dai-tdm-slot-width = <32>;
> > > > > >
> > > > > > It looks weird to have both some TDM setup here, and yet the format in
> > > > > > i2s?


I was looking at sound documentation regarding how I can properly
write the multi-lane I2S support.
And I think we made a wrong interpretation here.

TDM slot-num and slot-width are not referencing the format called PCM
or DSP_A / DSP_B.
But really the physical time division representation of a format.

For example Amlogic do the following representation for Multi-lane I2S:

dai-link-7 {
    sound-dai = <&tdmif_b>;
    dai-format = "i2s";
    dai-tdm-slot-tx-mask-0 = <1 1>;
    dai-tdm-slot-tx-mask-1 = <1 1>;
    dai-tdm-slot-tx-mask-2 = <1 1>;
    dai-tdm-slot-tx-mask-3 = <1 1>;
    mclk-fs = <256>;

    codec {
        sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
    };
};

So i think for 2 channels HDMI using the simple sound card with TDM
property is not a hack but the correct way to represent it.

Do you agree ?

If so, can I resend the simple sound card for HDMI audio ?

Thanks,
Clement

> > > > >
> > > > > Yes, I agree I will check if it's really needed.
> > > >
> > > > I think this was explained before.
> > >
> > > Possibly, but this should be in a comment or at least the commit log
> > >
> > > > Anyway, this is needed to force width to 32, no matter actual sample
> > > > width. That's a requirement of HDMI codec. I believe Marcus Cooper
> > > > have another codec which also needs fixed width.
> > > >
> > > > There is no similar property for I2S, so TDM one is used here.
> > >
> > > Except it's really dedicated to the TDM mode and doesn't really make
> > > much sense here.
> > >
> > > If we have special requirements like this on the codec setup, that
> > > sounds like a good justification for creating a custom codec instead of
> > > shoehorning it into simple-card
> >
> > When all the remarks are fixed would it be possible to merge the rest
> > of the series without the dts changes ?
> >
> > I will propose another series to introduce a dedicated codec for that.
>
> Yeah, sure
>
> Maxime
Maxime Ripard Nov. 2, 2020, 10:21 a.m. UTC | #9
On Sun, Nov 01, 2020 at 04:27:05PM +0100, Clément Péron wrote:
> On Wed, 30 Sep 2020 at 12:19, Maxime Ripard <maxime@cerno.tech> wrote:
> >
> > On Mon, Sep 28, 2020 at 04:27:42PM +0200, Clément Péron wrote:
> > > On Mon, 28 Sep 2020 at 10:43, Maxime Ripard <maxime@cerno.tech> wrote:
> > > >
> > > > On Mon, Sep 21, 2020 at 08:37:09PM +0200, Jernej Škrabec wrote:
> > > > > Dne ponedeljek, 21. september 2020 ob 19:23:49 CEST je Clément Péron
> > > > > napisal(a):
> > > > > > Hi Maxime,
> > > > > >
> > > > > > On Mon, 21 Sep 2020 at 15:59, Maxime Ripard <maxime@cerno.tech> wrote:
> > > > > > >
> > > > > > > On Mon, Sep 21, 2020 at 12:27:18PM +0200, Clément Péron wrote:
> > > > > > > > From: Jernej Skrabec <jernej.skrabec@siol.net>
> > > > > > > >
> > > > > > > > Add a simple-soundcard to link audio between HDMI and I2S.
> > > > > > > >
> > > > > > > > Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> > > > > > > > Signed-off-by: Marcus Cooper <codekipper@gmail.com>
> > > > > > > > Signed-off-by: Clément Péron <peron.clem@gmail.com>
> > > > > > > > ---
> > > > > > > >  arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 33 ++++++++++++++++++++
> > > > > > > >  1 file changed, 33 insertions(+)
> > > > > > > >
> > > > > > > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/
> > > > > boot/dts/allwinner/sun50i-h6.dtsi
> > > > > > > > index 28c77d6872f6..a8853ee7885a 100644
> > > > > > > > --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > > > > > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > > > > > > @@ -67,6 +67,25 @@ de: display-engine {
> > > > > > > >               status = "disabled";
> > > > > > > >       };
> > > > > > > >
> > > > > > > > +     hdmi_sound: hdmi-sound {
> > > > > > > > +             compatible = "simple-audio-card";
> > > > > > > > +             simple-audio-card,format = "i2s";
> > > > > > > > +             simple-audio-card,name = "sun50i-h6-hdmi";
> > > > > > > > +             simple-audio-card,mclk-fs = <128>;
> > > > > > > > +             simple-audio-card,frame-inversion;
> > > > > > > > +             status = "disabled";
> > > > > > > > +
> > > > > > > > +             simple-audio-card,codec {
> > > > > > > > +                     sound-dai = <&hdmi>;
> > > > > > > > +             };
> > > > > > > > +
> > > > > > > > +             simple-audio-card,cpu {
> > > > > > > > +                     sound-dai = <&i2s1>;
> > > > > > > > +                     dai-tdm-slot-num = <2>;
> > > > > > > > +                     dai-tdm-slot-width = <32>;
> > > > > > >
> > > > > > > It looks weird to have both some TDM setup here, and yet the format in
> > > > > > > i2s?
> 
> 
> I was looking at sound documentation regarding how I can properly
> write the multi-lane I2S support.
> And I think we made a wrong interpretation here.
> 
> TDM slot-num and slot-width are not referencing the format called PCM
> or DSP_A / DSP_B.
> But really the physical time division representation of a format.
> 
> For example Amlogic do the following representation for Multi-lane I2S:
> 
> dai-link-7 {
>     sound-dai = <&tdmif_b>;
>     dai-format = "i2s";
>     dai-tdm-slot-tx-mask-0 = <1 1>;
>     dai-tdm-slot-tx-mask-1 = <1 1>;
>     dai-tdm-slot-tx-mask-2 = <1 1>;
>     dai-tdm-slot-tx-mask-3 = <1 1>;
>     mclk-fs = <256>;
> 
>     codec {
>         sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
>     };
> };
> 
> So i think for 2 channels HDMI using the simple sound card with TDM
> property is not a hack but the correct way to represent it.
> 
> Do you agree ?
> 
> If so, can I resend the simple sound card for HDMI audio ?

I mean, it's not less weird :)

And like I said before we still have the option to write a card driver
ourselves that doesn't take anything from the DT beside the phandle of
the i2s controller and the HDMI controller.

If it's a fixed configuration, I'm not sure why we bother trying to make
it dynamic in the DT.

Maxime
Clément Péron Nov. 2, 2020, 11:19 a.m. UTC | #10
Hi Maxime,

On Mon, 2 Nov 2020 at 11:21, Maxime Ripard <maxime@cerno.tech> wrote:
>
> On Sun, Nov 01, 2020 at 04:27:05PM +0100, Clément Péron wrote:
> > On Wed, 30 Sep 2020 at 12:19, Maxime Ripard <maxime@cerno.tech> wrote:
> > >
> > > On Mon, Sep 28, 2020 at 04:27:42PM +0200, Clément Péron wrote:
> > > > On Mon, 28 Sep 2020 at 10:43, Maxime Ripard <maxime@cerno.tech> wrote:
> > > > >
> > > > > On Mon, Sep 21, 2020 at 08:37:09PM +0200, Jernej Škrabec wrote:
> > > > > > Dne ponedeljek, 21. september 2020 ob 19:23:49 CEST je Clément Péron
> > > > > > napisal(a):
> > > > > > > Hi Maxime,
> > > > > > >
> > > > > > > On Mon, 21 Sep 2020 at 15:59, Maxime Ripard <maxime@cerno.tech> wrote:
> > > > > > > >
> > > > > > > > On Mon, Sep 21, 2020 at 12:27:18PM +0200, Clément Péron wrote:
> > > > > > > > > From: Jernej Skrabec <jernej.skrabec@siol.net>
> > > > > > > > >
> > > > > > > > > Add a simple-soundcard to link audio between HDMI and I2S.
> > > > > > > > >
> > > > > > > > > Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> > > > > > > > > Signed-off-by: Marcus Cooper <codekipper@gmail.com>
> > > > > > > > > Signed-off-by: Clément Péron <peron.clem@gmail.com>
> > > > > > > > > ---
> > > > > > > > >  arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 33 ++++++++++++++++++++
> > > > > > > > >  1 file changed, 33 insertions(+)
> > > > > > > > >
> > > > > > > > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/
> > > > > > boot/dts/allwinner/sun50i-h6.dtsi
> > > > > > > > > index 28c77d6872f6..a8853ee7885a 100644
> > > > > > > > > --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > > > > > > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > > > > > > > > @@ -67,6 +67,25 @@ de: display-engine {
> > > > > > > > >               status = "disabled";
> > > > > > > > >       };
> > > > > > > > >
> > > > > > > > > +     hdmi_sound: hdmi-sound {
> > > > > > > > > +             compatible = "simple-audio-card";
> > > > > > > > > +             simple-audio-card,format = "i2s";
> > > > > > > > > +             simple-audio-card,name = "sun50i-h6-hdmi";
> > > > > > > > > +             simple-audio-card,mclk-fs = <128>;
> > > > > > > > > +             simple-audio-card,frame-inversion;
> > > > > > > > > +             status = "disabled";
> > > > > > > > > +
> > > > > > > > > +             simple-audio-card,codec {
> > > > > > > > > +                     sound-dai = <&hdmi>;
> > > > > > > > > +             };
> > > > > > > > > +
> > > > > > > > > +             simple-audio-card,cpu {
> > > > > > > > > +                     sound-dai = <&i2s1>;
> > > > > > > > > +                     dai-tdm-slot-num = <2>;
> > > > > > > > > +                     dai-tdm-slot-width = <32>;
> > > > > > > >
> > > > > > > > It looks weird to have both some TDM setup here, and yet the format in
> > > > > > > > i2s?
> >
> >
> > I was looking at sound documentation regarding how I can properly
> > write the multi-lane I2S support.
> > And I think we made a wrong interpretation here.
> >
> > TDM slot-num and slot-width are not referencing the format called PCM
> > or DSP_A / DSP_B.
> > But really the physical time division representation of a format.
> >
> > For example Amlogic do the following representation for Multi-lane I2S:
> >
> > dai-link-7 {
> >     sound-dai = <&tdmif_b>;
> >     dai-format = "i2s";
> >     dai-tdm-slot-tx-mask-0 = <1 1>;
> >     dai-tdm-slot-tx-mask-1 = <1 1>;
> >     dai-tdm-slot-tx-mask-2 = <1 1>;
> >     dai-tdm-slot-tx-mask-3 = <1 1>;
> >     mclk-fs = <256>;
> >
> >     codec {
> >         sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
> >     };
> > };
> >
> > So i think for 2 channels HDMI using the simple sound card with TDM
> > property is not a hack but the correct way to represent it.
> >
> > Do you agree ?
> >
> > If so, can I resend the simple sound card for HDMI audio ?
>
> I mean, it's not less weird :)
>
> And like I said before we still have the option to write a card driver
> ourselves that doesn't take anything from the DT beside the phandle of
> the i2s controller and the HDMI controller.
>
> If it's a fixed configuration, I'm not sure why we bother trying to make
> it dynamic in the DT.

Ok I see what you mean here, as the link is hardcoded in the SoC it's
a better representation to hardcode it in the sound card driver than
having it dynamically represented in each board device-tree.

Sounds correct for me,
Thanks :)

>
> Maxime
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
index 28c77d6872f6..a8853ee7885a 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
@@ -67,6 +67,25 @@  de: display-engine {
 		status = "disabled";
 	};
 
+	hdmi_sound: hdmi-sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,name = "sun50i-h6-hdmi";
+		simple-audio-card,mclk-fs = <128>;
+		simple-audio-card,frame-inversion;
+		status = "disabled";
+
+		simple-audio-card,codec {
+			sound-dai = <&hdmi>;
+		};
+
+		simple-audio-card,cpu {
+			sound-dai = <&i2s1>;
+			dai-tdm-slot-num = <2>;
+			dai-tdm-slot-width = <32>;
+		};
+	};
+
 	osc24M: osc24M_clk {
 		#clock-cells = <0>;
 		compatible = "fixed-clock";
@@ -609,6 +628,19 @@  mdio: mdio {
 			};
 		};
 
+		i2s1: i2s@5091000 {
+			#sound-dai-cells = <0>;
+			compatible = "allwinner,sun50i-h6-i2s";
+			reg = <0x05091000 0x1000>;
+			interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_I2S1>, <&ccu CLK_I2S1>;
+			clock-names = "apb", "mod";
+			dmas = <&dma 4>, <&dma 4>;
+			resets = <&ccu RST_BUS_I2S1>;
+			dma-names = "rx", "tx";
+			status = "disabled";
+		};
+
 		spdif: spdif@5093000 {
 			#sound-dai-cells = <0>;
 			compatible = "allwinner,sun50i-h6-spdif";
@@ -739,6 +771,7 @@  ohci3: usb@5311400 {
 		};
 
 		hdmi: hdmi@6000000 {
+			#sound-dai-cells = <0>;
 			compatible = "allwinner,sun50i-h6-dw-hdmi";
 			reg = <0x06000000 0x10000>;
 			reg-io-width = <1>;