Skip to content

Commit 2d12bed

Browse files
author
André Apitzsch
committed
WIP: bq-piccolo: Add sound support
Signed-off-by: André Apitzsch <[email protected]>
1 parent 65f0a87 commit 2d12bed

File tree

3 files changed

+217
-8
lines changed

3 files changed

+217
-8
lines changed

arch/arm64/boot/dts/qcom/msm8939-longcheer-l9100.dts

Lines changed: 210 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <dt-bindings/input/input.h>
1010
#include <dt-bindings/interrupt-controller/irq.h>
1111
#include <dt-bindings/leds/common.h>
12+
#include <dt-bindings/mfd/arizona.h>
1213
#include <dt-bindings/pinctrl/qcom,pmic-mpp.h>
1314

1415
/ {
@@ -72,6 +73,26 @@
7273
};
7374
};
7475

76+
/* regulator-spk {
77+
compatible = "regulator-fixed";
78+
regulator-name = "spk_vreg";
79+
startup-delay-us = <0>;
80+
enable-active-high;
81+
regulator-boot-on;
82+
regulator-always-on;
83+
gpio = <&tlmm 101 GPIO_ACTIVE_HIGH>;
84+
};*/
85+
86+
regulator-wm8998-ldo {
87+
compatible = "regulator-fixed";
88+
regulator-name = "wm8998_ldo";
89+
90+
enable-active-high;
91+
regulator-boot-on;
92+
regulator-always-on;
93+
gpio = <&tlmm 114 GPIO_ACTIVE_HIGH>;
94+
};
95+
7596
reg_ts_vdd: regulator-vdd-ts {
7697
compatible = "regulator-fixed";
7798
regulator-name = "regulator-vdd-ts";
@@ -121,6 +142,77 @@
121142

122143
};
123144

145+
&blsp_i2c1 {
146+
status = "okay";
147+
148+
speaker_codec: audio-codec@1a {
149+
compatible = "wlf,wm8998";
150+
reg = <0x1a>;
151+
152+
reset-gpios = <&tlmm 120 GPIO_ACTIVE_HIGH>;
153+
wlf,ldoena-gpios = <&tlmm 28 GPIO_ACTIVE_HIGH>;
154+
155+
pinctrl-names = "default", "sleep";
156+
pinctrl-0 = <&wlf_int_active &speaker_codec_default &speaker_codec_reset_default>;
157+
pinctrl-1 = <&wlf_int_suspend &speaker_codec_sleep &speaker_codec_reset_sleep>;
158+
159+
// TODO add pinctl for 114?
160+
// TODO add pinctl for 101?
161+
162+
gpio-controller;
163+
#gpio-cells = <2>;
164+
165+
sound-name-prefix = "Speaker";
166+
#sound-dai-cells = <1>;
167+
168+
AVDD-supply = <&pm8916_l6>;
169+
DBVDD1-supply = <&pm8916_l6>;
170+
DBVDD2-supply = <&pm8916_l6>;
171+
DBVDD3-supply = <&pm8916_l6>;
172+
CPVDD-supply = <&pm8916_l6>;
173+
SPKVDDL-supply = <&pm8916_l6>;
174+
SPKVDDR-supply = <&pm8916_l6>;
175+
176+
interrupt-controller;
177+
#interrupt-cells = <2>;
178+
interrupt-parent = <&tlmm>;
179+
interrupts = <69 IRQ_TYPE_LEVEL_LOW>;
180+
181+
clocks = <&rpmcc RPM_SMD_BB_CLK2>;
182+
clock-names = "mclk2";
183+
184+
wlf,gpio-defaults = <
185+
ARIZONA_GP_DEFAULT
186+
ARIZONA_GP_DEFAULT
187+
ARIZONA_GP_DEFAULT
188+
ARIZONA_GP_DEFAULT
189+
ARIZONA_GP_DEFAULT
190+
>;
191+
192+
wlf,inmode = <0 0 0>;
193+
wlf,micd-detect-debounce = <500>;
194+
wlf,micd-rate = <ARIZONA_MICD_TIME_8MS>;
195+
wlf,micd-configs = <0 ARIZONA_DMIC_MICBIAS2 1>;
196+
wlf,micd-bias-start-time = <ARIZONA_MICD_TIME_16MS>;
197+
198+
// TODO:
199+
// wlf,infinite_micd = <0x01>;
200+
// wlf,micbias1 = <0xaf0 0x01 0x00 0x01 0x00>;
201+
// wlf,micbias2 = <0xaf0 0x01 0x00 0x01 0x00>;
202+
// wlf,micbias3 = <0xaf0 0x01 0x00 0x01 0x00>;
203+
// wlf,ldo-enable = <0x77 28 0x00>;
204+
// wlf,ena-ldo = <0x77 114 0x00>;
205+
// wlf,clk-gpio = <0x77 116 0x00>;
206+
// wlf,ldospk = <0x77 0x00 0x00>; // gpio101? downstream spk_vreg
207+
// wlf,init-mic-delay = <0x1f4>;
208+
209+
micvdd {
210+
regulator-min-microvolt = <3000000>;
211+
regulator-max-microvolt = <3000000>;
212+
};
213+
};
214+
};
215+
124216
&blsp_i2c3 {
125217
status = "okay";
126218

@@ -328,7 +420,40 @@
328420
};
329421

