public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Inochi Amaoto <inochiama@gmail.com>
To: "Anton D. Stavinskii" <stavinsky@gmail.com>,
	 Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	 Chen Wang <unicorn_wang@outlook.com>,
	Inochi Amaoto <inochiama@gmail.com>,
	 Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Paul Walmsley <pjw@kernel.org>,
	 Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	 Alexandre Ghiti <alex@ghiti.fr>
Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	 sophgo@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org
Subject: Re: [PATCH 8/8] riscv: dts: sophgo: add Milk-V Duo 256M board dts
Date: Fri, 16 Jan 2026 07:35:13 +0800	[thread overview]
Message-ID: <aWl5fZKayAHmoES4@inochi.infowork> (raw)
In-Reply-To: <20260115-cv1800b-i2s-driver-v1-8-e8b22b8578ab@gmail.com>

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@gmail.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@bootlin.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@300a100 {
> +		compatible = "sophgo,cv1800b-sound-adc";
> +		#sound-dai-cells = <0>;
> +		reg = <0x300a100 0x100>;
> +	};
> +
> +	int_dac: codec@300a000 {
> +		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
> 

  reply	other threads:[~2026-01-16  1:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15 19:17 [PATCH 0/8] ASoC: sophgo: add CV1800 AIAO mux and I2S support Anton D. Stavinskii
2026-01-15 19:17 ` [PATCH 1/8] dt-bindings: sound: sophgo: add CV1800B I2S/TDM controller binding Anton D. Stavinskii
2026-01-21 16:32   ` Rob Herring
2026-01-21 16:52     ` Anton D. Stavinskii
2026-01-15 19:17 ` [PATCH 2/8] ASoC: sophgo: add CV1800B I2S/TDM controller driver Anton D. Stavinskii
2026-01-15 19:17 ` [PATCH 3/8] dt-bindings: sound: sophgo: add CV1800B internal ADC codec Anton D. Stavinskii
2026-01-15 19:17 ` [PATCH 4/8] ASoC: sophgo: add CV1800B internal ADC codec driver Anton D. Stavinskii
2026-01-15 19:17 ` [PATCH 5/8] dt-bindings: sound: sophgo: add CV1800B internal DAC codec Anton D. Stavinskii
2026-01-15 19:17 ` [PATCH 6/8] ASoC: sophgo: add CV1800B internal DAC codec driver Anton D. Stavinskii
2026-01-15 19:17 ` [PATCH 7/8] riscv: dts: sophgo: dts nodes for i2s tdm modules Anton D. Stavinskii
2026-01-15 19:17 ` [PATCH 8/8] riscv: dts: sophgo: add Milk-V Duo 256M board dts Anton D. Stavinskii
2026-01-15 23:35   ` Inochi Amaoto [this message]
2026-01-15 23:34 ` [PATCH 0/8] ASoC: sophgo: add CV1800 AIAO mux and I2S support Inochi Amaoto
2026-01-16 17:25   ` Anton D. Stavinskii
2026-01-17  0:29     ` Inochi Amaoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aWl5fZKayAHmoES4@inochi.infowork \
    --to=inochiama@gmail.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=perex@perex.cz \
    --cc=pjw@kernel.org \
    --cc=robh@kernel.org \
    --cc=sophgo@lists.linux.dev \
    --cc=stavinsky@gmail.com \
    --cc=tiwai@suse.com \
    --cc=unicorn_wang@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox