Commit 5db767ae authored by Stephan Gerhold's avatar Stephan Gerhold Committed by Bjorn Andersson

arm64: dts: qcom: msm8916-wingtech-wt88047: Add sound and modem

Enable sound and modem for the Xiaomi Redmi 2. The setup
is similar to most MSM8916 devices, i.e.:

 - QDSP6 audio
 - Earpiece/headphones/microphones via digital/analog codec in
   MSM8916/PM8916
 - Audio jack detection via analog codec in PM8916
 - WWAN Internet via BAM-DMUX

except:

 - Speaker amplifier is connected to HPH_R (headphones) output of the
   analog codec. There is a separate analog switch that allows disabling
   playback via the headphone jack.
Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20231003-msm8916-modem-v2-7-61b684be55c0@gerhold.netSigned-off-by: default avatarBjorn Andersson <andersson@kernel.org>
parent 6b66abd5
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
/dts-v1/; /dts-v1/;
#include "msm8916-pm8916.dtsi" #include "msm8916-pm8916.dtsi"
#include "msm8916-modem-qdsp6.dtsi"
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h> #include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h> #include <dt-bindings/leds/common.h>
...@@ -25,6 +27,28 @@ chosen { ...@@ -25,6 +27,28 @@ chosen {
stdout-path = "serial0"; stdout-path = "serial0";
}; };
speaker_amp: audio-amplifier {
compatible = "simple-audio-amplifier";
enable-gpios = <&tlmm 117 GPIO_ACTIVE_HIGH>;
sound-name-prefix = "Speaker Amp";
pinctrl-0 = <&speaker_amp_default>;
pinctrl-names = "default";
};
/*
* This seems to be actually an analog switch that either routes audio
* to the headphone jack or nowhere. Given that we need to enable a GPIO
* to get sound on headphones, modelling it as simple-audio-amplifier
* works just fine.
*/
headphones_switch: audio-switch {
compatible = "simple-audio-amplifier";
enable-gpios = <&tlmm 8 GPIO_ACTIVE_HIGH>;
sound-name-prefix = "Headphones Switch";
pinctrl-0 = <&headphones_switch_default>;
pinctrl-names = "default";
};
flash-led-controller { flash-led-controller {
compatible = "ocs,ocp8110"; compatible = "ocs,ocp8110";
enable-gpios = <&tlmm 31 GPIO_ACTIVE_HIGH>; enable-gpios = <&tlmm 31 GPIO_ACTIVE_HIGH>;
...@@ -146,6 +170,18 @@ &blsp_uart2 { ...@@ -146,6 +170,18 @@ &blsp_uart2 {
status = "okay"; status = "okay";
}; };
&mpss_mem {
reg = <0x0 0x86800000 0x0 0x5100000>;
};
&pm8916_codec {
qcom,micbias1-ext-cap;
qcom,micbias-lvl = <2800>;
qcom,mbhc-vthreshold-low = <75 100 120 180 500>;
qcom,mbhc-vthreshold-high = <75 100 120 180 500>;
qcom,hphl-jack-type-normally-open;
};
&pm8916_resin { &pm8916_resin {
status = "okay"; status = "okay";
linux,code = <KEY_VOLUMEDOWN>; linux,code = <KEY_VOLUMEDOWN>;
...@@ -180,6 +216,30 @@ &sdhc_2 { ...@@ -180,6 +216,30 @@ &sdhc_2 {
non-removable; non-removable;
}; };
&sound {
/*
* Provide widgets/pin-switches to allow enabling speaker and headphones
* separately. Both are routed via the HPH_L/HPH_R pins of the codec.
*/
model = "wt88047";
widgets =
"Speaker", "Speaker",
"Headphone", "Headphones";
pin-switches = "Speaker", "Headphones";
audio-routing =
"Speaker", "Speaker Amp OUTL",
"Speaker", "Speaker Amp OUTR",
"Speaker Amp INL", "HPH_R",
"Speaker Amp INR", "HPH_R",
"Headphones", "Headphones Switch OUTL",
"Headphones", "Headphones Switch OUTR",
"Headphones Switch INL", "HPH_L",
"Headphones Switch INR", "HPH_R",
"AMIC1", "MIC BIAS External1",
"AMIC2", "MIC BIAS Internal2";
aux-devs = <&speaker_amp>, <&headphones_switch>;
};
&usb { &usb {
status = "okay"; status = "okay";
extcon = <&usb_id>, <&usb_id>; extcon = <&usb_id>, <&usb_id>;
...@@ -226,6 +286,13 @@ gpio_keys_default: gpio-keys-default-state { ...@@ -226,6 +286,13 @@ gpio_keys_default: gpio-keys-default-state {
bias-pull-up; bias-pull-up;
}; };
headphones_switch_default: headphones-switch-default-state {
pins = "gpio8";
function = "gpio";
drive-strength = <2>;
bias-disable;
};
imu_default: imu-default-state { imu_default: imu-default-state {
pins = "gpio115"; pins = "gpio115";
function = "gpio"; function = "gpio";
...@@ -234,6 +301,13 @@ imu_default: imu-default-state { ...@@ -234,6 +301,13 @@ imu_default: imu-default-state {
bias-disable; bias-disable;
}; };
speaker_amp_default: speaker-amp-default-state {
pins = "gpio117";
function = "gpio";
drive-strength = <2>;
bias-disable;
};
touchscreen_default: touchscreen-default-state { touchscreen_default: touchscreen-default-state {
touchscreen-pins { touchscreen-pins {
pins = "gpio13"; pins = "gpio13";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment