From patchwork Fri Dec 2 15:20:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 630277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3146AC47089 for ; Fri, 2 Dec 2022 15:21:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233633AbiLBPVJ (ORCPT ); Fri, 2 Dec 2022 10:21:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233403AbiLBPVI (ORCPT ); Fri, 2 Dec 2022 10:21:08 -0500 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 586FED7564 for ; Fri, 2 Dec 2022 07:21:05 -0800 (PST) Received: by mail-lj1-x232.google.com with SMTP id r8so5744456ljn.8 for ; Fri, 02 Dec 2022 07:21:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YtADheyzSobQIPviq949CSNca1T2vQHvcCays+05YB0=; b=iOAFT0X1Be+Ghft0XScvfJNzUfa1WgFHNCLats84aF4kDok6Roi5EKr3nFCQvvZ2kT 7DLLrZ1YS07KgkzRjwokT/a1K+1Xo4z8EIECfuuzgfk68t6WQO5NbUghN03TRVNE82qB jwtBrWRrxxsas2nQ3kFDGb7UevWmFVq/8I59pbHX9DFAOEdek75utiS9RfcH4DvzIMso aCpxNB9OWtJd0OZyFegfq5B4/27mGQhzqW9t1VaSxF/diPehLyopfP0c/BbsJGQbE7fU oaaYjnPd3eJFDiOLzarfpex9VBDMhNgBheYAOdM+xUqN8xsFNDBXDO4wtvpv+kg6bWC5 zHOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YtADheyzSobQIPviq949CSNca1T2vQHvcCays+05YB0=; b=eBu4HvKcr3qkToK+vM96jgb+ZnctRqmzAbvyFI3XoRGuFauFA6/kgeHBmz0IdMqZR9 PHsaa5c9dqJdxTB+JG4LFbKAzIh+WPXf8FCEsJpnJfF8eVUQwjgonr2wIt+/NC9cXKXU sQj3LXWtAFeiTu4bIoI5pBME1IYzVjKLmJ3M80tIbuhVyE9WvT7Zix86H8Lx3LkjcZmU CCDkFTlML3Ejag1R8Lzf0Npca2YQhwVX+o+xza8F2RKocmU/qKCKVVwwDbmP2ScuBonG JT4X2+9QcRpi+6l55hdwUotvhvXhfn/QseLWD/XexPKUyQUjxFVZPsQBuFajY/3mBJcp za8g== X-Gm-Message-State: ANoB5pnKeCowVOxKBJ3/MtdAohkv9ggGfrBJgdrmkiHreuvkCJQNtCUR YsuKg5B05XqNLw7Lc6c2DmUZRg== X-Google-Smtp-Source: AA0mqf4h9oDY5iFKfsFQUQo0BE32krDUmF5AZOm3+bD189OYojj6f2zrPS+gtAxod3Zb7SSBtIp2EA== X-Received: by 2002:a2e:9589:0:b0:277:7c00:e12b with SMTP id w9-20020a2e9589000000b002777c00e12bmr19414919ljh.431.1669994463682; Fri, 02 Dec 2022 07:21:03 -0800 (PST) Received: from krzk-bin.NAT.warszawa.vectranet.pl (088156142067.dynamic-2-waw-k-3-2-0.vectranet.pl. [88.156.142.67]) by smtp.gmail.com with ESMTPSA id l16-20020ac24310000000b00498f871f33fsm1043273lfh.86.2022.12.02.07.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 07:21:03 -0800 (PST) From: Krzysztof Kozlowski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Srinivas Kandagatla , Krzysztof Kozlowski Subject: [PATCH v6 3/3] arm64: dts: qcom: sm8450-hdk: add sound support Date: Fri, 2 Dec 2022 16:20:54 +0100 Message-Id: <20221202152054.357316-4-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221202152054.357316-1-krzysztof.kozlowski@linaro.org> References: <20221202152054.357316-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Srinivas Kandagatla Add sound support to SM8450 HDK board. Tested setup so far is only two speakers (working) and head-phones (only one channel working). Signed-off-by: Srinivas Kandagatla Co-developed-by: Krzysztof Kozlowski Signed-off-by: Krzysztof Kozlowski Reviewed-by: Konrad Dybcio --- Changes since v5: 1. Use TX_CODEC_DMA_TX_3 for VA capture. 2. Reverse order of speakers (left/right). 3. Drop duplicated wcd-playback-dai-link and add wcd-capture-dai-link. Changes since v3: 1. None. Changes since v2: 1. Use ACTIVE_LOW for qcom,wcd9380-codec reset-gpios. https://lore.kernel.org/all/20221116053817.2929810-11-dmitry.torokhov@gmail.com/ Changes since v1: 1. Sort. 2. Correct include - do not use deprecated one and drop q6asm.h (not used). --- arch/arm64/boot/dts/qcom/sm8450-hdk.dts | 186 ++++++++++++++++++++++++ 1 file changed, 186 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8450-hdk.dts b/arch/arm64/boot/dts/qcom/sm8450-hdk.dts index 4d75f9db08c2..9d1070e193d2 100644 --- a/arch/arm64/boot/dts/qcom/sm8450-hdk.dts +++ b/arch/arm64/boot/dts/qcom/sm8450-hdk.dts @@ -6,6 +6,7 @@ /dts-v1/; #include +#include #include "sm8450.dtsi" / { @@ -406,6 +407,160 @@ &sdhc_2 { status = "okay"; }; +&soc { + wcd938x: codec { + compatible = "qcom,wcd9380-codec"; + + pinctrl-names = "default"; + pinctrl-0 = <&wcd_default>; + + qcom,micbias1-microvolt = <1800000>; + qcom,micbias2-microvolt = <1800000>; + qcom,micbias3-microvolt = <1800000>; + qcom,micbias4-microvolt = <1800000>; + qcom,mbhc-buttons-vthreshold-microvolt = <75000 150000 237000 500000 500000 500000 500000 500000>; + qcom,mbhc-headset-vthreshold-microvolt = <1700000>; + qcom,mbhc-headphone-vthreshold-microvolt = <50000>; + qcom,rx-device = <&wcd_rx>; + qcom,tx-device = <&wcd_tx>; + + reset-gpios = <&tlmm 43 GPIO_ACTIVE_LOW>; + #sound-dai-cells = <1>; + + vdd-buck-supply = <&vreg_s10b_1p8>; + vdd-rxtx-supply = <&vreg_s10b_1p8>; + vdd-io-supply = <&vreg_s10b_1p8>; + vdd-mic-bias-supply = <&vreg_bob>; + }; +}; + +&sound { + compatible = "qcom,sm8450-sndcard"; + model = "SM8450-HDK"; + audio-routing = "SpkrLeft IN", "WSA_SPK1 OUT", + "SpkrRight IN", "WSA_SPK2 OUT", + "IN1_HPHL", "HPHL_OUT", + "IN2_HPHR", "HPHR_OUT", + "AMIC2", "MIC BIAS2", + "VA DMIC0", "MIC BIAS1", + "VA DMIC1", "MIC BIAS1", + "VA DMIC2", "MIC BIAS3", + "TX DMIC0", "MIC BIAS1", + "TX DMIC1", "MIC BIAS2", + "TX DMIC2", "MIC BIAS3", + "TX SWR_ADC1", "ADC2_OUTPUT"; + + wcd-playback-dai-link { + link-name = "WCD Playback"; + + cpu { + sound-dai = <&q6apmbedai RX_CODEC_DMA_RX_0>; + }; + + codec { + sound-dai = <&wcd938x 0>, <&swr1 0>, <&rxmacro 0>; + }; + + platform { + sound-dai = <&q6apm>; + }; + }; + + wcd-capture-dai-link { + link-name = "WCD Capture"; + + cpu { + sound-dai = <&q6apmbedai TX_CODEC_DMA_TX_3>; + }; + + codec { + sound-dai = <&wcd938x 1>, <&swr2 0>, <&txmacro 0>; + }; + + platform { + sound-dai = <&q6apm>; + }; + }; + + wsa-dai-link { + link-name = "WSA Playback"; + + cpu { + sound-dai = <&q6apmbedai WSA_CODEC_DMA_RX_0>; + }; + + codec { + sound-dai = <&left_spkr>, <&right_spkr>, <&swr0 0>, <&wsamacro 0>; + }; + + platform { + sound-dai = <&q6apm>; + }; + }; + + va-dai-link { + link-name = "VA Capture"; + + cpu { + sound-dai = <&q6apmbedai TX_CODEC_DMA_TX_3>; + }; + + codec { + sound-dai = <&vamacro 0>; + }; + + platform { + sound-dai = <&q6apm>; + }; + }; +}; + +&swr0 { + left_spkr: speaker@0,1 { + compatible = "sdw10217020200"; + reg = <0 1>; + pinctrl-names = "default"; + pinctrl-0 = <&spkr_1_sd_n_active>; + powerdown-gpios = <&tlmm 1 GPIO_ACTIVE_LOW>; + #sound-dai-cells = <0>; + sound-name-prefix = "SpkrLeft"; + #thermal-sensor-cells = <0>; + vdd-supply = <&vreg_s10b_1p8>; + }; + + right_spkr: speaker@0,2 { + compatible = "sdw10217020200"; + reg = <0 2>; + pinctrl-names = "default"; + pinctrl-0 = <&spkr_2_sd_n_active>; + powerdown-gpios = <&tlmm 89 GPIO_ACTIVE_LOW>; + #sound-dai-cells = <0>; + sound-name-prefix = "SpkrRight"; + #thermal-sensor-cells = <0>; + vdd-supply = <&vreg_s10b_1p8>; + }; +}; + +&swr1 { + status = "okay"; + + wcd_rx: codec@0,4 { + compatible = "sdw20217010d00"; + reg = <0 4>; + qcom,rx-port-mapping = <1 2 3 4 5>; + }; +}; + +&swr2 { + status = "okay"; + + wcd_tx: codec@0,3 { + compatible = "sdw20217010d00"; + reg = <0 3>; + qcom,tx-port-mapping = <1 1 2 3>; + }; +}; + &tlmm { gpio-reserved-ranges = <28 4>, <36 4>; @@ -461,3 +616,34 @@ &usb_1_qmpphy { vdda-phy-supply = <&vreg_l6b_1p2>; vdda-pll-supply = <&vreg_l1b_0p91>; }; + +&vamacro { + pinctrl-0 = <&dmic01_default>, <&dmic02_default>; + pinctrl-names = "default"; + vdd-micb-supply = <&vreg_s10b_1p8>; + qcom,dmic-sample-rate = <600000>; +}; + +&tlmm { + spkr_1_sd_n_active: spkr-1-sd-n-active-state { + pins = "gpio1"; + function = "gpio"; + drive-strength = <4>; + bias-disable; + output-low; + }; + + spkr_2_sd_n_active: spkr-2-sd-n-active-state { + pins = "gpio89"; + function = "gpio"; + drive-strength = <4>; + bias-disable; + output-low; + }; + + wcd_default: wcd-default-state { + pins = "gpio43"; + function = "gpio"; + bias-disable; + }; +};