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

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

Merge "ASoC: msm: add support for MI2S slave mode on SDM845"

parents df9981a5 3daed8c7
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -134,6 +134,13 @@ struct mi2s_conf {
	u32 msm_is_mi2s_master;
};

static u32 mi2s_ebit_clk[MI2S_MAX] = {
	Q6AFE_LPASS_CLK_ID_PRI_MI2S_EBIT,
	Q6AFE_LPASS_CLK_ID_SEC_MI2S_EBIT,
	Q6AFE_LPASS_CLK_ID_TER_MI2S_EBIT,
	Q6AFE_LPASS_CLK_ID_QUAD_MI2S_EBIT
};

struct auxpcm_conf {
	struct mutex lock;
	u32 ref_cnt;
@@ -4247,9 +4254,6 @@ static void update_mi2s_clk_val(int dai_id, int stream)
		mi2s_clk[dai_id].clk_freq_in_hz =
		    mi2s_tx_cfg[dai_id].sample_rate * 2 * bit_per_sample;
	}

	if (!mi2s_intf_conf[dai_id].msm_is_mi2s_master)
		mi2s_clk[dai_id].clk_freq_in_hz = 0;
}

static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
@@ -4600,6 +4604,11 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
	 */
	mutex_lock(&mi2s_intf_conf[index].lock);
	if (++mi2s_intf_conf[index].ref_cnt == 1) {
		/* Check if msm needs to provide the clock to the interface */
		if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
			mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
			fmt = SND_SOC_DAIFMT_CBM_CFM;
		}
		ret = msm_mi2s_set_sclk(substream, true);
		if (ret < 0) {
			dev_err(rtd->card->dev,
@@ -4619,9 +4628,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
			ret = -EINVAL;
			goto clk_off;
		}
		/* Check if msm needs to provide the clock to the interface */
		if (!mi2s_intf_conf[index].msm_is_mi2s_master)
			fmt = SND_SOC_DAIFMT_CBM_CFM;
		ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
		if (ret < 0) {
			pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",