From ae75cc7edd3c8dc20cfcf6079faf84234f7bb92f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Apitzsch?= Date: Wed, 16 Apr 2025 22:09:02 +0200 Subject: [PATCH 1/3] squash! MSM8916: arm64: configs: Add msm8916_defconfig (v86) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CONFIG_MFD_ARIZONA_I2C=m CONFIG_MFD_WM8998=y CONFIG_REGULATOR_ARIZONA_LDO1=m CONFIG_REGULATOR_ARIZONA_MICSUPP=m CONFIG_SND_SOC_WM8998=m Signed-off-by: André Apitzsch --- arch/arm64/configs/msm8916_defconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/configs/msm8916_defconfig b/arch/arm64/configs/msm8916_defconfig index 77f4d31ebc3b73..201bef903e2ff7 100644 --- a/arch/arm64/configs/msm8916_defconfig +++ b/arch/arm64/configs/msm8916_defconfig @@ -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 @@ -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 From 720d15413bea8cd824f999905a00083b77a0332b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Apitzsch?= Date: Wed, 23 Apr 2025 21:52:37 +0200 Subject: [PATCH 2/3] ASoC: qcom: apq8016_sbc: Add support for arizona WM8998 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Apitzsch --- sound/soc/qcom/apq8016_sbc.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c index 3023cf180a7556..52de99b67f1e4e 100644 --- a/sound/soc/qcom/apq8016_sbc.c +++ b/sound/soc/qcom/apq8016_sbc.c @@ -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; @@ -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; From cd58d357c69685a71268c0b5058a708c5f93adfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Apitzsch?= Date: Sat, 7 Jan 2023 21:18:06 +0100 Subject: [PATCH 3/3] arm64: dts: qcom: msm8939-longcheer-l9100: Add sound support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Apitzsch --- .../boot/dts/qcom/msm8939-longcheer-l9100.dts | 218 +++++++++++++++++- 1 file changed, 217 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/msm8939-longcheer-l9100.dts b/arch/arm64/boot/dts/qcom/msm8939-longcheer-l9100.dts index 17d59345a00933..14e08e196bc234 100644 --- a/arch/arm64/boot/dts/qcom/msm8939-longcheer-l9100.dts +++ b/arch/arm64/boot/dts/qcom/msm8939-longcheer-l9100.dts @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -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"; @@ -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 = ; + wlf,micd-configs = <0 ARIZONA_DMIC_MICBIAS2 1>; + wlf,micd-bias-start-time = ; + + // 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"; @@ -388,6 +474,18 @@ status = "okay"; }; +&q6afedai { + dai@18 { + reg = ; + qcom,sd-lines = <0>; + }; + + dai@22 { + reg = ; + qcom,sd-lines = <0>; + }; +}; + &sdhc_1 { status = "okay"; }; @@ -403,7 +501,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 { @@ -428,6 +559,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"; @@ -540,4 +683,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; + }; + }; };