@@ -337,6 +337,38 @@ fake-reg-mclk3 {
clocks = <&camcc CAM_CC_MCLK3_CLK>;
regulator-always-on;
};
+
+ wcd9385: audio-codec-1 {
+ compatible = "qcom,wcd9385-codec";
+
+ pinctrl-0 = <&wcd_default>;
+ pinctrl-names = "default";
+
+ reset-gpios = <&tlmm 83 GPIO_ACTIVE_LOW>;
+
+ qcom,rx-device = <&wcd_rx>;
+ qcom,tx-device = <&wcd_tx>;
+
+ vdd-rxtx-supply = <&vreg_l18b>;
+ vdd-io-supply = <&vreg_l18b>; // ???
+ vdd-buck-supply = <&vreg_l17b>;
+ vdd-mic-bias-supply = <&vreg_bob>;
+
+ qcom,micbias1-microvolt = <1800000>;
+ qcom,micbias2-microvolt = <1800000>;
+ qcom,micbias3-microvolt = <1800000>;
+ qcom,micbias4-microvolt = <1800000>;
+
+ // FIXME validate those
+ 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>;
+ #sound-dai-cells = <1>;
+ };
};
&apps_rsc {
@@ -713,6 +794,43 @@ &ipa {
status = "okay";
};
+&lpass_rx_macro {
+ status = "okay";
+};
+
+&lpass_tx_macro {
+ status = "okay";
+};
+
+&lpass_va_macro {
+ status = "okay";
+};
+
+&lpass_rx_swr_clk {
+ drive-strength = <2>;
+ slew-rate = <1>;
+ bias-disable;
+};
+
+&lpass_rx_swr_data {
+ drive-strength = <2>;
+ slew-rate = <1>;
+ bias-bus-hold;
+};
+
+&lpass_tx_swr_clk {
+ drive-strength = <2>;
+ slew-rate = <1>;
+ bias-disable;
+};
+
+&lpass_tx_swr_data {
+ drive-strength = <2>;
+ slew-rate = <1>;
+ bias-bus-hold;
+};
+
&mdss {
status = "okay";
};
@@ -1083,6 +1215,35 @@ cpu {
};
};
+ wcd-capture-dai-link {
+ link-name = "WCD Capture";
+
+ cpu {
+ sound-dai = <&q6afedai TX_CODEC_DMA_TX_3>;
+ };
+
+ codec {
+ sound-dai = <&wcd9385 1>, <&swr1 0>, <&lpass_tx_macro 0>;
+ };
+ };
+
displayport-rx-dai-link {
link-name = "DisplayPort Playback";
@@ -1130,6 +1291,27 @@ goodix-berlin@0 {
};
};
+&swr0 {
+ status = "okay";
+
+ wcd_rx: codec@0,4 {
+ compatible = "sdw20217010d00";
+ reg = <0 4>;
+ qcom,rx-port-mapping = <1 2 3 4 5>; // TODO no clue if correct
+ };
+};
+
+&swr1 {
+ status = "okay";
+
+ wcd_tx: codec@0,3 {
+ compatible = "sdw20217010d00";
+ reg = <0 3>;
+ qcom,tx-port-mapping = <1 2 3 4>; // TODO no clue if correct
+ //qcom,tx-port-mapping = <1 1 2 3>; // TODO no clue if correct
+ };
+};
+
&tlmm {
/*
* 32-33: SMB1394 (SPMI)
@@ -1252,6 +1434,27 @@ usb_redrive_1v8_en_default: usb-redrive-1v8-en-default-state {
bias-disable;
output-high;
};
+
+ wcd_default: wcd-reset-n-active-state {
+ pins = "gpio83";
+ function = "gpio";
+ drive-strength = <16>;
+ bias-disable;
+ output-low;
+ };
};
&uart5 {
@@ -26,6 +26,7 @@
#include <dt-bindings/soc/qcom,apr.h>
#include <dt-bindings/soc/qcom,rpmh-rsc.h>
#include <dt-bindings/sound/qcom,lpass.h>
+#include <dt-bindings/sound/qcom,q6dsp-lpass-ports.h>
#include <dt-bindings/thermal/thermal.h>
/ {
@@ -2390,14 +2391,16 @@ lpass_rx_macro: codec@3200000 {
pinctrl-names = "default";
pinctrl-0 = <&lpass_rx_swr_clk>, <&lpass_rx_swr_data>;
- clocks = <&lpass_aon LPASS_AON_CC_TX_MCLK_CLK>,
- <&lpass_aon LPASS_AON_CC_TX_MCLK_2X_CLK>,
+ clocks = <&q6afecc LPASS_CLK_ID_RX_CORE_MCLK LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
+ <&q6afecc LPASS_CLK_ID_RX_CORE_NPL_MCLK LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
+ <&q6afecc LPASS_HW_MACRO_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
+ <&q6afecc LPASS_HW_DCODEC_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
<&lpass_va_macro>;
- clock-names = "mclk", "npl", "fsgen";
+ clock-names = "mclk", "npl", "macro", "dcodec", "fsgen";
- power-domains = <&lpass_hm LPASS_CORE_CC_LPASS_CORE_HM_GDSC>,
- <&lpass_aon LPASS_AON_CC_LPASS_AUDIO_HM_GDSC>;
- power-domain-names = "macro", "dcodec";
+ assigned-clocks = <&q6afecc LPASS_CLK_ID_RX_CORE_MCLK LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
+ <&q6afecc LPASS_CLK_ID_RX_CORE_NPL_MCLK LPASS_CLK_ATTRIBUTE_COUPLE_NO>;
+ assigned-clock-rates = <22579200>, <22579200>;
#clock-cells = <0>;
#sound-dai-cells = <1>;
@@ -2416,9 +2419,6 @@ swr0: soundwire@3210000 {
qcom,din-ports = <0>;
qcom,dout-ports = <5>;
- resets = <&lpass_audiocc LPASS_AUDIO_SWR_RX_CGCR>;
- reset-names = "swr_audio_cgcr";
-
qcom,ports-word-length = /bits/ 8 <0x01 0x07 0x04 0xff 0xff>;
qcom,ports-sinterval-low = /bits/ 8 <0x03 0x3f 0x1f 0x03 0x03>;
qcom,ports-offset1 = /bits/ 8 <0x00 0x00 0x0b 0x01 0x01>;
@@ -2443,14 +2443,18 @@ lpass_tx_macro: codec@3220000 {
pinctrl-names = "default";
pinctrl-0 = <&lpass_tx_swr_clk>, <&lpass_tx_swr_data>;
- clocks = <&lpass_aon LPASS_AON_CC_TX_MCLK_CLK>,
- <&lpass_aon LPASS_AON_CC_TX_MCLK_2X_CLK>,
+ clocks = <&q6afecc LPASS_CLK_ID_TX_CORE_MCLK LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
+ <&q6afecc LPASS_CLK_ID_TX_CORE_NPL_MCLK LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
+ <&q6afecc LPASS_HW_MACRO_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
+ <&q6afecc LPASS_HW_DCODEC_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
<&lpass_va_macro>;
- clock-names = "mclk", "npl", "fsgen";
+ clock-names = "mclk", "npl", "macro", "dcodec", "fsgen";
- power-domains = <&lpass_hm LPASS_CORE_CC_LPASS_CORE_HM_GDSC>,
- <&lpass_aon LPASS_AON_CC_LPASS_AUDIO_HM_GDSC>;
- power-domain-names = "macro", "dcodec";
+ assigned-clocks = <&q6afecc LPASS_CLK_ID_TX_CORE_MCLK LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
+ <&q6afecc LPASS_CLK_ID_TX_CORE_NPL_MCLK LPASS_CLK_ATTRIBUTE_COUPLE_NO>;
+ assigned-clock-rates = <19200000>, <19200000>;
+
+ clock-output-names = "mclk";
#clock-cells = <0>;
#sound-dai-cells = <1>;
@@ -2470,9 +2474,6 @@ swr1: soundwire@3230000 {
qcom,din-ports = <3>;
qcom,dout-ports = <0>;
- resets = <&lpass_audiocc LPASS_AUDIO_SWR_TX_CGCR>;
- reset-names = "swr_audio_cgcr";
-
qcom,ports-sinterval-low = /bits/ 8 <0x01 0x03 0x03>;
qcom,ports-offset1 = /bits/ 8 <0x01 0x00 0x02>;
qcom,ports-offset2 = /bits/ 8 <0x00 0x00 0x00>;
@@ -2501,21 +2502,23 @@ lpass_audiocc: clock-controller@3300000 {
#clock-cells = <1>;
#power-domain-cells = <1>;
#reset-cells = <1>;
+
+ status = "reserved"; /* Owned by ADSP firmware */
};
lpass_va_macro: codec@3370000 {
compatible = "qcom,sc7280-lpass-va-macro";
reg = <0 0x03370000 0 0x1000>;
- pinctrl-names = "default";
- pinctrl-0 = <&lpass_dmic01_clk>, <&lpass_dmic01_data>;
+ clocks = <&q6afecc LPASS_CLK_ID_VA_CORE_MCLK LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
+ <&q6afecc LPASS_HW_MACRO_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
+ <&q6afecc LPASS_HW_DCODEC_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
+ <&q6afecc LPASS_CLK_ID_VA_CORE_2X_MCLK LPASS_CLK_ATTRIBUTE_COUPLE_NO>;
+ clock-names = "mclk", "macro", "dcodec", "npl";
- clocks = <&lpass_aon LPASS_AON_CC_TX_MCLK_CLK>;
- clock-names = "mclk";
-
- power-domains = <&lpass_hm LPASS_CORE_CC_LPASS_CORE_HM_GDSC>,
- <&lpass_aon LPASS_AON_CC_LPASS_AUDIO_HM_GDSC>;
- power-domain-names = "macro", "dcodec";
+ assigned-clocks = <&q6afecc LPASS_CLK_ID_VA_CORE_MCLK LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
+ <&q6afecc LPASS_CLK_ID_VA_CORE_2X_MCLK LPASS_CLK_ATTRIBUTE_COUPLE_NO>;
+ assigned-clock-rates = <19200000>, <19200000>;
#clock-cells = <0>;
#sound-dai-cells = <1>;
@@ -2632,6 +2635,10 @@ lpass_tlmm: pinctrl@33c0000 {
#gpio-cells = <2>;
gpio-ranges = <&lpass_tlmm 0 0 15>;
+ clocks = <&q6afecc LPASS_HW_MACRO_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>,
+ <&q6afecc LPASS_HW_DCODEC_VOTE LPASS_CLK_ATTRIBUTE_COUPLE_NO>;
+ clock-names = "core", "audio";
+
lpass_dmic01_clk: dmic01-clk-state {
pins = "gpio6";
function = "dmic1_clk";
@@ -1998,18 +1998,18 @@ static int tx_macro_probe(struct platform_device *pdev)
}
/* Update defaults for lpass sc7280 */
- if (of_device_is_compatible(np, "qcom,sc7280-lpass-tx-macro")) {
- for (reg = 0; reg < ARRAY_SIZE(tx_defaults); reg++) {
- switch (tx_defaults[reg].reg) {
- case CDC_TX_TOP_CSR_SWR_AMIC0_CTL:
- case CDC_TX_TOP_CSR_SWR_AMIC1_CTL:
- tx_defaults[reg].def = 0x0E;
- break;
- default:
- break;
- }
- }
- }
+ //if (of_device_is_compatible(np, "qcom,sc7280-lpass-tx-macro")) {
+ // for (reg = 0; reg < ARRAY_SIZE(tx_defaults); reg++) {
+ // switch (tx_defaults[reg].reg) {
+ // case CDC_TX_TOP_CSR_SWR_AMIC0_CTL:
+ // case CDC_TX_TOP_CSR_SWR_AMIC1_CTL:
+ // tx_defaults[reg].def = 0x0E;
+ // break;
+ // default:
+ // break;
+ // }
+ // }
+ //}
tx->regmap = devm_regmap_init_mmio(dev, base, &tx_regmap_config);
if (IS_ERR(tx->regmap)) {
@@ -2162,7 +2162,7 @@ static const struct dev_pm_ops tx_macro_pm_ops = {
static const struct of_device_id tx_macro_dt_match[] = {
{
.compatible = "qcom,sc7280-lpass-tx-macro",
- .data = (void *)(LPASS_MACRO_FLAG_HAS_NPL_CLOCK | LPASS_MACRO_FLAG_RESET_SWR),
+ .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
}, {
.compatible = "qcom,sm6115-lpass-tx-macro",
.data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK,
@@ -1272,11 +1272,12 @@ static int wcd9380_probe(struct sdw_slave *pdev,
regcache_cache_only(wcd->regmap, true);
}
- pm_runtime_set_autosuspend_delay(dev, 3000);
+ pm_runtime_set_autosuspend_delay(dev, 10000);
pm_runtime_use_autosuspend(dev);
pm_runtime_mark_last_busy(dev);
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
ret = component_add(dev, &wcd938x_sdw_component_ops);
if (ret)
@@ -3096,12 +3096,14 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
unsigned long time_left;
int ret, i;
time_left = wait_for_completion_timeout(&tx_sdw_dev->initialization_complete,
- msecs_to_jiffies(2000));
+ msecs_to_jiffies(20000));
if (!time_left) {
dev_err(dev, "soundwire device init timeout\n");
return -ETIMEDOUT;
}
snd_soc_component_init_regmap(component, wcd938x->regmap);