We have a setup with linux, bluez and ofono. Everything works great except the HFP audio quality which is truly horrendous (unusable). We can make out features like the busy tone etc.
This happens both when sending data over HCI or using the PCM interface. The distortion on both is kind of similar (although even worse on PCM)
We tried tuning things with HCI commands
switch to hci instead of pcm interface (switches succesfully and we get SCO over HCI, and have sound but distorted as if parts were missing, or played at the wrong sample rate)
hcitool -i hci0 cmd 0x3F 0x00210 0x01 0x00 0x00 0xFF
sco flow control (not having any effect we can hear, neither when doing PCM or HCI)
hcitool -i hci0 cmd 0x03 0x002f 0x01
WBS disable (might mess with pure PCM with what I found, again no effect)
hcitool -i hci0 cmd 0x03 0x005e 0x01
hcitool -i hci0 cmd 0x03 0x179 0x01
HCI_VS_Write_CODEC_Config (0xFD06)106 options we tried, all give similar effects for the PCM
$ hcitool cmd 0x3f 0x106 0x0 0x8 0x0 0x40 0x1F 0x0 0x0 0x1 0x0 0x0 0x0 0x0 0x10 0x0 0x1 0x0 0x0 0x10 0x0 0x1 0x0 0x1 0x0 0x10 0x0 0x11 0x0 0x0 0x10 0x0 0x11 0x0 0x1 0x0 2mhz clock
$ hcitool cmd 0x3f 0x106 0x0 0x4 0x0 0x40 0x1F 0x0 0x0 0x1 0x0 0x0 0x0 0x0 0x10 0x0 0x1 0x0 0x0 0x10 0x0 0x1 0x0 0x1 0x0 0x10 0x0 0x11 0x0 0x0 0x10 0x0 0x11 0x0 0x1 0x0 1mhz clock
$ hcitool cmd 0x3f 0x106 0x0 0x4 0x0 0x40 0x1F 0x0 0x0 0x1 0x0 0x0 0x0 0x0 0x10 0x0 0x1 0x0 0x1 0x10 0x0 0x1 0x0 0x0 0x0 0x10 0x0 0x11 0x0 0x1 0x10 0x0 0x11 0x0 0x0 0x0 1mhz clock /data driven falling edge/sampled rising)
We also did some fiddling with HCI_VS_Write_CODEC_Config_Enhanced (0xFD07) 107
$ hcitool cmd 0x3f 0x107 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x2 0x1 0x0 0xBE 0xAD 0xDE 0x0 0x0 0x0 0x0 2 0x0 0x00 0xEF 0xBE 0xAD 0x0 0x0
Again no effect whatever we do.
How can we be sure the chip sends out 16bit le, 8Khz mono I2S PCM? (as despite HFP being mono 8Khz, we always seem to get two channels with data)
Any hints or actual commands to configure the PCM, SCO or audio stream are welcome as with the current sound quality HFP is unsuable. We have no issues in A2DP.