Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


What I2S DAC uses left justified format?
#11
pi@moode:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: GenericLJ [GenericLJ], device 0: bcm2835-i2s-dit-hifi dit-hifi-0 []
 Subdevices: 1/1
 Subdevice #0: subdevice #0
pi@moode:~ $ speaker-test -h

speaker-test 1.1.3

Usage: speaker-test [OPTION]...
-h,--help       help
-D,--device     playback device
-r,--rate       stream rate in Hz
-c,--channels   count of channels in stream
-f,--frequency  sine wave frequency in Hz
-F,--format     sample format
-b,--buffer     ring buffer size in us
-p,--period     period size in us
-P,--nperiods   number of periods
-t,--test       pink=use pink noise, sine=use sine wave, wav=WAV file
-l,--nloops     specify number of loops to test, 0 = infinite
-s,--speaker    single speaker test. Values 1=Left, 2=right, etc
-w,--wavfile    Use the given WAV file as a test sound
-W,--wavdir     Specify the directory containing WAV files
-m,--chmap      Specify the channel map to override
-X,--force-frequency    force frequencies outside the 30-8000hz range
-S,--scale      Scale of generated test tones in percent (default=80)

Recognized sample formats are: S8 S16_LE S16_BE FLOAT_LE S32_LE S32_BE

   
Reply
#12
(11-29-2018, 09:36 PM)xaled Wrote: There is something wrong with the drivers. I set speakertest to 32 bits but see only 24 at the Logic analyzer:

pi@moode:~ $ speaker-test -c2 -F S32_LE

speaker-test 1.1.3

Playback device is default
Stream parameters are 48000Hz, S32_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 64 to 65536
Period size range from 32 to 32768
Using max buffer size 65536
Periods = 4
was set period_size = 16384
was set buffer_size = 65536
0 - Front Left
1 - Front Right
Time per period = 4.102830
0 - Front Left
1 - Front Right

Speaker test confirms that whatever component is deciding the device doesn't support 32 bit word length is downstream from MPD.

It looks like speaker-test -h is reporting the formats that it supports and not what the audio device reports that it supports.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#13
generic-lj device tree description has an spdif part in it. Could it have some impact on reducing word length to 24 bits?
It is my first time working with overlays so I don't quite get all the details of the description.


Code:
/*
* Audio Graph Card overlay for generic DAC in left-justified mode
*
* compile with:
* dtc -@ -H epapr -O dtb -o generic-lj.dtbo -Wno-unit_address_vs_reg generic-lj.dts
*
*/
/dts-v1/;
/plugin/;

/ {
    fragment@0 {
        target = <&i2s>;
        __overlay__ {
            #sound-dai-cells = <0>;
            status = "okay";

            cpu_port: port {
                cpu_endpoint: endpoint {
                    remote-endpoint = <&codec_endpoint>;
                    dai-format = "left_j";
                    bitclock-master;
                    frame-master;
                };
            };
        };
    };

    fragment@1 {
        target-path = "/";
        __overlay__ {
            spdif-transmitter {
                #address-cells = <0>;
                #size-cells = <0>;
                #sound-dai-cells = <0>;
                compatible = "linux,spdif-dit";
                status = "okay";

                codec_port: port {
                    codec_endpoint: endpoint {
                        remote-endpoint = <&cpu_endpoint>;
                    };
                };
            };
        };
    };

    fragment@2 {
        target = <&sound>;
        __overlay__ {
            compatible = "audio-graph-card";
            label = "GenericLJ";
            dais = <&cpu_port>;
            status = "okay";
        };
    };
};
Reply
#14
It could be the culprit because S/PDIF format only supports up to 24 bit word length. This device is in the audio chain so ALSA must be seeing the requirement for "spdif" and then doing 32 -> 24 bit conversion.

I reread your post and didn't realize until I linked to the diyAudio thread that the converter you are referring to is from the TDA legend himself @ecdesigns :-)

I don't have much experience with driver/overlay development but if you are able to get a 32 bit capable LJ overlay made then next step would be to submit for acceptance into the Linux kernel. At same time I can code in support for the Converter and its overlays :-)

-Tim
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#15
I hoped that you have more experience with overlays so I could dump it on you Wink
It looks like I will have to get my hands dirty Smile
I will update on the progress.
Reply
#16
lol, a little dirt is good for the soul ;-)

Looking forward to updates :-)
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#17
(11-29-2018, 11:40 PM)Tim Curtis Wrote: a little dirt is good for the soul ;-)

Amen, Brother.
Reply
#18
It looks like starting with 4.16 kernel the spdif transmitter codec will support 32bit and the sample LJ overlay will work with 32 bits.

Do you have plans on updating the kernel?
Reply
#19
Thats cool :-)

I always strive to update to latest Raspberry Pi kernel via rpi-update as I'm preparing for a moOde release. They have not migrated to the 4.16.y branch yet.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: