~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/sof/intel/hda-trace.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
  2 //
  3 // This file is provided under a dual BSD/GPLv2 license.  When using or
  4 // redistributing this file, you may do so under either license.
  5 //
  6 // Copyright(c) 2018 Intel Corporation
  7 //
  8 // Authors: Liam Girdwood <liam.r.girdwood@linux.intel.com>
  9 //          Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
 10 //          Rander Wang <rander.wang@intel.com>
 11 //          Keyon Jie <yang.jie@linux.intel.com>
 12 //
 13 
 14 /*
 15  * Hardware interface for generic Intel audio DSP HDA IP
 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, struct snd_dma_buffer *dmab)
 23 {
 24         struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
 25         struct hdac_ext_stream *hext_stream = hda->dtrace_stream;
 26         struct hdac_stream *hstream = &hext_stream->hstream;
 27         int ret;
 28 
 29         hstream->period_bytes = 0;/* initialize period_bytes */
 30         hstream->bufsize = dmab->bytes;
 31 
 32         ret = hda_dsp_stream_hw_params(sdev, hext_stream, dmab, NULL);
 33         if (ret < 0)
 34                 dev_err(sdev->dev, "error: hdac prepare failed: %d\n", ret);
 35 
 36         return ret;
 37 }
 38 
 39 int hda_dsp_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab,
 40                        struct sof_ipc_dma_trace_params_ext *dtrace_params)
 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, SNDRV_PCM_STREAM_CAPTURE,
 46                                                 SOF_HDA_STREAM_DMI_L1_COMPATIBLE);
 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         dtrace_params->stream_tag = hda->dtrace_stream->hstream.stream_tag;
 55 
 56         /*
 57          * initialize capture stream, set BDL address and return corresponding
 58          * stream tag which will be sent to the firmware by IPC message.
 59          */
 60         ret = hda_dsp_trace_prepare(sdev, dmab);
 61         if (ret < 0) {
 62                 dev_err(sdev->dev, "error: hdac trace init failed: %d\n", ret);
 63                 hda_dsp_stream_put(sdev, SNDRV_PCM_STREAM_CAPTURE,
 64                                    dtrace_params->stream_tag);
 65                 hda->dtrace_stream = NULL;
 66                 dtrace_params->stream_tag = 0;
 67         }
 68 
 69         return ret;
 70 }
 71 EXPORT_SYMBOL_NS(hda_dsp_trace_init, SND_SOC_SOF_INTEL_HDA_COMMON);
 72 
 73 int hda_dsp_trace_release(struct snd_sof_dev *sdev)
 74 {
 75         struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
 76         struct hdac_stream *hstream;
 77 
 78         if (hda->dtrace_stream) {
 79                 hstream = &hda->dtrace_stream->hstream;
 80                 hda_dsp_stream_put(sdev,
 81                                    SNDRV_PCM_STREAM_CAPTURE,
 82                                    hstream->stream_tag);
 83                 hda->dtrace_stream = NULL;
 84                 return 0;
 85         }
 86 
 87         dev_dbg(sdev->dev, "DMA trace stream is not opened!\n");
 88         return -ENODEV;
 89 }
 90 EXPORT_SYMBOL_NS(hda_dsp_trace_release, SND_SOC_SOF_INTEL_HDA_COMMON);
 91 
 92 int hda_dsp_trace_trigger(struct snd_sof_dev *sdev, int cmd)
 93 {
 94         struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
 95 
 96         return hda_dsp_stream_trigger(sdev, hda->dtrace_stream, cmd);
 97 }
 98 EXPORT_SYMBOL_NS(hda_dsp_trace_trigger, SND_SOC_SOF_INTEL_HDA_COMMON);
 99 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php