330422
&sound {
331-
status = "disabled"; /* TODO */
423+
pinctrl-names = "default", "sleep";
424+
/* pinctrl-0 = <&ext_mclk_tlmm_lines_act &ext_sec_tlmm_lines_act>;*/
425+
/* pinctrl-1 = <&ext_mclk_tlmm_lines_sus &ext_sec_tlmm_lines_sus>;*/
426+
pinctrl-0 = <&pri_mi2s_mclk_default &sec_mi2s_default>;
427+
pinctrl-1 = <&pri_mi2s_mclk_sleep &sec_mi2s_sleep>;
428+
429+
model = "bq-piccolo";
430+
widgets =
431+
"Speaker", "Speaker",
432+
"Headphone", "Headphones";
433+
pin-switches = "Speaker";
434+
/*audio-routing =
435+
"IN1AL", "MICBIAS1",
436+
"IN1AR", "MICBIAS1",
437+
"IN2A", "MICBIAS2";*/
438+
439+
status = "okay";
440+
441+
/delete-node/ backend1-dai-link;
442+
};
443+
444+
&sound_link_backend0 {
445+
/* Primary MI2S is not used, replace with Quaternary MI2S */
446+
link-name = "Quaternary MI2S";
447+
448+
cpu {
449+
sound-dai = <&q6afedai QUATERNARY_MI2S_RX>;
450+
};
451+
platform {
452+
sound-dai = <&q6routing>;
453+
};
454+
codec {
455+
sound-dai = <&speaker_codec 0>;
456+
};
332457
};
333458

334459
&usb {
@@ -353,6 +478,17 @@
353478
status = "okay";
354479
};
355480

