SPDIF oputput from GPIO header

Hi, has anyone got any info to get SPDIF working via the GPIO header, or know of an image that supports this?

I can not see an overlay in the Debian image which I presume is required?

Thanks.

So I obviously have little idea of what I am doing, but without SPDIF I have a rather expensive paperweight on my desk…

So finding this and tracking down the working github link I have tried updating to suit the 5B resulting in this overlay;

/dts-v1/;
/plugin/;

/ {
        compatible = "radxa,rock-5b", "rockchip,rk3588";
        fragment@0 {
                target-path = "/";

                __overlay__ {
                        acodec: acodec {
                                #sound-dai-cells = <0>;
                                compatible = "rockchip,rk3588-codec";
                                status = "okay";
                                };
                        };
        };

        fragment@1 {
                target = <&spdif_tx>;

                __overlay__ {
                                status = "okay";
                        };
        };

        fragment@2 {
                target = <&i2s_8ch_0>;

                __overlay__ {
                        status = "disabled";
                };
        };

        fragment@3 {
                target = <&i2s_8ch_2>;

                __overlay__ {
                        status = "disabled";
                };
        };

        fragment@4 {
                target-path = "/";

                __overlay__ {
                        acodec-sound {
                                compatible = "rockchip,multicodecs-card";
                                rockchip,card-name = "SPDIF_out";
                                rockchip,mclk-fs = <256>;
                                rockchip,cpu = <&spdif_tx>;
                                rockchip,codec = <&acodec>;
                                };
                    };
          };
};

Which not to surprisingly just stops the board from booting… so I really need some help please!!

Stripping it back to

/dts-v1/;
/plugin/;

/ {
        compatible = "radxa,rock-5b", "rockchip,rk3588";

        fragment@0 {
                target = <&spdif_tx>;

                __overlay__ {
                                status = "okay";
                        };
        };

};

Also results in a no boot!! :frowning_face:

There’s no spdif_tx on Rock 5B.

From the schematics it looks like spdif_tx1 is available on GPIO pin 31, try using that as your overlay target.

1 Like

Thanks, good spot! I didn’t notice that from the GPIO schematic

That get is to boot with the striped back version but the optical transmitter still stays dark, like the pin is being pulled low.

Trying the same fix with the fill version and the board fails to boot, so something is not right in it and at the same time I think something else is needed to enable SPDIF.

So a bit of progress but still no solution…

GPIO and SPDIF tranmsitter appear to be working

rock@rock-5b:~$ gpiofind PIN_31
gpiochip1 15
rock@rock-5b:~$ gpioset -m signal gpiochip1 15=1
rock@rock-5b:~$ gpioset -m signal gpiochip1 15=0

toggles the transmitter on and then off again

rock@rock-5b:~$ lsmod |grep spdif
snd_soc_rockchip_spdif    16384  2
snd_soc_core          172032  9 snd_soc_rockchip_i2s_tdm,snd_soc_hdmi_codec,snd_soc_rockchip_spdif,snd_soc_rockchip_multicodecs,snd_soc_simple_card_utils,snd_soc_dummy_codec,snd_soc_simple_card,snd_soc_es8316,snd_soc_rockchip_hdmi
snd_pcm                94208  6 snd_soc_rockchip_i2s_tdm,snd_usb_audio,snd_soc_hdmi_codec,snd_soc_rockchip_spdif,snd_soc_core,snd_pcm_dmaengine
2 Likes

Could you point me towards the schematics where you found that please?

Thanks.

A bit later, yet - typically all schematics and datasheets are at https://dl.radxa.com/