Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 953cc18d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "btfm: Correct the slimbus turn on/off sequence for FM ports"

parents 49397ce3 3dbdaa51
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -171,7 +171,6 @@ int btfm_slim_enable_ch(struct btfmslim *btfmslim, struct btfmslim_ch *ch,
						ret);
				goto remove_channel;
			}

		} else {
			BTFMSLIM_INFO("slim_connect_src(port: %d, ch: %d)",
				ch->port, ch->ch);
@@ -190,6 +189,7 @@ int btfm_slim_enable_ch(struct btfmslim *btfmslim, struct btfmslim_ch *ch,
	BTFMSLIM_INFO(
		"port: %d, ch: %d, grp: %d, ch->grph: 0x%x, ch_hdl: 0x%x",
		chan->port, chan->ch, grp, chan->grph, chan->ch_hdl);

	ret = slim_control_ch(btfmslim->slim_pgd, (grp ? chan->grph :
		chan->ch_hdl), SLIM_CH_ACTIVATE, true);
	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 ",
		ch->port, grp, ch->grph, ch->ch_hdl);

	/* Remove the channel immediately*/
	ret = slim_control_ch(btfmslim->slim_pgd, (grp ? ch->grph : ch->ch_hdl),
			SLIM_CH_REMOVE, true);
@@ -233,7 +234,6 @@ int btfm_slim_disable_ch(struct btfmslim *btfmslim, struct btfmslim_ch *ch,
			goto error;
		}
	}

	/* Disable port through registration setting */
	for (i = 0; i < nchan; i++, ch++) {
		if (btfmslim->vendor_port_en) {
@@ -246,9 +246,11 @@ int btfm_slim_disable_ch(struct btfmslim *btfmslim, struct btfmslim_ch *ch,
			}
		}
	}

error:
	return ret;
}

static int btfm_slim_get_logical_addr(struct slim_device *slim)
{
	int ret = 0;
+0 −60
Original line number Diff line number Diff line
@@ -118,9 +118,6 @@ static void btfm_slim_dai_shutdown(struct snd_pcm_substream *substream,
		return;
	}

	if (dai->id == BTFM_FM_SLIM_TX)
		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) &&
@@ -134,7 +131,6 @@ static void btfm_slim_dai_shutdown(struct snd_pcm_substream *substream,
	}

	btfm_slim_disable_ch(btfmslim, ch, rxport, grp, nchan);
out:
	btfm_slim_hw_deinit(btfmslim);
}

@@ -205,61 +201,6 @@ int btfm_slim_dai_prepare(struct snd_pcm_substream *substream,
	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 */
static int btfm_slim_dai_set_channel_map(struct snd_soc_dai *dai,
				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,
	.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,
};
+13 −11
Original line number Diff line number Diff line
@@ -82,11 +82,12 @@ int btfm_slim_chrk_enable_port(struct btfmslim *btfmslim, uint8_t port_num,
	uint8_t rxport, uint8_t enable)
{
	int ret = 0;
	uint8_t reg_val = 0;
	uint8_t reg_val = 0, en;
	uint8_t port_bit = 0;
	uint16_t reg;

	BTFMSLIM_DBG("port(%d) enable(%d)", port_num, enable);

	if (rxport) {
		if (enable) {
			/* 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);
		ret = btfm_slim_write(btfmslim, reg, 1, &reg_val, IFD);
		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;
		}
	}
@@ -137,15 +139,15 @@ enable_disable_txport:
	reg = CHRK_SB_PGD_PORT_TX_CFGN(port_num);

enable_disable_rxport:
	if (enable) {
	if (enable)
		en = CHRK_SB_PGD_PORT_ENABLE;
	else
		en = CHRK_SB_PGD_PORT_DISABLE;

	if (is_fm_port(port_num))
			reg_val = CHRK_SB_PGD_PORT_ENABLE |
					CHRK_SB_PGD_PORT_WM_L3;
		reg_val = en | CHRK_SB_PGD_PORT_WM_L8;
	else
			reg_val = CHRK_SB_PGD_PORT_ENABLE |
					CHRK_SB_PGD_PORT_WM_LB;
	} else
		reg_val = CHRK_SB_PGD_PORT_DISABLE;
		reg_val = enable ? en | CHRK_SB_PGD_PORT_WM_LB : en;

	ret = btfm_slim_write(btfmslim, reg, 1, &reg_val, IFD);
	if (ret)
+2 −1
Original line number Diff line number Diff line
/* 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
 * 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_L2			(0x2 << 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_RX_NUM			16