Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4501082rwl; Mon, 3 Apr 2023 06:03:10 -0700 (PDT) X-Google-Smtp-Source: AKy350arI8l6SuBw9ADZ6DyHHWuW8352PJpUdFMUBnCndGiNDcJA3erV5iKRCi3uSo5cayUpu+Fy X-Received: by 2002:a17:90b:4a8b:b0:237:99b9:c415 with SMTP id lp11-20020a17090b4a8b00b0023799b9c415mr40377104pjb.38.1680526990101; Mon, 03 Apr 2023 06:03:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680526990; cv=none; d=google.com; s=arc-20160816; b=Xpy2PS8i/AsromBmnXxHXsxL+eNZdHAenPvMhf+byB7eyhmuKD7JZqaBrVMrfv711e wcTy+L4/cfIj88SbbB880OpCgGsFCUunkRNW/g2d6Cgk92PO9XA+iyoS8xINIPAPubcY KxiRdcid0xe6s/x4oVVho4HE4fe5x6ujNEz0UYk2NwoiAFTnybKWH5KnFmU2wrvPMigl DgYwV8Yz3EcoE8+VYWw+qol12v5/+Ms81x5FhCha4EZIugYR3mnOgpxNrcXPkfwom817 9R+/IMhLknmR0qy+tINQUaSX03gyVa/VeqfiUbrVVFmTxHZT9mNNkqM3T5AAOYIP9sZf V9qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=uyE7wh+vkdoS/mjZYQz2ZQcKv+b9ibvjwUrmRBC90uU=; b=TLmWql+gQGJC8w2UuYiqSh79+iEf6lTcdY8CzRHzMCZ0ACurSZD61MtImcnDQ6T+nc zAiG3Cm7FnbRb9YBS8NQ+FKKxHXxxE4XMZw0DYSmHrrg7qFP2f8nxsWTMzy3W+O8M3X/ EbZA/NkUBatzJ0Dj2icRSW994RdnwB1dv0JVvdAu11hcvM7oUlPGMWepEmqU1WDdDCsh aXqJwoZf5Uww8xmiTaJukvziVypkfncEMDyTTrj1IQKj8dx4WBv2mFt5a5Wm8tJqLZYm CKRkN1WIuiajIsBzh9HHWSehrVudUwYAj2nfyWhIu9OYX3x0pAdBjSGbUps46CJhfymf mnfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 11-20020a63030b000000b004fb97a4c536si8143421pgd.873.2023.04.03.06.02.41; Mon, 03 Apr 2023 06:03:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231826AbjDCM7E (ORCPT + 99 others); Mon, 3 Apr 2023 08:59:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231514AbjDCM7D (ORCPT ); Mon, 3 Apr 2023 08:59:03 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1797B3A9B; Mon, 3 Apr 2023 05:58:59 -0700 (PDT) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 2625724E094; Mon, 3 Apr 2023 20:58:56 +0800 (CST) Received: from EXMBX168.cuchost.com (172.16.6.78) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 3 Apr 2023 20:58:56 +0800 Received: from [192.168.125.145] (183.27.97.179) by EXMBX168.cuchost.com (172.16.6.78) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 3 Apr 2023 20:58:55 +0800 Message-ID: <693c38f8-6aec-dd50-94a0-65300b6ed1b2@starfivetech.com> Date: Mon, 3 Apr 2023 20:58:54 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v1 3/3] riscv: dts: starfive: add tdm node and sound card Content-Language: en-US To: Krzysztof Kozlowski , Jaroslav Kysela , Takashi Iwai , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Emil Renner Berthing CC: , , , References: <20230329153320.31390-1-walker.chen@starfivetech.com> <20230329153320.31390-4-walker.chen@starfivetech.com> From: Walker Chen In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [183.27.97.179] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX168.cuchost.com (172.16.6.78) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.3 required=5.0 tests=NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/3/30 15:43, Krzysztof Kozlowski wrote: > On 29/03/2023 17:33, Walker Chen wrote: >> Add the tdm controller node and sound card for the StarFive JH7110 SoC. >> >> Signed-off-by: Walker Chen >> --- >> .../jh7110-starfive-visionfive-2.dtsi | 87 +++++++++++++++++++ >> arch/riscv/boot/dts/starfive/jh7110.dtsi | 34 ++++++++ >> 2 files changed, 121 insertions(+) >> >> diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi >> index 1155b97b593d..35137c2edf5d 100644 >> --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi >> +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi >> @@ -62,6 +62,10 @@ >> clock-frequency = <297000000>; >> }; >> >> +&wm8960_mclk { >> + clock-frequency = <24576000>; >> +}; >> + >> &i2srx_bclk_ext { >> clock-frequency = <12288000>; >> }; >> @@ -102,6 +106,14 @@ >> pinctrl-names = "default"; >> pinctrl-0 = <&i2c0_pins>; >> status = "okay"; >> + >> + wm8960: codec@1a { >> + compatible = "wlf,wm8960"; >> + reg = <0x1a>; >> + #sound-dai-cells = <0>; >> + >> + wlf,shared-lrclk; >> + }; >> }; >> >> &i2c2 { >> @@ -214,6 +226,40 @@ >> slew-rate = <0>; >> }; >> }; >> + >> + tdm0_pins: tdm0-pins { >> + tdm0-pins-tx { >> + pinmux = > + GPOEN_ENABLE, >> + GPI_NONE)>; >> + bias-pull-up; >> + drive-strength = <2>; >> + input-disable; >> + input-schmitt-disable; >> + slew-rate = <0>; >> + }; >> + >> + tdm0-pins-rx { >> + pinmux = > + GPOEN_DISABLE, >> + GPI_SYS_TDM_RXD)>; >> + input-enable; >> + }; >> + >> + tdm0-pins-sync { >> + pinmux = > + GPOEN_DISABLE, >> + GPI_SYS_TDM_SYNC)>; >> + input-enable; >> + }; >> + >> + tdm0-pins-pcmclk { >> + pinmux = > + GPOEN_DISABLE, >> + GPI_SYS_TDM_CLK)>; >> + input-enable; >> + }; >> + }; >> }; >> >> &uart0 { >> @@ -221,3 +267,44 @@ >> pinctrl-0 = <&uart0_pins>; >> status = "okay"; >> }; >> + >> +&tdm { >> + pinctrl-names = "default"; >> + pinctrl-0 = <&tdm0_pins>; >> + status = "okay"; >> +}; >> + >> +&sound0 { >> + simple-audio-card,dai-link@0 { >> + reg = <0>; >> + status = "okay"; > > Why? Drop. Will drop it. > >> + format = "dsp_a"; >> + bitclock-master = <&dailink_master>; >> + frame-master = <&dailink_master>; >> + >> + widgets = > > Drop line break. OK, will drop it. > >> + "Microphone", "Mic Jack", >> + "Line", "Line In", >> + "Line", "Line Out", >> + "Speaker", "Speaker", >> + "Headphone", "Headphone Jack"; >> + routing = > > Drop unnecessary line break. OK, will drop it. > >> + "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 = <&tdm>; >> + }; >> + >> + dailink_master:codec { > > Missing space after label:. Will be fixed. > >> + sound-dai = <&wm8960>; >> + clocks = <&wm8960_mclk>; >> + clock-names = "mclk"; >> + }; >> + }; >> +}; >> diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi >> index b503b6137743..a89158d1d7a6 100644 >> --- a/arch/riscv/boot/dts/starfive/jh7110.dtsi >> +++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi >> @@ -210,6 +210,12 @@ >> #clock-cells = <0>; >> }; >> >> + wm8960_mclk: wm8960_mclk { > > No underscores in node names. Use consistent naming - do you see here > any nodes named "mclk"? > > Anyway this is some fake clock. Real clock should come out from wm8960. Thank you for pointing out this, it will be fixed. > >> + compatible = "fixed-clock"; >> + clock-output-names = "wm8960_mclk"; >> + #clock-cells = <0>; >> + }; >> + >> i2srx_bclk_ext: i2srx-bclk-ext-clock { >> compatible = "fixed-clock"; >> clock-output-names = "i2srx_bclk_ext"; >> @@ -375,6 +381,27 @@ >> status = "disabled"; >> }; >> >> + tdm: tdm@10090000 { >> + compatible = "starfive,jh7110-tdm"; >> + reg = <0x0 0x10090000 0x0 0x1000>; >> + clocks = <&syscrg JH7110_SYSCLK_TDM_AHB>, >> + <&syscrg JH7110_SYSCLK_TDM_APB>, >> + <&syscrg JH7110_SYSCLK_TDM_INTERNAL>, >> + <&syscrg JH7110_SYSCLK_TDM_TDM>, >> + <&syscrg JH7110_SYSCLK_MCLK_INNER>, >> + <&tdm_ext>; >> + clock-names = "tdm_ahb", "tdm_apb", >> + "tdm_internal", "tdm", >> + "mclk_inner", "tdm_ext"; >> + resets = <&syscrg JH7110_SYSRST_TDM_AHB>, >> + <&syscrg JH7110_SYSRST_TDM_APB>, >> + <&syscrg JH7110_SYSRST_TDM_CORE>; >> + dmas = <&dma 20>, <&dma 21>; >> + dma-names = "rx","tx"; >> + #sound-dai-cells = <0>; >> + status = "disabled"; >> + }; >> + >> stgcrg: clock-controller@10230000 { >> compatible = "starfive,jh7110-stgcrg"; >> reg = <0x0 0x10230000 0x0 0x10000>; >> @@ -601,5 +628,12 @@ >> #reset-cells = <1>; >> power-domains = <&pwrc JH7110_PD_VOUT>; >> }; >> + >> + sound0: snd-card0 { > > 1. Why card0? There are several audio interfaces in JH7110 SoC, each as an independent sound card. TDM is for snd-card0, latter i2s will be for snd-card1, spdif will be for snd-card2, etc. > 2. Where is this node located? In MMIO bus? Run some basic checks on > your DTS before submitting upstream. > dtbs_check > dtbs W=1 > > 3. Why this is even in the DTSI? This really looks wrong. It seems that the sound node should be located in DTS file more appropriately. Best regards, Walker