Skip to contentSkip to conversation

why error return in sound/soc/codecs/pcm3168a.c::pcm3168a_set_dai_fmt ?

PATCH Jurgen Lambrecht 2 participants 2 messages Jun 4, 2019 – Jul 1, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

When following
https://bootlin.com/blog/eight-channels-audio-on-i-mx7-with-pcm3168/ I get this error (from soc_core.c):

... kernel: [    3.059634][   T15] pcm3168a 3-0039: ASoC: Failed to set DAI format: -22

I could propose this patch (I get that printf when applying the patch) (all other errors in that file have a printf):

sound/soc/codecs/pcm3168a.c +1 -0
index 08d3fe192e65..75ccbb919902 100644
@@ -353,6 +353,7 @@ static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai,
         case SND_SOC_DAIFMT_NB_NF:
                 break;
         default:
+               dev_err(component->dev, "wrong INV_MASK\n");
                 return -EINVAL;
         }
 

But why does this code returns an error for code that has no effect? OK, it could be because SND_SOC_DAIFMT_INV_MASK must be SND_SOC_DAIFMT_NB_NF. But then Alexandre's blog contains an error, because the dac TDM sets frame-inversion in its dts (and it should not).

Signature · 16 lines
Kind Regards,

*Jürgen Lambrecht*
R&D Associate

Tel: +32 51 303045

www.televic-rail.com <https://www.televic-rail.com>

Televic Rail NV - Leo Bekaertlaan 1 - 8870 Izegem - Belgium
Company number 0825 539 581 - RPR Kortrijk

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#1 lore raw

Hello,

Quoted 24 lines · Jurgen Lambrecht

Hi,

When following
https://bootlin.com/blog/eight-channels-audio-on-i-mx7-with-pcm3168/ I get this error (from soc_core.c):

... kernel: [    3.059634][   T15] pcm3168a 3-0039: ASoC: Failed to set DAI format: -22

I could propose this patch (I get that printf when applying the patch) (all other errors in that file have a printf):

sound/soc/codecs/pcm3168a.c +1 -0
index 08d3fe192e65..75ccbb919902 100644
@@ -353,6 +353,7 @@ static int pcm3168a_set_dai_fmt(struct snd_soc_dai *dai,
         case SND_SOC_DAIFMT_NB_NF:
                 break;
         default:
+               dev_err(component->dev, "wrong INV_MASK\n");
                 return -EINVAL;
         }
 
Quoted 5 lines

But why does this code returns an error for code that has no effect? OK, it could be because SND_SOC_DAIFMT_INV_MASK must be SND_SOC_DAIFMT_NB_NF. But then Alexandre's blog contains an error, because the dac TDM sets frame-inversion in its dts (and it should not).

While I'm pretty sure what is in the blog is working (it is deployed in production), I remember there was something fishy with frame-inversion. I unfortunately don't remember the specifics.

Honestly, I would think you can remove frame-inversion safely as the codec is only supposed to support NB_NF.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com