Post Go back to editing

SSM4567 and custom board

Category: Software

Hi All, 

I have a few questions about SSM4567 Linux access.  

m

We have been trying to add the SSM4567 sound driver to our custom Yocto build. The kernel driver has been added to the kernel configuration file.

Additionally, the DTSI file was modified. Looks like the DTSI changes are not working.

Could you please assist me in understanding the steps I need to take in order to make this driver work and to be recognized by Linux as a sound card?

In our system, we use iMX8QM. We designed a custom board based on the Apalis Evaluation Board V1.1, which uses the imx8qm SOM.

In custom board, a few GPIOs are added, and SSM4567 is added.

 

 Following are the changes related to ssm4567.

 

The changes we added to Yocto Linux is explained in following info.

 

Ssm4567 driver:

https://git.yoctoproject.org/linux-yocto-4.6/plain/Documentation/devicetree/bindings/sound/ssm4567.txt

 

Kernel config changed, added for ssm4567.

CONFIG_SND_SOC_SSM4567=y

 

The yocto setup uses imx8-apalis-v1.1.dtsi device tree file.

device-trees/imx8-apalis-v1.1.dtsi at toradex_5.4-2.1.x-imx · toradex/device-trees · GitHub

 

It is modified as seen in following part:

Ssm4567 is added to i2c3 port.

 

/* Apalis I2C3 (CAM) */

