Merge "btfm: Correct the slimbus turn on/off sequence for FM ports"
This commit is contained in:
commit
953cc18d9e
4 changed files with 23 additions and 78 deletions
|
@ -171,7 +171,6 @@ int btfm_slim_enable_ch(struct btfmslim *btfmslim, struct btfmslim_ch *ch,
|
||||||
ret);
|
ret);
|
||||||
goto remove_channel;
|
goto remove_channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
BTFMSLIM_INFO("slim_connect_src(port: %d, ch: %d)",
|
BTFMSLIM_INFO("slim_connect_src(port: %d, ch: %d)",
|
||||||
ch->port, ch->ch);
|
ch->port, ch->ch);
|
||||||
|
@ -190,6 +189,7 @@ int btfm_slim_enable_ch(struct btfmslim *btfmslim, struct btfmslim_ch *ch,
|
||||||
BTFMSLIM_INFO(
|
BTFMSLIM_INFO(
|
||||||
"port: %d, ch: %d, grp: %d, ch->grph: 0x%x, ch_hdl: 0x%x",
|
"port: %d, ch: %d, grp: %d, ch->grph: 0x%x, ch_hdl: 0x%x",
|
||||||
chan->port, chan->ch, grp, chan->grph, chan->ch_hdl);
|
chan->port, chan->ch, grp, chan->grph, chan->ch_hdl);
|
||||||
|
|
||||||
ret = slim_control_ch(btfmslim->slim_pgd, (grp ? chan->grph :
|
ret = slim_control_ch(btfmslim->slim_pgd, (grp ? chan->grph :
|
||||||
chan->ch_hdl), SLIM_CH_ACTIVATE, true);
|
chan->ch_hdl), SLIM_CH_ACTIVATE, true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -220,6 +220,7 @@ int btfm_slim_disable_ch(struct btfmslim *btfmslim, struct btfmslim_ch *ch,
|
||||||
|
|
||||||
BTFMSLIM_INFO("port:%d, grp: %d, ch->grph:0x%x, ch->ch_hdl:0x%x ",
|
BTFMSLIM_INFO("port:%d, grp: %d, ch->grph:0x%x, ch->ch_hdl:0x%x ",
|
||||||
ch->port, grp, ch->grph, ch->ch_hdl);
|
ch->port, grp, ch->grph, ch->ch_hdl);
|
||||||
|
|
||||||
/* Remove the channel immediately*/
|
/* Remove the channel immediately*/
|
||||||
ret = slim_control_ch(btfmslim->slim_pgd, (grp ? ch->grph : ch->ch_hdl),
|
ret = slim_control_ch(btfmslim->slim_pgd, (grp ? ch->grph : ch->ch_hdl),
|
||||||
SLIM_CH_REMOVE, true);
|
SLIM_CH_REMOVE, true);
|
||||||
|
@ -233,7 +234,6 @@ int btfm_slim_disable_ch(struct btfmslim *btfmslim, struct btfmslim_ch *ch,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable port through registration setting */
|
/* Disable port through registration setting */
|
||||||
for (i = 0; i < nchan; i++, ch++) {
|
for (i = 0; i < nchan; i++, ch++) {
|
||||||
if (btfmslim->vendor_port_en) {
|
if (btfmslim->vendor_port_en) {
|
||||||
|
@ -246,9 +246,11 @@ int btfm_slim_disable_ch(struct btfmslim *btfmslim, struct btfmslim_ch *ch,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
error:
|
error:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int btfm_slim_get_logical_addr(struct slim_device *slim)
|
static int btfm_slim_get_logical_addr(struct slim_device *slim)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
|
@ -118,9 +118,6 @@ static void btfm_slim_dai_shutdown(struct snd_pcm_substream *substream,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dai->id == BTFM_FM_SLIM_TX)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
/* Search for dai->id matched port handler */
|
/* Search for dai->id matched port handler */
|
||||||
for (i = 0; (i < BTFM_SLIM_NUM_CODEC_DAIS) &&
|
for (i = 0; (i < BTFM_SLIM_NUM_CODEC_DAIS) &&
|
||||||
(ch->id != BTFM_SLIM_NUM_CODEC_DAIS) &&
|
(ch->id != BTFM_SLIM_NUM_CODEC_DAIS) &&
|
||||||
|
@ -134,7 +131,6 @@ static void btfm_slim_dai_shutdown(struct snd_pcm_substream *substream,
|
||||||
}
|
}
|
||||||
|
|
||||||
btfm_slim_disable_ch(btfmslim, ch, rxport, grp, nchan);
|
btfm_slim_disable_ch(btfmslim, ch, rxport, grp, nchan);
|
||||||
out:
|
|
||||||
btfm_slim_hw_deinit(btfmslim);
|
btfm_slim_hw_deinit(btfmslim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,61 +201,6 @@ int btfm_slim_dai_prepare(struct snd_pcm_substream *substream,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int btfm_slim_dai_hw_free(struct snd_pcm_substream *substream,
|
|
||||||
struct snd_soc_dai *dai)
|
|
||||||
{
|
|
||||||
int ret = -EINVAL, i;
|
|
||||||
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);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dai->id != BTFM_FM_SLIM_TX) {
|
|
||||||
ret = 0;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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!!");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
btfm_slim_disable_ch(btfmslim, ch, rxport, grp, nchan);
|
|
||||||
|
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function will be called once during boot up */
|
/* This function will be called once during boot up */
|
||||||
static int btfm_slim_dai_set_channel_map(struct snd_soc_dai *dai,
|
static int btfm_slim_dai_set_channel_map(struct snd_soc_dai *dai,
|
||||||
unsigned int tx_num, unsigned int *tx_slot,
|
unsigned int tx_num, unsigned int *tx_slot,
|
||||||
|
@ -402,7 +343,6 @@ static struct snd_soc_dai_ops btfmslim_dai_ops = {
|
||||||
.shutdown = btfm_slim_dai_shutdown,
|
.shutdown = btfm_slim_dai_shutdown,
|
||||||
.hw_params = btfm_slim_dai_hw_params,
|
.hw_params = btfm_slim_dai_hw_params,
|
||||||
.prepare = btfm_slim_dai_prepare,
|
.prepare = btfm_slim_dai_prepare,
|
||||||
.hw_free = btfm_slim_dai_hw_free,
|
|
||||||
.set_channel_map = btfm_slim_dai_set_channel_map,
|
.set_channel_map = btfm_slim_dai_set_channel_map,
|
||||||
.get_channel_map = btfm_slim_dai_get_channel_map,
|
.get_channel_map = btfm_slim_dai_get_channel_map,
|
||||||
};
|
};
|
||||||
|
|
|
@ -82,11 +82,12 @@ int btfm_slim_chrk_enable_port(struct btfmslim *btfmslim, uint8_t port_num,
|
||||||
uint8_t rxport, uint8_t enable)
|
uint8_t rxport, uint8_t enable)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint8_t reg_val = 0;
|
uint8_t reg_val = 0, en;
|
||||||
uint8_t port_bit = 0;
|
uint8_t port_bit = 0;
|
||||||
uint16_t reg;
|
uint16_t reg;
|
||||||
|
|
||||||
BTFMSLIM_DBG("port(%d) enable(%d)", port_num, enable);
|
BTFMSLIM_DBG("port(%d) enable(%d)", port_num, enable);
|
||||||
|
|
||||||
if (rxport) {
|
if (rxport) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
/* For SCO Rx, A2DP Rx */
|
/* For SCO Rx, A2DP Rx */
|
||||||
|
@ -117,7 +118,8 @@ int btfm_slim_chrk_enable_port(struct btfmslim *btfmslim, uint8_t port_num,
|
||||||
reg = CHRK_SB_PGD_TX_PORTn_MULTI_CHNL_0(port_num);
|
reg = CHRK_SB_PGD_TX_PORTn_MULTI_CHNL_0(port_num);
|
||||||
ret = btfm_slim_write(btfmslim, reg, 1, ®_val, IFD);
|
ret = btfm_slim_write(btfmslim, reg, 1, ®_val, IFD);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
BTFMSLIM_ERR("failed to write (%d) reg 0x%x", ret, reg);
|
BTFMSLIM_ERR("failed to write (%d) reg 0x%x",
|
||||||
|
ret, reg);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,15 +139,15 @@ enable_disable_txport:
|
||||||
reg = CHRK_SB_PGD_PORT_TX_CFGN(port_num);
|
reg = CHRK_SB_PGD_PORT_TX_CFGN(port_num);
|
||||||
|
|
||||||
enable_disable_rxport:
|
enable_disable_rxport:
|
||||||
if (enable) {
|
if (enable)
|
||||||
if (is_fm_port(port_num))
|
en = CHRK_SB_PGD_PORT_ENABLE;
|
||||||
reg_val = CHRK_SB_PGD_PORT_ENABLE |
|
|
||||||
CHRK_SB_PGD_PORT_WM_L3;
|
|
||||||
else
|
else
|
||||||
reg_val = CHRK_SB_PGD_PORT_ENABLE |
|
en = CHRK_SB_PGD_PORT_DISABLE;
|
||||||
CHRK_SB_PGD_PORT_WM_LB;
|
|
||||||
} else
|
if (is_fm_port(port_num))
|
||||||
reg_val = CHRK_SB_PGD_PORT_DISABLE;
|
reg_val = en | CHRK_SB_PGD_PORT_WM_L8;
|
||||||
|
else
|
||||||
|
reg_val = enable ? en | CHRK_SB_PGD_PORT_WM_LB : en;
|
||||||
|
|
||||||
ret = btfm_slim_write(btfmslim, reg, 1, ®_val, IFD);
|
ret = btfm_slim_write(btfmslim, reg, 1, ®_val, IFD);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 and
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
@ -68,6 +68,7 @@
|
||||||
#define CHRK_SB_PGD_PORT_WM_L1 (0x1 << 1)
|
#define CHRK_SB_PGD_PORT_WM_L1 (0x1 << 1)
|
||||||
#define CHRK_SB_PGD_PORT_WM_L2 (0x2 << 1)
|
#define CHRK_SB_PGD_PORT_WM_L2 (0x2 << 1)
|
||||||
#define CHRK_SB_PGD_PORT_WM_L3 (0x3 << 1)
|
#define CHRK_SB_PGD_PORT_WM_L3 (0x3 << 1)
|
||||||
|
#define CHRK_SB_PGD_PORT_WM_L8 (0x8 << 1)
|
||||||
#define CHRK_SB_PGD_PORT_WM_LB (0xB << 1)
|
#define CHRK_SB_PGD_PORT_WM_LB (0xB << 1)
|
||||||
|
|
||||||
#define CHRK_SB_PGD_PORT_RX_NUM 16
|
#define CHRK_SB_PGD_PORT_RX_NUM 16
|
||||||
|
|
Loading…
Add table
Reference in a new issue