Professional Documents
Culture Documents
80-P8754-50 B
February 24, 2017
NO PUBLIC DISCLOSURE PERMITTED: Please report postings of this document on public servers or websites to:
DocCtrlAgent@qualcomm.com.
Restricted Distribution: Not to be distributed to anyone who is not an employee of either Qualcomm Technologies, Inc. or its
affiliated companies without the express approval of Qualcomm Configuration Management.
Not to be used, copied, reproduced, or modified in whole or in part, nor its contents revealed in any manner to others without the
express written permission of Qualcomm Technologies, Inc.
Qualcomm and QXDM Professional are trademarks of Qualcomm Incorporated, registered in the United States and other countries.
Other product and brand names may be trademarks or registered trademarks of their respective owners.
This technical data may be subject to U.S. and international export, re-export, or transfer (“export”) laws. Diversion contrary to U.S.
and international law is strictly prohibited.
1 Introduction...................................................................................................... 6
1.1 Purpose.......................................................................................................................... 6
1.2 Conventions .................................................................................................................. 6
1.3 Technical assistance ...................................................................................................... 6
A References..................................................................................................... 32
A.1 Related documents ..................................................................................................... 32
A.2 Acronyms and terms .................................................................................................. 32
Figures
Figure 2-1 Audio bringup workflow ............................................................................................................ 8
Figure 3-1 Audio bringup workflow with external codec.......................................................................... 23
Tables
Table 2-1 SDM660/SDM630 GPIOs ......................................................................................................... 13
Table 3-1 SDM660/SDM630 GPIOs for external codec ........................................................................... 27
1.1 Purpose
This document describes how to bring up the audio modules on the SDM660/SDM630 chipset
Android platform.
1.2 Conventions
Function declarations, function names, type declarations, attributes, and code samples appear in a
different font, for example, #include.
Code variables appear in angle brackets, for example, <number>.
Commands to be entered appear in a different font, for example, copy a:*.* b:.
If you are viewing this document using a color monitor, or if you print this document to a color
printer, red boldface indicates code that is to be added, and blue strikethrough indicates code
that is to be replaced or removed.
Shading indicates content that has been added or changed in this revision of the document.
NOTE: This chapter describes the changes required for bringup with internal codec in the SDM660
chipset dtsi files. The dtsi files for SDM630 chipset follow a similar naming convention.
2.1 Prerequisites
1. Complete the audio hardware schematic review with QTI Customer Engineering (CE)
hardware team.
a. Follow the audio hardware schematic review checklist.
b. Initiate a hardware design review through Salesforce with a new case through New Case
> Record Type of new Record > Design Review.
2. Ensure that all hardware design review comments are implemented.
Step1:
Verify if ADSP is initialized
Design Phase start successfully
Step2:
Verify if sound card is
registered
CE review HW YES
design
Step3
NO Verify codec registration
80-P7747-5C
QCT HW CE team
share review
comments Step4
Verify Tx (capture) &
Rx(render) audio endpoints in
HW configuration
NO
1. Verify all SW changes have been
implemented correctly
2. Without this speaker/3rd party DAC
Step6: will not be functional
Verify all audio render and
capture paths
End of
functionality test
The following (similar) messages in bootup log signifies that proper DT file, sdm660-internal-
codec- -mtp.dts is picked.
Machine: Qualcomm Technologies, Inc. SDM 660 PM660 + PM660L Int. Audio
Codec CDP
Files applicable for AMOLED display:
sdm660-internal-codec-pm660a-mtp.dts
sdm660-internal-codec-pm660a-cdp.dts
Files applicable for normal LCD panel:
sdm660-internal-codec-mtp.dts
sdm660-internal-codec-cdp.dts
2.4 Verify that the PIL has loaded the DSP successfully
Locate the following log marker, which indicates that the PIL, has loaded the aDSP image
successfully:
subsys-pil-tz 15700000.qcom,lpass: adsp: loading from 0x0000000092a00000 to
0x0000000094800000
subsys-pil-tz 15700000.qcom,lpass: adsp: Brought out of reset
apr_tal_link_state_cb: edge[lpass] link state[0]
subsys-pil-tz 15700000.qcom,lpass: Subsystem error monitoring/handling
services are up
subsys-pil-tz 15700000.qcom,lpass: adsp: Power/Clock ready interrupt
received
NOTE: If this message is not present in the bootup log, either the aDSP image is not loaded or the DSP
has crashed.
write /sys/kernel/boot_adsp/boot 1
Usually, the aDSP image is loaded statically. The aDSP images require proper configuration in
the source code for accurately loading into the RAM.
CONFIG_MSM_ADSP_LOADER=y
config MSM_ADSP_LOADER
tristate "ADSP loader support"
selec t SND_SOC_MSM_APRV2_INTF
depends on MSM_QDSP6_APRV2|| MSM_QDSP6_APRV3 || \
MSM_QDSP6_APRV2_GLINK || MSM_QDSP6_APRV3_GLINKhelp
Enable ADSP image loader.
The ADSP loader brings ADSP out of reset
for the platforms that use APRv2.
Say M if you want to enable this module.
--- a/arch/arm/boot/dts/qcom/msm-audio.dtsi
+++ b/arch/arm/boot/dts/qcom/msm-audio.dtsi
status = "disabled";
compatible = "qcom,sdm660-asoc-snd";
qcom,model = "sdm660-snd-card";
+ qcom,wsa-disable;
qcom,wcn-btfm;
qcom,mi2s-audio-intf;
qcom,auxpcm-audio-intf;
NOTE: WSA speaker amp is enabled by default with internal codec configuration.
adb root
adb shell
cat /proc/asound/cards
qcom,msm-hs-micbias-type = "external";
"MIC BIAS External2", "Headset Mic",
"AMIC2", "MIC BIAS External2",
qcom,msm-hs-micbias-type = "internal";
"MIC BIAS Internal2", "Headset Mic",
"AMIC2", "MIC BIAS Internal2",
int_codec: sound {
…
qcom,msm-mbhc-hphl-swh = <0>;
qcom,msm-mbhc-gnd-swh = <0>;
…
qcom, msm-micbias1-ext-cap
Add the following command to the dtsi file if the headset has CAP.
qcom,msm-micbias2-ext-cap
Add both the commands if the headset and handset have CAP.
2.8.5 MCLK
The MSM™ chipset drives the master clock needed by the codec. The MCLK clock frequency
and the source of the clock are defined in the device tree. Based on the external codec and
external speaker amp requirements, the MCLK frequency is modified.
To modify the MCLK frequency, change the kernel/arch/arm/boot/dts/msm-audio.dtsi file as
follows:
int_codec: sound {
…
qcom,msm-mclk-freq = <9600000>;
Refer to SDM660 Device Specification (Advance Information) (80-P7747-1) and SDM630 Device
Specification (Advance Information) (80-P7865-1) for detailed information about audio GPIOs.
NOTE: Ensure that the following audio specific GPIOs are defined in the dtsi file
and the GPIO numbers are according to the MSM GPIO layout. The use cases in the machine
driver file determine the GPIO configurations.
config {
cdc_pdm_gpios_sleep: cdc_pdm_gpios_sleep {
mux {
pins = "gpio18", "gpio19",
"gpio20", "gpio21",
"gpio23", "gpio25";
function = "func1";
};
config {
pins = "gpio18", "gpio19",
"gpio20", "gpio21",
"gpio23", "gpio25";
drive-strength = <2>;
};
};
cdc_comp_gpios_active: cdc_pdm_comp_gpios_active {
mux {
pins = "gpio22", "gpio24";
function = "func1";
};
config {
pins = "gpio22", "gpio24";
drive-strength = <8>;
};
};
cdc_comp_gpios_sleep: cdc_pdm_comp_gpios_sleep {
mux {
pins = "gpio22", "gpio24";
function = "func1";
};
config {
pins = "gpio22", "gpio24";
drive-strength = <2>;
bias-disable;
};
};
tinycap /data/rec.wav
3. Disable sequence:
3. Disable sequence:
tinymix 'MultiMedia1 Mixer INT3_MI2S_TX' 0
tinymix 'DEC1 MUX' 'ZERO'
tinymix 'ADC2 MUX' 'ZERO'
3. Disable sequence:
tinymix 'MultiMedia1 Mixer INT3_MI2S_TX' 0
tinymix 'DEC1 MUX' 'ZERO'
tinymix 'ADC2 MUX' 'ZERO'
tinymix 'IIR1 INP1 MUX' 'ZERO'
3. Disable sequence:
tinymix 'MultiMedia1 Mixer INT3_MI2S_TX' 0
tinymix 'DEC1 MUX' 'ZERO'
d. The unique session ID for a VoLTE/voice call is passed from QCRIL to the audio layer
by calling AudioSystem::setParameters(). Eventually, the control flows through the APIs.
e. update_calls() function – Starts call (start_call()), stops call (stop_call()), to put call on
hold and update call states for the particular call session for which session ID is passed to
it.
f. start_call() function – Sets up the hostless PCM playback and capture sessions for the use
case passed to it.
g. stop_call() function – Is used to tear down the hostless PCM playback and capture
sessions for the use case passed to it.
h. The mixer controls for setting up the data path in the DSP for a voice/VoLTE call –
Listed in device/qcom/<chipset>/mixer_paths.xml.
i. enable_audio_route() function – Sets the mixer controls for voice/VoLTE use cases. The
mixer controls for VoLTE invoke functions in the kernel, which in turn sends commands
to the DSP to set up the data path.
j. Commands to the DSP for managing the voice/VoLTE session – Sent by the voice driver,
implemented in the msm-pcm-voice-v2.c file in the kernel.
k. Default VoLTE voice or default modem voice strings – Passed within the command
payload sent from APSS to the DSP voice module. The strings indicate whether the
commands are specific for a voice/VoLTE session.
To get the QXDM Professional log with the required log mask, use QCATs vocoder playback
function to play vocoder packets and PCM separately. The following voice quality issues may be
present.
1. Rx path vocoder packet is OK but the PCM is not – Verify the voice Rx tuning parameters
2. Tx path PCM is OK but the vocoder packet is not – Verify the voice Tx tuning parameters.
3. Rx path vocoder packet is not OK – Input from protocol layer may not be correct. Check for a
CRC error. If no error is present, it could be a network issue.
4. Tx path vocoder packet is OK but noise is still heard on the far end – Check the vocoder input
voice samples. If the noise is present in the vocoder input, it could be a network issue.
5. Mute on Rx or Tx path – Caused due to device issues. Ensure that the codec widgets of the
device are correctly connected. Check if the gain is muted or not. Voice quality issues also
occur due to the vocoder packets and PCM playback.
2.11.8 MBHC
The codec driver detects headset insertion/removal and button press/release events using adb
shell. To verify, check the headset and button jacks created in MBHC driver
(wcd-mbhc-v2.c) by calling snd_soc_jack_new(). Event numbers are found in the kernel logs (X
indicates the button-jack input event number and Y indicates the headset-jack input event
number).
If the headset is inserted, the following messages are displayed in the adb shell window:
If the headset is removed the following messages are displayed in the adb shell window:
The headset inserted or removed events are present in kernel logs too. Locate reporting insertion
or reporting removal in the log. Reporting insertion 1 indicates a headphone with no microphone.
Reporting insertion 3 indicates a headset with a microphone.
If the headset button is pressed, the following messages are displayed in the adb shell window:
If the headset button is released, the following messages are displayed in the adb shell window:
Headset button press or release events are also present in the kernel logs. Locate button pressed
or button released. To enable kernel MBHC debugging logs, run the following adb commands:
NOTE: This chapter describes the changes required for bringup with external codec in the SDM660
chipset dtsi files. The dtsi files for SDM630 chipset follow a similar naming convention.
The audio bringup process with external codec consists of the following steps:
1. Verify if proper DT (Device Tree) file is picked up – See Section 3.3
2. Verify that the PIL has successfully loaded the DSP – See Section 3.4
3. Verify that the sound card is registered – See Section 3.5
4. Verify the codec registration – See Section 3.6
5. Verify the hardware design with the standard QTI reference schematics and make the
appropriate software changes – See Section 3.7
6. Provide guidelines to modify the software when external audio components are integrated –
See Section 3.8
7. Verify audio-specific GPIO configurations – See Section 3.9
8. Verify the audio paths – See Section 3.10
3.1 Prerequisite
1. Complete the audio hardware schematic review with QTI Customer Engineering (CE)
hardware team.
a. Follow the audio hardware schematic review checklist.
b. Initiate a hardware design review through Salesforce with a new case through New Case
> Record Type of new Record > Design Review.
2. Ensure that all hardware design review comments are implemented.
Step1:
Verify if ADSP is initialized
Design Phase start successfully
Step2:
Verify if sound card is
registered
CE review HW YES
design
Step3
NO Verify codec registration
80-P7747-5C
QCT HW CE team
share review
comments Step4
Verify Tx (capture) &
Rx(render) audio endpoints in
HW configuration
All HW changes
implemented
Step5: Step5.1:
Verify audio specific GPIOs for Integrating external MI2S device
external I2S device(if any) 80-P8754-41
NO
1. Verify all SW changes have been
implemented correctly
2. Without this speaker/3rd party DAC
Step6: will not be functional
Verify all audio render and
capture paths
End of
functionality test
NOTE: If this message is not present in the bootup log, either the aDSP image is not loaded or the DSP
has crashed.
write /sys/kernel/boot_adsp/boot 1
Usually, the aDSP image is loaded statically. The aDSP images require proper configuration in
the source code for accurately loading into the RAM.
3. Locate the CONFIG_MSM_ADSP_LOADER configuration macro in /kernel/msm-
4.4/arch/arm/ configs/msm_defconfig.
CONFIG_MSM_ADSP_LOADER=y
config MSM_ADSP_LOADER
tristate "ADSP loader support"
select SND_SOC_MSM_APRV2_INTF
depends on MSM_QDSP6_APRV2|| MSM_QDSP6_APRV3 || \
MSM_QDSP6_APRV2_GLINK || MSM_QDSP6_APRV3_GLINK
help
Enable ADSP image loader.
adb root
adb shell
cat /proc/asound/cards
2. Ensure that an entry with sound card name “sdm660-tavil-snd-card” is present for WCD9341.
wsa881x_0211: wsa881x@20170211 {
compatible = "qcom,wsa881x";
reg = <0x0 0x20170211>;
qcom,spkr-sd-n-node = <&wsa_spkr_wcd_sd1>;
};
wsa881x_0212: wsa881x@20170212 {
compatible = "qcom,wsa881x";
reg = <0x0 0x20170212>;
qcom,spkr-sd-n-node = <&wsa_spkr_wcd_sd2>;
};
wsa881x_0213: wsa881x@21170213 {
compatible = "qcom,wsa881x";
reg = <0x0 0x21170213>;
qcom,spkr-sd-n-node = <&wsa_spkr_wcd_sd1>;
};
wsa881x_0214: wsa881x@21170214 {
compatible = "qcom,wsa881x";
reg = <0x0 0x21170214>;
qcom,spkr-sd-n-node = <&wsa_spkr_wcd_sd2>;
};
};
};
};
The swr_master has four WSA entries. They are applicable if stereo WSA speakers are connected
to the WCD external codec via PDM interface. For mono WSA speaker, add two WSA entries
inside the swr_master node based on WSA chip ID ((reg = <0x00 0x20170211> and reg = <0x00
0x20170212) OR (reg = <0x00 0x21170213> and reg = <0x00 0x21170214>))
sound {
…
qcom,msm-mbhc-hphl-swh = <0>;
qcom,msm-mbhc-gnd-swh = <0>;
…
3.7.6 MCLK
The MSM drives the master clock needed by the codec. The MCLK clock frequency and the
source of the clock are defined in the device tree. Based on the external codec and external
speaker amp requirements, the MCLK frequency is modified.
To modify the MCLK frequency, change the kernel/arch/arm/boot/dts/msm-audio.dtsi file as
follows:
tavil_snd: sound-tavil{
……………………………………………………………………………,
……………………………………………………………………………,
qcom,msm-mclk-freq = <9600000>;
……………………………………………………………………………
spkr_1_wcd_en_active {
mux {
pins = "gpio2";
};
config {
pins = "gpio2";
output-high;
};
};
spkr_1_wcd_en_sleep: spkr_1_wcd_en_sleep {
mux {
pins = "gpio2";
};
config {
pins = "gpio2";
input-enable;
};
};
spkr_2_wcd_en_active: spkr_2_sd_n_active {
mux {
pins = "gpio3";
};
config {
pins = "gpio3";
output-high;
};
};
spkr_2_wcd_en_sleep: spkr_2_sd_n_sleep {
mux {
pins = "gpio3";
};
config {
pins = "gpio3";
input-enable;
};
};