Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7419805ybl; Wed, 15 Jan 2020 22:38:40 -0800 (PST) X-Google-Smtp-Source: APXvYqwXT/hNSEIJc0aHV3Cx0Fp4rD2enW8aM1IARPNOs1YoPUS1A4oIzg4F7SviDYoDrjHK8lGy X-Received: by 2002:aca:a9c5:: with SMTP id s188mr3068542oie.154.1579156719907; Wed, 15 Jan 2020 22:38:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579156719; cv=none; d=google.com; s=arc-20160816; b=P0P6ImTlntgyoGVo5xQB+VUsyKkF7+oH0Kg/aIjuOYFUvSlfnW5hAGhJ/CQ04DzLus QpoOVvx91OoE4Z1wVuHfAe9eejKROqM4wPhY3rgox67li3ug1PrYv9EE06uVoi7q4MZq svJZ54Hb7XNOobLwuHXglB+jTpgTostABuqHcxTbITpDmKEP3ymzDfa3vDUGujvJ0HtB nV045ZOV1lzBGvE7LhcQrge3PenrDDH2bRfDTt0mnXmZSSm2PN3+t8EN6BLuIPM2cl0K VHBYmnI6yB9M5dVXhirUnArA47Sy2HOOLU1BPckneIITkIPUkg3YfGZSYvftsEQJN8YM lWPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NGGRCbRsjloWfYF2cHg3taqwmJTEu8ejz3Fhy/MiNIg=; b=RXaVkgeX7KTpyBAUdVP0l5eqS66ZIIX6/AA4j/iro2n2A5yy/v7YgGcQxv5uj5ICx/ 7NOMabxVky4UgviQDu5gwPZk0V5sY92rlbpo5j3TyTYrvfYTjQvZm2WLckUbieq8AjVY 37vKfCE0MeZHUCVoCQPzxrO+1FP4BwDDEFdYY/araJFJPhVxP6jiby8Wt+ZrRHICS1J+ EhepWG9g+KPaOfCn2KPZ8SlnvJFFc6JJJS2oSyRM+BWzP0Pg6htkitNBOLir+vLJCevf 3z3PQHtoHj/k0cPSNkGgNP8WhN5vw1/mylLKCto6jp18BQ6wDe0egSEm4R1rAzsbebEE e8yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FAPgEX95; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si10989103oid.132.2020.01.15.22.38.26; Wed, 15 Jan 2020 22:38:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FAPgEX95; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727007AbgAPFzI (ORCPT + 99 others); Thu, 16 Jan 2020 00:55:08 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35675 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726082AbgAPFzH (ORCPT ); Thu, 16 Jan 2020 00:55:07 -0500 Received: by mail-wr1-f68.google.com with SMTP id g17so17842900wro.2; Wed, 15 Jan 2020 21:55:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NGGRCbRsjloWfYF2cHg3taqwmJTEu8ejz3Fhy/MiNIg=; b=FAPgEX95Okm1PYWx+lYdAYkeQZFYdkQpx4INTn3yuTeEPggTIkb+SSmpiN1DrTzTMR F8YAzV3LpIE8v/+DzLESZGFiolINqohluQXIo5pP4qfGoAv4WuvIl09MTLyH/FgA1uED xrvzH0NNnXsLoP7bi/MMapp889FaW2xsFrvqd9tgZSywMra+//L2O3Mv0Qxb5MadOSHP jz223DZjqzt/Nu4ZBN1vXyCUZyN/lHZMeD3lyK1qC5WaiY3J1zUCz+M5X+Kbrc/ZBLL7 l6i3rSH3TITt2pQsDv9MJNDyHG9uJQQzOv14/uixxkDS9KoFz7btgVg7iRx2X6f/H1vU VCaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NGGRCbRsjloWfYF2cHg3taqwmJTEu8ejz3Fhy/MiNIg=; b=mORmB0PJPByy1cqEUlQrchJyP7gFMouicSTjwQ7+t72fWieNmPCMNTNO/5FOBY48/1 cYb/l8SlP8TccrcscJNysMyI8LOmsNBP3un3NJlbhDf/Uc/9ivr5FwPTRe5FNQOEDlN0 gl4qCFQ7lBxIFRS3G2hGzJr+P6gcC5xmaG8Q/zC+jVcpfdDiIkPK8neFNS7WN0IpRKPU mjb/A3Iu5je8d+0Gc461IgIpNfkLlk1Kj6uJPoghkqIHSLN32cbolktNBVZh6m0bSOlT Z5c3wKAimdus/4mAwAyIlKOjzeCASEtZTj1vIqV48buT8eKv1jm4ly0R1vCezTgc3V6R 8Ubg== X-Gm-Message-State: APjAAAUdw5UAMXCS4mDDA6WaKx4LubL2MYWVyFP9tuf4gAANyNWgzPL9 E0QaedYSHIOi+zAlaMrQ0RJ365RgOe0XMz5n1tQ= X-Received: by 2002:adf:d850:: with SMTP id k16mr1193679wrl.96.1579154104574; Wed, 15 Jan 2020 21:55:04 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: John Stultz Date: Wed, 15 Jan 2020 21:54:54 -0800 Message-ID: Subject: Re: [PATCH V6 3/4] ASoC: pcm_dmaengine: Extract snd_dmaengine_pcm_refine_runtime_hwparams To: Shengjiu Wang Cc: timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, Linux Kernel Mailing List , Rob Herring , Mark Rutland , devicetree@vger.kernel.org, lars@metafoo.de Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 8, 2020 at 8:58 PM John Stultz wrote: > On Thu, Sep 26, 2019 at 6:50 PM Shengjiu Wang wrote: > > > > When set the runtime hardware parameters, we may need to query > > the capability of DMA to complete the parameters. > > > > This patch is to Extract this operation from > > dmaengine_pcm_set_runtime_hwparams function to a separate function > > snd_dmaengine_pcm_refine_runtime_hwparams, that other components > > which need this feature can call this function. > > > > Signed-off-by: Shengjiu Wang > > Reviewed-by: Nicolin Chen > > As a heads up, this patch seems to be causing a regression on the HiKey board. > > On boot up I'm seeing: > [ 17.721424] hi6210_i2s f7118000.i2s: ASoC: can't open component > f7118000.i2s: -6 > > And HDMI audio isn't working. With this patch reverted, audio works again. > > > > diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c > > index 89a05926ac73..5749a8a49784 100644 > > --- a/sound/core/pcm_dmaengine.c > > +++ b/sound/core/pcm_dmaengine.c > > @@ -369,4 +369,87 @@ int snd_dmaengine_pcm_close_release_chan(struct snd_pcm_substream *substream) > ... > > + ret = dma_get_slave_caps(chan, &dma_caps); > > + if (ret == 0) { > > + if (dma_caps.cmd_pause && dma_caps.cmd_resume) > > + hw->info |= SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME; > > + if (dma_caps.residue_granularity <= DMA_RESIDUE_GRANULARITY_SEGMENT) > > + hw->info |= SNDRV_PCM_INFO_BATCH; > > + > > + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) > > + addr_widths = dma_caps.dst_addr_widths; > > + else > > + addr_widths = dma_caps.src_addr_widths; > > + } > > It seems a failing ret from dma_get_slave_caps() here is being returned... > > > + > > + /* > > + * If SND_DMAENGINE_PCM_DAI_FLAG_PACK is set keep > > + * hw.formats set to 0, meaning no restrictions are in place. > > + * In this case it's the responsibility of the DAI driver to > > + * provide the supported format information. > > + */ > > + if (!(dma_data->flags & SND_DMAENGINE_PCM_DAI_FLAG_PACK)) > > + /* > > + * Prepare formats mask for valid/allowed sample types. If the > > + * dma does not have support for the given physical word size, > > + * it needs to be masked out so user space can not use the > > + * format which produces corrupted audio. > > + * In case the dma driver does not implement the slave_caps the > > + * default assumption is that it supports 1, 2 and 4 bytes > > + * widths. > > + */ > > + for (i = SNDRV_PCM_FORMAT_FIRST; i <= SNDRV_PCM_FORMAT_LAST; i++) { > > + int bits = snd_pcm_format_physical_width(i); > > + > > + /* > > + * Enable only samples with DMA supported physical > > + * widths > > + */ > > + switch (bits) { > > + case 8: > > + case 16: > > + case 24: > > + case 32: > > + case 64: > > + if (addr_widths & (1 << (bits / 8))) > > + hw->formats |= pcm_format_to_bits(i); > > + break; > > + default: > > + /* Unsupported types */ > > + break; > > + } > > + } > > + > > + return ret; > > ... down here. > > Where as in the old code... > > > diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c > > index 748f5f641002..b9f147eaf7c4 100644 > > --- a/sound/soc/soc-generic-dmaengine-pcm.c > > +++ b/sound/soc/soc-generic-dmaengine-pcm.c > > > @@ -145,56 +140,12 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea > > if (pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE) > > hw.info |= SNDRV_PCM_INFO_BATCH; > > > > - ret = dma_get_slave_caps(chan, &dma_caps); > > - if (ret == 0) { > > - if (dma_caps.cmd_pause && dma_caps.cmd_resume) > > - hw.info |= SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME; > > - if (dma_caps.residue_granularity <= DMA_RESIDUE_GRANULARITY_SEGMENT) > > - hw.info |= SNDRV_PCM_INFO_BATCH; > > - > > - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) > > - addr_widths = dma_caps.dst_addr_widths; > > - else > > - addr_widths = dma_caps.src_addr_widths; > > - } > > ...the ret from dma_get_slave_caps() checked above, but is not > actually returned. > > Suggestions on how to sort this out? Just wanted to check in on this, as I'm still seeing this regression with -rc6. thanks -john