This source file includes following definitions.
- hda_dsp_trace_prepare
- hda_dsp_trace_init
- hda_dsp_trace_release
- hda_dsp_trace_trigger
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 #include <sound/hdaudio_ext.h>
  19 #include "../ops.h"
  20 #include "hda.h"
  21 
  22 static int hda_dsp_trace_prepare(struct snd_sof_dev *sdev)
  23 {
  24         struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
  25         struct hdac_ext_stream *stream = hda->dtrace_stream;
  26         struct hdac_stream *hstream = &stream->hstream;
  27         struct snd_dma_buffer *dmab = &sdev->dmatb;
  28         int ret;
  29 
  30         hstream->period_bytes = 0;
  31         hstream->bufsize = sdev->dmatb.bytes;
  32 
  33         ret = hda_dsp_stream_hw_params(sdev, stream, dmab, NULL);
  34         if (ret < 0)
  35                 dev_err(sdev->dev, "error: hdac prepare failed: %x\n", ret);
  36 
  37         return ret;
  38 }
  39 
  40 int hda_dsp_trace_init(struct snd_sof_dev *sdev, u32 *stream_tag)
  41 {
  42         struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
  43         int ret;
  44 
  45         hda->dtrace_stream = hda_dsp_stream_get(sdev,
  46                                                 SNDRV_PCM_STREAM_CAPTURE);
  47 
  48         if (!hda->dtrace_stream) {
  49                 dev_err(sdev->dev,
  50                         "error: no available capture stream for DMA trace\n");
  51                 return -ENODEV;
  52         }
  53 
  54         *stream_tag = hda->dtrace_stream->hstream.stream_tag;
  55 
  56         
  57 
  58 
  59 
  60         ret = hda_dsp_trace_prepare(sdev);
  61         if (ret < 0) {
  62                 dev_err(sdev->dev, "error: hdac trace init failed: %x\n", ret);
  63                 hda_dsp_stream_put(sdev, SNDRV_PCM_STREAM_CAPTURE, *stream_tag);
  64                 hda->dtrace_stream = NULL;
  65                 *stream_tag = 0;
  66         }
  67 
  68         return ret;
  69 }
  70 
  71 int hda_dsp_trace_release(struct snd_sof_dev *sdev)
  72 {
  73         struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
  74         struct hdac_stream *hstream;
  75 
  76         if (hda->dtrace_stream) {
  77                 hstream = &hda->dtrace_stream->hstream;
  78                 hda_dsp_stream_put(sdev,
  79                                    SNDRV_PCM_STREAM_CAPTURE,
  80                                    hstream->stream_tag);
  81                 hda->dtrace_stream = NULL;
  82                 return 0;
  83         }
  84 
  85         dev_dbg(sdev->dev, "DMA trace stream is not opened!\n");
  86         return -ENODEV;
  87 }
  88 
  89 int hda_dsp_trace_trigger(struct snd_sof_dev *sdev, int cmd)
  90 {
  91         struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
  92 
  93         return hda_dsp_stream_trigger(sdev, hda->dtrace_stream, cmd);
  94 }