public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: "Radosław Biernacki" <rad@semihalf.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>, Alex Levin <levinale@google.com>,
	Jie Yang <yang.jie@linux.intel.com>,
	Takashi Iwai <tiwai@suse.com>,
	"Sienkiewicz, Michal" <michal.sienkiewicz@intel.com>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Ben Zhang <benzh@chromium.org>, Mac Chiang <mac.chiang@intel.com>,
	Vamshi Krishna <vamshi.krishna.gopal@intel.com>,
	Marcin Wojtas <mw@semihalf.com>,
	linux-kernel@vger.kernel.org, Yong Zhi <yong.zhi@intel.com>
Subject: Re: [PATCH V2] ASoC: Intel: boards: Use FS as nau8825 sysclk in nau88125_* machine
Date: Tue, 5 May 2020 10:00:03 -0500	[thread overview]
Message-ID: <8b97bf43-ddd8-df81-90e7-9e87c19af1ab@linux.intel.com> (raw)
In-Reply-To: <CAOs-w0LPeKgooa_98x_Jkzus-Y5Kad7pDby0CriDGb6nTp_6sA@mail.gmail.com>


>>> This single fix address two issues on machines with nau88125:
>>> 1) Audio distortion, due to lack of required clock rate on MCLK line
>>> 2) Loud audible "pops" on headphones if there is no sysclk during nau8825
>>>      playback power up sequence
>>>
>>> Explanation for:
>>> 1) Due to Skylake HW limitation, MCLK pin can only output 24MHz clk
>>>      rate (it can be only connected to XTAL parent clk). The BCLK pin
>>>      can be driven by dividers and therefore FW is able to set it to rate
>>>      required by chosen audio format. According to nau8825 datasheet, 256*FS
>>>      sysclk gives the best audio quality and the only way to achieve this
>>>      (taking into account the above limitations) its to regenerate the MCLK
>>>      from BCLK on nau8825 side by FFL. Without required clk rate, audio is
>>>      distorted by added harmonics.
>>
>> The BCLK is going to be a multiple of 50 * Fs due to clocking
>> restrictions. Can the codec regenerate a good-enough sysclk from this?
> 
> According to Intel, silicon has a limitation, on SKL/KBL only clk_id =
> SKL_XTAL, .name = "xtal" is available for IO domain.
> As mentioned in the commit:
> MCLK is generated by using 24MHz Xtal directly or applying a divider
> (so no way of achieving the rate required by audio format).
> BCLK/FS is generated from 24MHz and uses dividers and additional
> padding bits are used to match the clock source.
> Next gen silicon has the possibility of using additional clock sources.
> 
> Summing up, using MCLK from SKL to NAU88L25 is not an option.
> The only option we found is to use BCLK and regen the required clock
> rate by FLL on the NAU88l25 side.

Right, this 24 MHz is a recurring problem.
But what I was asking was if the NAU8825 is fine working with e.g. a 
2.4MHz bit clock. i.e. with 25 bit slots or padding at the end of the frame?

> 
>>>
>>> 2) Currently Skylake does not output MCLK/FS when the back-end DAI op
>>>      hw_param is called, so we cannot switch to MCLK/FS in hw_param.  This
>>>      patch reduces pop by letting nau8825 keep using its internal VCO clock
>>>      during widget power up sequence, until SNDRV_PCM_TRIGGER_START when
>>>      MCLK/FS is available. Once device resumes, the system will only enable
>>>      power sequence for playback without doing hardware parameter, audio
>>>      format, and PLL configure. In the mean time, the jack detecion sequence
>>>      has changed PLL parameters and switched to internal clock. Thus, the
>>>      playback signal distorted without correct PLL parameters.  That is why
>>>      we need to configure the PLL again in SNDRV_PCM_TRIGGER_RESUME case.
>>
>> IIRC the FS can be controlled with the clk_ api with the Skylake driver,
>> as done for some KBL platforms. Or is this not supported by the firmware
>> used by this machine?
> 
> According to Ben, SKL had limitations in FW for managing the clk's
> back in the days.
> Can you point to the other driver you mention so we can cross check?

There are two KBL drivers that control the SSP clocks from the machine 
driver, but indeed I don't know if this would work on Firmware, it'd be 
a question for Lech/Cezary.

kbl_rt5663_max98927.c:          ret = clk_prepare_enable(priv->mclk);
kbl_rt5663_max98927.c:          ret = clk_prepare_enable(priv->sclk);
kbl_rt5663_rt5514_max98927.c:           ret = 
clk_prepare_enable(priv->mclk);
kbl_rt5663_rt5514_max98927.c:           ret = 
clk_prepare_enable(priv->sclk);
kbl_rt5663_rt5514_max98927.c:                   ret = 
clk_prepare_enable(priv->mclk);



  reply	other threads:[~2020-05-05 22:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 19:31 [PATCH V2] ASoC: Intel: boards: Use FS as nau8825 sysclk in nau88125_* machine Radoslaw Biernacki
2020-05-01 20:16 ` Pierre-Louis Bossart
2020-05-05 14:23   ` Radosław Biernacki
2020-05-05 15:00     ` Pierre-Louis Bossart [this message]
2020-09-08 17:42       ` Radosław Biernacki
2020-09-08 18:06         ` Pierre-Louis Bossart
2020-09-08 18:24           ` Radosław Biernacki
2020-05-05 15:57     ` Cezary Rojewski
2020-05-02 11:00 ` kbuild test robot

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=8b97bf43-ddd8-df81-90e7-9e87c19af1ab@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=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