From nobody Mon Nov 25 16:39:18 2024 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8DB71662E4 for ; Fri, 25 Oct 2024 15:39:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729870750; cv=none; b=Sgen6g8DL9h+hZtmBtdfXgj0ySzWWnkLaS9EEUKMYG+YAZDqg20ZL+pMAZ2NCcg4nMRFZXfbbmsQ1s7AF4j0rY1dCW7iy7UmdwctDfdh0CNL2YCprAfvgnXtNEafK1c9mt0zpNl1xuuE/h3POEu+qWkbhUlCCAYCwu73d5PyXOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729870750; c=relaxed/simple; bh=EOvJ0D8TG78IMVWVRxSYtA0OQt6UgWwiQHkwPlaUOi0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=UQQouEXhiosN8gpB3+y401zQhWJZnJvqBVsi0WPBFkZnM7C7zC6KA8oIjGuYzPYtpUzjWTGFijlWHCC7jBQByvsX86EzRCeWQL+3OxLzqX1BqRVJSQchwb2oYqEbZasxtQCs6quOHzcdXpJk6o1gD42J2jpr/f1olHONqRxhFSk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=lQi4Pbwm; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lQi4Pbwm" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4315b957ae8so2731445e9.1 for ; Fri, 25 Oct 2024 08:39:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729870746; x=1730475546; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/kQLJ1WulOnKboXBM3Jz/ufmddrGHi57pVSzIXTz7Ok=; b=lQi4PbwmipohI5f+XXKLXAvg5KcR8dQm7A36A4uCHKzsVw5AoDXZS2VBkPjoo0qNf3 9WZwd6eLCvlb0sKdOFDr3WpBFAQ65ITKudk1rhB0LSIl+u2NlSfpWcyH3aW4TQDKBx3H XiUY54umrZeX4X+fJbmeWuBV6G/z8ivmDsZCyx66YZY7HERWWASMe/M0iZbZTA04jxc7 Kgh9x4M26EHqm/rGImMz6kNAc5Jf0jIWdBosBlzwUwovFhurKjG9j8Yisp9j4UPHV2tq yA4VKuqtKEbqGELDjAv7ySVRK86LTIht+wze81G5c919wW7Z7sRxkKABg1c9IvTPKmnd Tl5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729870746; x=1730475546; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/kQLJ1WulOnKboXBM3Jz/ufmddrGHi57pVSzIXTz7Ok=; b=Jyddt+e8aj4bSOaZHoOGUGNVnZHOtNOMueN5dexS2ivLLw6e07+Dukm3ei4At5SpJn oXTv9dtk6Ca41BzYJ19+LCXzlw4dIC9aDr8R4JYyH+TkMX6sAM8qywm+BPw2Sm6C4u9o VlOUWL04xqYchEzk/99qswZgwKPebxNpkjgZm5xX7ZfQ++SXzLfgSkcFYXuf1Xl9Owam Zt01nkYHGcH/P1EeXjpTljy/VWfwxPiYq75pXIQeavgq1t/46qy25KVfJJjdkIfnJvCb iW89f83o+TsjGd4vOxwcOfeiucYbgcpxcvQayJDfFiV9qFjm10zzz3Z7tqh65J6Upal6 L7aQ== X-Forwarded-Encrypted: i=1; AJvYcCUXAKYMxlKJ3jvagYNkRTVHWRLT65lRa2PI3KISfaEZzlX583eDr3YZn2bRmIDULDw3qdQy60tmtK/NgGo=@vger.kernel.org X-Gm-Message-State: AOJu0Ywm1DIujyjnJMFzdvDI5DaRTdGzHOsCUheBC3VDOVLXgFb2yBXf VXkfwqVgBnfU+Ms9yqvsCJyMU2UUFGImWPNyGYqbeZ9fcFTArb3Bf8zNiAnocrA= X-Google-Smtp-Source: AGHT+IHBTzIwTHTRLbojQmV6hikqVsR0ckenIkv4UnP+XvG0/HGaL7jpvZiuD0W1h/yM40GSudKt0g== X-Received: by 2002:a05:600c:4f91:b0:430:52ec:1e2a with SMTP id 5b1f17b1804b1-43194e37134mr8892645e9.7.1729870746133; Fri, 25 Oct 2024 08:39:06 -0700 (PDT) Received: from krzk-bin.. ([178.197.211.167]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b55f484sm51022355e9.13.2024.10.25.08.39.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 08:39:05 -0700 (PDT) From: Krzysztof Kozlowski To: Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Srinivas Kandagatla , Krzysztof Kozlowski , Abel Vesa , Johan Hovold Subject: [PATCH] arm64: dts: qcom: x1e78100-t14s: add sound support Date: Fri, 25 Oct 2024 17:39:01 +0200 Message-ID: <20241025153901.156891-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla Add support for audio on Lenovo T14s laptop, coming with two speakers, audio jack and two digital microphones. This is very early work, not yet complete: 1. 2x speakers: work OK. 2. 2x digital microphones: work OK. 3. Headset (audio jack) recording: does not work. 4. Headphones playback (audio jack): channels are intermixed. Signed-off-by: Srinivas Kandagatla [krzysztof: correct DMIC routing and vamacro pinctrl, re-order nodes, add commit msg] Co-developed-by: Krzysztof Kozlowski Signed-off-by: Krzysztof Kozlowski Reviewed-by: Konrad Dybcio --- 1. Audioreach topology was already pushed to main branch: https://github.com/linux-msm/audioreach-topology 2. ALSA UCM files are ready and soon will be pushed by Srini. Cc: Abel Vesa Cc: Johan Hovold --- .../qcom/x1e78100-lenovo-thinkpad-t14s.dts | 183 ++++++++++++++++++ 1 file changed, 183 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts b/a= rch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts index d078c76c6da5..7bc3756803d2 100644 --- a/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts +++ b/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts @@ -19,6 +19,32 @@ / { compatible =3D "lenovo,thinkpad-t14s", "qcom,x1e78100", "qcom,x1e80100"; chassis-type =3D "laptop"; =20 + wcd938x: audio-codec { + compatible =3D "qcom,wcd9385-codec"; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&wcd_default>; + + qcom,micbias1-microvolt =3D <1800000>; + qcom,micbias2-microvolt =3D <1800000>; + qcom,micbias3-microvolt =3D <1800000>; + qcom,micbias4-microvolt =3D <1800000>; + qcom,mbhc-buttons-vthreshold-microvolt =3D <75000 150000 237000 500000 5= 00000 500000 500000 500000>; + qcom,mbhc-headset-vthreshold-microvolt =3D <1700000>; + qcom,mbhc-headphone-vthreshold-microvolt =3D <50000>; + qcom,rx-device =3D <&wcd_rx>; + qcom,tx-device =3D <&wcd_tx>; + + reset-gpios =3D <&tlmm 191 GPIO_ACTIVE_LOW>; + + vdd-buck-supply =3D <&vreg_l15b_1p8>; + vdd-rxtx-supply =3D <&vreg_l15b_1p8>; + vdd-io-supply =3D <&vreg_l15b_1p8>; + vdd-mic-bias-supply =3D <&vreg_bob1>; + + #sound-dai-cells =3D <1>; + }; + gpio-keys { compatible =3D "gpio-keys"; =20 @@ -151,6 +177,85 @@ vph_pwr: regulator-vph-pwr { regulator-always-on; regulator-boot-on; }; + + sound { + compatible =3D "qcom,x1e80100-sndcard"; + model =3D "X1E80100-LENOVO-Thinkpad-T14s"; + audio-routing =3D "SpkrLeft IN", "WSA WSA_SPK1 OUT", + "SpkrRight IN", "WSA WSA_SPK2 OUT", + "IN1_HPHL", "HPHL_OUT", + "IN2_HPHR", "HPHR_OUT", + "AMIC2", "MIC BIAS2", + "VA DMIC0", "MIC BIAS1", + "VA DMIC1", "MIC BIAS1", + "VA DMIC0", "VA MIC BIAS1", + "VA DMIC1", "VA MIC BIAS1", + "TX SWR_INPUT1", "ADC2_OUTPUT"; + + wcd-playback-dai-link { + link-name =3D "WCD Playback"; + + cpu { + sound-dai =3D <&q6apmbedai RX_CODEC_DMA_RX_0>; + }; + + codec { + sound-dai =3D <&wcd938x 0>, <&swr1 0>, <&lpass_rxmacro 0>; + }; + + platform { + sound-dai =3D <&q6apm>; + }; + }; + + wcd-capture-dai-link { + link-name =3D "WCD Capture"; + + cpu { + sound-dai =3D <&q6apmbedai TX_CODEC_DMA_TX_3>; + }; + + codec { + sound-dai =3D <&wcd938x 1>, <&swr2 1>, <&lpass_txmacro 0>; + }; + + platform { + sound-dai =3D <&q6apm>; + }; + }; + + wsa-dai-link { + link-name =3D "WSA Playback"; + + cpu { + sound-dai =3D <&q6apmbedai WSA_CODEC_DMA_RX_0>; + }; + + codec { + sound-dai =3D <&left_spkr>, <&right_spkr>, <&swr0 0>, <&lpass_wsamacro= 0>; + }; + + platform { + sound-dai =3D <&q6apm>; + }; + }; + + va-dai-link { + link-name =3D "VA Capture"; + + cpu { + sound-dai =3D <&q6apmbedai VA_CODEC_DMA_TX_0>; + }; + + codec { + sound-dai =3D <&lpass_vamacro 0>; + }; + + platform { + sound-dai =3D <&q6apm>; + }; + }; + }; }; =20 &apps_rsc { @@ -183,6 +288,13 @@ vreg_bob2: bob2 { regulator-initial-mode =3D ; }; =20 + vreg_l1b_1p8: ldo1 { + regulator-name =3D "vreg_l1b_1p8"; + regulator-min-microvolt =3D <1800000>; + regulator-max-microvolt =3D <1800000>; + regulator-initial-mode =3D ; + }; + vreg_l2b_3p0: ldo2 { regulator-name =3D "vreg_l2b_3p0"; regulator-min-microvolt =3D <3072000>; @@ -513,6 +625,24 @@ touchscreen@10 { /* TODO: second-sourced touchscreen @ 0x41 */ }; =20 +&lpass_tlmm { + spkr_01_sd_n_active: spkr-01-sd-n-active-state { + pins =3D "gpio12"; + function =3D "gpio"; + drive-strength =3D <16>; + bias-disable; + output-low; + }; +}; + +&lpass_vamacro { + pinctrl-0 =3D <&dmic01_default>; + pinctrl-names =3D "default"; + + vdd-micb-supply =3D <&vreg_l1b_1p8>; + qcom,dmic-sample-rate =3D <4800000>; +}; + &mdss { status =3D "okay"; }; @@ -643,6 +773,59 @@ &smb2360_1_eusb2_repeater { vdd3-supply =3D <&vreg_l14b_3p0>; }; =20 +&swr0 { + status =3D "okay"; + + pinctrl-0 =3D <&wsa_swr_active>, <&spkr_01_sd_n_active>; + pinctrl-names =3D "default"; + + /* WSA8845, Left Speaker */ + left_spkr: speaker@0,0 { + compatible =3D "sdw20217020400"; + reg =3D <0 0>; + reset-gpios =3D <&lpass_tlmm 12 GPIO_ACTIVE_LOW>; + #sound-dai-cells =3D <0>; + sound-name-prefix =3D "SpkrLeft"; + vdd-1p8-supply =3D <&vreg_l15b_1p8>; + vdd-io-supply =3D <&vreg_l12b_1p2>; + qcom,port-mapping =3D <1 2 3 7 10 13>; + }; + + /* WSA8845, Right Speaker */ + right_spkr: speaker@0,1 { + compatible =3D "sdw20217020400"; + reg =3D <0 1>; + reset-gpios =3D <&lpass_tlmm 12 GPIO_ACTIVE_LOW>; + #sound-dai-cells =3D <0>; + sound-name-prefix =3D "SpkrRight"; + vdd-1p8-supply =3D <&vreg_l15b_1p8>; + vdd-io-supply =3D <&vreg_l12b_1p2>; + qcom,port-mapping =3D <4 5 6 7 11 13>; + }; +}; + +&swr1 { + status =3D "okay"; + + /* WCD9385 RX */ + wcd_rx: codec@0,4 { + compatible =3D "sdw20217010d00"; + reg =3D <0 4>; + qcom,rx-port-mapping =3D <1 2 3 4 5>; + }; +}; + +&swr2 { + status =3D "okay"; + + /* WCD9385 TX */ + wcd_tx: codec@0,3 { + compatible =3D "sdw20217010d00"; + reg =3D <0 3>; + qcom,tx-port-mapping =3D <2 2 3 4>; + }; +}; + &tlmm { gpio-reserved-ranges =3D <34 2>, /* Unused */ <44 4>, /* SPI (TPM) */ --=20 2.43.0