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

Commit ab77b376 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 7b83f01e fc057b51
Loading
Loading
Loading
Loading
+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 @@ static 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,
@@ -405,7 +346,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,
};
+10 −10
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ 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;

@@ -137,15 +137,15 @@ int btfm_slim_chrk_enable_port(struct btfmslim *btfmslim, uint8_t port_num,
	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)
+1 −0
Original line number Diff line number Diff line
@@ -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