From: David Heidelberg <[email protected]> Introduce support for sound card and wire two CS35L36 audio codecs for top and bottom speakers.
Inspired by commit from Joel Selvaraj. Signed-off-by: David Heidelberg <[email protected]> --- arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi | 133 ++++++++++++++++++++- 1 file changed, 131 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi index b2dc0327dff85..d00fee7ebd424 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi @@ -2,16 +2,18 @@ /dts-v1/; #include <dt-bindings/arm/qcom,ids.h> #include <dt-bindings/dma/qcom-gpi.h> #include <dt-bindings/input/linux-event-codes.h> #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/regulator/qcom,rpmh-regulator.h> +#include <dt-bindings/sound/qcom,q6afe.h> +#include <dt-bindings/sound/qcom,q6asm.h> #include "sdm845.dtsi" #include "pm8998.dtsi" #include "pmi8998.dtsi" /delete-node/ &mpss_region; /delete-node/ &venus_mem; /delete-node/ &cdsp_mem; @@ -404,19 +406,63 @@ nfc@28 { firmware-gpios = <&tlmm 79 GPIO_ACTIVE_HIGH>; pinctrl-0 = <&nfc_int_default &nfc_enable_default>; pinctrl-names = "default"; }; }; &i2c12 { - /* Bottom spkr (right) CS35L36 @ 40 */ + status = "okay"; + + /* CS35L36, Bottom Speaker */ + cs35l36_bottom: audio-codec@40 { + compatible = "cirrus,cs35l36"; + reg = <0x40>; + reset-gpios = <&tlmm 112 GPIO_ACTIVE_HIGH>; + #sound-dai-cells = <0>; + sound-name-prefix = "Right"; /* Bottom */ + VA-supply = <&vreg_s4a_1p8>; + interrupts-extended = <&tlmm 115 IRQ_TYPE_LEVEL_LOW>; + + pinctrl-0 = <&cs35l36_bottom_default_state>; + pinctrl-names = "default"; + + cirrus,boost-ind-nanohenry = <1000>; + cirrus,boost-ctl-select = <1>; + cirrus,boost-ctl-millivolt = <10000>; + cirrus,boost-peak-milliamp = <3700>; + cirrus,temp-warn-threshold = <1>; + cirrus,multi-amp-mode; + cirrus,irq-drive-select = <0>; + cirrus,irq-gpio-select = <0>; + }; - /* Top spkr (left) CS35L36 @ 41 */ + /* CS35L36, Top Speaker */ + cs35l36_top: audio-codec@41 { + compatible = "cirrus,cs35l36"; + reg = <0x41>; + reset-gpios = <&tlmm 75 GPIO_ACTIVE_HIGH>; + #sound-dai-cells = <0>; + sound-name-prefix = "Left"; /* Top */ + VA-supply = <&vreg_s4a_1p8>; + interrupts-extended = <&tlmm 40 IRQ_TYPE_LEVEL_LOW>; + + pinctrl-0 = <&cs35l36_top_default_state>; + pinctrl-names = "default"; + + cirrus,boost-ind-nanohenry = <1000>; + cirrus,boost-ctl-select = <0x01>; + cirrus,boost-ctl-millivolt = <10000>; + cirrus,boost-peak-milliamp = <3700>; + cirrus,temp-warn-threshold = <1>; + cirrus,multi-amp-mode; + cirrus,irq-drive-select = <0>; + cirrus,irq-gpio-select = <0>; + }; }; &ipa { firmware-name = "qcom/sdm845/Google/blueline/ipa_fws.mbn"; memory-region = <&ipa_fw_mem>; status = "okay"; }; @@ -449,16 +495,35 @@ &pm8998_resin { }; &pmi8998_charger { monitored-battery = <&battery>; status = "okay"; }; +&q6afedai { + dai@72 { + reg = <QUATERNARY_TDM_RX_0>; + + qcom,tdm-sync-mode = <0>; + qcom,tdm-sync-src = <1>; + qcom,tdm-data-out = <0>; + qcom,tdm-invert-sync = <0>; + qcom,tdm-data-delay = <1>; + qcom,tdm-data-align = <0>; + }; +}; + +&q6asmdai { + dai@0 { + reg = <MSM_FRONTEND_DAI_MULTIMEDIA1>; + }; +}; + &qupv3_id_0 { status = "okay"; }; &qupv3_id_1 { status = "okay"; }; @@ -467,16 +532,48 @@ &qup_uart9_rx { bias-pull-up; }; &qup_uart9_tx { drive-strength = <2>; bias-disable; }; +&sound { + compatible = "qcom,sdm845-sndcard"; + model = "Google Pixel 3"; + pinctrl-0 = <&quat_mi2s_active>, <&quat_mi2s_sd0_active>, + <&quat_mi2s_sd1_active>; + pinctrl-names = "default"; + + mm1-dai-link { + link-name = "MultiMedia1"; + + cpu { + sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>; + }; + }; + + cs35l36-dai-link { + link-name = "Speaker Playback"; + + cpu { + sound-dai = <&q6afedai QUATERNARY_TDM_RX_0>; + }; + + platform { + sound-dai = <&q6routing>; + }; + + codec { + sound-dai = <&cs35l36_bottom>, <&cs35l36_top>; + }; + }; +}; + &tlmm { gpio-reserved-ranges = < 0 4>, /* SPI (Intel MNH Pixel Visual Core) */ <81 4>; /* SPI (most likely Fingerprint Cards FPC1075) */ nfc_int_default: nfc-int-default-state { pins = "gpio63"; function = "gpio"; drive-strength = <2>; @@ -505,16 +602,48 @@ touchscreen_pins: ts-pins-gpio-state { }; touchscreen_i2c_pins: qup-i2c2-gpio-state { pins = "gpio27", "gpio28"; function = "gpio"; drive-strength = <2>; bias-disable; }; + + cs35l36_bottom_default_state: cs35l36-bottom-default-state { + reset-pins { + pins = "gpio112"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + irq-pins { + pins = "gpio115"; + function = "gpio"; + drive-strength = <2>; + bias-pull-up; + }; + }; + + cs35l36_top_default_state: cs35l36-top-default-state { + irq-pins { + pins = "gpio40"; + function = "gpio"; + drive-strength = <2>; + bias-pull-up; + }; + + reset-pins { + pins = "gpio75"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + }; }; &uart6 { pinctrl-0 = <&qup_uart6_4pin>; status = "okay"; bluetooth { -- 2.53.0

