Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp167598iog; Fri, 24 Jun 2022 01:23:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v9w9vnNxZ4UFsjmu4QZ5qS31yeN8pY5jnYga8pV7yR2swTJfjfRWmeac3tzgCelZZ/8e0X X-Received: by 2002:a05:6a00:1a0e:b0:523:1e7c:e26e with SMTP id g14-20020a056a001a0e00b005231e7ce26emr44484176pfv.60.1656059021241; Fri, 24 Jun 2022 01:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656059021; cv=none; d=google.com; s=arc-20160816; b=sirFjaMWrIUmJU67xPAooqCw4BYXrS8m4mNETpR9U0SW7XS5ibxm3flcNmOMPrNxpy xlClH5yXlz0ShTZLfXeIzqCVLzL6JYXF+Kqah25GssWxBIl497AtRJVRcCQ4RF87btZR gZpgiaPm3vafcwS86R5VWDK3RaIqX1UgKDcglp7ss8y93krb+d03ya5HzG5p76piv3GN R2lbwOsLRQVyJToj82/BzdW990rZkV9Fuhm+VxLroFrmYy605gzFAli48N60H3JdGOBt UrrkaOVR1IMCEwnMFYvU+H1s0yTGFyfUi8VeegXIvDlD1Tf7xOrWhrDznJAWP80nGMqE h7kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=ml4VPpo8y7KsY/Hqohq2nXovkh3UR8C6KsUsHXfku7g=; b=fgimKzrgRwC0JWksne/tg+BcuSB32kWFGzb3KxpzmYATUXC0y6esbXflQ90v5bPpny iPFZ2AjTujg6Oq1aeh8fEYGTW8ggzublKlCotL0JNH9UZc7Erq9P7BbTQhYTm0iHB/UL WxD0m7WSYQay8mO9PtMlq6gZRcFRflSJMldRDEi+z/P3U7DVlre4Q05ujSS1+BG0rd2W 5VpghHZPGfzROei7EyeBrz2wVpF6q/USkjvJTIJ2V+KcxhtylloJPmtf5+DBkv7Uo5fF LmFbhnJhMHeDbhzWqhSRSvmo+18ElSHWeCJFJFQ63gSzvNuJa8LS8Kx2zwx2yjDPGjeb hPSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nTpZR8UM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020aa79ac3000000b005255489198esi1941380pfp.24.2022.06.24.01.23.28; Fri, 24 Jun 2022 01:23:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nTpZR8UM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230152AbiFXIEI (ORCPT + 99 others); Fri, 24 Jun 2022 04:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230488AbiFXIDx (ORCPT ); Fri, 24 Jun 2022 04:03:53 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E1C16DB03 for ; Fri, 24 Jun 2022 01:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656057832; x=1687593832; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=ENT73aWnAztm46LKNlhTKMt+fCuUob46bDVIkTPIOIg=; b=nTpZR8UMd+xcgXDZMfGM/P9vDLwVQ785v+RbLTsDPd3Zipn8S7wOMSgV CgYb+8kH8ZV4fbbv5WoGCyJkhY6p4j3l5B85jq4ksT+FHCfP2jbzxo5UW PoGzcMws+zGwkyltFrAxqCVkxbGiFo2GjQHawqL2SheR+Wz/PYsTOBHTe SBj31bUOjw1jSo2tLI/uHK73nMMLA4/Sqe7sk7B6HZTKnXL1GAW2RjQXT mBEN43DmbHpzBfRPd9/Ghwj0nD5H7SLPcojsD1WHasXL6TXvRvi3fqTp/ DOmsiGCxYz65E/J+uDh6xwINwpiBua+Ckbsbj8NpOC2FVby4NLdhhrjVz w==; X-IronPort-AV: E=McAfee;i="6400,9594,10387"; a="306415899" X-IronPort-AV: E=Sophos;i="5.92,218,1650956400"; d="scan'208";a="306415899" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2022 01:03:48 -0700 X-IronPort-AV: E=Sophos;i="5.92,218,1650956400"; d="scan'208";a="621643208" 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; 24 Jun 2022 01:03:45 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, gregkh@linuxfoundation.org, srinivas.kandagatla@linaro.org, pierre-louis.bossart@linux.intel.com, sanyog.r.kale@intel.com, bard.liao@intel.com Subject: [PATCH v3 2/2] ASoC: SOF: Intel: add trigger callback into sdw_callback Date: Fri, 24 Jun 2022 16:03:26 +0800 Message-Id: <20220624080326.29139-3-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220624080326.29139-1-yung-chuan.liao@linux.intel.com> References: <20220624080326.29139-1-yung-chuan.liao@linux.intel.com> X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For IPC4, we need to set pipeline state in BE DAI trigger. Signed-off-by: Bard Liao Reviewed-by: Rander Wang Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan --- sound/soc/sof/intel/hda-dai.c | 14 +++++++++++--- sound/soc/sof/intel/hda.c | 2 +- sound/soc/sof/intel/hda.h | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c index ed74a1f264e8..ce5a39326dce 100644 --- a/sound/soc/sof/intel/hda-dai.c +++ b/sound/soc/sof/intel/hda-dai.c @@ -714,8 +714,7 @@ static const struct snd_soc_dai_ops ipc3_ssp_dai_ops = { .shutdown = ssp_dai_shutdown, }; -static int ipc4_be_dai_trigger(struct snd_pcm_substream *substream, - int cmd, struct snd_soc_dai *dai) +static int ipc4_be_dai_common_trigger(struct snd_soc_dai *dai, int cmd, int stream) { struct snd_sof_widget *pipe_widget; struct sof_ipc4_pipeline *pipeline; @@ -724,7 +723,7 @@ static int ipc4_be_dai_trigger(struct snd_pcm_substream *substream, struct snd_sof_dev *sdev; int ret; - w = snd_soc_dai_get_widget(dai, substream->stream); + w = snd_soc_dai_get_widget(dai, stream); swidget = w->dobj.private; pipe_widget = swidget->pipe_widget; pipeline = pipe_widget->private; @@ -759,6 +758,12 @@ static int ipc4_be_dai_trigger(struct snd_pcm_substream *substream, return 0; } +static int ipc4_be_dai_trigger(struct snd_pcm_substream *substream, + int cmd, struct snd_soc_dai *dai) +{ + return ipc4_be_dai_common_trigger(dai, cmd, substream->stream); +} + static const struct snd_soc_dai_ops ipc4_dmic_dai_ops = { .trigger = ipc4_be_dai_trigger, }; @@ -810,6 +815,9 @@ void hda_set_dai_drv_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *ops) if (!hda_use_tplg_nhlt) ipc4_data->nhlt = intel_nhlt_init(sdev->dev); + if (IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE)) + sdw_callback.trigger = ipc4_be_dai_common_trigger; + break; } default: diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index bc07df1fc39f..cdd3601e84f5 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -147,7 +147,7 @@ static int sdw_free_stream(struct device *dev, return hda_ctrl_dai_widget_free(w, SOF_DAI_CONFIG_FLAGS_NONE, &data); } -static const struct sdw_intel_ops sdw_callback = { +struct sdw_intel_ops sdw_callback = { .params_stream = sdw_params_stream, .free_stream = sdw_free_stream, }; diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index dc713c20ba1d..5439fcfe2b4d 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -778,5 +778,6 @@ irqreturn_t cnl_ipc4_irq_thread(int irq, void *context); int cnl_ipc4_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg); irqreturn_t hda_dsp_ipc4_irq_thread(int irq, void *context); int hda_dsp_ipc4_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg); +extern struct sdw_intel_ops sdw_callback; #endif -- 2.17.1