public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Brent Lu <brent.lu@intel.com>, alsa-devel@alsa-project.org
Cc: Cezary Rojewski <cezary.rojewski@intel.com>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Peter Ujfalusi <peter.ujfalusi@linux.intel.com>,
	Bard Liao <yung-chuan.liao@linux.intel.com>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>, Yong Zhi <yong.zhi@intel.com>,
	Vamshi Krishna <vamshi.krishna.gopal@intel.com>,
	Ajye Huang <ajye.huang@gmail.com>,
	Mac Chiang <mac.chiang@intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: Intel: sof_rt5682: remove SOF_RT1015_SPEAKER_AMP_100FS flag
Date: Tue, 13 Sep 2022 10:07:35 +0200	[thread overview]
Message-ID: <2577e4db-8593-cf37-135b-aa51b6268cd7@linux.intel.com> (raw)
In-Reply-To: <20220913074906.926774-1-brent.lu@intel.com>




> -static int rt1015_hw_params_pll_and_tdm(struct snd_pcm_substream *substream,
> -					 struct snd_pcm_hw_params *params)
> -{
> -	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
> -	struct snd_soc_dai *codec_dai;
> -	int i, fs = 100, ret;
> -
>  	for_each_rtd_codec_dais(rtd, i, codec_dai) {
>  		ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK,
> -					  params_rate(params) * fs,
> +					  clk_freq,
>  					  params_rate(params) * 256);
> -		if (ret)
> +		if (ret) {
> +			dev_err(codec_dai->dev, "fail to set pll, ret %d\n",
> +				ret);
>  			return ret;
> +		}
>  
>  		ret = snd_soc_dai_set_sysclk(codec_dai, RT1015_SCLK_S_PLL,
>  					     params_rate(params) * 256,
>  					     SND_SOC_CLOCK_IN);
> -		if (ret)
> +		if (ret) {
> +			dev_err(codec_dai->dev, "fail to set sysclk, ret %d\n",
> +				ret);
>  			return ret;
> -	}
> -	/* rx slot 1 for RT1015_DEV0_NAME */
> -	ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_codec(rtd, 0),
> -				       0x0, 0x1, 4, 24);
> -	if (ret)
> -		return ret;
> +		}
>  
> -	/* rx slot 2 for RT1015_DEV1_NAME */
> -	ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_codec(rtd, 1),
> -				       0x0, 0x2, 4, 24);
> -	if (ret)
> -		return ret;
> +		switch (dai_link->dai_fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
> +		case SND_SOC_DAIFMT_DSP_A:
> +		case SND_SOC_DAIFMT_DSP_B:
> +			/* 4-slot TDM */
> +			ret = snd_soc_dai_set_tdm_slot(codec_dai,
> +						       rt1015_tdm_mask[i].tx,
> +						       rt1015_tdm_mask[i].rx,
> +						       4,
> +						       params_width(params));

The changes look ok, just wondering if we can avoid hard-coding those 4
values. Can we not get the number of TDM slots from topology and/or
dailink configuration?


> +			if (ret < 0) {
> +				dev_err(codec_dai->dev, "fail to set tdm slot, ret %d\n",
> +					ret);
> +				return ret;
> +			}
> +			break;
> +		default:
> +			dev_dbg(codec_dai->dev, "codec is in I2S mode\n");
> +			break;
> +		}
> +	}
>  
> -	return 0;
> +	return ret;

  reply	other threads:[~2022-09-13  8:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13  7:49 [PATCH] ASoC: Intel: sof_rt5682: remove SOF_RT1015_SPEAKER_AMP_100FS flag Brent Lu
2022-09-13  8:07 ` Pierre-Louis Bossart [this message]
2022-09-27 13:16   ` Lu, Brent
2022-09-28  8:38     ` Pierre-Louis Bossart
2022-09-29  6:25       ` Lu, Brent
2022-09-29  8:39         ` Pierre-Louis Bossart
2022-09-30  9:41 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2577e4db-8593-cf37-135b-aa51b6268cd7@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=ajye.huang@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=brent.lu@intel.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mac.chiang@intel.com \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.com \
    --cc=vamshi.krishna.gopal@intel.com \
    --cc=yong.zhi@intel.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox