I’m trying to set up an audio codec driver for the TI Wilink that is able to send the proper command to the Wilink to set up its PCM according to the sample rate being requested.
Here is the function I’ve written for it;
static int bt_sco_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *cpu_dai)
{
u8 rate8k = 1;
u8 pcm8k[34] = {0x00, 0x02, 0x01, 0x40, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x01, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x21, 0x00, 0x01, 0x10, 0x00, 0x21, 0x00, 0x00, 0x00};
u8 pcm16k[34] = {0x00, 0x04, 0x01, 0x80, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x01, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x21, 0x00, 0x01, 0x10, 0x00, 0x21, 0x00, 0x00, 0x00};
u8 *pcm;
struct hci_dev *hdev;
switch (params_rate(params)) {
case 8000:
pcm = pcm8k;
break;
case 16000:
pcm = pcm16k;
break;
default:
dev_err(cpu_dai->dev, "Bad rate: %d\n", params_rate(params));
return -EINVAL;
}
if ((hdev = hci_dev_get(0))){
hci_send_cmd(hdev, 0xfd06, 34, pcm);
}
return 0;
}
Now here is the thing… it “kind of” works.
What I mean by that is this; if I enable dut mode via modified mcap_tool, then it works and I get clear audio. If I don’t enable dut mode, then it does not work.
I’ve tried enabling dut mode via debugfs (echo “Y” > dut_mode), but that has no effect at all on the hardware.
Anyone have any ideas?