From: Cezary Rojewski <cezary.rojewski@intel.com>
To: alsa-devel@alsa-project.org, broonie@kernel.org
Cc: tiwai@suse.com, perex@perex.cz, zhuning@everest-semi.com,
amadeuszx.slawinski@linux.intel.com,
pierre-louis.bossart@linux.intel.com, hdegoede@redhat.com,
Cezary Rojewski <cezary.rojewski@intel.com>
Subject: [PATCH 8/8] ASoC: Intel: avs: rt5682: Tidy up hw_params()
Date: Thu, 29 Jun 2023 13:24:49 +0200 [thread overview]
Message-ID: <20230629112449.1755928-9-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20230629112449.1755928-1-cezary.rojewski@intel.com>
To improve readability, reword several local variables to better match
their counterparts in declarations of soc-dai.h. For similar reasons,
wording for few comments is streamlined while redundant comments are
removed.
No functional changes.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
sound/soc/intel/avs/boards/rt5682.c | 35 +++++++++++++----------------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git a/sound/soc/intel/avs/boards/rt5682.c b/sound/soc/intel/avs/boards/rt5682.c
index bd0902bb5a37..b93468ae0977 100644
--- a/sound/soc/intel/avs/boards/rt5682.c
+++ b/sound/soc/intel/avs/boards/rt5682.c
@@ -145,39 +145,36 @@ avs_rt5682_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_para
{
struct snd_soc_pcm_runtime *runtime = asoc_substream_to_rtd(substream);
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(runtime, 0);
- int clk_id, clk_freq;
- int pll_out, ret;
+ int pll_source, freq_in, freq_out;
+ int ret;
if (avs_rt5682_quirk & AVS_RT5682_MCLK_EN) {
- clk_id = RT5682_PLL1_S_MCLK;
+ pll_source = RT5682_PLL1_S_MCLK;
if (avs_rt5682_quirk & AVS_RT5682_MCLK_24MHZ)
- clk_freq = 24000000;
+ freq_in = 24000000;
else
- clk_freq = 19200000;
+ freq_in = 19200000;
} else {
- clk_id = RT5682_PLL1_S_BCLK1;
- clk_freq = params_rate(params) * 50;
+ pll_source = RT5682_PLL1_S_BCLK1;
+ freq_in = params_rate(params) * 50;
}
- pll_out = params_rate(params) * 512;
+ freq_out = params_rate(params) * 512;
- ret = snd_soc_dai_set_pll(codec_dai, 0, clk_id, clk_freq, pll_out);
+ ret = snd_soc_dai_set_pll(codec_dai, RT5682_PLL1, pll_source, freq_in, freq_out);
if (ret < 0)
- dev_err(runtime->dev, "snd_soc_dai_set_pll err = %d\n", ret);
+ dev_err(runtime->dev, "Set PLL failed: %d\n", ret);
- /* Configure sysclk for codec */
- ret = snd_soc_dai_set_sysclk(codec_dai, RT5682_SCLK_S_PLL1, pll_out, SND_SOC_CLOCK_IN);
+ ret = snd_soc_dai_set_sysclk(codec_dai, RT5682_SCLK_S_PLL1, freq_out, SND_SOC_CLOCK_IN);
if (ret < 0)
- dev_err(runtime->dev, "snd_soc_dai_set_sysclk err = %d\n", ret);
+ dev_err(runtime->dev, "Set sysclk failed: %d\n", ret);
- /* slot_width should equal or large than data length, set them be the same */
+ /* slot_width should be equal or larger than data length. */
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x0, 0x0, 2, params_width(params));
- if (ret < 0) {
- dev_err(runtime->dev, "set TDM slot err:%d\n", ret);
- return ret;
- }
+ if (ret < 0)
+ dev_err(runtime->dev, "Set TDM slot failed: %d\n", ret);
- return 0;
+ return ret;
}
static const struct snd_soc_ops avs_rt5682_ops = {
--
2.25.1
next prev parent reply other threads:[~2023-06-29 11:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-29 11:24 [PATCH 0/8] ASoC: Intel: avs: New boards and fixes to existing ones Cezary Rojewski
2023-06-29 11:24 ` [PATCH 1/8] ASoC: codecs: es8316: Add support for 24 MHz MCLK Cezary Rojewski
2023-06-29 11:24 ` [PATCH 2/8] ASoC: codecs: es8316: Add support for S24_3LE format Cezary Rojewski
2023-06-29 11:24 ` [PATCH 3/8] ASoC: Intel: avs: Add es8336 machine board Cezary Rojewski
2023-06-29 11:24 ` [PATCH 4/8] ASoC: Intel: avs: Load es8336 board on KBL-based platforms Cezary Rojewski
2023-06-29 11:24 ` [PATCH 5/8] ASoC: Intel: avs: Add rt5663 machine board Cezary Rojewski
2023-06-29 11:24 ` [PATCH 6/8] ASoC: Intel: avs: Load rt5663 board on KBL-based platforms Cezary Rojewski
2023-06-29 11:24 ` [PATCH 7/8] ASoC: Intel: avs: rt5682: Add missing components Cezary Rojewski
2023-06-29 11:24 ` Cezary Rojewski [this message]
2023-07-12 11:46 ` [PATCH 0/8] ASoC: Intel: avs: New boards and fixes to existing ones 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=20230629112449.1755928-9-cezary.rojewski@intel.com \
--to=cezary.rojewski@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=amadeuszx.slawinski@linux.intel.com \
--cc=broonie@kernel.org \
--cc=hdegoede@redhat.com \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=tiwai@suse.com \
--cc=zhuning@everest-semi.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