From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Radoslaw Biernacki <rad@semihalf.com>,
Liam Girdwood <liam.r.girdwood@linux.intel.com>,
Jie Yang <yang.jie@linux.intel.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: Lech Betlej <Lech.Betlej@intel.com>,
alsa-devel@alsa-project.org, Todd Broch <tbroch@google.com>,
Harshapriya <harshapriya.n@intel.com>,
John Hsu <KCHSU0@nuvoton.com>,
linux-kernel@vger.kernel.org, michal.sienkiewicz@intel.com,
Ben Zhang <benzh@chromium.org>, Mac Chiang <mac.chiang@intel.com>,
Yong Zhi <yong.zhi@intel.com>, Marcin Wojtas <mw@semihalf.com>,
Vamshi Krishna <vamshi.krishna.gopal@intel.com>,
Alex Levin <levinale@google.com>
Subject: Re: [PATCH V3] ASoC: Intel: boards: Use FS as nau8825 sysclk in nau88125_* machine
Date: Tue, 8 Sep 2020 15:59:40 -0500 [thread overview]
Message-ID: <50db252a-1274-f681-d5e7-e7fba839c0ee@linux.intel.com> (raw)
In-Reply-To: <20200908200314.22771-1-rad@semihalf.com>
Sorry, I couldn't resist adding three more comments to improve further:
> -static int skylake_nau8825_hw_params(struct snd_pcm_substream *substream,
> - struct snd_pcm_hw_params *params)
> +static int skylake_nau8825_trigger(struct snd_pcm_substream *substream, int cmd)
> {
> struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct snd_pcm_runtime *runtime = substream->runtime;
> struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
> - int ret;
> -
> - ret = snd_soc_dai_set_sysclk(codec_dai,
> - NAU8825_CLK_MCLK, 24000000, SND_SOC_CLOCK_IN);
> + int ret = 0;
>
> - if (ret < 0)
> - dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret);
> + switch (cmd) {
> + case SNDRV_PCM_TRIGGER_START:
> + ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_FS, 0,
> + SND_SOC_CLOCK_IN);
Maybe a simple comment to explain what this does?
> + if (ret < 0) {
> + dev_err(codec_dai->dev, "can't set FS clock %d\n", ret);
> + break;
> + }
> + ret = snd_soc_dai_set_pll(codec_dai, 0, 0, runtime->rate,
> + runtime->rate * 256);
> + if (ret < 0)
> + dev_err(codec_dai->dev, "can't set FLL: %d\n", ret);
> + break;
You could replace this by a /* fallthrough */ statement?
> + case SNDRV_PCM_TRIGGER_RESUME:
> + ret = snd_soc_dai_set_pll(codec_dai, 0, 0, runtime->rate,
> + runtime->rate * 256);
> + if (ret < 0)
> + dev_err(codec_dai->dev, "can't set FLL: %d\n", ret);
> + break;
> + }
> +static int __maybe_unused skylake_nau8825_resume_post(struct snd_soc_card *card)
> +{
> + struct snd_soc_dai *codec_dai;
> +
> + codec_dai = snd_soc_card_get_codec_dai(card, SKL_NUVOTON_CODEC_DAI);
> + if (!codec_dai) {
> + dev_err(card->dev, "Codec dai not found\n");
> + return -EIO;
> + }
> +
> + dev_dbg(codec_dai->dev, "playback_active:%d playback_widget->active:%d codec_dai->rate:%d\n",
> + codec_dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK],
> + codec_dai->playback_widget->active,
> + codec_dai->rate);
> +
> + if (codec_dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK] &&
> + codec_dai->playback_widget->active)
> + snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_FS, 0,
> + SND_SOC_CLOCK_IN);
And that part is also worthy of a comment, e.g. why not do this as part
of the TRIGGER_RESUME and why only for playback?
> --- a/sound/soc/intel/boards/skl_nau88l25_ssm4567.c
> +++ b/sound/soc/intel/boards/skl_nau88l25_ssm4567.c
same comments for this other machine driver.
next prev parent reply other threads:[~2020-09-08 20:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 20:03 [PATCH V3] ASoC: Intel: boards: Use FS as nau8825 sysclk in nau88125_* machine Radoslaw Biernacki
2020-09-08 20:59 ` Pierre-Louis Bossart [this message]
2020-09-10 15:37 ` Radosław Biernacki
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=50db252a-1274-f681-d5e7-e7fba839c0ee@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=KCHSU0@nuvoton.com \
--cc=Lech.Betlej@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=benzh@chromium.org \
--cc=harshapriya.n@intel.com \
--cc=levinale@google.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mac.chiang@intel.com \
--cc=michal.sienkiewicz@intel.com \
--cc=mw@semihalf.com \
--cc=perex@perex.cz \
--cc=rad@semihalf.com \
--cc=tbroch@google.com \
--cc=tiwai@suse.com \
--cc=vamshi.krishna.gopal@intel.com \
--cc=yang.jie@linux.intel.com \
--cc=yong.zhi@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;
as well as URLs for NNTP newsgroup(s).