bluetooth: Fix slimbus shutdown sequence
During slimbus shutdown process, registered codec driver callback has been implemented in wrong seqeunce. So, it causes audio data overflow and impact on next audio streaming. To correct the sequence, slimbus port disable routine should be performed when WCN codec shutdown callback is called. Change-Id: Id6ef22c34066adbb5b28bc31e605776c467bf03c Signed-off-by: Sungjun Park <sjpark@codeaurora.org>
This commit is contained in:
parent
98094e2149
commit
d28b85777a
1 changed files with 43 additions and 53 deletions
|
@ -54,7 +54,7 @@ static int btfm_slim_dai_startup(struct snd_pcm_substream *substream,
|
|||
int ret;
|
||||
struct btfmslim *btfmslim = dai->dev->platform_data;
|
||||
|
||||
BTFMSLIM_DBG("substream = %s stream = %d dai name = %s",
|
||||
BTFMSLIM_DBG("substream = %s stream = %d dai->name = %s",
|
||||
substream->name, substream->stream, dai->name);
|
||||
ret = btfm_slim_hw_init(btfmslim);
|
||||
return ret;
|
||||
|
@ -63,10 +63,48 @@ static int btfm_slim_dai_startup(struct snd_pcm_substream *substream,
|
|||
static void btfm_slim_dai_shutdown(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
int i;
|
||||
struct btfmslim *btfmslim = dai->dev->platform_data;
|
||||
struct btfmslim_ch *ch;
|
||||
uint8_t rxport, grp = false, nchan = 1;
|
||||
|
||||
BTFMSLIM_DBG("substream = %s stream = %d dai name = %s",
|
||||
substream->name, substream->stream, dai->name);
|
||||
BTFMSLIM_DBG("dai->name: %s, dai->id: %d, dai->rate: %d", dai->name,
|
||||
dai->id, dai->rate);
|
||||
|
||||
switch (dai->id) {
|
||||
case BTFM_FM_SLIM_TX:
|
||||
grp = true; nchan = 2;
|
||||
ch = btfmslim->tx_chs;
|
||||
rxport = 0;
|
||||
break;
|
||||
case BTFM_BT_SCO_SLIM_TX:
|
||||
ch = btfmslim->tx_chs;
|
||||
rxport = 0;
|
||||
break;
|
||||
case BTFM_BT_SCO_A2DP_SLIM_RX:
|
||||
case BTFM_BT_SPLIT_A2DP_SLIM_RX:
|
||||
ch = btfmslim->rx_chs;
|
||||
rxport = 1;
|
||||
break;
|
||||
case BTFM_SLIM_NUM_CODEC_DAIS:
|
||||
default:
|
||||
BTFMSLIM_ERR("dai->id is invalid:%d", dai->id);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Search for dai->id matched port handler */
|
||||
for (i = 0; (i < BTFM_SLIM_NUM_CODEC_DAIS) &&
|
||||
(ch->id != BTFM_SLIM_NUM_CODEC_DAIS) &&
|
||||
(ch->id != dai->id); ch++, i++)
|
||||
;
|
||||
|
||||
if ((ch->port == BTFM_SLIM_PGD_PORT_LAST) ||
|
||||
(ch->id == BTFM_SLIM_NUM_CODEC_DAIS)) {
|
||||
BTFMSLIM_ERR("ch is invalid!!");
|
||||
return;
|
||||
}
|
||||
|
||||
btfm_slim_disable_ch(btfmslim, ch, rxport, grp, nchan);
|
||||
btfm_slim_hw_deinit(btfmslim);
|
||||
}
|
||||
|
||||
|
@ -74,7 +112,7 @@ static int btfm_slim_dai_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
BTFMSLIM_DBG("dai name = %s DAI-ID %x rate %d num_ch %d",
|
||||
BTFMSLIM_DBG("dai->name = %s DAI-ID %x rate %d num_ch %d",
|
||||
dai->name, dai->id, params_rate(params),
|
||||
params_channels(params));
|
||||
|
||||
|
@ -89,7 +127,7 @@ int btfm_slim_dai_prepare(struct snd_pcm_substream *substream,
|
|||
struct btfmslim_ch *ch;
|
||||
uint8_t rxport, grp = false, nchan = 1;
|
||||
|
||||
BTFMSLIM_DBG("dai name: %s, dai->id: %d, dai->rate: %d", dai->name,
|
||||
BTFMSLIM_DBG("dai->name: %s, dai->id: %d, dai->rate: %d", dai->name,
|
||||
dai->id, dai->rate);
|
||||
|
||||
switch (dai->id) {
|
||||
|
@ -129,53 +167,6 @@ int btfm_slim_dai_prepare(struct snd_pcm_substream *substream,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int btfm_slim_dai_hw_free(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
int i, ret = -EINVAL;
|
||||
struct btfmslim *btfmslim = dai->dev->platform_data;
|
||||
struct btfmslim_ch *ch;
|
||||
uint8_t rxport, grp = false, nchan = 1;
|
||||
|
||||
BTFMSLIM_DBG("dai name: %s, dai->id: %d, dai->rate: %d", dai->name,
|
||||
dai->id, dai->rate);
|
||||
|
||||
switch (dai->id) {
|
||||
case BTFM_FM_SLIM_TX:
|
||||
grp = true; nchan = 2;
|
||||
ch = btfmslim->tx_chs;
|
||||
rxport = 0;
|
||||
break;
|
||||
case BTFM_BT_SCO_SLIM_TX:
|
||||
ch = btfmslim->tx_chs;
|
||||
rxport = 0;
|
||||
break;
|
||||
case BTFM_BT_SCO_A2DP_SLIM_RX:
|
||||
case BTFM_BT_SPLIT_A2DP_SLIM_RX:
|
||||
ch = btfmslim->rx_chs;
|
||||
rxport = 1;
|
||||
break;
|
||||
case BTFM_SLIM_NUM_CODEC_DAIS:
|
||||
default:
|
||||
BTFMSLIM_ERR("dai->id is invalid:%d", dai->id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Search for dai->id matched port handler */
|
||||
for (i = 0; (i < BTFM_SLIM_NUM_CODEC_DAIS) &&
|
||||
(ch->id != BTFM_SLIM_NUM_CODEC_DAIS) &&
|
||||
(ch->id != dai->id); ch++, i++)
|
||||
;
|
||||
|
||||
if ((ch->port == BTFM_SLIM_PGD_PORT_LAST) ||
|
||||
(ch->id == BTFM_SLIM_NUM_CODEC_DAIS)) {
|
||||
BTFMSLIM_ERR("ch is invalid!!");
|
||||
return ret;
|
||||
}
|
||||
ret = btfm_slim_disable_ch(btfmslim, ch, rxport, grp, nchan);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* This function will be called once during boot up */
|
||||
static int btfm_slim_dai_set_channel_map(struct snd_soc_dai *dai,
|
||||
unsigned int tx_num, unsigned int *tx_slot,
|
||||
|
@ -315,7 +306,6 @@ static struct snd_soc_dai_ops btfmslim_dai_ops = {
|
|||
.shutdown = btfm_slim_dai_shutdown,
|
||||
.hw_params = btfm_slim_dai_hw_params,
|
||||
.prepare = btfm_slim_dai_prepare,
|
||||
.hw_free = btfm_slim_dai_hw_free,
|
||||
.set_channel_map = btfm_slim_dai_set_channel_map,
|
||||
.get_channel_map = btfm_slim_dai_get_channel_map,
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue