From: Takashi Iwai Subject: Re: [PATCH] ASoC: Intel: hdac_hdmi: Add sampling frequencies constraint Date: Tue, 07 Aug 2018 17:22:50 +0200 Message-ID: References: <1533653765-26080-1-git-send-email-yong.zhi@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id DC768267692 for ; Tue, 7 Aug 2018 17:22:51 +0200 (CEST) In-Reply-To: <1533653765-26080-1-git-send-email-yong.zhi@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Yong Zhi Cc: alsa-devel@alsa-project.org, harshapriya.n@intel.com, pierre-louis.bossart@linux.intel.com, vkoul@kernel.org, broonie@kernel.org, naveen.m@intel.com, sanyog.r.kale@intel.com List-Id: alsa-devel@alsa-project.org On Tue, 07 Aug 2018 16:56:05 +0200, Yong Zhi wrote: > > Playback of 44.1Khz contents with HDMI plugged returns > "Invalid pipe config". Why? Is it a limitation of i915 graphics side? If it's a generic issue, we'd need to fix also in the legacy HDMI driver, too. (snip) .... > + > + sad_rates = sad_sample_rates_lpcm(sad); > + /* Filter out 44.1, 88.2 and 176.4Khz */ > + for (j = 0; j < 7; j += 2) > + if (sad_rates & BIT(j)) > + rates |= cea_sampling_freqs[j]; > + > + snd_pcm_hw_constraint_mask64(runtime, > + SNDRV_PCM_HW_PARAM_RATE, > + rates); The whole changes are too complex. You don't have to reduce the list dynamically, but just need to tell the all possible rates with a static array. Or, even simpler, just filter the rates bits in hdac_hdmi_create_dais() from the beginning like below. thanks, Takashi --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -1410,6 +1410,12 @@ static int hdac_hdmi_create_dais(struct hdac_device *hdev, if (ret) return ret; + /* Filter out 44.1, 88.2 and 176.4Khz */ + rates &= ~(SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_88200 | + SNDRV_PCM_RATE_176400); + if (!rates) + return -EINVAL; + sprintf(dai_name, "intel-hdmi-hifi%d", i+1); hdmi_dais[i].name = devm_kstrdup(&hdev->dev, dai_name, GFP_KERNEL);