[PATCH 3/6] ASoC: SOF: Create client driver for IPC test

Greg KH gregkh at linuxfoundation.org
Thu Oct 1 15:04:50 CEST 2020


On Wed, Sep 30, 2020 at 03:50:48PM -0700, Dave Ertman wrote:
> +/*
> + * 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_test_probe(struct ancillary_device *ancildev,
> +			      const struct ancillary_device_id *id)
> +{
> +	struct sof_client_dev *cdev = ancillary_dev_to_sof_client_dev(ancildev);
> +	struct sof_ipc_client_data *ipc_client_data;
> +
> +	/*
> +	 * The ancillary device has a usage count of 0 even before runtime PM
> +	 * is enabled. So, increment the usage count to let the device
> +	 * suspend after probe is complete.
> +	 */
> +	pm_runtime_get_noresume(&ancildev->dev);
> +
> +	/* allocate memory for client data */
> +	ipc_client_data = devm_kzalloc(&ancildev->dev, sizeof(*ipc_client_data), GFP_KERNEL);
> +	if (!ipc_client_data)
> +		return -ENOMEM;
> +
> +	ipc_client_data->buf = devm_kzalloc(&ancildev->dev, IPC_FLOOD_TEST_RESULT_LEN, GFP_KERNEL);
> +	if (!ipc_client_data->buf)
> +		return -ENOMEM;
> +
> +	cdev->data = ipc_client_data;
> +
> +	/* create debugfs root folder with device name under parent SOF dir */
> +	ipc_client_data->dfs_root = debugfs_create_dir(dev_name(&ancildev->dev),
> +						       sof_client_get_debugfs_root(cdev));
> +
> +	/* create read-write ipc_flood_count debugfs entry */
> +	debugfs_create_file("ipc_flood_count", 0644, ipc_client_data->dfs_root,
> +			    cdev, &sof_ipc_dfs_fops);
> +
> +	/* create read-write ipc_flood_duration_ms debugfs entry */
> +	debugfs_create_file("ipc_flood_duration_ms", 0644, ipc_client_data->dfs_root,
> +			    cdev, &sof_ipc_dfs_fops);

These debugfs files are never removed, why not?

thanks,

greg k-h


More information about the Alsa-devel mailing list