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.

PCM1780: About the device tree .

Part Number: PCM1780

Hi Team,

I'm working on pcm1780 on a Linux platform.

I've customized the pcm179x Linux driver and tried a prototype driver. (The driver is not perfect.)

The pcm1780 is connected to SAI1 and SPI1 of STM32MP157.

[ 3.612164] ALSA device list:
[ 3.613674] No soundcards found.

[ 22.409313] spi_stm32 44004000.spi: driver initialized

[ 65.393494] snd-soc-pcm1780-spi : pcm1780_spi_probe
[ 65.414580] snd-soc-pcm1780-spi : devm_regmap_init_spi(), success [9f06e26a]
[ 65.420197] snd-soc-pcm1780-spi : goto pcm1780_common_init()
[ 65.476548] snd-soc-pcm1780-codec : pcm1780_common_init()
[ 65.480510] snd-soc-pcm1780-codec : devm_kzalloc(), success
[ 65.551852] snd-soc-pcm1780-codec : goto dev_set_drvdata()
[ 65.565813] snd-soc-pcm1780-codec : goto devm_snd_soc_register_component()
[ 65.572999] snd-soc-pcm1780-codec : pcm1780_set_dai_fmt()
[ 65.595866] asoc-audio-graph-card sound: pcm1780-hifi <-> 4400a004.audio-controller mapping ok
[ 65.603073] asoc-audio-graph-card sound: ASoC: no source widget found for MCLK
[ 65.727225] asoc-audio-graph-card sound: ASoC: Failed to add route MCLK -> direct -> Playback

sound {
compatible = "audio-graph-card";
label = "PCM1780_Audio";
routing =
"Playback" , "MCLK";
dais = <&sai1a_port>;
status = "okay";
};

The above has a problem detecting MCLK, but it was not in the referenced pcm179x driver.

Am I making a mistake in the device tree?

Is there a sample device tree for pcm179x (SPI)?

Unfortunately, "Documentation/devicetree/bindings/sound/pcm179x.txt" is not useful.

Thanks,

  • Let me check with one of my colleagues and see if this is something we can support. I will let you know by Wednesday of next week.

    Regards,

    Arash

  • I consulted my colleagues and this is what I can offer you . Hopefully this solves the issue you have  or get you in the right path.

    Below is the dts setting of TAS27xx on BBB.

    Regarding the no soundcard found, you can  double check it by using command cat /proc/asound/pcm to see if there’s correct pcm node.As there’re too many potential reasons can cause soundcard register fail, you can search it in Google.

    Regards

    Arash

  • Thank you for your reply.

    I expect your suggestion to be a customization of the following files.

    arch\arm\boot\dts\am335x-boneblack-common.dtsi
    arch\arm\boot\dts\am335x-osd3358-sm-red.dts

    Unfortunately I couldn't solve the problem.

    Is there a difference between "simple-audio-card" and "audio-graph-card"?
    I have confirmed that the prototype driver works with the following settings.

    sound {
      compatible = "audio-graph-card";
      label = "IoTGateway";
      // routing =
        // "Playback" , "MCLK";
      dais = <&sai1a_port>;
      status = "okay";
    };


    &spi1 {
      pinctrl-names = "default", "sleep";
      pinctrl-0 = <&spi1_pins_a1 &spi1_pins_a2>;
      pinctrl-1 = <&spi1_sleep_pins_a1 &spi1_sleep_pins_a2>;
      cs-gpios = <&gpioa 15 GPIO_ACTIVE_HIGH>;
      status = "okay";

      codec: 1780@0 {
        compatible = "ti,pcm1780";
        clocks = <&sai1a>;
        clock-name = "MCLK";
        spi-max-frequency = <600000>;
        reg = <0>;

        pcm1780_port: port {
        #address-cells = <1>;
        #size-cells = <0>;

        pcm1780_tx_endpoint: endpoint@0 {
          reg = <0>;
          remote-endpoint = <&sai1a_endpoint>;
          frame-master;
          bitclock-master;
        };
      };
    };
    };

    &sai1 {
      clocks = <&rcc SAI1>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
      clock-names = "pclk", "x8k", "x11k";
      pinctrl-names = "default", "sleep";
      pinctrl-0 = <&sai1a_pins_a>;
      pinctrl-1 = <&sai1a_sleep_pins_a>;
      status = "okay";

      sai1a: audio-controller@4400a004 {
        #clock-cells = <0>;
        dma-names = "tx";
        clocks = <&rcc SAI1_K>;
        clock-names = "sai_ck";
        status = "okay";

        sai1a_port: port {
          sai1a_endpoint: endpoint {
            remote-endpoint = <&pcm1780_tx_endpoint>;
            format = "i2s";
            mclk-fs = <512>;
            dai-tdm-slot-num = <2>;
            dai-tdm-slot-width = <32>;
          };
        };
      };
      sai1b: audio-controller@4400a024 {
        status = "disabled";
      };
    };

    However, the audio output has not been confirmed yet.
    This part should be avoided as the pcm1780 does not support register reads.
    I don't think the pcm1780 is suitable as an ALSA device...
    Also, in audio output, "write error: Input/output error" occurs in aplay.

    Thanks,

    Nishimura

  •  Hello Nishimura, If you need an alternative  part suggestion, let us know the specs you need and we can give you some suggestions.  If you want to discuss more about the above code and driver, you can give me your email and I see if one of my colleagues  can further help you.

    Regards,

    Arash

  • Thank you for your kind support.
    Unfortunately, I have stopped using the pcm1780.

    Thanks,

    Nishimura