From patchwork Fri Sep 15 07:56:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liao, Bard" X-Patchwork-Id: 723986 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C05ACEE6432 for ; Fri, 15 Sep 2023 07:51:21 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AFB99DF4; Fri, 15 Sep 2023 09:50:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AFB99DF4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1694764279; bh=YV7wiUPxH40qX3QFyXronw880qBrpYFVzzX3+75uL5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=b2g7f68MRuw2yN+WkSmepXjpLXqSFj27ozMy6f33elGjNsYr1iwNK+0ZP2r7VNqIi L2n/vIYVJbjTgKkZjl/SXLLwkUKUjWwWeOjUUqwlrFDlGb7/w3X8dgcrzNUjzQF11t lx2nQv2eTQzdYsGDswViL7y1w8K1cQVnNqpMN8Kw= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D8FEAF805B0; Fri, 15 Sep 2023 09:49:37 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 80D08F8059F; Fri, 15 Sep 2023 09:49:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8A0BDF8059F; Fri, 15 Sep 2023 09:49:34 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) (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 0B4C4F8047D for ; Fri, 15 Sep 2023 09:49:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0B4C4F8047D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Y1+5JXAS DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694764147; x=1726300147; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YV7wiUPxH40qX3QFyXronw880qBrpYFVzzX3+75uL5k=; b=Y1+5JXAS1IexVSr2/DxXpfjO9GayEOj3mBTID4wFw726D1SogQCxbBWR zMCpNbyssVZn6W0ALC1r9ECIomPplK25Ld7OLn9ZzEBzKoJUSB/XMgm3r mPHjk3L5I4VGwOZjUHnjpucNU8yOB6Ot4IKCPd8kR0UtgCnE4EQ4xqS/d EeiSGhICJ8Z4WL7l8pbRFp6GkiXAoj3XRBjwkMVL2S+B71hFx2flHWpe6 iqSOeFGH3SRgx2edLHNp0034efFxowf8TRp1pwftqXPBJUQy5qSxr4T8S llMo2Ptt0LpOJ/3Vmpj8kII+vpspXiaIATzJy+AfHnIF2t6hjzLm0qzKH w==; X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="376527562" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="376527562" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 00:48:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="779998602" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="779998602" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 00:47:44 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, peter.ujfalusi@linux.intel.com, ckeepax@opensource.cirrus.com Subject: [PATCH 4/4] ASoC: intel: sof_sdw: Increment be_id in init_dai_link Date: Fri, 15 Sep 2023 15:56:11 +0800 Message-Id: <20230915075611.1619548-5-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230915075611.1619548-1-yung-chuan.liao@linux.intel.com> References: <20230915075611.1619548-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: UKCV7DAB7L37SMXXGNM5W4REHWSCQPW3 X-Message-ID-Hash: UKCV7DAB7L37SMXXGNM5W4REHWSCQPW3 X-MailFrom: yung-chuan.liao@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Charles Keepax Rather than incrementing the ID for the dai_links in many places throughout the code, just increment it each time we initialise a new DAI link. Signed-off-by: Charles Keepax Reviewed-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- sound/soc/intel/boards/sof_sdw.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 335048dfae53..752bfce1ea01 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -20,8 +20,6 @@ static int quirk_override = -1; module_param_named(quirk, quirk_override, int, 0444); MODULE_PARM_DESC(quirk, "Board-specific quirk override"); -#define INC_ID(BE, LINK) do { (BE)++; (LINK)++; } while (0) - static void log_quirks(struct device *dev) { if (SOF_JACK_JDSRC(sof_sdw_quirk)) @@ -1089,14 +1087,14 @@ static int get_dailink_info(struct device *dev, } static void init_dai_link(struct device *dev, struct snd_soc_dai_link *dai_links, - int be_id, char *name, int playback, int capture, + int *be_id, char *name, int playback, int capture, struct snd_soc_dai_link_component *cpus, int cpus_num, struct snd_soc_dai_link_component *codecs, int codecs_num, int (*init)(struct snd_soc_pcm_runtime *rtd), const struct snd_soc_ops *ops) { - dev_dbg(dev, "create dai link %s, id %d\n", name, be_id); - dai_links->id = be_id; + dev_dbg(dev, "create dai link %s, id %d\n", name, *be_id); + dai_links->id = (*be_id)++; dai_links->name = name; dai_links->platforms = platform_component; dai_links->num_platforms = ARRAY_SIZE(platform_component); @@ -1112,7 +1110,7 @@ static void init_dai_link(struct device *dev, struct snd_soc_dai_link *dai_links } static int init_simple_dai_link(struct device *dev, struct snd_soc_dai_link *dai_links, - int be_id, char *name, int playback, int capture, + int *be_id, char *name, int playback, int capture, const char *cpu_dai_name, const char *codec_name, const char *codec_dai_name, int (*init)(struct snd_soc_pcm_runtime *rtd), @@ -1484,7 +1482,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, playback = (stream == SNDRV_PCM_STREAM_PLAYBACK); capture = (stream == SNDRV_PCM_STREAM_CAPTURE); - init_dai_link(dev, dai_links + *link_index, (*be_id)++, name, + init_dai_link(dev, dai_links + *link_index, be_id, name, playback, capture, cpus, cpu_dai_num, codecs, codec_num, NULL, &sdw_ops); @@ -1674,7 +1672,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) playback = info->dais[0].direction[SNDRV_PCM_STREAM_PLAYBACK]; capture = info->dais[0].direction[SNDRV_PCM_STREAM_CAPTURE]; - ret = init_simple_dai_link(dev, dai_links + link_index, be_id, name, + ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, name, playback, capture, cpu_dai_name, codec_name, info->dais[0].dai_name, NULL, info->ops); @@ -1685,7 +1683,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) if (ret < 0) return ret; - INC_ID(be_id, link_index); + link_index++; } DMIC: @@ -1696,16 +1694,16 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) goto HDMI; } - ret = init_simple_dai_link(dev, dai_links + link_index, be_id, "dmic01", + ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, "dmic01", 0, 1, // DMIC only supports capture "DMIC01 Pin", "dmic-codec", "dmic-hifi", sof_sdw_dmic_init, NULL); if (ret) return ret; - INC_ID(be_id, link_index); + link_index++; - ret = init_simple_dai_link(dev, dai_links + link_index, be_id, "dmic16k", + ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, "dmic16k", 0, 1, // DMIC only supports capture "DMIC16k Pin", "dmic-codec", "dmic-hifi", /* don't call sof_sdw_dmic_init() twice */ @@ -1713,7 +1711,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) if (ret) return ret; - INC_ID(be_id, link_index); + link_index++; } HDMI: @@ -1731,14 +1729,14 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) codec_dai_name = "snd-soc-dummy-dai"; } - ret = init_simple_dai_link(dev, dai_links + link_index, be_id, name, + ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, name, 1, 0, // HDMI only supports playback cpu_dai_name, codec_name, codec_dai_name, sof_sdw_hdmi_init, NULL); if (ret) return ret; - INC_ID(be_id, link_index); + link_index++; } if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) { @@ -1748,7 +1746,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port); cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", port); - ret = init_simple_dai_link(dev, dai_links + link_index, be_id, name, + ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, name, 1, 1, cpu_dai_name, asoc_dummy_dlc.name, asoc_dummy_dlc.dai_name, NULL, NULL); if (ret)