All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
To: lgirdwood@gmail.com, broonie@kernel.org,
	pierre-louis.bossart@linux.intel.com, daniel.baluta@nxp.com,
	AjitKumar.Pandey@amd.com
Cc: alsa-devel@alsa-project.org, ranjani.sridharan@linux.intel.com,
	kai.vehmanen@linux.intel.com
Subject: [PATCH 5/8] ASoC: SOF: ipc3-dtrace: Move host ops wrappers from generic header to private
Date: Mon, 16 May 2022 13:47:08 +0300	[thread overview]
Message-ID: <20220516104711.26115-6-peter.ujfalusi@linux.intel.com> (raw)
In-Reply-To: <20220516104711.26115-1-peter.ujfalusi@linux.intel.com>

Move the snd_sof_dma_trace_* ops wrappers from ops.h to ipc3-priv.h since
they are not used outside of IPC3 code.
While moving, rename them to sof_dtrace_host_*

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 sound/soc/sof/ipc3-dtrace.c | 10 +++++-----
 sound/soc/sof/ipc3-priv.h   | 32 ++++++++++++++++++++++++++++++++
 sound/soc/sof/ops.h         | 26 --------------------------
 3 files changed, 37 insertions(+), 31 deletions(-)

diff --git a/sound/soc/sof/ipc3-dtrace.c b/sound/soc/sof/ipc3-dtrace.c
index 0bc3ad586d23..63132baaaa5a 100644
--- a/sound/soc/sof/ipc3-dtrace.c
+++ b/sound/soc/sof/ipc3-dtrace.c
@@ -412,7 +412,7 @@ static int ipc3_dtrace_enable(struct snd_sof_dev *sdev)
 	sdev->host_offset = 0;
 	sdev->dtrace_draining = false;
 
-	ret = snd_sof_dma_trace_init(sdev, &params);
+	ret = sof_dtrace_host_init(sdev, &params);
 	if (ret < 0) {
 		dev_err(sdev->dev, "Host dtrace init failed: %d\n", ret);
 		return ret;
@@ -427,7 +427,7 @@ static int ipc3_dtrace_enable(struct snd_sof_dev *sdev)
 	}
 
 start:
-	ret = snd_sof_dma_trace_trigger(sdev, SNDRV_PCM_TRIGGER_START);
+	ret = sof_dtrace_host_trigger(sdev, SNDRV_PCM_TRIGGER_START);
 	if (ret < 0) {
 		dev_err(sdev->dev, "Host dtrace trigger start failed: %d\n", ret);
 		goto trace_release;
@@ -438,7 +438,7 @@ static int ipc3_dtrace_enable(struct snd_sof_dev *sdev)
 	return 0;
 
 trace_release:
-	snd_sof_dma_trace_release(sdev);
+	sof_dtrace_host_release(sdev);
 	return ret;
 }
 
@@ -541,7 +541,7 @@ static void ipc3_dtrace_release(struct snd_sof_dev *sdev, bool only_stop)
 	if (!sdev->fw_trace_is_supported || sdev->dtrace_state == SOF_DTRACE_DISABLED)
 		return;
 
-	ret = snd_sof_dma_trace_trigger(sdev, SNDRV_PCM_TRIGGER_STOP);
+	ret = sof_dtrace_host_trigger(sdev, SNDRV_PCM_TRIGGER_STOP);
 	if (ret < 0)
 		dev_err(sdev->dev, "Host dtrace trigger stop failed: %d\n", ret);
 	sdev->dtrace_state = SOF_DTRACE_STOPPED;
@@ -563,7 +563,7 @@ static void ipc3_dtrace_release(struct snd_sof_dev *sdev, bool only_stop)
 	if (only_stop)
 		goto out;
 
-	ret = snd_sof_dma_trace_release(sdev);
+	ret = sof_dtrace_host_release(sdev);
 	if (ret < 0)
 		dev_err(sdev->dev, "Host dtrace release failed %d\n", ret);
 
diff --git a/sound/soc/sof/ipc3-priv.h b/sound/soc/sof/ipc3-priv.h
index bb9cb0678686..21f0bd20323f 100644
--- a/sound/soc/sof/ipc3-priv.h
+++ b/sound/soc/sof/ipc3-priv.h
@@ -29,4 +29,36 @@ int sof_ipc3_validate_fw_version(struct snd_sof_dev *sdev);
 int ipc3_dtrace_posn_update(struct snd_sof_dev *sdev,
 			    struct sof_ipc_dma_trace_posn *posn);
 
