Hello,
We are trying to utilze HFP on our custom board with i.MX8MP, TLV320AIC3100 audio codec and AW-CM358 wifi-bt module with NXP 88W8987.
We can utilize A2DP when both our custom board as sink and source. We've tested our mic which is working we are able to record audio with it.
We can utilize calls via ofono, however we can't receive or transmit any sound for HFP. Here is our card info and loopback modules for pulseaudio:
Card #0
Name: alsa_card.platform-sound-bt-sco
Driver: module-alsa-card.c
Owner Module: 6
Properties:
alsa.card = "1"
alsa.card_name = "bt-sco-audio"
alsa.long_card_name = "bt-sco-audio"
device.bus_path = "platform-sound-bt-sco"
sysfs.path = "/devices/platform/sound-bt-sco/sound/card1"
device.form_factor = "internal"
device.string = "1"
device.description = "Built-in Audio"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card"
Profiles:
input:mono-fallback: Mono Input (sinks: 0, sources: 1, priority: 1, available: yes)
output:mono-fallback: Mono Output (sinks: 1, sources: 0, priority: 100, available: yes)
output:mono-fallback+input:mono-fallback: Mono Output + Mono Input (sinks: 1, sources: 1, priority: 101, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: output:mono-fallback+input:mono-fallback
Ports:
analog-input: Analog Input (type: Analog, priority: 10000, latency offset: 0 usec, availability unknown)
Part of profile(s): input:mono-fallback, output:mono-fallback+input:mono-fallback
analog-output: Analog Output (type: Analog, priority: 9900, latency offset: 0 usec, availability unknown)
Part of profile(s): output:mono-fallback, output:mono-fallback+input:mono-fallback
Card #1
Name: alsa_card.platform-sound-tlv320aic31xx
Driver: module-alsa-card.c
Owner Module: 7
Properties:
alsa.card = "0"
alsa.card_name = "tlv320aic31xx-Codec"
alsa.long_card_name = "tlv320aic31xx-Codec"
device.bus_path = "platform-sound-tlv320aic31xx"
sysfs.path = "/devices/platform/sound-tlv320aic31xx/sound/card0"
device.form_factor = "internal"
device.string = "0"
device.description = "Built-in Audio"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card"
Profiles:
input:stereo-fallback: Stereo Input (sinks: 0, sources: 1, priority: 51, available: yes)
output:stereo-fallback: Stereo Output (sinks: 1, sources: 0, priority: 5100, available: yes)
output:stereo-fallback+input:stereo-fallback: Stereo Output + Stereo Input (sinks: 1, sources: 1, priority: 5151, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: output:stereo-fallback+input:stereo-fallback
Ports:
analog-input: Analog Input (type: Analog, priority: 10000, latency offset: 0 usec, availability unknown)
Part of profile(s): input:stereo-fallback, output:stereo-fallback+input:stereo-fallback
analog-output-speaker: Speakers (type: Speaker, priority: 10000, latency offset: 0 usec, availability unknown)
Properties:
device.icon_name = "audio-speakers"
Part of profile(s): output:stereo-fallback, output:stereo-fallback+input:stereo-fallback
Card #3
Name: bluez_card.DC_C4_9C_37_BB_0D
Driver: module-bluez5-device.c
Owner Module: 31
Properties:
device.description = "Gencay adlı kişiye ait S24"
device.string = "DC:C4:9C:37:BB:0D"
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
device.form_factor = "phone"
bluez.path = "/org/bluez/hci0/dev_DC_C4_9C_37_BB_0D"
bluez.class = "0x5a020c"
bluez.alias = "Gencay adlı kişiye ait S24"
device.icon_name = "audio-card-bluetooth"
bluetooth.codec = "mSBC"
Profiles:
a2dp_source: High Fidelity Capture (A2DP Source) (sinks: 0, sources: 1, priority: 20, available: yes)
headset_audio_gateway: Headset Audio Gateway (HSP) (sinks: 1, sources: 1, priority: 10, available: no)
handsfree_audio_gateway: Handsfree Audio Gateway (HFP) (sinks: 1, sources: 1, priority: 10, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: handsfree_audio_gateway
Ports:
phone-output: Phone (type: Phone, priority: 0, latency offset: 0 usec, availability unknown)
Part of profile(s): headset_audio_gateway, handsfree_audio_gateway
phone-input: Phone (type: Phone, priority: 0, latency offset: 0 usec, availability unknown)
Part of profile(s): a2dp_source, headset_audio_gateway, handsfree_audio_gateway
root@imx8mp-lpddr4-evk:/# pactl list sinks short
0 alsa_output.platform-sound-bt-sco.mono-fallback module-alsa-card.c s16le 1ch 16000Hz RUNNING
1 alsa_output.platform-sound-tlv320aic31xx.stereo-fallback module-alsa-card.c s16le 2ch 48000Hz RUNNING
6 bluez_sink.DC_C4_9C_37_BB_0D.handsfree_audio_gateway module-bluez5-device.c s16le 1ch 16000Hz SUSPENDED
root@imx8mp-lpddr4-evk:/# pactl list sources short
0 alsa_output.platform-sound-bt-sco.mono-fallback.monitor module-alsa-card.c s16le 1ch 16000Hz IDLE
1 alsa_input.platform-sound-bt-sco.mono-fallback module-alsa-card.c s16le 1ch 16000Hz RUNNING
2 alsa_output.platform-sound-tlv320aic31xx.stereo-fallback.monitor module-alsa-card.c s16le 2ch 48000Hz IDLE
3 alsa_input.platform-sound-tlv320aic31xx.stereo-fallback module-alsa-card.c s16le 2ch 48000Hz RUNNING
15 bluez_sink.DC_C4_9C_37_BB_0D.handsfree_audio_gateway.monitor module-bluez5-device.c s16le 1ch 16000Hz IDLE
16 bluez_source.DC_C4_9C_37_BB_0D.handsfree_audio_gateway module-bluez5-device.c s16le 1ch 16000Hz SUSPENDED
root@imx8mp-lpddr4-evk:/# pactl list modules short
0 module-device-restore
1 module-stream-restore
2 module-card-restore
3 module-augment-properties
4 module-switch-on-port-available
5 module-udev-detect tsched=0
6 module-alsa-card device_id="1" name="platform-sound-bt-sco" card_name="alsa_card.platform-sound-bt-sco" namereg_fail=false tsched=no fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1"
7 module-alsa-card device_id="0" name="platform-sound-tlv320aic31xx" card_name="alsa_card.platform-sound-tlv320aic31xx" namereg_fail=false tsched=no fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1"
8 module-bluetooth-policy
9 module-bluetooth-discover headset=auto
10 module-bluez5-discover headset=auto
11 module-native-protocol-unix
12 module-default-device-restore
14 module-always-sink
15 module-intended-roles
16 module-suspend-on-idle
17 module-position-event-sounds
18 module-role-cork
19 module-filter-heuristics
20 module-filter-apply
31 module-bluez5-device path=/org/bluez/hci0/dev_DC_C4_9C_37_BB_0D autodetect_mtu=0 output_rate_refresh_interval_ms=500 avrcp_absolute_volume=1
35 module-loopback source=alsa_input.platform-sound-tlv320aic31xx.stereo-fallback sink=alsa_output.platform-sound-bt-sco.mono-fallback latency_msec=20
36 module-loopback source=alsa_input.platform-sound-bt-sco.mono-fallback sink=alsa_output.platform-sound-tlv320aic31xx.stereo-fallback latency_msec=20
42 module-loopback sink="bluez_sink.DC_C4_9C_37_BB_0D.handsfree_audio_gateway" sink_dont_move="true" source_output_properties="media.role=phone"
43 module-loopback source="bluez_source.DC_C4_9C_37_BB_0D.handsfree_audio_gateway" source_dont_move="true" sink_input_properties="media.role=phone"
We've adjusted hci command w.r.t UM11490 like below:
# 1. Enable PCM Line Management by the Host
hcitool -i hci0 cmd 0x3F 0x0070 0x01
# 2. Set SCO Voice Data Path Through PCM Interface
hcitool -i hci0 cmd 0x3F 0x001D 0x01
# 3. Write PCM Settings (Enable PCM Clock Continuously)
hcitool -i hci0 cmd 0x3F 0x0007 0x10
# 4. Configure PCM Sync Settings
hcitool -i hci0 cmd 0x3F 0x0028 0x03 0x00 0x03
# 5. Configure PCM Link Settings
hcitool -i hci0 cmd 0x3F 0x0029 0x04 0x00
# 6. Write Voice Settings (Set CVSD Codec)
hcitool -i hci0 cmd 0x03 0x0026 0x60 0x00
And below is our device tree for the pcm interface and codecs:
sound-bt-sco {
compatible = "simple-audio-card";
simple-audio-card,name = "bt-sco-audio";
simple-audio-card,format = "dsp_a";
simple-audio-card,bitclock-inversion;
simple-audio-card,frame-master = <&btcpu>;
simple-audio-card,bitclock-master = <&btcpu>;
btcpu: simple-audio-card,cpu {
sound-dai = <&sai2>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <16>;
};
simple-audio-card,codec {
sound-dai = <&bt_sco_codec 1>;
};
};
sound-tlv320aic31xx {
compatible = "simple-audio-card";
simple-audio-card,name = "tlv320aic31xx-Codec";
simple-audio-card,format = "i2s";
simple-audio-card,frame-master = <&dailink_master>;//Which one is master
simple-audio-card,bitclock-master = <&dailink_master>;//which one is master
simple-audio-card,widgets =
"Speaker", "External Speaker",
"Headphone", "Headphone Jack",
"Microphone", "Mic Jack";
simple-audio-card,routing =
"External Speaker", "SPK",
"Headphone Jack", "HPL",
"Headphone Jack", "HPR",
"Mic Jack", "MIC1RP";
dailink_master:simple-audio-card,cpu {
sound-dai = <&sai3>;
};
simple-audio-card,codec {
sound-dai = <&tlv320aic3100>;
system-clock-frequency = <12288000>;
};
};
&sai2 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai2>;
assigned-clocks = <&clk IMX8MP_CLK_SAI2>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
assigned-clock-rates = <12288000>;
status = "okay";
};
&sai3 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
assigned-clock-rates = <12288000>;
clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_IPG>, <&clk IMX8MP_CLK_DUMMY>,
<&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
<&clk IMX8MP_CLK_DUMMY>;
clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
fsl,sai-mclk-direction-output;
status = "okay";
};
So we have few questions:
- Are our loopback routings for HFP are correct?
- Do HFP uses pcm and A2DP use uart in terms of data transmission is this correct?
- Are hci commands to prepare the module for PCM transmissions are correct?
- What could be the issue for our case?
Best Regards,