This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/TAS2552SW-LINUX: How to use ALSA System on Chip (ASoC)

Part Number: TAS2552SW-LINUX
Other Parts Discussed in Thread: TAS2552

Tool/software: Linux

Hallo,

we want to use TAS2552 Amplifier and Converter with an ARM based embedded Linux.

However, after configuring DTS there is a ALSA Souncard, but aplay gives an error:

aplay  -v  -c 1 -t raw  /usr/share/sounds/alsa/Noise.wav
Playing WAVE '/usr/share/sounds/alsa/Noise.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: set_params:1305: Channels count non available

We configured two new Items in DTS for Kernel:

       tas2552_sound: tas2552-sound {
                status = "okay";
                compatible = "simple-audio-card";
                model = "ti-tas2550";
                simple-audio-card,format = "i2s";
                simple-audio-card,mclk-fs = <256>;
                simple-audio-card,name = "P5tas2552";

                audio-routing =
                        "Ext Spk", "OUT" ,
                        "Int Mic", "IN";
                simple-audio-card,cpu {
                        sound-dai = <&i2s0>;
                };
                simple-audio-card,codec {
                        sound-dai = <&tas2552>;
                };
        };

&i2c2 {
        status = "okay";
        clock-frequency = <400000>;

        tas2552: tas2552@40 {
                compatible = "ti,tas2552";
                reg = <0x40>;
                #sound-dai-cells = <0>;
                vbat-supply = <&vdda_codec>;
                iovdd-supply = <&vccadc_ref>;
                avdd-supply= <&vccadc_ref>;
        };
};

This is an excerpt of messages during boot of the Board:

..
[    0.189809] Advanced Linux Sound Architecture Driver Initialized.
...
[    4.876924] asoc-simple-card hdmi-codec: i2s-hifi <-> ff8a0000.i2s mapping ok
[    4.888926] asoc-simple-card tas2552-sound: tas2552-amplifier <-> ff880000.i2s mapping ok
...
 [    5.131152] ALSA device list:
[    5.139035]   #0: HDMI-CODEC
[    5.146635]   #1: P5tas2552

[  OK  ] Reached target Sound Card.

To use TAS2552 as default, I created /etc/asound.conf:

# cat /etc/asound.conf
pcm.!default {
    type hw
    card 1
}

ctl.!default {
    type hw
    card 1
}

Accessing with Alsa-Tools:

# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: HDMICODEC [HDMI-CODEC], device 0: ff8a0000.i2s-i2s-hifi i2s-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: P5tas2552 [P5tas2552], device 0: ff880000.i2s-tas2552-amplifier tas2552-amplifier-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=HDMICODEC
    HDMI-CODEC,
    Default Audio Device
sysdefault:CARD=P5tas2552
    P5tas2552,
    Default Audio Device
# amixer  set 'Speaker Driver' 100%
Simple mixer control 'Speaker Driver',0
  Capabilities: pvolume pvolume-joined
  Playback channels: Mono
  Limits: Playback 0 - 31
  Mono: Playback 31 [100%] [24.00dB]
# amixer set 'Input selection' "Digital"
Simple mixer control 'Input selection',0
  Capabilities: enum
  Items: 'Digital' 'Analog'
  Item0: 'Digital'
# aplay  -v  -c 1 -t raw  /usr/share/sounds/alsa/Noise.wav
Playing WAVE '/usr/share/sounds/alsa/Noise.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: set_params:1305: Channels count non available

As simple-audio-card is working with HDMI, I think something wrong with configuration of TAS2552

Any hints will  be greatly appreciated.

With  best regards

