[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aWl5fZKayAHmoES4@inochi.infowork>
Date: Fri, 16 Jan 2026 07:35:13 +0800
From: Inochi Amaoto <inochiama@...il.com>
To: "Anton D. Stavinskii" <stavinsky@...il.com>,
Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
Chen Wang <unicorn_wang@...look.com>, Inochi Amaoto <inochiama@...il.com>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>, Paul Walmsley <pjw@...nel.org>,
Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>,
Alexandre Ghiti <alex@...ti.fr>
Cc: linux-sound@...r.kernel.org, devicetree@...r.kernel.org,
sophgo@...ts.linux.dev, linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org
Subject: Re: [PATCH 8/8] riscv: dts: sophgo: add Milk-V Duo 256M board dts
On Thu, Jan 15, 2026 at 11:17:45PM +0400, Anton D. Stavinskii wrote:
> Example of usage internal dac/adc and external I2S mic
> The example shows how to use the card and
> will actually work other boards.
> Fixed clocks needed to make simple card make
> initial .set_sysclk with proper clock rates.
> Same for DAC. I2S3 has to be started not only
> for DAC but for the ADC also because it
> provides mclk for both.
>
> dai-link@2 will only work if registers
> are set according to this issue
> https://github.com/sophgo/sophgo-doc/issues/174#event-21395297524
> in other case i2s2 will not output clocks and data.
> Those changes are not connected to the driver itself,
> but for another subsystem which is not yet ipmlemented.
> The following config properly works for MilkV Duo/256Mm, Module.
> Basically everything with sg2000/sg2002 but on some boards
> i2s2 output pins are soldered to Ethernet module.
> In Milk 256M they are free to use as external DAC/ADC.
>
> Signed-off-by: Anton D. Stavinskii <stavinsky@...il.com>
> ---
> arch/riscv/boot/dts/sophgo/Makefile | 1 +
> .../boot/dts/sophgo/sg2002-milkv-duo-256m.dts | 231 +++++++++++++++++++++
> 2 files changed, 232 insertions(+)
>
> diff --git a/arch/riscv/boot/dts/sophgo/Makefile b/arch/riscv/boot/dts/sophgo/Makefile
> index 6f65526d4193..c8901ff680cb 100644
> --- a/arch/riscv/boot/dts/sophgo/Makefile
> +++ b/arch/riscv/boot/dts/sophgo/Makefile
> @@ -6,3 +6,4 @@ dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
> dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-evb-v1.dtb
> dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-evb-v2.dtb
> dtb-$(CONFIG_ARCH_SOPHGO) += sg2044-sophgo-srd3-10.dtb
> +dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-milkv-duo-256m.dtb
> diff --git a/arch/riscv/boot/dts/sophgo/sg2002-milkv-duo-256m.dts b/arch/riscv/boot/dts/sophgo/sg2002-milkv-duo-256m.dts
> new file mode 100644
> index 000000000000..cc33c4355969
> --- /dev/null
> +++ b/arch/riscv/boot/dts/sophgo/sg2002-milkv-duo-256m.dts
> @@ -0,0 +1,231 @@
> +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
> +/*
> + * Copyright (C) 2024 Thomas Bonnefille <thomas.bonnefille@...tlin.com>
> + */
> +
> +/dts-v1/;
> +
> +#include "sg2002.dtsi"
> +
> +/ {
> + model = "Milk-V duo 256M";
> + compatible = "milkv,duo-256m",
> + "sipeed,licheerv-nano",
> + "sophgo,sg2002";
> +
> + aliases {
> + gpio0 = &gpio0;
> + gpio1 = &gpio1;
> + gpio2 = &gpio2;
> + gpio3 = &gpio3;
> + serial0 = &uart0;
> + serial1 = &uart1;
> + serial2 = &uart2;
> + serial3 = &uart3;
> + serial4 = &uart4;
> + };
> +
> + chosen {
> + stdout-path = "serial0:115200n8";
> + };
> +};
> +
> +&osc {
> + clock-frequency = <25000000>;
> +};
> +
> +&pinctrl {
> + uart0_cfg: uart0-cfg {
> + uart0-pins {
> + pinmux = <PINMUX(PIN_UART0_TX, 0)>,
> + <PINMUX(PIN_UART0_RX, 0)>;
> + bias-pull-up;
> + drive-strength-microamp = <10800>;
> + power-source = <3300>;
> + };
> + };
> +
> + sdhci0_cfg: sdhci0-cfg {
> + sdhci0-clk-pins {
> + pinmux = <PINMUX(PIN_SD0_CLK, 0)>;
> + bias-pull-up;
> + drive-strength-microamp = <16100>;
> + power-source = <3300>;
> + };
> +
> + sdhci0-cmd-pins {
> + pinmux = <PINMUX(PIN_SD0_CMD, 0)>;
> + bias-pull-up;
> + drive-strength-microamp = <10800>;
> + power-source = <3300>;
> + };
> +
> + sdhci0-data-pins {
> + pinmux = <PINMUX(PIN_SD0_D0, 0)>,
> + <PINMUX(PIN_SD0_D1, 0)>,
> + <PINMUX(PIN_SD0_D2, 0)>,
> + <PINMUX(PIN_SD0_D3, 0)>;
> + bias-pull-up;
> + drive-strength-microamp = <10800>;
> + power-source = <3300>;
> + };
> +
> + sdhci0-cd-pins {
> + pinmux = <PINMUX(PIN_SD0_CD, 0)>;
> + bias-pull-up;
> + drive-strength-microamp = <10800>;
> + power-source = <3300>;
> + };
> + };
> +};
> +
> +&sdhci0 {
> + pinctrl-0 = <&sdhci0_cfg>;
> + pinctrl-names = "default";
> + status = "okay";
> + bus-width = <4>;
> + no-1-8-v;
> + no-mmc;
> + no-sdio;
> + disable-wp;
> +};
> +
> +&usb {
> + dr_mode = "peripheral";
> + status = "okay";
> + g-rx-fifo-size = <1536>;
> + g-tx-fifo-size = <128 128 64 64 64 64 32 32>;
> +};
> +
> +&uart0 {
> + pinctrl-0 = <&uart0_cfg>;
> + pinctrl-names = "default";
> + status = "okay";
> +};
> +
> +&dmac {
> + status = "okay";
> +};
> +
> +&dmamux {
> + status = "okay";
> +};
> +
> +&pinctrl {
> + i2s2_cfg: i2s2-cfg {
> + i2s2-out-pins {
> + pinmux = <PINMUX(PIN_ETH_TXM, 7)>,
> + <PINMUX(PIN_ETH_RXP, 7)>,
> + <PINMUX(PIN_ETH_RXM, 7)>;
> +
> + drive-strength-microamp = <15700>;
> + power-source = <1800>;
> + };
> +
> + i2s2-in-pins {
> + pinmux = <PINMUX(PIN_ETH_TXP, 7)>;
> + power-source = <1800>;
> + };
> + };
> +};
> +
> +&i2s0 {
> + #sound-dai-cells = <0>;
> + status = "okay";
> +};
> +
> +&i2s2 {
> + pinctrl-0 = <&i2s2_cfg>;
> + pinctrl-names = "default";
> + #sound-dai-cells = <0>;
> + status = "okay";
> +};
> +
> +&i2s3 {
> + #sound-dai-cells = <0>;
> + status = "okay";
> +};
> +
> +/ {
> + int_adc: codec@...a100 {
> + compatible = "sophgo,cv1800b-sound-adc";
> + #sound-dai-cells = <0>;
> + reg = <0x300a100 0x100>;
> + };
> +
> + int_dac: codec@...a000 {
> + compatible = "sophgo,cv1800b-sound-dac";
> + #sound-dai-cells = <0>;
> + reg = <0x300a000 0x100>;
> + };
> +
Move these two nodes into cv180x.dtsi, others are not allowed
in this patch series, use a separate patch instead.
Regards,
Inochi
> + ext_adc: my-ext-adc {
> + compatible = "invensense,ics43432";
> + #sound-dai-cells = <0>;
> + };
> +
> + sound {
> + compatible = "simple-audio-card";
> + simple-audio-card,name = "cv1800b card";
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + simple-audio-card,dai-link@0 {
> + reg = <0>;
> + format = "i2s";
> + bitclock-master = <&clock_master0>;
> + frame-master = <&clock_master0>;
> +
> + codec {
> + sound-dai = <&int_dac>;
> + };
> +
> + clock_master0: cpu {
> + system-clock-frequency = <12288000>;
> + system-clock-fixed;
> + system-clock-direction-out;
> + mclk-fs = <256>;
> + sound-dai = <&i2s3>;
> + };
> + };
> +
> + simple-audio-card,dai-link@1 {
> + reg = <1>;
> + format = "i2s";
> + bitclock-master = <&clock_master1>;
> + frame-master = <&clock_master1>;
> +
> + clock_master1: codec {
> + mclk-fs = <256>;
> + system-clock-frequency = <12288000>;
> + system-clock-fixed;
> + sound-dai = <&int_adc>;
> + };
> +
> + cpu {
> + mclk-fs = <256>;
> + system-clock-frequency = <12288000>;
> + system-clock-fixed;
> + sound-dai = <&i2s0>;
> + };
> + };
> +
> + simple-audio-card,dai-link@2 {
> + reg = <2>;
> + format = "i2s";
> + bitclock-master = <&clock_master2>;
> + frame-master = <&clock_master2>;
> +
> + codec {
> + sound-dai = <&ext_adc>;
> + };
> +
> + clock_master2: cpu {
> + mclk-fs = <256>;
> + system-clock-frequency = <12288000>;
> + system-clock-fixed;
> + sound-dai = <&i2s2>;
> + };
> + };
> + };
> +};
>
> --
> 2.43.0
>
Powered by blists - more mailing lists