Skip to content

arm64: dts: qcom: msm8939-longcheer-l9100: Add sound #295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: wip/msm8916/6.15-rc3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 217 additions & 1 deletion arch/arm64/boot/dts/qcom/msm8939-longcheer-l9100.dts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/mfd/arizona.h>
#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
#include <dt-bindings/pinctrl/qcom,pmic-mpp.h>

Expand Down Expand Up @@ -73,6 +74,16 @@
};
};

/* regulator-spk {
compatible = "regulator-fixed";
regulator-name = "spk_vreg";
startup-delay-us = <0>;
enable-active-high;
regulator-boot-on;
regulator-always-on;
gpio = <&tlmm 101 GPIO_ACTIVE_HIGH>;
};*/

reg_ts_vdd: regulator-vdd-ts {
compatible = "regulator-fixed";
regulator-name = "regulator-vdd-ts";
Expand Down Expand Up @@ -122,6 +133,81 @@

};

&blsp_i2c1 {
status = "okay";

speaker_codec: audio-codec@1a {
compatible = "wlf,wm8998";
reg = <0x1a>;

reset-gpios = <&tlmm 120 GPIO_ACTIVE_HIGH>;
wlf,ldoena-gpios = <&tlmm 114 GPIO_ACTIVE_HIGH>;

pinctrl-0 = <&wlf_int_active &speaker_codec_default &speaker_codec_reset_default>;
pinctrl-1 = <&wlf_int_suspend &speaker_codec_sleep &speaker_codec_reset_sleep>;
pinctrl-names = "default", "sleep";

// TODO add pinctl for 114?
// TODO add pinctl for 101?

gpio-controller;
#gpio-cells = <2>;

sound-name-prefix = "Speaker";
#sound-dai-cells = <1>;

AVDD-supply = <&pm8916_l6>;
DBVDD1-supply = <&pm8916_l6>;
DBVDD2-supply = <&pm8916_l6>;
DBVDD3-supply = <&pm8916_l6>;
CPVDD-supply = <&pm8916_l6>;
SPKVDDL-supply = <&pm8916_l6>;
SPKVDDR-supply = <&pm8916_l6>;

interrupt-controller;
#interrupt-cells = <2>;
interrupts-extended = <&tlmm 69 IRQ_TYPE_LEVEL_LOW>;

clocks = <&rpmcc RPM_SMD_BB_CLK2>;
clock-names = "mclk1";

wlf,gpio-defaults = <
ARIZONA_GP_DEFAULT
ARIZONA_GP_DEFAULT
ARIZONA_GP_DEFAULT
ARIZONA_GP_DEFAULT
ARIZONA_GP_DEFAULT
>;

wlf,inmode = <0 0 0>;
wlf,micd-detect-debounce = <500>;
wlf,micd-rate = <ARIZONA_MICD_TIME_8MS>;
wlf,micd-configs = <0 ARIZONA_DMIC_MICBIAS2 1>;
wlf,micd-bias-start-time = <ARIZONA_MICD_TIME_16MS>;

// TODO:
// wlf,infinite_micd = <0x01>;
// wlf,micbias1 = <0xaf0 0x01 0x00 0x01 0x00>;
// wlf,micbias2 = <0xaf0 0x01 0x00 0x01 0x00>;
// wlf,micbias3 = <0xaf0 0x01 0x00 0x01 0x00>;
// wlf,ldo-enable = <0x77 28 0x00>;
// wlf,ena-ldo = <0x77 114 0x00>;
// wlf,clk-gpio = <0x77 116 0x00>;
// wlf,ldospk = <0x77 0x00 0x00>; // gpio101? downstream spk_vreg
// wlf,init-mic-delay = <0x1f4>;

ldo1 {
regulator-boot-on;
regulator-always-on;
};

micvdd {
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3000000>;
};
};
};

&blsp_i2c2 {
status = "okay";

Expand Down Expand Up @@ -385,6 +471,18 @@
status = "okay";
};

&q6afedai {
dai@18 {
reg = <SECONDARY_MI2S_RX>;
qcom,sd-lines = <0>;
};

dai@22 {
reg = <QUATERNARY_MI2S_RX>;
qcom,sd-lines = <0>;
};
};

&sdhc_1 {
status = "okay";
};
Expand All @@ -400,7 +498,40 @@
};

&sound {
status = "disabled"; /* TODO */
/* pinctrl-0 = <&ext_mclk_tlmm_lines_act &ext_sec_tlmm_lines_act>;*/
/* pinctrl-1 = <&ext_mclk_tlmm_lines_sus &ext_sec_tlmm_lines_sus>;*/
pinctrl-0 = <&pri_mi2s_mclk_default &sec_mi2s_default>;
pinctrl-1 = <&pri_mi2s_mclk_sleep &sec_mi2s_sleep>;
pinctrl-names = "default", "sleep";

model = "bq-piccolo";
widgets =
"Speaker", "Speaker",
"Headphone", "Headphones";
pin-switches = "Speaker";
audio-routing =
"Speaker IN1AL", "Speaker MICBIAS1",
"Speaker IN1AR", "Speaker MICBIAS1",
"Speaker IN2A", "Speaker MICBIAS2";

status = "okay";

/delete-node/ backend1-dai-link;
};

&sound_link_backend0 {
/* Primary MI2S is not used, replace with Quaternary MI2S */
link-name = "Quaternary MI2S";

cpu {
sound-dai = <&q6afedai QUATERNARY_MI2S_RX>;
};
platform {
sound-dai = <&q6routing>;
};
codec {
sound-dai = <&speaker_codec 0>;
};
};

