Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1758782pxj; Wed, 19 May 2021 13:14:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzerDo9nNHLFSSynIMLln7Pdooeulk/+T3+ahISUct7rluLeA/nzjpCFs1i/nVJDW8/bz4j X-Received: by 2002:a05:6e02:eac:: with SMTP id u12mr896405ilj.177.1621455276642; Wed, 19 May 2021 13:14:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621455276; cv=none; d=google.com; s=arc-20160816; b=SEAOrEgUI98y/lDLy/g20AlY3fBdMiqTflz5m4YQQcFc/JCYMQrW/um9KWSZw28cPU 7207bPDu/vQEitM6x7FDbWv/dU1/vdZlsv+9FNtsjZsTVI8f6ReNMARcwHvOSd9KXui4 RFlmH9t5+JIqlbpuZpHzTZTN4aJ2L/8TXHbzHD9xBAPndyJcbY4GnCQ1TbFOr3lpHMlZ 2ixPTLAsqtI7sQsZ+E0W4FowZVNGj2KfmnQDqdVUjApNAklVHIylSSJJGnXbDUgO4Trx A+M8WgZ0oN+gcg3Ah6gHFlvDD5ba3pOoTx/gD0ix9vfmnSH1E3yvkBVeyzVHyQpUPNLH lG+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=IUgrpe1HeFuyM5l2L0KTLvow3oNv8Ugl5K7ppWS5xjc=; b=WSH7kraciTWosRHbiu69Uwt9zNTSVLI/8GVoZo7uNjbc12/Rh8CZhDlBzmunffZZKC RUN22kfp9aNTgrQboWbNGaCUsONlJZgfUTGMbegiIMHKsE25Orc3Rh5f9UVvXxMNkZeC v4vT94aUTMqGRX78PhT4AH5XCMHaP8Iphp1mjIaKZDdQaWJf5lpY+xi1ZenmDId5Z5F1 1HoVcJpkJdgCLSyyLQGsUmt7ZahwfM+9Mmvk83jgCWpZAcLeXR7x4nPxyMFz1GALJxpv DwE/ugMk+/0Ed3nJC0d3lFvM17AAf10ndcr8w1raImRTQGCyGWL35VBhVTh7768NOADT 2Tow== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z8si751252ilq.2.2021.05.19.13.14.24; Wed, 19 May 2021 13:14:36 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347850AbhESPmw (ORCPT + 99 others); Wed, 19 May 2021 11:42:52 -0400 Received: from mx2.suse.de ([195.135.220.15]:53510 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242076AbhESPmv (ORCPT ); Wed, 19 May 2021 11:42:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E1776B01E; Wed, 19 May 2021 15:41:30 +0000 (UTC) Date: Wed, 19 May 2021 17:41:30 +0200 Message-ID: From: Takashi Iwai To: Cc: , , , , , , , , , , , Subject: Re: [RFC PATCH 0/6] soc-pcm: Add separate snd_pcm_runtime for BEs In-Reply-To: <056e560e-d06d-23bc-b041-60890fa51e63@microchip.com> References: <20210519104842.977895-1-codrin.ciubotariu@microchip.com> <056e560e-d06d-23bc-b041-60890fa51e63@microchip.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 19 May 2021 17:08:10 +0200, wrote: > > On 19.05.2021 17:15, Takashi Iwai wrote: > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > > > On Wed, 19 May 2021 12:48:36 +0200, > > Codrin Ciubotariu wrote: > >> > >> This patchset adds a different snd_pcm_runtime in the BE's substream, > >> replacing the FE's snd_pcm_runtime. With a different structure, the BE > >> HW capabilities and constraints will no longer merge with the FE ones. > >> This allows for error detection if the be_hw_params_fixup() applies HW > >> parameters not supported by the BE DAIs. Also, it calculates values > >> needed for mem-to-dev/dev-to-mem DMA transfers, such as buffer size and > >> period size, if needed. > >> > >> The first 4 patches are preparatory patches, that just group and export > >> functions used to allocate and initialize the snd_pcm_runtime. Also, the > >> functions that set and apply the HW constraints are exported. > >> The 5th patch does (almost) everything need to create the new snd_pcm_runtime > >> for BEs, which includes allocation, initializing the HW capabilities, > >> HW constraints and HW parameters. The BE HW parameters are no longer > >> copied from the FE. They are recalculated, based on HW capabilities, > >> constraints and the be_hw_params_fixup() callback. > >> The 6th and last patch basically adds support for the PCM generic > >> dmaengine to be used as a platform driver for BE DAI links. It allocates > >> a buffer, needed by the DMA transfers that do not support dev-to-dev > >> transfers between FE and BE DAIs. > >> > >> This is a superset of > >> https://mailman.alsa-project.org/pipermail/alsa-devel/2021-March/182630.html > >> which only handles the BE HW constraints. This patchset aims to be more > >> complete, defining a a snd_pcm_runtime between each FE and BE and can > >> be used between any DAI link connection. I am sure I am not handling all > >> the needed members of snd_pcm_runtime (such as handling > >> struct snd_pcm_mmap_status *status), but I would like to have your > >> feedback regarding this idea. > > > > I'm also concerned about the handling of other fields in runtime > > object, maybe allocating a complete runtime object for each BE is an > > overkill and fragile. Could it be rather only hw_constraints to be > > unique for each BE, instead? > > I tried with only the hw constraints in the previous patchset and it's > difficult to handle the snd_pcm_hw_rule_add() calls, without changing > the function's declaration. This solution requires no changes to > constraints API, nor to their 'clients'. I agree that handling all the > runtime fields might be over-complicated. From what I see, the scary > ones are used to describe the buffer and the status of the transfers. I > do not think there are BEs that use these values at this moment (the FE > ones). I think that the HW params, private section, hardware description > and maybe DMA members (at least in my case) are mostly needed by BEs. OK, I'll check your previous series again, but my gut feeling is for pursuit to the hw_constraints hacks. e.g. we may split snd_pcm_hw_constraints and snd_pcm_hw_rule, too, if that matters. > > Also, the last patch allows only IRAM type, which sounds already > > doubtful. The dmaengine code should be generic. > > dmaengine, when used with normal PCM, preallocates only IRAM buffers > [1]. This BE buffer would only be needed if DMA dev-to-mem or mem-to-dev > transfers are needed, between FE and BE. I agree that it could be > handled differently, I added it here mostly to express my goal, which is > to use the generic dmaengine for BEs. My DMA has no dev-to-dev DMA > capability, so I need a buffer to move the data between FE and BE. Ah, right, I overlooked that part... It's confusing. Maybe it's in that style just because it falls back to SNDRV_DMA_TYPE_DEV? It's another discussion, in anyway. thanks, Takashi