linux/sound/soc/sof/sof-client-ipc-flood-test.c

// SPDX-License-Identifier: GPL-2.0-only
//
// Copyright(c) 2022 Intel Corporation
//
// Authors: Ranjani Sridharan <[email protected]>
//	    Peter Ujfalusi <[email protected]>
//

#include <linux/auxiliary_bus.h>
#include <linux/completion.h>
#include <linux/debugfs.h>
#include <linux/ktime.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <sound/sof/header.h>

#include "sof-client.h"

#define MAX_IPC_FLOOD_DURATION_MS
#define MAX_IPC_FLOOD_COUNT
#define IPC_FLOOD_TEST_RESULT_LEN
#define SOF_IPC_CLIENT_SUSPEND_DELAY_MS

#define DEBUGFS_IPC_FLOOD_COUNT
#define DEBUGFS_IPC_FLOOD_DURATION

struct sof_ipc_flood_priv {};

static int sof_ipc_flood_dfs_open(struct inode *inode, struct file *file)
{}

/*
 * helper function to perform the flood test. Only one of the two params, ipc_duration_ms
 * or ipc_count, will be non-zero and will determine the type of test
 */
static int sof_debug_ipc_flood_test(struct sof_client_dev *cdev,
				    bool flood_duration_test,
				    unsigned long ipc_duration_ms,
				    unsigned long ipc_count)
{}

/*
 * Writing to the debugfs entry initiates the IPC flood test based on
 * the IPC count or the duration specified by the user.
 */
static ssize_t sof_ipc_flood_dfs_write(struct file *file, const char __user *buffer,
				       size_t count, loff_t *ppos)
{}

/* return the result of the last IPC flood test */
static ssize_t sof_ipc_flood_dfs_read(struct file *file, char __user *buffer,
				      size_t count, loff_t *ppos)
{}

static int sof_ipc_flood_dfs_release(struct inode *inode, struct file *file)
{}

static const struct file_operations sof_ipc_flood_fops =;

/*
 * The IPC test client creates a couple of debugfs entries that will be used
 * flood tests. Users can write to these entries to execute the IPC flood test
 * by specifying either the number of IPCs to flood the DSP with or the duration
 * (in ms) for which the DSP should be flooded with test IPCs. At the
 * end of each test, the average, min and max response times are reported back.
 * The results of the last flood test can be accessed by reading the debugfs
 * entries.
 */
static int sof_ipc_flood_probe(struct auxiliary_device *auxdev,
			       const struct auxiliary_device_id *id)
{}

static void sof_ipc_flood_remove(struct auxiliary_device *auxdev)
{}

static const struct auxiliary_device_id sof_ipc_flood_client_id_table[] =;
MODULE_DEVICE_TABLE(auxiliary, sof_ipc_flood_client_id_table);

/*
 * No need for driver pm_ops as the generic pm callbacks in the auxiliary bus
 * type are enough to ensure that the parent SOF device resumes to bring the DSP
 * back to D0.
 * Driver name will be set based on KBUILD_MODNAME.
 */
static struct auxiliary_driver sof_ipc_flood_client_drv =;

module_auxiliary_driver();

MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_IMPORT_NS();