Skip to content
Permalink
Browse files
wip probe rework
  • Loading branch information
ujfalusi committed Apr 19, 2021
1 parent 63afe03 commit 15fe7d05b9aa6e18a92ef9fc0aec61b4fd3d9f21
Show file tree
Hide file tree
Showing 16 changed files with 130 additions and 262 deletions.
@@ -198,14 +198,14 @@ config SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST_NUM
endif

config SND_SOC_SOF_DEBUG_PROBES
tristate "SOF enable data probing"
select SND_SOC_SOF_CLIENT
tristate
select SND_SOC_SOF_IPC_CLIENT
select SND_SOC_COMPRESS
help
This option enables the data probing feature that can be used to
gather data directly from specific points of the audio pipeline.
Say Y if you want to enable probes.
If unsure, select "N".
This option is not user-selectable but automagically handled by
'select' statements at a higher level.

config SND_SOC_SOF_DEBUG_RETAIN_DSP_CONTEXT
bool "SOF retain DSP context on any FW exceptions"
@@ -242,7 +242,7 @@ config SND_SOC_SOF_HDA_AUDIO_CODEC

config SND_SOC_SOF_HDA_PROBES
bool "SOF enable probes over HDA"
depends on SND_SOC_SOF_DEBUG_PROBES
select SND_SOC_SOF_DEBUG_PROBES
help
This option enables the data probing for Intel(R)
Skylake and newer platforms.
@@ -74,15 +74,6 @@ const struct snd_sof_dsp_ops sof_apl_ops = {
.pcm_trigger = hda_dsp_pcm_trigger,
.pcm_pointer = hda_dsp_pcm_pointer,

#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
/* probe callbacks */
.probe_assign = hda_probe_compr_assign,
.probe_free = hda_probe_compr_free,
.probe_set_params = hda_probe_compr_set_params,
.probe_trigger = hda_probe_compr_trigger,
.probe_pointer = hda_probe_compr_pointer,
#endif

/* firmware loading */
.load_firmware = snd_sof_load_firmware_raw,

@@ -294,15 +294,6 @@ const struct snd_sof_dsp_ops sof_cnl_ops = {
.pcm_trigger = hda_dsp_pcm_trigger,
.pcm_pointer = hda_dsp_pcm_pointer,

#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
/* probe callbacks */
.probe_assign = hda_probe_compr_assign,
.probe_free = hda_probe_compr_free,
.probe_set_params = hda_probe_compr_set_params,
.probe_trigger = hda_probe_compr_trigger,
.probe_pointer = hda_probe_compr_pointer,
#endif

/* firmware loading */
.load_firmware = snd_sof_load_firmware_raw,

@@ -16,10 +16,6 @@

#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)

#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_PROBES)
#include "../sof-probe.h"
#endif

struct hda_pipe_params {
u8 host_dma_id;
u8 link_dma_id;
@@ -11,6 +11,8 @@
#include <sound/hdaudio_ext.h>
#include <sound/soc.h>
#include "../sof-priv.h"
#include "../sof-ipc-client.h"
#include "../sof-probe.h"
#include "hda.h"

static inline struct hdac_ext_stream *
@@ -19,7 +21,7 @@ hda_compr_get_stream(struct snd_compr_stream *cstream)
return cstream->runtime->private_data;
}

int hda_probe_compr_assign(struct snd_sof_dev *sdev,
static int hda_probe_compr_assign(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream,
struct snd_soc_dai *dai)
{
@@ -36,7 +38,7 @@ int hda_probe_compr_assign(struct snd_sof_dev *sdev,
return hdac_stream(stream)->stream_tag;
}

int hda_probe_compr_free(struct snd_sof_dev *sdev,
static int hda_probe_compr_free(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream,
struct snd_soc_dai *dai)
{
@@ -56,7 +58,7 @@ int hda_probe_compr_free(struct snd_sof_dev *sdev,
return 0;
}

int hda_probe_compr_set_params(struct snd_sof_dev *sdev,
static int hda_probe_compr_set_params(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream,
struct snd_compr_params *params,
struct snd_soc_dai *dai)
@@ -89,7 +91,7 @@ int hda_probe_compr_set_params(struct snd_sof_dev *sdev,
return 0;
}

int hda_probe_compr_trigger(struct snd_sof_dev *sdev,
static int hda_probe_compr_trigger(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream, int cmd,
struct snd_soc_dai *dai)
{
@@ -98,7 +100,7 @@ int hda_probe_compr_trigger(struct snd_sof_dev *sdev,
return hda_dsp_stream_trigger(sdev, stream, cmd);
}

int hda_probe_compr_pointer(struct snd_sof_dev *sdev,
static int hda_probe_compr_pointer(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream,
struct snd_compr_tstamp *tstamp,
struct snd_soc_dai *dai)
@@ -112,3 +114,58 @@ int hda_probe_compr_pointer(struct snd_sof_dev *sdev,

return 0;
}

/* SOF client implementation */
static struct sof_probes_ops hda_probe_ops = {
.assign = hda_probe_compr_assign,
.free = hda_probe_compr_free,
.set_params = hda_probe_compr_set_params,
.trigger = hda_probe_compr_trigger,
.pointer = hda_probe_compr_pointer,
};

static int hda_probes_client_probe(struct auxiliary_device *auxdev,
const struct auxiliary_device_id *id)
{
struct sof_client_dev *cdev = auxiliary_dev_to_sof_client_dev(auxdev);
struct sof_probes_data *probes_client_data;

probes_client_data = devm_kzalloc(&auxdev->dev, sizeof(*probes_client_data), GFP_KERNEL);
if (!probes_client_data)
return -ENOMEM;

probes_client_data->ops = &hda_probe_ops;

cdev->data = probes_client_data;

return sof_client_probes_init(cdev);
}

static void hda_probes_client_remove(struct auxiliary_device *auxdev)
{
struct sof_client_dev *cdev = auxiliary_dev_to_sof_client_dev(auxdev);

sof_client_probes_cleanup(cdev);
}

static const struct auxiliary_device_id hda_probes_auxbus_id_table[] = {
{ .name = "snd_sof.probes" },
{},
};
MODULE_DEVICE_TABLE(auxiliary, hda_probes_auxbus_id_table);

/* driver name will be set based on KBUILD_MODNAME */
static struct sof_client_drv hda_probes_test_client_drv = {
.auxiliary_drv = {
.id_table = hda_probes_auxbus_id_table,
.probe = hda_probes_client_probe,
.remove = hda_probes_client_remove,
.shutdown = hda_probes_client_remove,
},
};

module_sof_client_driver(hda_probes_test_client_drv);

MODULE_DESCRIPTION("SOF Probes Client Driver");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(SND_SOC_SOF_CLIENT);
@@ -574,29 +574,6 @@ int hda_ipc_pcm_params(struct snd_sof_dev *sdev,
struct snd_pcm_substream *substream,
const struct sof_ipc_pcm_params_reply *reply);

#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
/*
* Probe Compress Operations.
*/
int hda_probe_compr_assign(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream,
struct snd_soc_dai *dai);
int hda_probe_compr_free(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream,
struct snd_soc_dai *dai);
int hda_probe_compr_set_params(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream,
struct snd_compr_params *params,
struct snd_soc_dai *dai);
int hda_probe_compr_trigger(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream, int cmd,
struct snd_soc_dai *dai);
int hda_probe_compr_pointer(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream,
struct snd_compr_tstamp *tstamp,
struct snd_soc_dai *dai);
#endif

/*
* DSP IPC Operations.
*/
@@ -90,15 +90,6 @@ const struct snd_sof_dsp_ops sof_icl_ops = {
.pcm_trigger = hda_dsp_pcm_trigger,
.pcm_pointer = hda_dsp_pcm_pointer,

#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
/* probe callbacks */
.probe_assign = hda_probe_compr_assign,
.probe_free = hda_probe_compr_free,
.probe_set_params = hda_probe_compr_set_params,
.probe_trigger = hda_probe_compr_trigger,
.probe_pointer = hda_probe_compr_pointer,
#endif

/* firmware loading */
.load_firmware = snd_sof_load_firmware_raw,

@@ -86,15 +86,6 @@ const struct snd_sof_dsp_ops sof_tgl_ops = {
.pcm_trigger = hda_dsp_pcm_trigger,
.pcm_pointer = hda_dsp_pcm_pointer,

#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
/* probe callbacks */
.probe_assign = hda_probe_compr_assign,
.probe_free = hda_probe_compr_free,
.probe_set_params = hda_probe_compr_set_params,
.probe_trigger = hda_probe_compr_trigger,
.probe_pointer = hda_probe_compr_pointer,
#endif

/* firmware loading */
.load_firmware = snd_sof_load_firmware_raw,

@@ -428,49 +428,6 @@ snd_sof_pcm_platform_pointer(struct snd_sof_dev *sdev,
return 0;
}

#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_PROBES)
static inline int
snd_sof_probe_compr_assign(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream, struct snd_soc_dai *dai)
{
return sof_ops(sdev)->probe_assign(sdev, cstream, dai);
}

static inline int
snd_sof_probe_compr_free(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream, struct snd_soc_dai *dai)
{
return sof_ops(sdev)->probe_free(sdev, cstream, dai);
}

static inline int
snd_sof_probe_compr_set_params(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream,
struct snd_compr_params *params, struct snd_soc_dai *dai)
{
return sof_ops(sdev)->probe_set_params(sdev, cstream, params, dai);
}

static inline int
snd_sof_probe_compr_trigger(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream, int cmd,
struct snd_soc_dai *dai)
{
return sof_ops(sdev)->probe_trigger(sdev, cstream, cmd, dai);
}

static inline int
snd_sof_probe_compr_pointer(struct snd_sof_dev *sdev,
struct snd_compr_stream *cstream,
struct snd_compr_tstamp *tstamp, struct snd_soc_dai *dai)
{
if (sof_ops(sdev) && sof_ops(sdev)->probe_pointer)
return sof_ops(sdev)->probe_pointer(sdev, cstream, tstamp, dai);

return 0;
}
#endif

/* machine driver */
static inline int
snd_sof_machine_register(struct snd_sof_dev *sdev, void *pdata)

0 comments on commit 15fe7d0

Please sign in to comment.