Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1191854ybj; Tue, 5 May 2020 15:06:27 -0700 (PDT) X-Google-Smtp-Source: APiQypIbQtcVHRHwvnDv7epCPL/dLfO5WtK4f1/05MR2GXm/NB1TBkGcI/j7MolXrmPvnNw+gvSd X-Received: by 2002:a17:906:e210:: with SMTP id gf16mr4942273ejb.214.1588716387075; Tue, 05 May 2020 15:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588716387; cv=none; d=google.com; s=arc-20160816; b=vXlpQw314vDuaMWix5tqMaX+LWWzEm7cp9AURDLjnKjOU4bquq6XdvajX9S+FxZn+c yK/Axs+AIynJV3BomJGHiPgMLiv2IbCa/vMmXdjZToKv9U2XWdyus4u7WwcaQd+wrG7J +hwzHA2eo0uZH3lNcJkzPm48iQ8flvmPJPT0LcAd3FAugIk2McIigzwgD7WE/mEAf2EE 95B8hcwnjcXLK/2o3XrjKn7Gy1ICOrXBQD/234J+E0UFX1W4GCYE1kA6kyMrVl9fkvpW OTnzXJ8GysHp7T+FsQ4q1eJDOkGipgWoKNe3pT5CAgCyLC1/gOHZ94cqiXYmCnB5HVX3 GuMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=khZlIlEVTYkUPF1074MuiFsDKzIpjHIPfW+1G0r8LPo=; b=f8uV60xFOgYI4vY6kOgrLLoZw18y3TDGStQ4LT53+cXE5UmAyqfrQX10awz931j0Jh EWJYdSH/xfV6upUD/9lV+gooT8YOr/hntKXkIvgF45R3uobnHqygSW5jdJcIZfiaOrlK Kb0KKIWGTPWd+DwJtNp3JM84JzyCMKStzv+SYB+hxMquov0gfxI73wrNwJqxtvO7yYON 3yQUjLTCvCy1S89nSrV6ac4BUUrj4NWaDfV0/oOyieYUTtsNtItkGLza/a894SCKZr3V wEU+e3CJKVbFhJuCkUzmYB96FEhkGbxYjYU/lWnEMZG+zyu6JijugdbEnTox5s5AOsOG OJ7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c94si1976874edf.446.2020.05.05.15.06.02; Tue, 05 May 2020 15:06:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729354AbgEEWEX (ORCPT + 99 others); Tue, 5 May 2020 18:04:23 -0400 Received: from mga02.intel.com ([134.134.136.20]:48051 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727785AbgEEWEX (ORCPT ); Tue, 5 May 2020 18:04:23 -0400 IronPort-SDR: /RnhK7h5k59VMlvMt8V+WbILtuVBh3x2YbEmUBqbXHd2hQqsv/ik/JgxD5WTRcpB1DToMEecZp Hgw9JufC7sIQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2020 15:04:20 -0700 IronPort-SDR: y6UqgH1vxBwoaEF3R9aoJcRP4PwHDFLbYrd6lJw4h/SkEGEpO/usT3X8LjWcUD0ncc8j/uixfi DIxqFLnT0P7w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,356,1583222400"; d="scan'208";a="278022605" Received: from krogers-mobl1.amr.corp.intel.com (HELO [10.255.229.42]) ([10.255.229.42]) by orsmga002.jf.intel.com with ESMTP; 05 May 2020 15:04:16 -0700 Subject: Re: [PATCH V2] ASoC: Intel: boards: Use FS as nau8825 sysclk in nau88125_* machine To: =?UTF-8?Q?Rados=c5=82aw_Biernacki?= Cc: Lech Betlej , alsa-devel@alsa-project.org, Todd Broch , Harshapriya , John Hsu , Alex Levin , Jie Yang , Takashi Iwai , "Sienkiewicz, Michal" , Liam Girdwood , Ben Zhang , Mac Chiang , Vamshi Krishna , Marcin Wojtas , linux-kernel@vger.kernel.org, Yong Zhi References: <20200501193141.30293-1-rad@semihalf.com> <3ad44b75-387f-da75-d7b2-3a16ed00550c@linux.intel.com> From: Pierre-Louis Bossart Message-ID: <8b97bf43-ddd8-df81-90e7-9e87c19af1ab@linux.intel.com> Date: Tue, 5 May 2020 10:00:03 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>> 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);