Skip to content

Commit 796e67a

Browse files
author
André Apitzsch
committed
WIP: bq-piccolo: Add sound support
Signed-off-by: André Apitzsch <[email protected]>
1 parent 0ad259c commit 796e67a

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

@@ -380,7 +472,40 @@
380472
};
381473

382474
&sound {
383-
status = "disabled"; /* TODO */
475+
pinctrl-names = "default", "sleep";
476+
/* pinctrl-0 = <&ext_mclk_tlmm_lines_act &ext_sec_tlmm_lines_act>;*/
477+
/* pinctrl-1 = <&ext_mclk_tlmm_lines_sus &ext_sec_tlmm_lines_sus>;*/
478+
pinctrl-0 = <&pri_mi2s_mclk_default &sec_mi2s_default>;
479+
pinctrl-1 = <&pri_mi2s_mclk_sleep &sec_mi2s_sleep>;
480+
481+
model = "bq-piccolo";
482+
widgets =
483+
"Speaker", "Speaker",
484+
"Headphone", "Headphones";
485+
pin-switches = "Speaker";
486+
/*audio-routing =
487+
"IN1AL", "MICBIAS1",
488+
"IN1AR", "MICBIAS1",
489+
"IN2A", "MICBIAS2";*/
490+
491+
status = "okay";
492+
493+
/delete-node/ backend1-dai-link;
494+
};
495+
496+
&sound_link_backend0 {
497+
/* Primary MI2S is not used, replace with Quaternary MI2S */
498+
link-name = "Quaternary MI2S";
499+
500+
cpu {
501+
sound-dai = <&q6afedai QUATERNARY_MI2S_RX>;
502+
};
503+
platform {
504+
sound-dai = <&q6routing>;
505+
};
506+
codec {
507+
sound-dai = <&speaker_codec 0>;
508+
};
384509
};
385510

386511
&usb {
@@ -405,6 +530,17 @@
405530
status = "okay";
406531
};
407532

533+
&lpass_codec {
534+
status = "disabled";
535+
};
536+
537+
&pm8916_codec {
538+
qcom,micbias-lvl = <2800>;
539+
qcom,mbhc-vthreshold-low = <25 50 75 112 137>;
540+
qcom,mbhc-vthreshold-high = <25 50 75 112 137>;
541+
//qcom,hphl-jack-type-normally-open;
542+
};
543+
408544
&tlmm {
409545
button_backlight_default: button-backlight-default-state {
410546
pins = "gpio17";
@@ -510,4 +646,77 @@
510646
drive-strength = <2>;
511647
output-high;
512648
};
649+
650+
speaker_codec_reset_default: speaker-codec-reset-default-state {
651+
pins = "gpio120";
652+
function = "ldo_update";
653+
654+
drive-strength = <6>;
655+
bias-pull-up;
656+
};
657+
658+
speaker_codec_reset_sleep: speaker-codec-reset-sleep-state {
659+
pins = "gpio120";
660+
function = "ldo_update";
661+
662+
drive-strength = <2>;
663+
bias-pull-down;
664+
};
665+
666+
speaker_codec_default: speaker-codec-default-state { // ldo_enable
667+
pins = "gpio28";
668+
function = "gpio";
669+
drive-strength = <6>;
670+
bias-pull-up;
671+
};
672+
673+
speaker_codec_sleep: speaker-codec-sleep-state { // ldo_enable
674+
pins = "gpio28";
675+
function = "gpio";
676+
drive-strength = <2>;
677+
bias-pull-down;
678+
};
679+
/*
680+
speaker_enaldo_default: speaker-ena-ldo-default-state { // ena_ldo
681+
pins = "gpio114";
682+
function = "gpio";
683+
drive-strength = <6>;
684+
bias-pull-up;
685+
};
686+
687+
speaker_enaldo_sleep: speaker-ena-ldo-sleep-state { // ena_ldo
688+
pins = "gpio114";
689+
function = "gpio";
690+
drive-strength = <2>;
691+
bias-pull-down;
692+
};*/
693+
694+
/* wlf_ldospk_pin {
695+
pins = "gpio101";
696+
label = "wlf_speaker_ldo";
697+
698+
wlf_ldospk_active {
699+
drive-strength = <6>;
700+
bias-pull-up;
701+
};
702+
703+
wlf_ldospk_suspend {
704+
drive-strength = <2>;
705+
bias-pull-down;
706+
};
707+
};*/
708+
709+
wlf_int_pin {
710+
/* wolfson codec */
711+
wlf_int_active: wlf-int-active {
712+
pins = "gpio69";
713+
drive-strength = <6>;
714+
bias-pull-up;
715+
};
716+
wlf_int_suspend: wlf-int-suspend {
717+
pins = "gpio69";
718+
drive-strength = <2>;
719+
bias-pull-down;
720+
};
721+
};
513722
};

sound/soc/codecs/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2344,7 +2344,7 @@ config SND_SOC_WM8997
23442344
depends on MFD_WM8997 && MFD_ARIZONA
23452345

23462346
config SND_SOC_WM8998
2347-
tristate
2347+
tristate "Wolfson Microelectronics WM8998 codec driver"
23482348
depends on MFD_WM8998 && MFD_ARIZONA
23492349

23502350
config SND_SOC_WM9081

sound/soc/qcom/apq8016_sbc.c

Lines changed: 6 additions & 6 deletions
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)