[alsa-devel] ALSA Overlay 24bit data 32bit slots

Ed McNicholas emcnicholas at bogen.com
Mon Mar 27 18:30:01 CEST 2017


I am interfacing with a dsp that we have programmed and there are only options for slot widths of 16 or 32 bits but we are using a 24 bit data format. When I record using

arecord -v -f S32_LE -r 48000 -t wav -c4 /home/nyquist/test.wav

I get valid audio recording but the lower 8bits is 0 as would be expected. When I record using :

arecord -v -f S24_LE -r 48000 -t wav -c4 /home/nyquist/test.wav

I get garbage as it appears to be using 24bit wide tdm slots.  My overlay is below and I have set what I believe are the correct slot configurations for the device.  We have 4 channel input and one channel output 32bit slot width.

Any help would be greatly appreciated as I am sure I am missing something.

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/input/linux-event-codes.h>


/ {
                compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";

                /* identification */
                part-number = "NQ-ASB-01";
                version = "00A0", "A0";

                fragment at 0 {
                                target = <&am33xx_pinmux>;
                                __overlay__ {

                                                bone_audio_cape_audio_pins: pinmux_bone_audio_cape_audio_pins {
                                                                pinctrl-single,pins = <
                                                                                0x190 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_aclkx.mcasp0_aclkx */
                                                                                0x194 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_fsx.mcasp0_fsx, INPUT */
                                                                                0x198 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_axr0.mcasp0_axr0 */
                                                                                0x19c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mcasp0_ahclkr.mcasp0_axr2 */
                                                                                0x1ac (PIN_INPUT_PULLDOWN | MUX_MODE0) /* MCASP0_AHCLKX -> MCASP0_AHCLKX (I2S_MCLK_OUT)- in */
                                                                                0x06c ( PIN_OUTPUT_PULLUP | MUX_MODE7 ) /* mcasp0_axr1 GPIO1_27 | OUTPUT | PULLUP */
                                                                >;
                                                };
                                                /* dsp SPI Pins */
                                                bb_spi0_pins: pinmux_bb_spi0_pins {
                                                                pinctrl-single,pins = <
                                                                                0x150 0x30         /* p84 spi0_sclk.spi0_sclk, INPUT_PULLUP | MODE0 */
                                                                                0x154 0x30         /* p85 spi0_d0.spi0_d0, INPUT_PULLUP | MODE0 */
                                                                                0x158 0x10         /* p86 spi0_d1.spi0_d1, OUTPUT_PULLUP | MODE0 */
                                                                                0x15c 0x10          /* p87 spi0_cs0.spi0_cs0, OUTPUT_PULLUP | MODE0 */
                                                                >;
                                                };
                                };
                };

                /* Relay Spi Interface */
                fragment at 1 {
                                target = <&spi0>;
                                __overlay__ {
                                                #address-cells = <1>;
                                                #size-cells = <0>;

                                                status = "okay";
                                                pinctrl-names = "default";
                                                pinctrl-0 = <&bb_spi0_pins>;
                                                ti,pio-mode; /* disable dma when used as an overlay, dma gets stuck at 160 bits... */
                                                ti,pindir-d0-out-d1-in = <1>;

                                                dspspi: channel at 0 {
                                                                #address-cells = <1>;
                                                                #size-cells = <0>;
                                                                #sound-dai-cells = <0>;

                                                                compatible = "nq,dsp";

                                                                reg = <0>;
                                                                spi-max-frequency = <16000000>;
                                                                spi-cpha;
                                                };
                                };
                };
                /* MCASP Interface */
                fragment at 2 {
                                target = <&mcasp0>;
                                __overlay__ {
                                                #sound-dai-cells = <0>;
                                                compatible = "ti,am33xx-mcasp-audio";
                                                pinctrl-names = "default";
                                                pinctrl-0 = <&bone_audio_cape_audio_pins>;
                                                status = "okay";
                                                op-mode = <0>;          /* MCASP_IIS_MODE */
                                                tdm-slots = <4>;
                                                serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
                                                                2 0 1 0
                                                                0 0 0 0
                                                                0 0 0 0
                                                                0 0 0 0
                                                >;
                                                tx-num-evt = <1>;
                                                rx-num-evt = <1>;
                                };
                };
                /*Sound Interface Config */
                fragment at 3 {
                                target-path="/";
                                __overlay__ {
                                                sound {
                                                                compatible = "simple-audio-card";
                                                                simple-audio-card,name = "Nyquist Mixer DSP";
                                                                simple-audio-card,format = "dsp_a";
                                                                simple-audio-card,bitclock-master = <&sound_master>;
                                                                simple-audio-card,frame-master = <&sound_master>;

                                                                simple-audio-card,widgets =
                                                                                "Line", "Line In";

                                                                simple-audio-card,cpu {
                                                                                sound-dai = <&mcasp0>;
                                                                                dai-tdm-slot-num = <4>;
                                                                                dai-tdm-slot-width = <32>;
                                                                                dai-tdm-slot-tx-mask = <1 0 0 0>;
                                                                                dai-tdm-slot-rx-mask = <1 1 1 1>;
                                                                };

                                                                sound_master: simple-audio-card,codec {
                                                                                sound-dai = <&dspspi>;
                                                                                dai-tdm-slot-num = <4>;
                                                                                dai-tdm-slot-width = <32>;
                                                                                dai-tdm-slot-tx-mask = <1 0 0 0>;
                                                                                dai-tdm-slot-rx-mask = <1 1 1 1>;
                                                                };
                                                };
                                };

                };
};


Ed McNicholas
Sr Embedded Engineer

[Bogen Signature Logo]<http://www.bogen.com/>
Bogen Communications, Inc.
3862 Quadrangle Blvd
Suite 150
Orlando, FL 32817
Direct: (201) 995-2087
Cell: (321) 217-5518

-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 1940 bytes
Desc: image001.jpg
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20170327/e6488fcb/attachment-0001.jpg>


More information about the Alsa-devel mailing list