Skip to content

Commit

Permalink
WIP: bq-piccolo: Add sound support
Browse files Browse the repository at this point in the history
Signed-off-by: André Apitzsch <git@apitzsch.eu>
  • Loading branch information
André Apitzsch committed Apr 27, 2023
1 parent 1e91bcf commit 47f7bfa
Show file tree
Hide file tree
Showing 3 changed files with 219 additions and 7 deletions.
212 changes: 212 additions & 0 deletions 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-mpp.h>

/ {
Expand Down Expand Up @@ -77,6 +78,26 @@
};
};

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

regulator-wm8998-ldo {
compatible = "regulator-fixed";
regulator-name = "wm8998_ldo";

enable-active-high;
regulator-boot-on;
regulator-always-on;
gpio = <&msmgpio 114 GPIO_ACTIVE_HIGH>;
};

reg_ts_vdd: regulator-vdd-ts {
compatible = "regulator-fixed";
regulator-name = "regulator-vdd-ts";
Expand Down Expand Up @@ -126,6 +147,77 @@

};

&blsp_i2c1 {
status = "okay";

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

reset-gpios = <&msmgpio 120 GPIO_ACTIVE_HIGH>;
wlf,ldoena-gpios = <&msmgpio 28 GPIO_ACTIVE_HIGH>;

pinctrl-names = "default", "sleep";
pinctrl-0 = <&wlf_int_active &speaker_codec_default &speaker_codec_reset_default>;
pinctrl-1 = <&wlf_int_suspend &speaker_codec_sleep &speaker_codec_reset_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>;
interrupt-parent = <&msmgpio>;
interrupts = <69 IRQ_TYPE_LEVEL_LOW>;

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

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>;

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

&blsp_i2c3 {
status = "okay";

Expand Down Expand Up @@ -313,6 +405,40 @@
status = "okay";
};

&sound {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&ext_mclk_tlmm_lines_act &ext_sec_tlmm_lines_act>;
pinctrl-1 = <&ext_mclk_tlmm_lines_sus &ext_sec_tlmm_lines_sus>;

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

status = "okay";
};

&sound_dai_primary {
status = "disabled";
};

&sound_dai_tertiary {
status = "disabled";
};

&sound_dai_quaternary {
status = "okay";

codec {
sound-dai = <&speaker_codec 0>;
};
};

&usb {
extcon = <&charger>, <&usb_id>;
vbus-supply = <&usb_otg_vbus>;
Expand All @@ -331,6 +457,19 @@
compatible = "qcom,wcn3620";
};

&lpass_codec {
status = "disabled";
};

&wcd_codec {
status = "disabled";
/* qcom,micbias-lvl = <2800>;
qcom,mbhc-vthreshold-low = <25 50 75 112 137>;
qcom,mbhc-vthreshold-high = <25 50 75 112 137>;
//qcom,hphl-jack-type-normally-open;
*/
};

&smd_rpm_regulators {
vdd_l1_l2_l3-supply = <&pm8916_s3>;
vdd_l4_l5_l6-supply = <&pm8916_s4>;
Expand Down Expand Up @@ -530,6 +669,79 @@
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;
};
};
};

&pm8916_mpps {
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2053,7 +2053,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
12 changes: 6 additions & 6 deletions sound/soc/qcom/apq8016_sbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ static int apq8016_dai_init(struct snd_soc_pcm_runtime *rtd, int mi2s)

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);
if (rval != 0 && rval != -ENOTSUPP) {
dev_warn(card->dev, "Failed to set mclk: %d\n", rval);
return rval;
}
/* rval = snd_soc_component_set_sysclk(component, 0, 0, DEFAULT_MCLK_RATE,*/
/* SND_SOC_CLOCK_IN);*/
/* if (rval != 0 && rval != -ENOTSUPP) {*/
/* dev_warn(card->dev, "Failed to set mclk: %d\n", rval);*/
/* return rval;*/
/* }*/
rval = snd_soc_component_set_jack(component, &pdata->jack, NULL);
if (rval != 0 && rval != -ENOTSUPP) {
dev_warn(card->dev, "Failed to set jack: %d\n", rval);
Expand Down

0 comments on commit 47f7bfa

Please sign in to comment.