Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1268097pxa; Fri, 28 Aug 2020 08:11:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbJ/cY935Mf3wjtLOqs619TczFR/3/ZbxKhU+0xxpLurtc9lGfdG87+pviOAnESkybLeDV X-Received: by 2002:a17:906:f293:: with SMTP id gu19mr2289998ejb.209.1598627465577; Fri, 28 Aug 2020 08:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598627465; cv=none; d=google.com; s=arc-20160816; b=zdYbSOCiupQ6htZdR+57UYVBmJV9zK3cI63c5cvYdDDXXmci3kCAR0IxP+aprLIxCM iWCMXhk7cDPga6XpEYHaqSIlOS4NuFa7FRAAJqx5r73WqwgLoST55yi824LoFWbF2RH+ yC9Yl9wggiyZO5neMx9OhCARr92pXzCfFqefrbpaXl/sv2ZM1Hj65vH18zB6x93428zv rjJJaC6YWnBWBbC8TbGCzNGW0AS4klYNXXQe+EZCE14NPHYpB166kUoB6C1Xc3Gz0dP1 tFmjtTjgrxAAYaWY+fV2Hf+pBztiYt/1SaDrCngJpduw9opN+eOPf6tWg66OSL0ApSL4 Ztkw== 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=pHdtVi+DMRj89hipCnaE8GytC+UpSa36DJ0zxlrs5FY=; b=ykZ7DEs6TpxXLlzRhHcXsb8h8maiZrCmwoQPYg+MQZ+kR+Wo0SaUywqofjDR54wcih 2zytqwOavcQ9u567oLG6VlZfiNkR8/upmsJsZsJFQrXFnZpQsILaP3tXopNkcApqWugJ 2duk2hTojwEOB7TeLE6PP3FhzAdSYo1w8dRwIFtGyVCqGwZE4IVup7sNnSjcRxH2OhVi c8IXSh77OICZTVbJqaizD5fRMf1spNRDb05QBiSLTcp+qDMgKDDiFu3HwqZzKtaY6I5B deIKjTu1pL4pXz3PVjyL9MbljI6wq4hwdfvu2tAB/Hw9/fmwpHOaTQiUn1oDpYgeuG3y pvog== 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 t19si886653edt.161.2020.08.28.08.10.39; Fri, 28 Aug 2020 08:11:05 -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 S1727957AbgH1PHn (ORCPT + 99 others); Fri, 28 Aug 2020 11:07:43 -0400 Received: from mga05.intel.com ([192.55.52.43]:57782 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726141AbgH1PHm (ORCPT ); Fri, 28 Aug 2020 11:07:42 -0400 IronPort-SDR: UDMcF1IBjSbeVvBlcSTVrP0XEhstyDZgsrRnJxbv68wp9UEYViKAH+Fi+PKi+zRd17AneCZWEO lSmgM+bvW2iQ== X-IronPort-AV: E=McAfee;i="6000,8403,9727"; a="241493878" X-IronPort-AV: E=Sophos;i="5.76,364,1592895600"; d="scan'208";a="241493878" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2020 08:07:41 -0700 IronPort-SDR: 3221SinK08aDM3DBF4iZ1zeOb2Dw1HuzNYvFcqfiP5278XKel9wUEhTOKsl79dqCj69wLyapBb TRFE+iC8pR/w== X-IronPort-AV: E=Sophos;i="5.76,364,1592895600"; d="scan'208";a="300263904" Received: from lilymao-mobl.amr.corp.intel.com (HELO [10.209.185.175]) ([10.209.185.175]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2020 08:07:39 -0700 Subject: Re: [PATCH 07/11] soundwire: intel: Only call sdw stream APIs for the first cpu_dai To: Vinod Koul , "Liao, Bard" Cc: "alsa-devel@alsa-project.org" , "tiwai@suse.de" , "gregkh@linuxfoundation.org" , "linux-kernel@vger.kernel.org" , "ranjani.sridharan@linux.intel.com" , "hui.wang@canonical.com" , "broonie@kernel.org" , "srinivas.kandagatla@linaro.org" , "jank@cadence.com" , "Lin, Mengdong" , "Kale, Sanyog R" , Bard Liao , "rander.wang@linux.intel.com" References: <20200818024120.20721-1-yung-chuan.liao@linux.intel.com> <20200818024120.20721-8-yung-chuan.liao@linux.intel.com> <20200826094636.GB2639@vkoul-mobl> <20200828074544.GM2639@vkoul-mobl> From: Pierre-Louis Bossart Message-ID: <9eac0f85-1b0f-d2c2-6d1b-15b77707c9b7@linux.intel.com> Date: Fri, 28 Aug 2020 10:07:38 -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: <20200828074544.GM2639@vkoul-mobl> 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 On 8/28/20 2:45 AM, Vinod Koul wrote: > On 28-08-20, 01:47, Liao, Bard wrote: >>> snd_pcm_substream *substream, >>>> goto err; >>>> } >>>> >>>> - ret = sdw_prepare_stream(dma->stream); >>>> + /* >>>> + * All cpu dais belong to a stream. To ensure sdw_prepare_stream >>>> + * is called once per stream, we should call it only when >>>> + * dai = first_cpu_dai. >>>> + */ >>>> + if (first_cpu_dai == dai) >>>> + ret = sdw_prepare_stream(dma->stream); >>> >>> Hmmm why not use the one place which is unique in the card to call this, >>> hint machine dais are only called once. >> >> Yes, we can call it in machine driver. But, shouldn't it belong to platform >> level? The point is that if we move the stuff to machine driver, it will >> force people to implement these stuff on their own Intel machine driver. > > nothing stops anyone from doing that right! machine driver is another > component so it can be moved there as well What Bard is saying is that there is nothing board-specific here. This is platform-driver code that is independent of the actual machine configuration. Machine drivers can be board-specific, so we would have to add the code for prepare/deprepare/trigger to every machine driver. Today it's true that we worked to have a single machine driver for all SoundWire-based devices, so the change is a 1:1 move, but we can't guarantee that this would be the case moving forward. In fact, we *know* we will need a different machine driver when we parse platform firmware to create the card for SDCA support. So in the end there would be duplication of code. See the code we worked on at https://github.com/thesofproject/linux/commit/7322e1d25ce2ec9bb78c6e861919f61e0be7cc0b.patch it'd really a bit silly to have this generic code in the machine driver. it would be fine to call a set of helpers called from the machine driver dailink, but where would we put these helpers? on the ASoC or SoundWire sides?