Klaus

  • Hi Klaus,

    You might want to upload this issue on the Linux forum:
    e2e.ti.com/.../

    I'll try to find out what could be causing this issue although we're not really involved in the linux driver operation/usage.

    Best regards,
    -Ivan Salazar
    Audio Applications Engineer - Low Power Audio & Actuators
  • Klaus,

    Have you tried by sending the play command with 2 channels? I think it is done by the -c argument, so it should be something like "-c 2"

    Best regards,
    -Ivan Salazar
    Audio Applications Engineer - Low Power Audio & Actuators
  • Hallo,

    it seems no difference if I use -c 1 or -c 2 as flag with aplay.

    In further tests with a slightly different Device-Tree give another output of aplay.

    This is the actual devicetree:

            tas2552_sound: tas2552-sound {
                    status = "okay";
                    compatible = "simple-audio-card";
                    model = "ti-tas2550";
                    simple-audio-card,format = "i2s";
                    simple-audio-card,mclk-fs = <256>;
                    simple-audio-card,name = "P5tas2552";
    
                    audio-routing =
                            "Ext Spk", "OUT" ,
                            "Int Mic", "IN";
    
                    simple-audio-card,cpu {
                            sound-dai = <&i2s0>;
                    };
                    simple-audio-card,codec {
                            sound-dai = <&tas2552>;
                    };
            };
    

    aplay gives following output, first call ends without sound, secound call  doesn't play sound also and doesn't return to shell:

    aplay  -v  -c 1 -t raw  /usr/share/sounds/alsa/Noise.wav
    Playing WAVE '/usr/share/sounds/alsa/Noise.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
    Plug PCM: Route conversion PCM (sformat=S16_LE)
      Transformation table:
        0 <- 0
        1 <- 0
    Its setup is:
      stream       : PLAYBACK
      access       : RW_INTERLEAVED
      format       : S16_LE
      subformat    : STD
      channels     : 1
      rate         : 48000
      exact rate   : 48000 (48000/1)
      msbits       : 16
      buffer_size  : 24000
      period_size  : 6000
      period_time  : 125000
      tstamp_mode  : NONE
      tstamp_type  : MONOTONIC
      period_step  : 1
      avail_min    : 6000
      period_event : 0
      start_threshold  : 24000
      stop_threshold   : 24000
      silence_threshold: 0
      silence_size : 0
      boundary     : 6755399441055744000
    Slave: Hardware PCM card 0 'P5tas2552' device 0 subdevice 0
    Its setup is:
      stream       : PLAYBACK
      access       : MMAP_INTERLEAVED
      format       : S16_LE
      subformat    : STD
      channels     : 2
      rate         : 48000
      exact rate   : 48000 (48000/1)
      msbits       : 16
      buffer_size  : 24000
      period_size  : 6000
      period_time  : 125000
      tstamp_mode  : NONE
      tstamp_type  : MONOTONIC
      period_step  : 1
      avail_min    : 6000
      period_event : 0
      start_threshold  : 24000
      stop_threshold   : 24000
      silence_threshold: 0
      silence_size : 0
      boundary     : 6755399441055744000
      appl_ptr     : 0
      hw_ptr       : 0
    

    Still I don't know whether I need entries for "simple-audio-card,widgets".

    Also whether frame-master and bitclock-master are necessary to be set.

    With best regards

    Klaus

  • Hallo!

    I was able to check LRCLK, BCLK and DIN of TA2552, see following hardcopies of oscilloscope:

    Yellow: LRCLK

    Blue: BCLK

     

    Yello: LRCK Blue: DIN

    Sorry, I don't have experience with I2S. But for me this seems to be ok. Any hints why we don't have any sound?

    The Evaluation kit works with windows test software TAS2552 EVM GUI.

    With best regards

    Klaus

  • Hallo!
    Still we got no sound. Maybe I have to setup the PLL. Are there any examples how to config the TAS2552 to work with LRCLK and BCLK only (without MCLK) throuh device tree (DTS). I can't get the link from ./include/dt-bindings/sound/tas2552.h with Documentation/devicetree/bindings/sound/tas2552.txt to a valid entry in out Device Tree File.
    With best regards
    Klaus
  • Hi Klaus,

    Unfortunately we don't have a way to support issues related with Linux operation.
    We can offer the register configurations that you would need to operate without MCLK by using only LRCLK and BCLK. You could test this on the EVM and windows GUI. However we don't have support on Linux drivers or device tree operation.

    Best regards,
    -Ivan Salazar
    Applications Engineer - Low Power Audio & Actuators