From patchwork Wed Aug 21 20:05:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 11108117 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BD9413B1 for ; Wed, 21 Aug 2019 20:06:34 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B337623403 for ; Wed, 21 Aug 2019 20:06:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="H/WKoEzS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B337623403 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7E5FD857; Wed, 21 Aug 2019 22:05:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7E5FD857 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1566417991; bh=CzFHXHYv0rlqIcjyQzEFYHe5Y/bkp6azgfvBV/aMO98=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=H/WKoEzSISqevKeF0L3bWOx+i62ZMfx+755HtNXC4caO/t1TkadfYJo4/CbwpJi6V BBQO2M1+FNwimfvhpUmUn+tP/Of2EGCttP30mq1C1uWcuXcf8RAnWDsPwhc6yuCtg/ ebqRrUbnDHZUa6Urc3D8L+e/qQ9Qz2xzFfOjc0Hg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 908E2F802FB; Wed, 21 Aug 2019 22:05:39 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1D289F80322; Wed, 21 Aug 2019 22:05:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_NONE autolearn=disabled version=3.4.0 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 93109F800BF for ; Wed, 21 Aug 2019 22:05:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 93109F800BF X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2019 13:05:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,412,1559545200"; d="scan'208";a="196069731" Received: from smasango-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.252.139.100]) by fmsmga001.fm.intel.com with ESMTP; 21 Aug 2019 13:05:27 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Wed, 21 Aug 2019 15:05:10 -0500 Message-Id: <20190821200521.17283-1-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Cc: Pierre-Louis Bossart , tiwai@suse.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, Ranjani Sridharan , vkoul@kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, slawomir.blauciak@intel.com, Bard liao , Rander Wang Subject: [alsa-devel] [RFC PATCH 00/11] soundwire: intel: simplify DAI/PDI handling X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" In the initial SoundWire code released by Intel, the PDIs and ports on the Master interface were dynamically allocated. This wasn't a bad idea at the time and would have allowed for interesting routing. Fast-forward to 2019, with the hardware available on CometLake/IceLake, that dynamic allocation makes it complicated to deal with statically-allocated ASoC dailinks and topology-defined DAIs. In this series, we suggest a drastic simplification where the SoundWire code reuses information provided by DAIs and dailinks. We also suggest removing the dynamic allocation of ports on the master since in practice there is a 1:1 mapping between ports and PDIs. In the second part of the series, we suggest adding new callbacks to SoundWire DAIs, so that all the SoundWire stream operations are contained at the DAI level. This solution results in a very simple integration with the SOF code (which will be shared in a separate series since SOF will not apply directly on top of soundwire/next). The SOF parts only call a SoundWire init/release API, and provides 2 callbacks for hw_params and free, with all the details of the SoundWire DAIs and IP handled in drivers/soundwire. This solution has been tested on CometLake/IceLake with simple capture/playback. When ASoC supports the multi-cpu capability needed for synchronized playback/capture across multiple links, we will have to modify slightly this solution so that the stream alloc, release and trigger operations are done once. This is future work that will take place later, likely after 5.4, and which should not impact the SOF integration. The code in this patchset is the result of collaboration between Bard Liao, Rander Wang and Pierre Bossart, with ideas coming from all 3 sides. It's likely that there are still some parts in the code that can be improved, hence the RFC state. Bard Liao (3): soundwire: intel: fix intel_register_dai PDI offsets and numbers soundwire: intel: remove playback/capture stream_name soundwire: cadence_master: improve PDI allocation Pierre-Louis Bossart (3): soundwire: remove DAI_ID_RANGE definitions soundwire: cadence/intel: simplify PDI/port mapping soundwire: intel: don't filter out PDI0/1 Rander Wang (5): soundwire: intel: improve .config_stream callback, add .free_stream soundwire: intel: add prepare support in sdw dai driver soundwire: intel: add trigger support in sdw dai driver soundwire: intel: do sdw stream setup in setup function soundwire: intel: free all resources on hw_free() drivers/soundwire/cadence_master.c | 158 ++++------------ drivers/soundwire/cadence_master.h | 34 +--- drivers/soundwire/intel.c | 278 ++++++++++++++++------------ include/linux/soundwire/sdw.h | 3 - include/linux/soundwire/sdw_intel.h | 4 +- 5 files changed, 209 insertions(+), 268 deletions(-)