VisionFive 2 Board Level Configuration

wm8960 Codec

The file jh7110-visionfive-v2-wm8960.dts stores the wm8960 codec.

For example, the board-level configuration for VisionFive 2 SBC is listed in the following code block:
/freelight-u-sdk/linux/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2-wm8960.dts
/freelight-u-sdk/linux/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2-ac108.dts
/freelight-u-sdk/linux/arch/riscv/boot/dts/starfive/codecs/sf_wm8960.dtsi
Note: The codecs file sf_wm8960.dtsi is used for sound card configuration.
Use the following configuration to connect wm8960 as the external sound card.
&sound{
        /* i2s + wm8960 */	
        simple-audio-card,dai-link@1 {
                reg = <0>;
                status = "okay";
                format = "i2s";
                bitclock-master = <&sndcodec1>;
                frame-master = <&sndcodec1>;

                widgets =
                                "Microphone", "Mic Jack",
                                "Line", "Line In",
                                "Line", "Line Out",
                                "Speaker", "Speaker",
                                "Headphone", "Headphone Jack";
                routing =
                                "Headphone Jack", "HP_L",
                                "Headphone Jack", "HP_R",
                                "Speaker", "SPK_LP",
                                "Speaker", "SPK_LN",
                                "LINPUT1", "Mic Jack",
                                "LINPUT3", "Mic Jack",
                                "RINPUT1", "Mic Jack",
                                "RINPUT2", "Mic Jack";
                cpu0 {
                        sound-dai = <&i2srx_3ch>;
                };
                cpu1 {
                        sound-dai = <&i2stx_4ch1>;
                };

                sndcodec1:codec {
                        sound-dai = <&wm8960>;
                        clocks = <&wm8960_mclk>;
                        clock-names = "mclk";
                };
        };
};

ac108 Codec

The jh7110-visionfive-v2-ac108.dts file stores the ac108 codec.

For example, the board-level configuration for VisionFive 2 is listed in the following code block:
/freelight-u-sdk/linux/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2-wm8960.dts
/freelight-u-sdk/linux/arch/riscv/boot/dts/starfive/jh7110-visionfive-v2-ac108.dts
/freelight-u-sdk/linux/arch/riscv/boot/dts/starfive/codecs/sf_ac108.dtsi
Note: The codecs file sf_ac108.dtsi is used for sound card configuration.
Use the following configuration to connect ac108 as the external sound card.
&sound {
        /* i2s + ac108 */
        simple-audio-card,dai-link@0 {
                reg = <0>;
                format = "i2s";
                bitclock-master = <&sndcodec1>;
                frame-master = <&sndcodec1>;

                widgets =
                                "Microphone", "Mic Jack",
                                "Line", "Line In",
                                "Line", "Line Out",
                                "Speaker", "Speaker",
                                "Headphone", "Headphone Jack";
                routing =
                                "Headphone Jack", "HP_L",
                                "Headphone Jack", "HP_R",
                                "Speaker", "SPK_LP",
                                "Speaker", "SPK_LN",
                                "LINPUT1", "Mic Jack",
                                "LINPUT3", "Mic Jack",
                                "RINPUT1", "Mic Jack",
                                "RINPUT2", "Mic Jack";

                cpu {
                        sound-dai = <&i2srx_3ch>;
                };
                sndcodec1: codec {
                        sound-dai = <&ac108_a>;
                        clocks = <&ac108_mclk>;
                        clock-names = "mclk";
                };
        };
};