&i2c3 {

pinctrl-names = "default";

pinctrl-0 = <&pinctrl_lpi2c3>;

#address-cells = <1>;

#size-cells = <0>;

clock-frequency = <100000>;

status = "okay";

 

ssm4567: ssm4567@34 {

compatible = "adi,ssm4567";

reg = <0x34>;

 

};

 

sound {

compatible = "simple-audio-card";

simple-audio-card,bitclock-master = <&dailink_master>;

simple-audio-card,format = "i2s";

simple-audio-card,frame-master = <&dailink_master>;

/* simple-audio-card,mclk-fs = <1>; */

simple-audio-card,name = "ssm4567-i2S-Card";

        status = "okay";

 

simple-audio-card,cpu {

sound-dai = <&sai1>;

};

 

dailink_master: simple-audio-card,codec {

clocks = <&mclkout0_lpcg 0>;

sound-dai = <&ssm4567-hifi>;

};

};

 

 

I try to add ssm4567 as simple-audio-card to dtsi but could not detect it in linux, tries aplay and alsamixer. And checkged dmesg logs. 

Can you please assist me with the device tree file, how do I add the correct settings for DAP1 pins?

 

SSM4567 is seen in the i2c port and it is bonded to ssm4567 driver as seen in the linux command line.

 

 

I also dumped register values of SSM4567: 

They look ok,they are in their default values. 

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    

00: 81 09 32 40 00 08 01 20 32 07 07 07 00 a4 73 00  

10: 00 00 30 40 11 03 00 00 00 00 00 00 00 00 00 00  

 

Thanks 

Ahmet.   

  • I'll appreciate help on the topic. 

    I’ll share a few of findings.

     I put a few printk lines in ssm4567.c file inside ssm4567_i2c_probe function. I can see it was called without any error.

     

    I can dump the registers. And read&write to registers work too.

    I2c connection is working. 

     

    What I need to do is settings connections on the device file dtsi as a simple-audio-card.

    As seen from the schematics, SSM4567 is connected to DAP1 ports. 

    As seen from dtsi i2s is configured for sgtl5000.  We don’t intend to use sgtl5000.

     

    It will be used in i2s mode.  And no MCLK. It will be driven by DAP1_SYNC and DAP1_BIT_CLK

     

    Speaker test and playing a wav file via aplay does not work. Some settings are missing related to DAP1 pins and

    route or widgets info in device tree. 

    I added the dtsi file which has the changes.

     

     

    Device tree changes:

                   sound {

                                  compatible = "simple-audio-card";

                                  lable = "ssm4567-audio";

                                  simple-audio-card,name = "ssm4567";

                                 

                                  simple-audio-card,frame-master = <&ssmcpu>;

                                  simple-audio-card,bitclock-master = <&ssmcpu>;

                                 

                                  simple-audio-card,dai-link {

                                                 format = "i2s";

                                                 cpu {

                                                                sound-dai = <&sai1>;

                                                 };

                                                 ssmcpu: codec {

                                                                sound-dai = <&ssm4567>;

                                                 };

                                  };

                   };

     

    /* Apalis I2C3 (CAM) */

    &i2c3 {

                   pinctrl-names = "default";

                   pinctrl-0 = <&pinctrl_lpi2c3>;

                   #address-cells = <1>;

                   #size-cells = <0>;

                   clock-frequency = <100000>;

                  

                   ssm4567: ssm4567@34 {

                                  compatible = "ssm4567";

                                  reg = <0x34>;

                                  #sound-dai-cells = <0>;

                                 

                   };

    };

     

    Using device tree changes, I got the following result:

     

    b2qt-apalis-imx8:~:>dmesg | grep ssm4567

    [    2.511720] LOG: ssm4567 function: ssm4567_i2c_probe

    [    2.512122] LOG: ssm4567 function: ssm4567_i2c_probe end of function

    [    3.135002] debugfs: Directory '59050000.sai' with parent 'ssm4567' already present!

    [    3.142910] asoc-simple-card sound: ssm4567-hifi <-> 59050000.sai mapping ok

    [    3.211230]   #1: ssm4567

    b2qt-apalis-imx8:~:>aplay -l

    **** List of PLAYBACK Hardware Devices ****

    card 0: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-0 [S/PDIF PCM snd-soc-dummy-dai-0]

      Subdevices: 1/1

      Subdevice #0: subdevice #0

    card 1: ssm4567 [ssm4567], device 0: 59050000.sai-ssm4567-hifi ssm4567-hifi-0 []

      Subdevices: 1/1

      Subdevice #0: subdevice #0

    b2qt-apalis-imx8:~:>amixer -c 1

    Simple mixer control 'Master',0

      Capabilities: pvolume pvolume-joined

      Playback channels: Mono

      Limits: Playback 0 - 255

      Mono: Playback 137 [54%] [-20.08dB]

    Simple mixer control 'Amplifier Boost',0

      Capabilities: pswitch pswitch-joined

      Playback channels: Mono

      Mono: Playback [on]

    Simple mixer control 'DAC High Pass Filter',0

      Capabilities: pswitch pswitch-joined

     Playback channels: Mono

      Mono: Playback [on]

    Simple mixer control 'DAC Low Power Mode',0

      Capabilities: pswitch pswitch-joined

      Playback channels: Mono

      Mono: Playback [on]

    b2qt-apalis-imx8:~:>

     

     

    Please could you guide me on the next steps. How to activate DAP1 ports or how to sett route and widgets.

      /* Apalis DAP1 */
    pinctrl_dap1_gpios: dap1gpiosgrp {
    fsl,pins = <
    /* Apalis DAP1_SYNC */
    IMX8QM_SPI2_CS1_LSIO_GPIO3_IO11 0x00000021     --> connected to FSYNC SSM4567 
    /* Apalis DAP1_BIT_CLK */
    IMX8QM_SPI0_CS1_LSIO_GPIO3_IO06 0x00000021   --> connected to BCLK 
    /* Apalis DAP1_D_OUT */
    IMX8QM_SAI1_RXC_LSIO_GPIO3_IO12 0x00000021  --> connected to DAC_SDATAI
    /* Apalis DAP1_D_IN */
    IMX8QM_SAI1_RXFS_LSIO_GPIO3_IO14 0x00000021 --> connected to SNS_DATAO
    >;
    };

     

    Best regards

    a.g.

  • Sorry we missed this question.

    Do you still need help?

    -Michael

  • Hi Michael, 

    After the changes in the device tree. I'm able to play wav files.  

    It looks working fine.

    After a bit more testing and verifying.

    I'll post my changes if needed by anyone else. 

    Thanks

    Ahmet.