+/* dtrace platform callback wrappers */
+static inline int sof_dtrace_host_init(struct snd_sof_dev *sdev,
+				       struct sof_ipc_dma_trace_params_ext *dtrace_params)
+{
+	struct snd_sof_dsp_ops *dsp_ops = sdev->pdata->desc->ops;
+
+	if (dsp_ops->trace_init)
+		return dsp_ops->trace_init(sdev, dtrace_params);
+
+	return 0;
+}
+
+static inline int sof_dtrace_host_release(struct snd_sof_dev *sdev)
+{
+	struct snd_sof_dsp_ops *dsp_ops = sdev->pdata->desc->ops;
+
+	if (dsp_ops->trace_release)
+		return dsp_ops->trace_release(sdev);
+
+	return 0;
+}
+
+static inline int sof_dtrace_host_trigger(struct snd_sof_dev *sdev, int cmd)
+{
+	struct snd_sof_dsp_ops *dsp_ops = sdev->pdata->desc->ops;
+
+	if (dsp_ops->trace_trigger)
+		return dsp_ops->trace_trigger(sdev, cmd);
+
+	return 0;
+}
+
 #endif
diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h
index aa64e3bd645f..b79ae4f66eba 100644
--- a/sound/soc/sof/ops.h
+++ b/sound/soc/sof/ops.h
@@ -375,32 +375,6 @@ static inline int snd_sof_dsp_send_msg(struct snd_sof_dev *sdev,
 	return sof_ops(sdev)->send_msg(sdev, msg);
 }
 
-/* host DMA trace */
-static inline int snd_sof_dma_trace_init(struct snd_sof_dev *sdev,
-					 struct sof_ipc_dma_trace_params_ext *dtrace_params)
-{
-	if (sof_ops(sdev)->trace_init)
-		return sof_ops(sdev)->trace_init(sdev, dtrace_params);
-
-	return 0;
-}
-
-static inline int snd_sof_dma_trace_release(struct snd_sof_dev *sdev)
-{
-	if (sof_ops(sdev)->trace_release)
-		return sof_ops(sdev)->trace_release(sdev);
-
-	return 0;
-}
-
-static inline int snd_sof_dma_trace_trigger(struct snd_sof_dev *sdev, int cmd)
-{
-	if (sof_ops(sdev)->trace_trigger)
-		return sof_ops(sdev)->trace_trigger(sdev, cmd);
-
-	return 0;
-}
-
 /* host PCM ops */
 static inline int
 snd_sof_pcm_platform_open(struct snd_sof_dev *sdev,
-- 
2.36.1


  parent reply	other threads:[~2022-05-16 10:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 10:47 [PATCH 0/8] ASoC: SOF: Introduce generic (in)firmware tracing infrastructure Peter Ujfalusi
2022-05-16 10:47 ` [PATCH 1/8] ASoC: SOF: Introduce IPC independent ops for firmware tracing support Peter Ujfalusi
2022-05-16 10:47 ` [PATCH 2/8] ASoC: SOF: Rename dtrace_is_supported flag to fw_trace_is_supported Peter Ujfalusi
2022-05-16 10:47 ` [PATCH 3/8] ASoC: SOF: Clone the trace code to ipc3-dtrace as fw_tracing implementation Peter Ujfalusi
2022-05-16 10:47 ` [PATCH 4/8] ASoC: SOF: Switch to IPC generic firmware tracing Peter Ujfalusi
2022-05-16 10:47 ` Peter Ujfalusi [this message]
2022-05-16 10:47 ` [PATCH 6/8] ASoC: SOF: Modify the host trace_init parameter list to include dmab Peter Ujfalusi
2022-05-16 10:47 ` [PATCH 7/8] ASoC: SOF: Introduce opaque storage of private data for firmware tracing Peter Ujfalusi
2022-05-16 10:47 ` [PATCH 8/8] ASoC: SOF: ipc3-dtrace: Move dtrace related variables local from sof_dev Peter Ujfalusi
2022-05-20 16:58 ` [PATCH 0/8] ASoC: SOF: Introduce generic (in)firmware tracing infrastructure Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220516104711.26115-6-peter.ujfalusi@linux.intel.com \
    --to=peter.ujfalusi@linux.intel.com \
    --cc=AjitKumar.Pandey@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@nxp.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.