Skip to content

Commit 2c6a6e4

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

File tree

3 files changed

+221
-7
lines changed

3 files changed

+221
-7
lines changed

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

Lines changed: 214 additions & 0 deletions
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

@@ -327,6 +419,42 @@
327419
status = "okay";
328420
};
329421

422+
&sound {
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+
442+
&sound_dai_primary {
443+
status = "disabled";
444+
};
445+
446+
&sound_dai_tertiary {
447+
status = "disabled";
448+
};
449+
450+
&sound_dai_quaternary {
451+
status = "okay";
452+
453+
codec {
454+
sound-dai = <&speaker_codec 0>;
455+
};
456+
};
457+
330458
&usb {
331459
extcon = <&charger>, <&usb_id>;
332460
vbus-supply = <&usb_otg_vbus>;
@@ -349,6 +477,19 @@
349477
status = "okay";
350478
};
351479

480+
&lpass_codec {
481+
status = "disabled";
482+
};
483+
484+
&pm8916_codec {
485+
status = "disabled";
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+
};
492+
352493
&tlmm {
353494
button_backlight_default: button-backlight-default-state {
354495
pins = "gpio17";
@@ -454,4 +595,77 @@
454595
drive-strength = <2>;
455596
output-high;
456597
};
598+
599+
speaker_codec_reset_default: speaker-codec-reset-default-state {
600+
pins = "gpio120";
601+
function = "ldo_update";
602+
603+
drive-strength = <6>;
604+
bias-pull-up;
605+
};
606+
607+
speaker_codec_reset_sleep: speaker-codec-reset-sleep-state {
608+
pins = "gpio120";
609+
function = "ldo_update";
610+
611+
drive-strength = <2>;
612+
bias-pull-down;
613+
};
614+
615+
speaker_codec_default: speaker-codec-default-state { // ldo_enable
616+
pins = "gpio28";
617+
function = "gpio";
618+
drive-strength = <6>;
619+
bias-pull-up;
620+
};
621+
622+
speaker_codec_sleep: speaker-codec-sleep-state { // ldo_enable
623+
pins = "gpio28";
624+
function = "gpio";
625+
drive-strength = <2>;
626+
bias-pull-down;
627+
};
628+
/*
629+
speaker_enaldo_default: speaker-ena-ldo-default-state { // ena_ldo
630+
pins = "gpio114";
631+
function = "gpio";
632+
drive-strength = <6>;
633+
bias-pull-up;
634+
};
635+
636+
speaker_enaldo_sleep: speaker-ena-ldo-sleep-state { // ena_ldo
637+
pins = "gpio114";
638+
function = "gpio";
639+
drive-strength = <2>;
640+
bias-pull-down;
641+
};*/
642+
643+
/* wlf_ldospk_pin {
644+
pins = "gpio101";
645+
label = "wlf_speaker_ldo";
646+
647+
wlf_ldospk_active {
648+
drive-strength = <6>;
649+
bias-pull-up;
650+
};
651+
652+
wlf_ldospk_suspend {
653+
drive-strength = <2>;
654+
bias-pull-down;
655+
};
656+
};*/
657+
658+
wlf_int_pin {
659+
/* wolfson codec */
660+
wlf_int_active: wlf-int-active {
661+
pins = "gpio69";
662+
drive-strength = <6>;
663+
bias-pull-up;
664+
};
665+
wlf_int_suspend: wlf-int-suspend {
666+
pins = "gpio69";
667+
drive-strength = <2>;
668+
bias-pull-down;
669+
};
670+
};
457671
};

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)