From patchwork Wed Aug 21 20:17:16 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: 11108147 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 6A29B1399 for ; Wed, 21 Aug 2019 20:19:27 +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 EE7232332A for ; Wed, 21 Aug 2019 20:19:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="iOssyNWc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE7232332A 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 32ED41666; Wed, 21 Aug 2019 22:18:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 32ED41666 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1566418764; bh=/YywfK7f8MmVWkZSAfn47eVLdFc2vdSF0oqcC+i5jSk=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=iOssyNWc4eX/nXVPWuCvbmWNlAt8rnZrQJBPA2mlvvXb7AkdrM38GO3096uWPD4Gn hVNnAuDHLrupxRFhB+1STsfbVKQbdYVltu63WAzhD8K2WQdU0yQPWlMNLlrTfxUH10 hGUbvYcxG3lUfci6WaZZXURvSZQ/Bp99MjXivYYI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 35219F8036A; Wed, 21 Aug 2019 22:17:46 +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 2BD56F8036B; Wed, 21 Aug 2019 22:17:45 +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, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 0F6E3F8036A for ; Wed, 21 Aug 2019 22:17:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0F6E3F8036A X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2019 13:17:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,412,1559545200"; d="scan'208";a="186344116" Received: from smasango-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.252.139.100]) by FMSMGA003.fm.intel.com with ESMTP; 21 Aug 2019 13:17:35 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Wed, 21 Aug 2019 15:17:16 -0500 Message-Id: <20190821201720.17768-2-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190821201720.17768-1-pierre-louis.bossart@linux.intel.com> References: <20190821201720.17768-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Seppo Ingalsuo , Janusz Jankowski , tiwai@suse.de, gregkh@linuxfoundation.org, Takashi Iwai , linux-kernel@vger.kernel.org, Ranjani Sridharan , Liam Girdwood , Masahiro Yamada , vkoul@kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, slawomir.blauciak@intel.com, Thomas Gleixner , Bard liao , Rander Wang Subject: [alsa-devel] [RFC PATCH 1/5] ASoC: SOF: IPC: dai-intel: move ALH declarations in header file 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" ALH was inserted in the wrong place during integration, add after DMIC to mirror the file used by SOF firmware. No functional change, just text move in the same file to better track changes, if any. Signed-off-by: Pierre-Louis Bossart --- include/sound/sof/dai-intel.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/sound/sof/dai-intel.h b/include/sound/sof/dai-intel.h index 5f1ef5565be6..04e48227f542 100644 --- a/include/sound/sof/dai-intel.h +++ b/include/sound/sof/dai-intel.h @@ -87,6 +87,15 @@ struct sof_ipc_dai_hda_params { uint32_t link_dma_ch; } __packed; +/* ALH Configuration Request - SOF_IPC_DAI_ALH_CONFIG */ +struct sof_ipc_dai_alh_params { + struct sof_ipc_hdr hdr; + uint32_t stream_id; + + /* reserved for future use */ + uint32_t reserved[15]; +} __packed; + /* DMIC Configuration Request - SOF_IPC_DAI_DMIC_CONFIG */ /* This struct is defined per 2ch PDM controller available in the platform. @@ -179,13 +188,4 @@ struct sof_ipc_dai_dmic_params { struct sof_ipc_dai_dmic_pdm_ctrl pdm[0]; } __packed; -/* ALH Configuration Request - SOF_IPC_DAI_ALH_CONFIG */ -struct sof_ipc_dai_alh_params { - struct sof_ipc_hdr hdr; - uint32_t stream_id; - - /* reserved for future use */ - uint32_t reserved[15]; -} __packed; - #endif From patchwork Wed Aug 21 20:17:17 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: 11108151 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 2AE611399 for ; Wed, 21 Aug 2019 20:20:18 +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 B42582332A for ; Wed, 21 Aug 2019 20:20:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="EiN/6+gP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B42582332A 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 E2F5A84A; Wed, 21 Aug 2019 22:19:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E2F5A84A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1566418814; bh=aCNG8THXIf6cFnGEu5a6t8iza+cy9kzXzqaHzg3W7KA=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=EiN/6+gP+WtLgwownBYFoz/qXHaWpa+uQQVjOcnMg1ndqv88BtFxq+uW9UareA+KQ 0g2T49ahGpoxJC1V0BHTe58TIUgQAWVvhiX80Ilbt7WEvWFNe+DLONbWnLhSwTvqLS fE9LaMlyGx9FFEWKh+o3Eri4l5yfqku/yPtNzHGA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C4973F8045E; Wed, 21 Aug 2019 22:17:57 +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 80838F805E2; Wed, 21 Aug 2019 22:17:55 +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, URIBL_BLOCKED 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 96AFEF8045E for ; Wed, 21 Aug 2019 22:17:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 96AFEF8045E X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2019 13:17:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,412,1559545200"; d="scan'208";a="186344150" Received: from smasango-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.252.139.100]) by FMSMGA003.fm.intel.com with ESMTP; 21 Aug 2019 13:17:46 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Wed, 21 Aug 2019 15:17:17 -0500 Message-Id: <20190821201720.17768-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190821201720.17768-1-pierre-louis.bossart@linux.intel.com> References: <20190821201720.17768-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Guennadi Liakhovetski , tiwai@suse.de, Pan Xiuli , Takashi Iwai , srinivas.kandagatla@linaro.org, jank@cadence.com, Bard liao , YueHaibing , Pierre-Louis Bossart , Fred Oh , Ranjani Sridharan , Rander Wang , Arnd Bergmann , broonie@kernel.org, Daniel Baluta , Zhu Yingjiang , Kai Vehmanen , gregkh@linuxfoundation.org, Liam Girdwood , linux-kernel@vger.kernel.org, vkoul@kernel.org, slawomir.blauciak@intel.com Subject: [alsa-devel] [RFC PATCH 2/5] ASoC: SOF: Intel: hda: add helper to initialize SoundWire IP 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" The helper calls the SoundWire initializations and sets the resource structure defined as an interface with the platform driver. The resource deals with PCI base address, interrupts and the callback for the stream configuration. The interrupts are gated/ungated at the top-level with the ADSPIPC2.SNDW field Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/hda.c | 63 +++++++++++++++++++++++++++++++++++++++ sound/soc/sof/intel/hda.h | 1 + 2 files changed, 64 insertions(+) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index c72e9a09eee1..a968890d0754 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -18,7 +18,9 @@ #include #include +#include #include +#include #include #include #include @@ -35,6 +37,67 @@ #define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348) #define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8) +#if IS_ENABLED(CONFIG_SOUNDWIRE_INTEL) + +static void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable) +{ + if (enable) + snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, + HDA_DSP_REG_ADSPIC2, + HDA_DSP_ADSPIC2_SNDW, + HDA_DSP_ADSPIC2_SNDW); + else + snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, + HDA_DSP_REG_ADSPIC2, + HDA_DSP_ADSPIC2_SNDW, + 0); +} + +static int hda_sdw_init(struct snd_sof_dev *sdev) +{ + acpi_handle handle; + struct sdw_intel_res res; + + handle = ACPI_HANDLE(sdev->dev); + + memset(&res, 0, sizeof(res)); + + res.mmio_base = sdev->bar[HDA_DSP_BAR]; + res.irq = sdev->ipc_irq; + res.parent = sdev->dev; + + hda_sdw_int_enable(sdev, true); + + sdev->sdw = sdw_intel_init(handle, &res); + if (!sdev->sdw) { + dev_err(sdev->dev, "SDW Init failed\n"); + return -EIO; + } + + return 0; +} + +static int hda_sdw_exit(struct snd_sof_dev *sdev) +{ + hda_sdw_int_enable(sdev, false); + + if (sdev->sdw) + sdw_intel_exit(sdev->sdw); + + return 0; +} +#else +static int hda_sdw_init(struct snd_sof_dev *sdev) +{ + return 0; +} + +static int hda_sdw_exit(struct snd_sof_dev *sdev) +{ + return 0; +} +#endif + /* * Debug */ diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 5591841a1b6f..c8f93317aeb4 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -211,6 +211,7 @@ #define HDA_DSP_ADSPIC_IPC 1 #define HDA_DSP_ADSPIS_IPC 1 +#define HDA_DSP_ADSPIC2_SNDW BIT(5) /* Intel HD Audio General DSP Registers */ #define HDA_DSP_GEN_BASE 0x0 From patchwork Wed Aug 21 20:17:18 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: 11108153 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 9B641112C for ; Wed, 21 Aug 2019 20:21:03 +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 3220222CF7 for ; Wed, 21 Aug 2019 20:21:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="SHfJdDau" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3220222CF7 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 75EB91668; Wed, 21 Aug 2019 22:20:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 75EB91668 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1566418861; bh=4PTHQeiy2pe4mLnclY1aFNhVAq2sVjUTNVS202i4s0Q=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SHfJdDau5166Dnro0/GCJpbbtOHGfMfoe/LMgXwztLHYHxR3JWbFzZ0XNzh/KQ2KH 3oJrTmXJ+bN3LZ+PH/zgS3xjb4sVQHVc1kv1CFdhUfGxGHsBqh1MMipXprOqGR7ek5 Vkw4dB8uMW9y3sp1fsx+M1rKfNs1rAZr66KfDgoQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8B2BBF805F7; Wed, 21 Aug 2019 22:18:08 +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 D7781F805F9; Wed, 21 Aug 2019 22:18:06 +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, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 DDFA4F805F7 for ; Wed, 21 Aug 2019 22:18:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DDFA4F805F7 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2019 13:18:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,412,1559545200"; d="scan'208";a="186344192" Received: from smasango-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.252.139.100]) by FMSMGA003.fm.intel.com with ESMTP; 21 Aug 2019 13:17:57 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Wed, 21 Aug 2019 15:17:18 -0500 Message-Id: <20190821201720.17768-4-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190821201720.17768-1-pierre-louis.bossart@linux.intel.com> References: <20190821201720.17768-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Guennadi Liakhovetski , tiwai@suse.de, Pan Xiuli , Keyon Jie , Takashi Iwai , srinivas.kandagatla@linaro.org, jank@cadence.com, Bard liao , YueHaibing , Pierre-Louis Bossart , Fred Oh , Ranjani Sridharan , Rander Wang , Arnd Bergmann , broonie@kernel.org, Daniel Baluta , Zhu Yingjiang , Kai Vehmanen , gregkh@linuxfoundation.org, Liam Girdwood , linux-kernel@vger.kernel.org, vkoul@kernel.org, slawomir.blauciak@intel.com Subject: [alsa-devel] [RFC PATCH 3/5] ASoC: SOF: Intel: hda: add SoundWire IP support 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" The Core0 needs to be powered before the SoundWire IP is initialized. Call sdw_intel_init/exit and store the context. We only have one context, but depending on the hardware capabilities and BIOS settings may enable multiple SoundWire links. Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/hda.c | 40 +++++++++++++++++++++++++++++++++------ sound/soc/sof/intel/hda.h | 5 +++++ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index a968890d0754..e754058e3679 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -57,6 +57,8 @@ static int hda_sdw_init(struct snd_sof_dev *sdev) { acpi_handle handle; struct sdw_intel_res res; + struct sof_intel_hda_dev *hdev; + void *sdw; handle = ACPI_HANDLE(sdev->dev); @@ -66,23 +68,32 @@ static int hda_sdw_init(struct snd_sof_dev *sdev) res.irq = sdev->ipc_irq; res.parent = sdev->dev; - hda_sdw_int_enable(sdev, true); - - sdev->sdw = sdw_intel_init(handle, &res); - if (!sdev->sdw) { + sdw = sdw_intel_init(handle, &res); + if (!sdw) { dev_err(sdev->dev, "SDW Init failed\n"); return -EIO; } + hda_sdw_int_enable(sdev, true); + + /* save context */ + hdev = sdev->pdata->hw_pdata; + hdev->sdw = sdw; + return 0; } static int hda_sdw_exit(struct snd_sof_dev *sdev) { + struct sof_intel_hda_dev *hdev; + + hdev = sdev->pdata->hw_pdata; + hda_sdw_int_enable(sdev, false); - if (sdev->sdw) - sdw_intel_exit(sdev->sdw); + if (hdev->sdw) + sdw_intel_exit(hdev->sdw); + hdev->sdw = NULL; return 0; } @@ -713,6 +724,21 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) /* set default mailbox offset for FW ready message */ sdev->dsp_box.offset = HDA_DSP_MBOX_UPLINK_OFFSET; + /* need to power-up core before setting-up capabilities */ + ret = hda_dsp_core_power_up(sdev, HDA_DSP_CORE_MASK(0)); + if (ret < 0) { + dev_err(sdev->dev, "error: could not power-up DSP subsystem\n"); + goto free_ipc_irq; + } + + /* initialize SoundWire capabilities */ + ret = hda_sdw_init(sdev); + if (ret < 0) { + dev_err(sdev->dev, "error: SoundWire get caps error\n"); + hda_dsp_core_power_down(sdev, HDA_DSP_CORE_MASK(0)); + goto free_ipc_irq; + } + return 0; free_ipc_irq: @@ -744,6 +770,8 @@ int hda_dsp_remove(struct snd_sof_dev *sdev) snd_hdac_ext_bus_device_remove(bus); #endif + hda_sdw_exit(sdev); + if (!IS_ERR_OR_NULL(hda->dmic_dev)) platform_device_unregister(hda->dmic_dev); diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index c8f93317aeb4..48e09b7daf0a 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -399,6 +399,11 @@ struct sof_intel_hda_dev { /* DMIC device */ struct platform_device *dmic_dev; + +#if IS_ENABLED(CONFIG_SOUNDWIRE_INTEL) + /* sdw context */ + void *sdw; +#endif }; static inline struct hdac_bus *sof_to_bus(struct snd_sof_dev *s) From patchwork Wed Aug 21 20:17:19 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: 11108155 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 8EA1A112C for ; Wed, 21 Aug 2019 20:21:27 +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 229AE2339E for ; Wed, 21 Aug 2019 20:21:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="ZBIkWfSP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 229AE2339E 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 5ACED166D; Wed, 21 Aug 2019 22:20:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5ACED166D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1566418885; bh=y4JttAdj/dew0tMqimE/X1cx1o7m6vg8zhO6sn++7bY=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZBIkWfSPYPVwcMHBC893fDuvKNmDf8ZCnJnCv3r//W9XRlbjrYzhq8E+t+tB7Aueo CgPvgH/zIF8py/YiDYbRvRAuFuUBPuTk4jMULS7PMN4Dy69qPoJtbLRAd2sxSx4cHR 3aXvAN008VDPx7xaQUWYdD53LtUabYbnzQYJMxEE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B5784F805FD; Wed, 21 Aug 2019 22:18:17 +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 D3B21F805FE; Wed, 21 Aug 2019 22:18:14 +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_PASS,SPF_NONE, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 9B44AF805F8 for ; Wed, 21 Aug 2019 22:18:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9B44AF805F8 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2019 13:18:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,412,1559545200"; d="scan'208";a="186344211" Received: from smasango-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.252.139.100]) by FMSMGA003.fm.intel.com with ESMTP; 21 Aug 2019 13:18:04 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Wed, 21 Aug 2019 15:17:19 -0500 Message-Id: <20190821201720.17768-5-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190821201720.17768-1-pierre-louis.bossart@linux.intel.com> References: <20190821201720.17768-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Guennadi Liakhovetski , Arnd Bergmann , Kai Vehmanen , Liam Girdwood , tiwai@suse.de, gregkh@linuxfoundation.org, Takashi Iwai , YueHaibing , linux-kernel@vger.kernel.org, Ranjani Sridharan , vkoul@kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, slawomir.blauciak@intel.com, Zhu Yingjiang , Bard liao , Rander Wang Subject: [alsa-devel] [RFC PATCH 4/5] ASoC: SOF: Intel: hda: add SoundWire stream config/free callbacks 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" These callbacks are invoked when a matching hw_params/hw_free() DAI operation takes place, and will result in IPC operations with the SOF firmware. Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/hda.c | 66 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index e754058e3679..1e84ea9e6fce 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -53,6 +53,70 @@ static void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable) 0); } +static int sdw_config_stream(void *arg, void *s, void *dai, + void *params, int link_id, int alh_stream_id) +{ + struct snd_sof_dev *sdev = arg; + struct snd_soc_dai *d = dai; + struct sof_ipc_dai_config config; + struct sof_ipc_reply reply; + int ret; + u32 size = sizeof(config); + + memset(&config, 0, size); + config.hdr.size = size; + config.hdr.cmd = SOF_IPC_GLB_DAI_MSG | SOF_IPC_DAI_CONFIG; + config.type = SOF_DAI_INTEL_ALH; + config.dai_index = (link_id << 8) | (d->id); + config.alh.stream_id = alh_stream_id; + + /* send message to DSP */ + ret = sof_ipc_tx_message(sdev->ipc, + config.hdr.cmd, &config, size, &reply, + sizeof(reply)); + if (ret < 0) { + dev_err(sdev->dev, + "error: failed to set DAI hw_params for link %d dai->id %d ALH %d\n", + link_id, d->id, alh_stream_id); + } + + return ret; +} + +static int sdw_free_stream(void *arg, void *s, void *dai, int link_id) +{ + struct snd_sof_dev *sdev = arg; + struct snd_soc_dai *d = dai; + struct sof_ipc_dai_config config; + struct sof_ipc_reply reply; + int ret; + u32 size = sizeof(config); + + memset(&config, 0, size); + config.hdr.size = size; + config.hdr.cmd = SOF_IPC_GLB_DAI_MSG | SOF_IPC_DAI_CONFIG; + config.type = SOF_DAI_INTEL_ALH; + config.dai_index = (link_id << 8) | d->id; + config.alh.stream_id = 0xFFFF; /* invalid value on purpose */ + + /* send message to DSP */ + ret = sof_ipc_tx_message(sdev->ipc, + config.hdr.cmd, &config, size, &reply, + sizeof(reply)); + if (ret < 0) { + dev_err(sdev->dev, + "error: failed to free stream for link %d dai->id %d\n", + link_id, d->id); + } + + return ret; +} + +static const struct sdw_intel_ops sdw_callback = { + .config_stream = sdw_config_stream, + .free_stream = sdw_free_stream, +}; + static int hda_sdw_init(struct snd_sof_dev *sdev) { acpi_handle handle; @@ -67,6 +131,8 @@ static int hda_sdw_init(struct snd_sof_dev *sdev) res.mmio_base = sdev->bar[HDA_DSP_BAR]; res.irq = sdev->ipc_irq; res.parent = sdev->dev; + res.ops = &sdw_callback; + res.arg = sdev; sdw = sdw_intel_init(handle, &res); if (!sdw) { From patchwork Wed Aug 21 20:17:20 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: 11108157 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 DB14F1399 for ; Wed, 21 Aug 2019 20:22:20 +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 70C7322DD3 for ; Wed, 21 Aug 2019 20:22:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="uL9ow9c5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 70C7322DD3 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 C41AA1607; Wed, 21 Aug 2019 22:21:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C41AA1607 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1566418938; bh=DGtT1NI66vgJloFOi7QdCwzapGK2bdPBegwnET08cBE=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=uL9ow9c5V+cZ+ptewEZjD+mhMHZmD35IXQNz1yfX4OQwI5N0LZl2nmXwDN4/ZdOTv 5GWDGSW/xq0xRrT+0FYLxGP1uZLGpGaIThrDHLN3xi+x6jCN0jHEqRCBlrpUzlfTj4 PCII6eD2KTbfk5zCoRGEuEn6zTigbu2FCwIZW7Rg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5C1FDF80633; Wed, 21 Aug 2019 22:18:29 +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 E2657F80635; Wed, 21 Aug 2019 22:18:27 +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, URIBL_BLOCKED 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 48D02F80633 for ; Wed, 21 Aug 2019 22:18:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 48D02F80633 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2019 13:18:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,412,1559545200"; d="scan'208";a="186344260" Received: from smasango-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.252.139.100]) by FMSMGA003.fm.intel.com with ESMTP; 21 Aug 2019 13:18:18 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Wed, 21 Aug 2019 15:17:20 -0500 Message-Id: <20190821201720.17768-6-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190821201720.17768-1-pierre-louis.bossart@linux.intel.com> References: <20190821201720.17768-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Guennadi Liakhovetski , tiwai@suse.de, Pan Xiuli , Keyon Jie , Takashi Iwai , srinivas.kandagatla@linaro.org, jank@cadence.com, Bard liao , YueHaibing , Pierre-Louis Bossart , Fred Oh , Ranjani Sridharan , Rander Wang , Arnd Bergmann , broonie@kernel.org, Daniel Baluta , Zhu Yingjiang , Kai Vehmanen , gregkh@linuxfoundation.org, Liam Girdwood , linux-kernel@vger.kernel.org, vkoul@kernel.org, slawomir.blauciak@intel.com Subject: [alsa-devel] [RFC PATCH 5/5] ASoC: SOF: Intel: add support for SoundWire suspend/resume 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" Somehow the core0 needs to be on to set-up the interrupts and power-up the SoundWire IP. Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/hda-dsp.c | 11 +++++++++++ sound/soc/sof/intel/hda.c | 2 +- sound/soc/sof/intel/hda.h | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c index fb55a3c5afd0..e1ade59ac6e1 100644 --- a/sound/soc/sof/intel/hda-dsp.c +++ b/sound/soc/sof/intel/hda-dsp.c @@ -374,6 +374,17 @@ static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume) hda_dsp_ctrl_ppcap_enable(sdev, true); hda_dsp_ctrl_ppcap_int_enable(sdev, true); +#if IS_ENABLED(CONFIG_SOUNDWIRE_INTEL) + /* need to power-up core before setting-up capabilities */ + ret = hda_dsp_core_power_up(sdev, HDA_DSP_CORE_MASK(0)); + if (ret < 0) { + dev_err(sdev->dev, "error: could not power-up DSP subsystem\n"); + return ret; + } + + hda_sdw_int_enable(sdev, true); +#endif + return 0; } diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 1e84ea9e6fce..09aa0cfa6099 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -39,7 +39,7 @@ #if IS_ENABLED(CONFIG_SOUNDWIRE_INTEL) -static void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable) +void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable) { if (enable) snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 48e09b7daf0a..de71c92b2f39 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -591,6 +591,11 @@ int hda_dsp_trace_init(struct snd_sof_dev *sdev, u32 *stream_tag); int hda_dsp_trace_release(struct snd_sof_dev *sdev); int hda_dsp_trace_trigger(struct snd_sof_dev *sdev, int cmd); +/* + * SoundWire support + */ +void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable); + /* common dai driver */ extern struct snd_soc_dai_driver skl_dai[];