Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1393661ybh; Thu, 16 Jul 2020 10:49:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzM+lh+Gz+4gSysO8ZBqlXhSygtvXIDggIBaHnvtSu52UfOY4CpzLhC+9aCx70e9juqKuho X-Received: by 2002:a17:906:899:: with SMTP id n25mr4596795eje.298.1594921793075; Thu, 16 Jul 2020 10:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594921793; cv=none; d=google.com; s=arc-20160816; b=NBhYrTpZnVm2FZJLd6l0xNvM1d8w3b26FjjeR3u60GlISb4NV7LTZ4dIm8TSCRgF+s 9LJvSinm6r2EfNqaIrvYsn8FO7UX5lAewXluSYudJLX5ega45tbOOtD8N35VAlTdtgQk Of8GvmzVZRnw0ZPWkKgT3ZrTL8L0oDDBa2RctoeFZ0mt8bVTZmsclAsRokHQLf4vWfOR 4TxZdCEqDS96+NNFh48wlF3VtN7gIPxeVUCMrT+e6MKBNCzsbHbWkDO3ZZNxdJMcLBsc 3Tk0tY5EmckMmHEFtsD8fZdmspWPsNtPFzWuwzUs61SotkYJYluc32vPOD0meL/S2Xej 6oJQ== 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=YQ/JA3Oom+OrJq4mAeEQJXjblnSV1uZ3RsFYujUcK7Y=; b=oCJhORVU8d5mWzS5e14eFdPddBaCd87b+QfB9i6VxTXeGgyc2j/k9TRan8fLqRAfG8 YiEquY7u51e5DyxEbmx4Fh5oPXI/eC+uUanYYBnTbtPr6TjWfjYrydUwtcvtSUKcksqH MRJqGwGU6Poi7SAAVJfqg+SWByryFrdbFFwNSExr+NZ0XW5YXbDn23yUIvIITqkfzGyd UEDVmkkizsI/ZN+FEUcXYRCD18t7md2vkZKM5dkV/F7f7CrvkAqD1xUapb42hR0p5izD JTPNzwkoQNcCFC/T4uPJ+5trrpDet3khgO1Z+PIaxw7c+soM+Azk6yM22LvZfQJO5AKT Y6UA== 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 v6si3446787ejw.169.2020.07.16.10.49.29; Thu, 16 Jul 2020 10:49: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 S1728807AbgGPRtO (ORCPT + 99 others); Thu, 16 Jul 2020 13:49:14 -0400 Received: from mga01.intel.com ([192.55.52.88]:49940 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725867AbgGPRtO (ORCPT ); Thu, 16 Jul 2020 13:49:14 -0400 IronPort-SDR: DyGwkKbffdpAv+EvDuzi2JN2b/7zSUGIfRBd3qkUsoXSWY3rHUy+ZuMp/mFavuvDpYxAeNokC9 2jcApfQKHleQ== X-IronPort-AV: E=McAfee;i="6000,8403,9684"; a="167588403" X-IronPort-AV: E=Sophos;i="5.75,360,1589266800"; d="scan'208";a="167588403" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2020 10:49:13 -0700 IronPort-SDR: +FJMnqbi0e5opvXc/QNBLvyCHwRoCRa12NBi7JzCh7a/livn8ib1kDpO+9d2btffBpmf85sew7 Cy+xleFVaiug== X-IronPort-AV: E=Sophos;i="5.75,360,1589266800"; d="scan'208";a="486691924" Received: from unknown (HELO [10.254.114.13]) ([10.254.114.13]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2020 10:49:12 -0700 Subject: Re: [PATCH v6] ASoC: Intel: kbl_rt5663_rt5514_max98927: Fix kabylake_ssp_fixup function To: Harsha Priya , alsa-devel@alsa-project.org, broonie@kernel.org Cc: lma@semihalf.com, yang.jie@linux.intel.com, liam.r.girdwood@linux.intel.com, rad@semihalf.com, zwisler@google.com, linux-kernel@vger.kernel.org, sathya.prakash.m.r@intel.com, brndt@google.com, mw@semihalf.com, levinale@chromium.org, Vamshi Krishna Gopal References: <1594919637-31460-1-git-send-email-harshapriya.n@intel.com> From: Pierre-Louis Bossart Message-ID: <48a6db3a-2aef-cfca-19ec-7825573fc3da@linux.intel.com> Date: Thu, 16 Jul 2020 12:49:09 -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: <1594919637-31460-1-git-send-email-harshapriya.n@intel.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 > diff --git a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c > index 584e4f9cedc2..b261b1c466a8 100644 > --- a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c > +++ b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c > @@ -379,22 +379,30 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, > struct snd_interval *chan = hw_param_interval(params, > SNDRV_PCM_HW_PARAM_CHANNELS); > struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); > - struct snd_soc_dpcm *dpcm = container_of( > - params, struct snd_soc_dpcm, hw_params); > - struct snd_soc_dai_link *fe_dai_link = dpcm->fe->dai_link; > - struct snd_soc_dai_link *be_dai_link = dpcm->be->dai_link; > + struct snd_soc_dpcm *dpcm, *rtd_dpcm; > + > + /* > + * This macro will be called for playback stream > + */ > + for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_PLAYBACK, dpcm) > + rtd_dpcm = dpcm; > + /* > + * This macro will be called for capture stream > + */ > + for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_CAPTURE, dpcm) > + rtd_dpcm = dpcm; is the assumption that both of those loops return the same pointer? If yes, why not stop for the first non-NULL dpcm value? Also wondering if you are using a loop because there's no other helper available? > > /* > * The ADSP will convert the FE rate to 48k, stereo, 24 bit > */ > - if (!strcmp(fe_dai_link->name, "Kbl Audio Port") || > - !strcmp(fe_dai_link->name, "Kbl Audio Headset Playback") || > - !strcmp(fe_dai_link->name, "Kbl Audio Capture Port")) { > + if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Port") || > + !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Headset Playback") || > + !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Capture Port")) { > rate->min = rate->max = 48000; > chan->min = chan->max = 2; > snd_mask_none(fmt); > snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE); > - } else if (!strcmp(fe_dai_link->name, "Kbl Audio DMIC cap")) { > + } else if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio DMIC cap")) { > if (params_channels(params) == 2 || > DMIC_CH(dmic_constraints) == 2) > chan->min = chan->max = 2; > @@ -405,7 +413,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, > * The speaker on the SSP0 supports S16_LE and not S24_LE. > * thus changing the mask here > */ > - if (!strcmp(be_dai_link->name, "SSP0-Codec")) > + if (!strcmp(rtd_dpcm->be->dai_link->name, "SSP0-Codec")) > snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE); > > return 0; >