From patchwork Tue Oct 8 16:44:39 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: 175526 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp5949092ill; Tue, 8 Oct 2019 09:49:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqztRLxu/xGtLXZI6UJBH1zX37bSigzKRJKLsKroyhm0o5uRSTiOcA6QzOSMf0lo8kl8FzWE X-Received: by 2002:a1c:9e46:: with SMTP id h67mr4650349wme.48.1570553357637; Tue, 08 Oct 2019 09:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570553357; cv=none; d=google.com; s=arc-20160816; b=vizCs1Ls0fDemM7tubghDT9i7ZolJghpmgf1uHExlmVR2vqxEqdfEMMrfxZvfvDSKP HZs9aIbhtxWDURA2ZlmetZGe5ScP8fUl/ZL9gDzs8AUlbBdNFJsWI+cPtfMRRYL0gvh+ 0dZh0lxWhjnG+L4hCjF3tTGGAyaal+y1iYqZULnxUywrujHJBK8l3yQNuUN422ckF9n5 pqbNHcWDm1ZJ4DJDtddG8s1AMhW1/2ZUaxb/HxtfSOznOz6bsUgXcMTKDx06zCcotZXJ ZbBUYvV844bEMqJG8lzV6cNTyvGiWPKD6IFvEPHYD8xq4Pq6tyU+8v4MvqDUBrYbJeEp sTEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :dkim-filter:delivered-to:dkim-signature:dkim-filter; bh=Jm79MSq425TP2PN+/lxqSkLYTeQgn024v5Vx+o4ljVA=; b=Al/Y/8+rNVEsP+eCUXZn2aEugZx/9iERSTcJEJwpJuh3bAKGxe7b/LSgi2IxcVIsmL MC+fvVMrkDcSAkz1IEH27ac2nbiQLti3PZYwSVq2wNbZzFjGUGqmrU7WyYczPGOoKjNs GqLcgApyegsPFkuBBPyrqNpsNNMIJ8ukWK3Z+COkS1aREZwvzakJSNTc/+NyDOsgEq/W b7CTW46XLIgt5Ad130IBc3csqu3yESdIoQlovIMG/dYs978kaAlpqu3P/8h+QCo7jAM2 33WpUYYmYGC95SY69KvPtvqQ24MB9cCnNBXQNHCQ+M6OE3jhO6pQZ6afwQacHJ+HEYiD ldcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alsa-project.org header.s=default header.b=IWGGOexU; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTPS id c198si2837913wmd.186.2019.10.08.09.49.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2019 09:49:17 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=pass header.i=@alsa-project.org header.s=default header.b=IWGGOexU; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 D7BC91677; Tue, 8 Oct 2019 18:48:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D7BC91677 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1570553356; bh=hGIoHwKw5+WbiGfGZzMEzfXSmPrvQ4kT7c4YTwkVaQE=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=IWGGOexU5LsnC4TW3rKcAtIleupP+gzuf+3C6B5YvPCUz3dmMra59z5sw83mxNuaN IUyPH8rtQQUUQC3g4ndZSdKAlQa/myqmaeasLlOmyBjvWNQk9zNPa2wUvgma7JNEhn ogk1bPz0dsCHPt57HYpI3rEgTDjoJikG7ubz6AyI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DEFF8F80636; Tue, 8 Oct 2019 18:45:03 +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 10C68F8060F; Tue, 8 Oct 2019 18:44:59 +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=RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE, SPF_NONE, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 82B4CF804CA for ; Tue, 8 Oct 2019 18:44:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 82B4CF804CA X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Oct 2019 09:44:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,270,1566889200"; d="scan'208";a="218338333" Received: from kwwong-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.150.53]) by fmsmga004.fm.intel.com with ESMTP; 08 Oct 2019 09:44:49 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 8 Oct 2019 11:44:39 -0500 Message-Id: <20191008164443.1358-6-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191008164443.1358-1-pierre-louis.bossart@linux.intel.com> References: <20191008164443.1358-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: tiwai@suse.de, broonie@kernel.org, Daniel Baluta , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 5/9] ASoC: SOF: imx: Describe ESAI parameters to be sent to DSP 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" From: Daniel Baluta Introduce sof_ipc_dai_esai_params to keep information that we get from topology and we send to DSP FW. Also bump the ABI minor to reflect the changes on DSP FW. Signed-off-by: Daniel Baluta Signed-off-by: Pierre-Louis Bossart --- include/sound/sof/dai-imx.h | 34 +++++++++++++++++++++++++++++++++ include/sound/sof/dai.h | 2 ++ include/uapi/sound/sof/abi.h | 2 +- include/uapi/sound/sof/tokens.h | 3 +-- 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 include/sound/sof/dai-imx.h -- 2.20.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/include/sound/sof/dai-imx.h b/include/sound/sof/dai-imx.h new file mode 100644 index 000000000000..e02fb0b0fae1 --- /dev/null +++ b/include/sound/sof/dai-imx.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ +/* + * Copyright 2019 NXP + * + * Author: Daniel Baluta + */ + +#ifndef __INCLUDE_SOUND_SOF_DAI_IMX_H__ +#define __INCLUDE_SOUND_SOF_DAI_IMX_H__ + +#include + +/* ESAI Configuration Request - SOF_IPC_DAI_ESAI_CONFIG */ +struct sof_ipc_dai_esai_params { + struct sof_ipc_hdr hdr; + + /* MCLK */ + uint16_t reserved1; + uint16_t mclk_id; + uint32_t mclk_direction; + + uint32_t mclk_rate; /* MCLK frequency in Hz */ + uint32_t fsync_rate; /* FSYNC frequency in Hz */ + uint32_t bclk_rate; /* BCLK frequency in Hz */ + + /* TDM */ + uint32_t tdm_slots; + uint32_t rx_slots; + uint32_t tx_slots; + uint16_t tdm_slot_width; + uint16_t reserved2; /* alignment */ +} __packed; + +#endif diff --git a/include/sound/sof/dai.h b/include/sound/sof/dai.h index 0f1235022146..c229565767e5 100644 --- a/include/sound/sof/dai.h +++ b/include/sound/sof/dai.h @@ -11,6 +11,7 @@ #include #include +#include /* * DAI Configuration. @@ -73,6 +74,7 @@ struct sof_ipc_dai_config { struct sof_ipc_dai_dmic_params dmic; struct sof_ipc_dai_hda_params hda; struct sof_ipc_dai_alh_params alh; + struct sof_ipc_dai_esai_params esai; }; } __packed; diff --git a/include/uapi/sound/sof/abi.h b/include/uapi/sound/sof/abi.h index a0fe0d4c4b66..ebfdc20ca081 100644 --- a/include/uapi/sound/sof/abi.h +++ b/include/uapi/sound/sof/abi.h @@ -26,7 +26,7 @@ /* SOF ABI version major, minor and patch numbers */ #define SOF_ABI_MAJOR 3 -#define SOF_ABI_MINOR 10 +#define SOF_ABI_MINOR 11 #define SOF_ABI_PATCH 0 /* SOF ABI version number. Format within 32bit word is MMmmmppp */ diff --git a/include/uapi/sound/sof/tokens.h b/include/uapi/sound/sof/tokens.h index 8f996857fb24..da18c9de1056 100644 --- a/include/uapi/sound/sof/tokens.h +++ b/include/uapi/sound/sof/tokens.h @@ -111,7 +111,6 @@ /* TODO: Add SAI tokens */ /* ESAI */ -#define SOF_TKN_IMX_ESAI_FIRST_TOKEN 1100 -/* TODO: Add ESAI tokens */ +#define SOF_TKN_IMX_ESAI_MCLK_ID 1100 #endif From patchwork Tue Oct 8 16:44:40 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: 175527 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp5950857ill; Tue, 8 Oct 2019 09:50:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOf1Ug527EPs33DySAlCJryTn5UmnItZECq6LqDAdV9iT2i2QsOYeWGG3OA/wG1TTeV+7s X-Received: by 2002:adf:e341:: with SMTP id n1mr23076984wrj.133.1570553452637; Tue, 08 Oct 2019 09:50:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570553452; cv=none; d=google.com; s=arc-20160816; b=w8mrXcc+SITLt9zCE1t4A7SBWILXFi2KneoOpwaMTtAjgojhi6V4Cq1vbePdizbzsA Y9lhH7VZewYcyoDjuoBoK/ICSRuEzLIoElps3645eArHp5eWhtYzeks4ZdZvPqHOLM56 +MMgXkKi/XcZZMyCApHC4tXdekXVxxyV4vfCmUvmS1CqA5+XH7D+d3DIeFxdaTwywiFz IzM1Zqwf+1gWk+bK6e1Y1tv669NCMeiTZC4Zzpl81mp8dZ3e4dXu4P7bGtiYCZnmITa4 gUMfAJukz59wAODYvtJzcuNfzmly57PriOLhA5KqeIgcpdlp0FTfNOYekmNxT7cElo6o 1gyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :dkim-filter:delivered-to:dkim-signature:dkim-filter; bh=cnfiBazNnKOqudz+G3SjkmYqFFfceWi/nxXgiZ1EsRk=; b=W25cw5L3jvYWDQKPPjFBHwuGsUKHxlT5qYAGWzrGCOPbg3o18Py8SKSs9p4apg8VrG kDD5FN9BmtyWifmCjrpasv6nkvnswFDLAuPk3zSGDF4mkHAX2RnyrkbNrWZRjtrRGArY l3IcS2D9u1nyjqDqROTZZefOhXDu5c3RTk4o2c0H119/EzlOmK+fV5DpN8b2AGB87pVS 8JbNiZZzwxBAz7CactANQ63UcSl50UgyapPKS4sykvI3QgKPF6U88g5qLE9c7YH0zWmh ZupiPMxngzpRdZKKin+1ievwxMsMWHIGl0B94jDVqidsmEjcFTaBGPn11GxzPiopc5hf l1pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alsa-project.org header.s=default header.b=Jqn83UVy; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTPS id m3si8954889wrj.56.2019.10.08.09.50.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2019 09:50:52 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=pass header.i=@alsa-project.org header.s=default header.b=Jqn83UVy; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 C377E166B; Tue, 8 Oct 2019 18:50:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C377E166B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1570553451; bh=EA1OMy9QUONg4YtOTkhRmqj2jvvDBvCObV/LDfTvP4E=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Jqn83UVyCB+/o9zz9/cRHV5ARHLeWrKAHZkou0XZi+AJUO8ZvzdxhhYRFBQ8pCpIG T4apeTVry95RF4ePsG1o1cYGF+xyIYmPo0v98LsJQB7lNTvQRPZpEbfCKT3kBjO2AQ QkK9DGuTfAbK6/Ba95lw9BHGCXAWxz6J/F+adXZ0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B7645F80649; Tue, 8 Oct 2019 18:45:05 +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 F062BF8060D; Tue, 8 Oct 2019 18:44:59 +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=RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE, SPF_NONE, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 5EC01F8059F for ; Tue, 8 Oct 2019 18:44:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5EC01F8059F X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Oct 2019 09:44:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,270,1566889200"; d="scan'208";a="218338338" Received: from kwwong-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.251.150.53]) by fmsmga004.fm.intel.com with ESMTP; 08 Oct 2019 09:44:50 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Tue, 8 Oct 2019 11:44:40 -0500 Message-Id: <20191008164443.1358-7-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191008164443.1358-1-pierre-louis.bossart@linux.intel.com> References: <20191008164443.1358-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: tiwai@suse.de, broonie@kernel.org, Daniel Baluta , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH 6/9] ASoC: SOF: imx: Read ESAI parameters and send them to DSP 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" From: Daniel Baluta ESAI parameters are read for topology file, packed into sof_ipc_dai_esai_parms struct and then sent to DSP. Signed-off-by: Daniel Baluta Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/pcm.c | 8 +++++ sound/soc/sof/topology.c | 69 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 75 insertions(+), 2 deletions(-) -- 2.20.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index 2b876d497447..b0f4217433e5 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -691,6 +691,14 @@ static int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, case SOF_DAI_INTEL_ALH: /* do nothing for ALH dai_link */ break; + case SOF_DAI_IMX_ESAI: + channels->min = dai->dai_config->esai.tdm_slots; + channels->max = dai->dai_config->esai.tdm_slots; + + dev_dbg(sdev->dev, + "channels_min: %d channels_max: %d\n", + channels->min, channels->max); + break; default: dev_err(sdev->dev, "error: invalid DAI type %d\n", dai->dai_config->type); diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 0aabb3190ddc..d8172d3f672f 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -798,6 +798,13 @@ static const struct sof_topology_token dmic_tokens[] = { }; +/* ESAI */ +static const struct sof_topology_token esai_tokens[] = { + {SOF_TKN_IMX_ESAI_MCLK_ID, + SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, + offsetof(struct sof_ipc_dai_esai_params, mclk_id), 0}, +}; + /* * DMIC PDM Tokens * SOF_TKN_INTEL_DMIC_PDM_CTRL_ID should be the first token @@ -2535,8 +2542,66 @@ static int sof_link_esai_load(struct snd_soc_component *scomp, int index, struct snd_soc_tplg_hw_config *hw_config, struct sof_ipc_dai_config *config) { - /*TODO: Add implementation */ - return 0; + struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); + struct snd_soc_tplg_private *private = &cfg->priv; + struct sof_ipc_reply reply; + u32 size = sizeof(*config); + int ret; + + /* handle master/slave and inverted clocks */ + sof_dai_set_format(hw_config, config); + + /* init IPC */ + memset(&config->esai, 0, sizeof(struct sof_ipc_dai_esai_params)); + config->hdr.size = size; + + ret = sof_parse_tokens(scomp, &config->esai, esai_tokens, + ARRAY_SIZE(esai_tokens), private->array, + le32_to_cpu(private->size)); + if (ret != 0) { + dev_err(sdev->dev, "error: parse esai tokens failed %d\n", + le32_to_cpu(private->size)); + return ret; + } + + config->esai.mclk_rate = le32_to_cpu(hw_config->mclk_rate); + config->esai.bclk_rate = le32_to_cpu(hw_config->bclk_rate); + config->esai.fsync_rate = le32_to_cpu(hw_config->fsync_rate); + config->esai.mclk_direction = hw_config->mclk_direction; + config->esai.tdm_slots = le32_to_cpu(hw_config->tdm_slots); + config->esai.tdm_slot_width = le32_to_cpu(hw_config->tdm_slot_width); + config->esai.rx_slots = le32_to_cpu(hw_config->rx_slots); + config->esai.tx_slots = le32_to_cpu(hw_config->tx_slots); + + dev_info(sdev->dev, + "tplg: config ESAI%d fmt 0x%x mclk %d width %d slots %d mclk id %d\n", + config->dai_index, config->format, + config->esai.mclk_rate, config->esai.tdm_slot_width, + config->esai.tdm_slots, config->esai.mclk_id); + + if (config->esai.tdm_slots < 1 || config->esai.tdm_slots > 8) { + dev_err(sdev->dev, "error: invalid channel count for ESAI%d\n", + config->dai_index); + return -EINVAL; + } + + /* 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 config for ESAI%d\n", + config->dai_index); + return ret; + } + + /* set config for all DAI's with name matching the link name */ + ret = sof_set_dai_config(sdev, size, link, config); + if (ret < 0) + dev_err(sdev->dev, "error: failed to save DAI config for ESAI%d\n", + config->dai_index); + + return ret; } static int sof_link_dmic_load(struct snd_soc_component *scomp, int index,