Hi
I want to play a wav by a bluetooth headset spk,but I can't heard the voice what I play ,instead of noise.
# ./aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: IPNC [TI8148 IPNC], device 0: ap62xxbt AP62XXBT-DAI_CODEC-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
After SCO link is established
# ./aplay -D hw:0,0 -c 2 -f S16_LE /mnt/ring_8k.wav
Playing WAVE '/mnt/ring_8k.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
I heard noise, not the wav's sound ;And I found that ring_8k.wav is a 9 secs wav file,but it played 18 secs
Can anyone help me ? Does the mcasp set err ? Or the wav file is wrong to bt headset?
How can I do to make the bluetooth headset spk play right?
flowing is the details:
bt(master) dm8148(slave)
pcm_sync <--> mcasp4_AFSX --> 8k
pcm_clk <--> mcasp4_ACLKX -->256k
pcm_in <--> mcasp4_AXR0
pcm_out <--> mcasp4_AXR1
////////////////////
static struct snd_soc_dai_link ti81xx_ipnc_dai[] = {
#if defined(CONFIG_SND_SOC_AP62XXBT)
{
.name = "ap62xx_bt_pcm",
.stream_name = "ap62xxbt",
.cpu_dai_name = "davinci-mcasp.4",
.platform_name = "davinci-pcm-audio",
.codec_dai_name = "AP62XXBT-DAI_CODEC", /* DAI name */
.codec_name = "ap62xxbt-dummy-codec",
.ops = &ap62xxbt_pcm_ops,
},
#endif
////////////////////////////////////
/* Set cpu DAI configuration for ap62xx Bluetooth codec */
ret = snd_soc_dai_set_fmt(cpu_dai,
SND_SOC_DAIFMT_DSP_B |
SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM);
if (ret < 0) {
printk(KERN_ERR "Can't set cpu DAI configuration for " \
"ap62xx Bluetooth codec \n");
return ret;
}
ret = snd_soc_dai_set_fmt(codec_dai,
SND_SOC_DAIFMT_DSP_B |
SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM);
if (ret < 0) {
printk(KERN_ERR "Can't set codec DAI configuration for " \
"ap62xx Bluetooth codec \n");
return ret;
}
///////////////////////////////////////////
static void davinci_hw_param(struct davinci_audio_dev *dev, int stream)
{
int i, active_slots;
u32 mask = 0;
active_slots = (dev->tdm_slots > 31) ? 1 : dev->tdm_slots;
for (i = 0; i < active_slots; i++)
mask |= (1 << i);
mcasp_clr_bits(dev->base + DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC);
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
/* bit stream is MSB first with no delay */
/* DSP_B mode */
mcasp_clr_bits(dev->base + DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE);
mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask);
mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD);
if ((dev->tdm_slots >= 2) || (dev->tdm_slots <= 32))
mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG,
FSXMOD(dev->tdm_slots), FSXMOD(0x1FF));
else
printk(KERN_ERR "playback tdm slot %d not supported\n",
dev->tdm_slots);
mcasp_clr_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR);
} else {
/* bit stream is MSB first with no delay */
/* DSP_B mode */
mcasp_set_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, RXORD);
mcasp_set_bits(dev->base + DAVINCI_MCASP_AHCLKRCTL_REG,
AHCLKRE);
mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask);
if ((dev->tdm_slots >= 2) || (dev->tdm_slots <= 32))
mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG,
FSRMOD(dev->tdm_slots), FSRMOD(0x1FF));
else
printk(KERN_ERR "capture tdm slot %d not supported\n",
dev->tdm_slots);
mcasp_clr_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, FSRDUR);
}
}
Yellow pulse wave ---> pcm_sync 8k; Green pulse wave -->pcm_clk 256k