481+
&lpass_codec {
482+
status = "disabled";
483+
};
484+
485+
&pm8916_codec {
486+
qcom,micbias-lvl = <2800>;
487+
qcom,mbhc-vthreshold-low = <25 50 75 112 137>;
488+
qcom,mbhc-vthreshold-high = <25 50 75 112 137>;
489+
//qcom,hphl-jack-type-normally-open;
490+
};
491+
356492
&tlmm {
357493
button_backlight_default: button-backlight-default-state {
358494
pins = "gpio17";
@@ -458,4 +594,77 @@
458594
drive-strength = <2>;
459595
output-high;
460596
};
597+
598+
speaker_codec_reset_default: speaker-codec-reset-default-state {
599+
pins = "gpio120";
600+
function = "ldo_update";
601+
602+
drive-strength = <6>;
603+
bias-pull-up;
604+
};
605+
606+
speaker_codec_reset_sleep: speaker-codec-reset-sleep-state {
607+
pins = "gpio120";
608+
function = "ldo_update";
609+
610+
drive-strength = <2>;
611+
bias-pull-down;
612+
};
613+
614+
speaker_codec_default: speaker-codec-default-state { // ldo_enable
615+
pins = "gpio28";
616+
function = "gpio";
617+
drive-strength = <6>;
618+
bias-pull-up;
619+
};
620+
621+
speaker_codec_sleep: speaker-codec-sleep-state { // ldo_enable
622+
pins = "gpio28";
623+
function = "gpio";
624+
drive-strength = <2>;
625+
bias-pull-down;
626+
};
627+
/*
628+
speaker_enaldo_default: speaker-ena-ldo-default-state { // ena_ldo
629+
pins = "gpio114";
630+
function = "gpio";
631+
drive-strength = <6>;
632+
bias-pull-up;
633+
};
634+
635+
speaker_enaldo_sleep: speaker-ena-ldo-sleep-state { // ena_ldo
636+
pins = "gpio114";
637+
function = "gpio";
638+
drive-strength = <2>;
639+
bias-pull-down;
640+
};*/
641+
642+
/* wlf_ldospk_pin {
643+
pins = "gpio101";
644+
label = "wlf_speaker_ldo";
645+
646+
wlf_ldospk_active {
647+
drive-strength = <6>;
648+
bias-pull-up;
649+
};
650+
651+
wlf_ldospk_suspend {
652+
drive-strength = <2>;
653+
bias-pull-down;
654+
};
655+
};*/
656+
657+
wlf_int_pin {
658+
/* wolfson codec */
659+
wlf_int_active: wlf-int-active {
660+
pins = "gpio69";
661+
drive-strength = <6>;
662+
bias-pull-up;
663+
};
664+
wlf_int_suspend: wlf-int-suspend {
665+
pins = "gpio69";
666+
drive-strength = <2>;
667+
bias-pull-down;
668+
};
669+
};
461670
};

sound/soc/codecs/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2223,7 +2223,7 @@ config SND_SOC_WM8997
22232223
depends on MFD_WM8997 && MFD_ARIZONA
22242224

22252225
config SND_SOC_WM8998
2226-
tristate
2226+
tristate "Wolfson Microelectronics WM8998 codec driver"
22272227
depends on MFD_WM8998 && MFD_ARIZONA
22282228

22292229
config SND_SOC_WM9081

sound/soc/qcom/apq8016_sbc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ static int apq8016_dai_init(struct snd_soc_pcm_runtime *rtd, int mi2s)
129129

130130
component = codec_dai->component;
131131
/* Set default mclk for internal codec */
132-
rval = snd_soc_component_set_sysclk(component, 0, 0, DEFAULT_MCLK_RATE,
133-
SND_SOC_CLOCK_IN);
134-
if (rval != 0 && rval != -ENOTSUPP) {
135-
dev_warn(card->dev, "Failed to set mclk: %d\n", rval);
136-
return rval;
137-
}
132+
/* rval = snd_soc_component_set_sysclk(component, 0, 0, DEFAULT_MCLK_RATE,*/
133+
/* SND_SOC_CLOCK_IN);*/
134+
/* if (rval != 0 && rval != -ENOTSUPP) {*/
135+
/* dev_warn(card->dev, "Failed to set mclk: %d\n", rval);*/
136+
/* return rval;*/
137+
/* }*/
138138
rval = snd_soc_component_set_jack(component, &pdata->jack, NULL);
139139
if (rval != 0 && rval != -ENOTSUPP) {
140140
dev_warn(card->dev, "Failed to set jack: %d\n", rval);

0 commit comments

Comments
 (0)