&usb {
Expand All @@ -425,6 +556,18 @@
status = "okay";
};

&lpass {
status = "okay";
};

&pm8916_codec {
qcom,micbias-lvl = <2800>;
qcom,mbhc-vthreshold-low = <25 50 75 112 137>;
qcom,mbhc-vthreshold-high = <25 50 75 112 137>;
qcom,micbias1-ext-cap;
//qcom,hphl-jack-type-normally-open;
};

&tlmm {
button_backlight_default: button-backlight-default-state {
pins = "gpio17";
Expand Down Expand Up @@ -537,4 +680,77 @@
drive-strength = <2>;
output-high;
};

speaker_codec_reset_default: speaker-codec-reset-default-state {
pins = "gpio120";
function = "ldo_update";

drive-strength = <6>;
bias-pull-up;
};

speaker_codec_reset_sleep: speaker-codec-reset-sleep-state {
pins = "gpio120";
function = "ldo_update";

drive-strength = <2>;
bias-pull-down;
};

speaker_codec_default: speaker-codec-default-state { // ldo_enable
pins = "gpio28";
function = "gpio";
drive-strength = <6>;
bias-pull-up;
};

speaker_codec_sleep: speaker-codec-sleep-state { // ldo_enable
pins = "gpio28";
function = "gpio";
drive-strength = <2>;
bias-pull-down;
};
/*
speaker_enaldo_default: speaker-ena-ldo-default-state { // ena_ldo
pins = "gpio114";
function = "gpio";
drive-strength = <6>;
bias-pull-up;
};

speaker_enaldo_sleep: speaker-ena-ldo-sleep-state { // ena_ldo
pins = "gpio114";
function = "gpio";
drive-strength = <2>;
bias-pull-down;
};*/

/* wlf_ldospk_pin {
pins = "gpio101";
label = "wlf_speaker_ldo";

wlf_ldospk_active {
drive-strength = <6>;
bias-pull-up;
};

wlf_ldospk_suspend {
drive-strength = <2>;
bias-pull-down;
};
};*/

wlf_int_pin {
/* wolfson codec */
wlf_int_active: wlf-int-active {
pins = "gpio69";
drive-strength = <6>;
bias-pull-up;
};
wlf_int_suspend: wlf-int-suspend {
pins = "gpio69";
drive-strength = <2>;
bias-pull-down;
};
};
};
5 changes: 5 additions & 0 deletions arch/arm64/configs/msm8916_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,12 @@ CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_SYSFS=y
CONFIG_QCOM_WDT=y
CONFIG_PM8916_WATCHDOG=y
CONFIG_MFD_ARIZONA_I2C=m
CONFIG_MFD_WM8998=y
CONFIG_MFD_SPMI_PMIC=y
CONFIG_MFD_RT5033=m
CONFIG_REGULATOR_ARIZONA_LDO1=m
CONFIG_REGULATOR_ARIZONA_MICSUPP=m
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_REGULATOR_QCOM_SMD_RPM=y
CONFIG_REGULATOR_QCOM_SPMI=y
Expand Down Expand Up @@ -317,6 +321,7 @@ CONFIG_SND_SOC_MSM8916_WCD_ANALOG=m
CONFIG_SND_SOC_MSM8916_WCD_DIGITAL=m
CONFIG_SND_SOC_SIMPLE_AMPLIFIER=m
CONFIG_SND_SOC_TFA989X=m
CONFIG_SND_SOC_WM8998=m
CONFIG_USB_LED_TRIG=y
CONFIG_USB=y
CONFIG_USB_OTG=y
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2479,7 +2479,7 @@ config SND_SOC_WM8997
depends on MFD_WM8997 && MFD_ARIZONA

config SND_SOC_WM8998
tristate
tristate "Wolfson Microelectronics WM8998 codec driver"
depends on MFD_WM8998 && MFD_ARIZONA

config SND_SOC_WM9081
Expand Down
19 changes: 16 additions & 3 deletions sound/soc/qcom/apq8016_sbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

#define MI2S_COUNT (MI2S_QUATERNARY + 1)

#define ARIZONA_CLK_SYSCLK 1
#define ARIZONA_CLK_SRC_MCLK1 0

struct apq8016_sbc_data {
struct snd_soc_card card;
void __iomem *mic_iomux;
Expand Down Expand Up @@ -127,11 +130,21 @@ static int apq8016_dai_init(struct snd_soc_pcm_runtime *rtd, int mi2s)
}

for_each_rtd_codec_dais(rtd, i, codec_dai) {

int clk_id, pll_out, source;

if (!strcmp(codec_dai->name, "wm8998-aif1")) {
clk_id = ARIZONA_CLK_SYSCLK;
pll_out = 12288000;
source = ARIZONA_CLK_SRC_MCLK1;
} else {
clk_id = 0;
pll_out = DEFAULT_MCLK_RATE;
source = 0;
}
component = codec_dai->component;
/* Set default mclk for internal codec */
rval = snd_soc_component_set_sysclk(component, 0, 0, DEFAULT_MCLK_RATE,
SND_SOC_CLOCK_IN);
rval = snd_soc_component_set_sysclk(component, clk_id, source,
pll_out, SND_SOC_CLOCK_IN);
if (rval != 0 && rval != -ENOTSUPP) {
dev_warn(card->dev, "Failed to set mclk: %d\n", rval);
return rval;
Expand Down
Loading