Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp163668pxk; Tue, 1 Sep 2020 19:58:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqj08IEw+0j0z+WwXrAFgL/RDrSXqj0JIa5Zc5hyWN9/OXc0Pp8/GjgqGbe5nygho4cdPG X-Received: by 2002:aa7:c2c6:: with SMTP id m6mr4616532edp.118.1599015481504; Tue, 01 Sep 2020 19:58:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599015481; cv=none; d=google.com; s=arc-20160816; b=MmbpNgiXP2sgyTWJH2Bq66i1sFZ9JeJe9VQToz6fOkYvr20H2AVqSVT9c5mOlQ2M7v e8tuwUmmnjQZolYhWTEqWKZTwiv8Cg+Ey+vWOx8r0Bp2xYRLdlIKGJJar6qEfG4yNLOV 0X1ijzUDdvh/y/+nzo0ixFtFzzXTLiVB0XzuT93Cogbz8ENNthAPTMVzMmBHAoiNTi1w PiRvZyMnY5ZOvWYEeYFmwxHGRApqK5fsoX+5nmIer2RVfqCpAGkxGVBotI7lkSWYaitg M7jFkdrhxK2V2iKqOdo0PBUS7RSK0ljnOolWxR6zd+9AC+4v7zuu7y+Q22TPtbhAeJuF yi+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=1A8hIrVtFGOkigkIM+FAXXi1693fmKeoyoMvCzsLS0M=; b=iGP2zzMSajjeWMEGgBWUDnomHP5iKLoqWaz7CyQ7OdLCBQp0iRmhbsWtiP+i+qGJsb R61AEOXIGaALjd7isFUGqfuFjEtf89OUpmAH3W6ATaZMCOZTmBNNfsIucnLpY0ek3gWs gInnleQQ8vNhwAnJDaYZAFJBwmwQoJx884UhVuIsYparjW1YOfD/KjSWTIrocsxSn/kH RXjWCKDU5Bk9hYAq4ocgdDNBDwfsxKnCXry5pj3eV9FxCy9SkBbnM3+jcjQ6gkguZr9/ VM+vSWfMz8UipmpPkmHG3lpoevzKsMdqLe9r2yYr4NYTmaaDN0fOs7meAZEtkiBkA9EU 3NOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si1713847edr.313.2020.09.01.19.57.38; Tue, 01 Sep 2020 19:58:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726979AbgIBC4n (ORCPT + 99 others); Tue, 1 Sep 2020 22:56:43 -0400 Received: from mga07.intel.com ([134.134.136.100]:49594 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726948AbgIBC4k (ORCPT ); Tue, 1 Sep 2020 22:56:40 -0400 IronPort-SDR: m6se6xkpzDCx/7TrX4P7yQRjqFBkDQzm1DUfv2A7d9mw5fjEzS+zMQcKOMQCoylQCExTU8lhOM 9j5wkFFEqTSA== X-IronPort-AV: E=McAfee;i="6000,8403,9731"; a="221528376" X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="221528376" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2020 19:56:39 -0700 IronPort-SDR: 9Bd0PSp1IBENYypiCkhDcIoULlOOo24raIyuYUkA3HCgalhLH4s1UhWJWW9hCl72HEW9knh9ey anQ4lLIbyO5Q== X-IronPort-AV: E=Sophos;i="5.76,381,1592895600"; d="scan'208";a="477457289" Received: from bard-ubuntu.sh.intel.com ([10.239.13.33]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2020 19:56:35 -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, jank@cadence.com, srinivas.kandagatla@linaro.org, rander.wang@linux.intel.com, ranjani.sridharan@linux.intel.com, hui.wang@canonical.com, pierre-louis.bossart@linux.intel.com, sanyog.r.kale@intel.com, mengdong.lin@intel.com, bard.liao@intel.com Subject: [PATCH 4/7] ASOC: Intel: sof_sdw: add dailink .trigger callback Date: Tue, 1 Sep 2020 23:02:37 +0800 Message-Id: <20200901150240.19288-5-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200901150240.19288-1-yung-chuan.liao@linux.intel.com> References: <20200901150240.19288-1-yung-chuan.liao@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart Add trigger functionality to dailink, so far only .startup() and .shutdown() were implemented at the machine driver level. The companion patch for this patch is the removal of the trigger callback at the DAI level in drivers/soundwire/intel.c Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Bard Liao --- sound/soc/intel/boards/sof_sdw.c | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 2463d432bf4d..f251e046d74d 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -195,6 +195,46 @@ int sdw_startup(struct snd_pcm_substream *substream) return sdw_startup_stream(substream); } +static int sdw_trigger(struct snd_pcm_substream *substream, int cmd) +{ + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct sdw_stream_runtime *sdw_stream; + struct snd_soc_dai *dai; + int ret; + + /* Find stream from first CPU DAI */ + dai = asoc_rtd_to_cpu(rtd, 0); + + sdw_stream = snd_soc_dai_get_sdw_stream(dai, substream->stream); + + if (IS_ERR(sdw_stream)) { + dev_err(rtd->dev, "no stream found for DAI %s", dai->name); + return PTR_ERR(sdw_stream); + } + + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + case SNDRV_PCM_TRIGGER_RESUME: + ret = sdw_enable_stream(sdw_stream); + break; + + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: + case SNDRV_PCM_TRIGGER_SUSPEND: + case SNDRV_PCM_TRIGGER_STOP: + ret = sdw_disable_stream(sdw_stream); + break; + default: + ret = -EINVAL; + break; + } + + if (ret) + dev_err(rtd->dev, "%s trigger %d failed: %d", __func__, cmd, ret); + + return ret; +} + void sdw_shutdown(struct snd_pcm_substream *substream) { sdw_shutdown_stream(substream); @@ -202,6 +242,7 @@ void sdw_shutdown(struct snd_pcm_substream *substream) static const struct snd_soc_ops sdw_ops = { .startup = sdw_startup, + .trigger = sdw_trigger, .shutdown = sdw_shutdown, }; -- 2.17.1