Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4220167pxk; Tue, 8 Sep 2020 14:00:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8NFRxZ4FQAKqKcCfzherFx0h4nbi6I5zMIRkyuygn7wW8n6dzCxs4x3mHXlg5v2iD/rW+ X-Received: by 2002:a05:6402:456:: with SMTP id p22mr906009edw.177.1599598853127; Tue, 08 Sep 2020 14:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599598853; cv=none; d=google.com; s=arc-20160816; b=qtyVm4fJYu+Pf77wwAubK0WxiBxyMkI+G6qUJk50I//VoE8MY+Nez0H0BfeBeP5iXV Hhau+rxTdFWGj9rNp/cbuO5QMLpl92eoghxga+ip2CxLEOw4x8VRrc8gLpqtlAY8w3vz VNYXIaLBz1vwoJLy5VR9DfHSfr0x1G0rki9BW2Hi4tjZLBWlr/PkfP4fQLISuCHHXCoq xMdej1qpleAawKdY2wVWsEucVfcfq1dA3ZkpgfRT4cI6Z6vkLGv7+EXAR4T84I7S5l40 5jTWgdpwWf6LYx1Evo7EPeS56M8mdYYxH3Nvmlu7q1wu5NTUsyvx0DEA5PQZaBd82rUV RUEA== 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=0AowmorzWDU58qMGc9a75JvvgB7gO/GK2vAlHc5/OAE=; b=hHWyEqR6jgCwJ8DNLflrdsEnTsV0TCal/1qx5TCD7skE88I7BlEIB3+AIhEpUjuwXl Hp9MRFxqdomGvWETfK4ZOhEOsDCAwgHIsjRvFviktbpCw0NokXewkgCDKKkSf8pmpjUD +znyQf+HgCvR6vhSfTDjNsxJ8NbipIo1dze6PpbA06vaCvGITDpdM4AeDsXEgWlORgul wyL0zY7CcM+4VqQ5965zuLfLxYFEL6yV1vPqXkEemrUS9ibNzfoavlbps4ZvVkpFWpyz JXtjX/DUzM4WurBJvGd45rPUgDAfOKrruMC8592iQP63ujzYb7jPT1GEBzHJw5g1zZMV oeZw== 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 t25si95971ejs.675.2020.09.08.14.00.27; Tue, 08 Sep 2020 14:00:53 -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 S1728879AbgIHU7q (ORCPT + 99 others); Tue, 8 Sep 2020 16:59:46 -0400 Received: from mga07.intel.com ([134.134.136.100]:50044 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725997AbgIHU7o (ORCPT ); Tue, 8 Sep 2020 16:59:44 -0400 IronPort-SDR: yZeAniWVEx7njJKXmSX/giRFOck3OuhhcdWjDzjpgywznAFAjZ+zNNKhZT84GV9E3v+1uFPJFA JqQ3mzqCRofw== X-IronPort-AV: E=McAfee;i="6000,8403,9738"; a="222430064" X-IronPort-AV: E=Sophos;i="5.76,407,1592895600"; d="scan'208";a="222430064" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2020 13:59:43 -0700 IronPort-SDR: y6hZDRdeztSDI9qEbOW7puJWdEwvMxonv1KDJltNB5uCftszS+MGKmKHSNxRlJQ8kXrPsfdSYF rHqN8Ota+BTQ== X-IronPort-AV: E=Sophos;i="5.76,407,1592895600"; d="scan'208";a="504506013" Received: from mschen-mobl2.amr.corp.intel.com (HELO [10.213.174.122]) ([10.213.174.122]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2020 13:59:42 -0700 Subject: Re: [PATCH V3] ASoC: Intel: boards: Use FS as nau8825 sysclk in nau88125_* machine To: Radoslaw Biernacki , Liam Girdwood , Jie Yang , Jaroslav Kysela , Takashi Iwai Cc: Lech Betlej , alsa-devel@alsa-project.org, Todd Broch , Harshapriya , John Hsu , linux-kernel@vger.kernel.org, michal.sienkiewicz@intel.com, Ben Zhang , Mac Chiang , Yong Zhi , Marcin Wojtas , Vamshi Krishna , Alex Levin References: <20200908200314.22771-1-rad@semihalf.com> From: Pierre-Louis Bossart Message-ID: <50db252a-1274-f681-d5e7-e7fba839c0ee@linux.intel.com> Date: Tue, 8 Sep 2020 15:59:40 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200908200314.22771-1-rad@semihalf.com> 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 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.