Skip to content

Commit 86d8cd2

Browse files
author
André Apitzsch
committed
WIP: bq-piccolo: Add sound support
Signed-off-by: André Apitzsch <[email protected]>
1 parent 36ed5b1 commit 86d8cd2

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

+210-1
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-gpio.h>
1314
#include <dt-bindings/pinctrl/qcom,pmic-mpp.h>
1415

@@ -73,6 +74,26 @@
7374
};
7475
};
7576

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

123144
};
124145

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

@@ -400,7 +492,40 @@
400492
};
401493

402494
&sound {
403-
status = "disabled"; /* TODO */
495+
pinctrl-names = "default", "sleep";
496+
/* pinctrl-0 = <&ext_mclk_tlmm_lines_act &ext_sec_tlmm_lines_act>;*/
497+
/* pinctrl-1 = <&ext_mclk_tlmm_lines_sus &ext_sec_tlmm_lines_sus>;*/
498+
pinctrl-0 = <&pri_mi2s_mclk_default &sec_mi2s_default>;
499+
pinctrl-1 = <&pri_mi2s_mclk_sleep &sec_mi2s_sleep>;
500+
501+
model = "bq-piccolo";
502+
widgets =
503+
"Speaker", "Speaker",
504+
"Headphone", "Headphones";
505+
pin-switches = "Speaker";
506+
audio-routing =
507+
"Speaker IN1AL", "Speaker MICBIAS1",
508+
"Speaker IN1AR", "Speaker MICBIAS1",
509+
"Speaker IN2A", "Speaker MICBIAS2";
510+
511+
status = "okay";
512+
513+
/delete-node/ backend1-dai-link;
514+
};
515+
516+
&sound_link_backend0 {
517+
/* Primary MI2S is not used, replace with Quaternary MI2S */
518+
link-name = "Quaternary MI2S";
519+
520+
cpu {
521+
sound-dai = <&q6afedai QUATERNARY_MI2S_RX>;
522+
};
523+
platform {
524+
sound-dai = <&q6routing>;
525+
};
526+
codec {
527+
sound-dai = <&speaker_codec 0>;
528+
};
404529
};
405530

406531
&usb {
@@ -425,6 +550,17 @@
425550
status = "okay";
426551
};
427552

553+
&lpass {
554+
status = "okay";
555+
};
556+
557+
&pm8916_codec {
558+
qcom,micbias-lvl = <2800>;
559+
qcom,mbhc-vthreshold-low = <25 50 75 112 137>;
560+
qcom,mbhc-vthreshold-high = <25 50 75 112 137>;
561+
//qcom,hphl-jack-type-normally-open;
562+
};
563+
428564
&tlmm {
429565
button_backlight_default: button-backlight-default-state {
430566
pins = "gpio17";
@@ -537,4 +673,77 @@
537673
drive-strength = <2>;
538674
output-high;
539675
};
676+
677+
speaker_codec_reset_default: speaker-codec-reset-default-state {
678+
pins = "gpio120";
679+
function = "ldo_update";
680+
681+
drive-strength = <6>;
682+
bias-pull-up;
683+
};
684+
685+
speaker_codec_reset_sleep: speaker-codec-reset-sleep-state {
686+
pins = "gpio120";
687+
function = "ldo_update";
688+
689+
drive-strength = <2>;
690+
bias-pull-down;
691+
};
692+
693+
speaker_codec_default: speaker-codec-default-state { // ldo_enable
694+
pins = "gpio28";
695+
function = "gpio";
696+
drive-strength = <6>;
697+
bias-pull-up;
698+
};
699+
700+
speaker_codec_sleep: speaker-codec-sleep-state { // ldo_enable
701+
pins = "gpio28";
702+
function = "gpio";
703+
drive-strength = <2>;
704+
bias-pull-down;
705+
};
706+
/*
707+
speaker_enaldo_default: speaker-ena-ldo-default-state { // ena_ldo
708+
pins = "gpio114";
709+
function = "gpio";
710+
drive-strength = <6>;
711+
bias-pull-up;
712+
};
713+
714+
speaker_enaldo_sleep: speaker-ena-ldo-sleep-state { // ena_ldo
715+
pins = "gpio114";
716+
function = "gpio";
717+
drive-strength = <2>;
718+
bias-pull-down;
719+
};*/
720+
721+
/* wlf_ldospk_pin {
722+
pins = "gpio101";
723+
label = "wlf_speaker_ldo";
724+
725+
wlf_ldospk_active {
726+
drive-strength = <6>;
727+
bias-pull-up;
728+
};
729+
730+
wlf_ldospk_suspend {
731+
drive-strength = <2>;
732+
bias-pull-down;
733+
};
734+
};*/
735+
736+
wlf_int_pin {
737+
/* wolfson codec */
738+
wlf_int_active: wlf-int-active {
739+
pins = "gpio69";
740+
drive-strength = <6>;
741+
bias-pull-up;
742+
};
743+
wlf_int_suspend: wlf-int-suspend {
744+
pins = "gpio69";
745+
drive-strength = <2>;
746+
bias-pull-down;
747+
};
748+
};
540749
};

sound/soc/codecs/Kconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -2466,7 +2466,7 @@ config SND_SOC_WM8997
24662466
depends on MFD_WM8997 && MFD_ARIZONA
24672467

24682468
config SND_SOC_WM8998
2469-
tristate
2469+
tristate "Wolfson Microelectronics WM8998 codec driver"
24702470
depends on MFD_WM8998 && MFD_ARIZONA
24712471

24722472
config SND_SOC_WM9081

sound/soc/qcom/apq8016_sbc.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ static int apq8016_dai_init(struct snd_soc_pcm_runtime *rtd, int mi2s)
130130

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

0 commit comments

Comments
 (0)