btfm: Program multi channel registers in wcn3990 for Tx/Rx

For A2DP/SCO Rx, SCO/FM Tx use cases, we need to program
multi channel registers. Without this there would be
glitches and random silence during A2DP playback.

While at it, add the function name to the debug print macro.

CRs-Fixed: 2027268
Change-Id: Ia8e5fde48bb94e97346fe323e92dc32ed60b0e65
Signed-off-by: Satish Kodishala <skodisha@codeaurora.org>
This commit is contained in:
Satish Kodishala 2017-05-01 19:17:06 +05:30 committed by Gerrit - the friendly Code Review server
parent 5d78c03af8
commit 413d2ae9fe
2 changed files with 30 additions and 3 deletions

View file

@ -13,7 +13,7 @@
#define BTFM_SLIM_H #define BTFM_SLIM_H
#include <linux/slimbus/slimbus.h> #include <linux/slimbus/slimbus.h>
#define BTFMSLIM_DBG(fmt, arg...) pr_debug(fmt "\n", ## arg) #define BTFMSLIM_DBG(fmt, arg...) pr_debug("%s: " fmt "\n", __func__, ## arg)
#define BTFMSLIM_INFO(fmt, arg...) pr_info("%s: " fmt "\n", __func__, ## arg) #define BTFMSLIM_INFO(fmt, arg...) pr_info("%s: " fmt "\n", __func__, ## arg)
#define BTFMSLIM_ERR(fmt, arg...) pr_err("%s: " fmt "\n", __func__, ## arg) #define BTFMSLIM_ERR(fmt, arg...) pr_err("%s: " fmt "\n", __func__, ## arg)

View file

@ -83,19 +83,34 @@ int btfm_slim_chrk_enable_port(struct btfmslim *btfmslim, uint8_t port_num,
{ {
int ret = 0; int ret = 0;
uint8_t reg_val = 0; uint8_t reg_val = 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) {
/* For SCO Rx, A2DP Rx */
reg_val = 0x1;
port_bit = port_num - 0x10;
reg = CHRK_SB_PGD_RX_PORTn_MULTI_CHNL_0(port_bit);
BTFMSLIM_DBG("writing reg_val (%d) to reg(%x)",
reg_val, reg);
ret = btfm_slim_write(btfmslim, reg, 1, &reg_val, IFD);
if (ret) {
BTFMSLIM_ERR("failed to write (%d) reg 0x%x",
ret, reg);
goto error;
}
}
/* Port enable */ /* Port enable */
reg = CHRK_SB_PGD_PORT_RX_CFGN(port_num - 0x10); reg = CHRK_SB_PGD_PORT_RX_CFGN(port_num - 0x10);
goto enable_disable_rxport; goto enable_disable_rxport;
} }
/* txport */
if (!enable) if (!enable)
goto enable_disable_txport; goto enable_disable_txport;
/* Multiple Channel Setting - only for FM Tx */ /* txport */
/* Multiple Channel Setting */
if (is_fm_port(port_num)) { if (is_fm_port(port_num)) {
reg_val = (0x1 << CHRK_SB_PGD_PORT_TX1_FM) | reg_val = (0x1 << CHRK_SB_PGD_PORT_TX1_FM) |
(0x1 << CHRK_SB_PGD_PORT_TX2_FM); (0x1 << CHRK_SB_PGD_PORT_TX2_FM);
@ -105,6 +120,18 @@ int btfm_slim_chrk_enable_port(struct btfmslim *btfmslim, uint8_t port_num,
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;
} }
} else if (port_num == CHRK_SB_PGD_PORT_TX_SCO) {
/* SCO Tx */
reg_val = 0x1 << CHRK_SB_PGD_PORT_TX_SCO;
reg = CHRK_SB_PGD_TX_PORTn_MULTI_CHNL_0(port_num);
BTFMSLIM_DBG("writing reg_val (%d) to reg(%x)",
reg_val, reg);
ret = btfm_slim_write(btfmslim, reg, 1, &reg_val, IFD);
if (ret) {
BTFMSLIM_ERR("failed to write (%d) reg 0x%x",
ret, reg);
goto error;
}
} }
/* Enable Tx port hw auto recovery for underrun or overrun error */ /* Enable Tx port hw auto recovery for underrun or overrun error */