Re: [PATCH v33 14/31] ASoC: Add SoC USB APIs for adding an USB backend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

There are a few kernel-doc problems here (see below).

On 1/16/25 3:28 PM, Wesley Cheng wrote:
> Some platforms may have support for offloading USB audio devices to a
> dedicated audio DSP.  Introduce a set of APIs that allow for management of
> USB sound card and PCM devices enumerated by the USB SND class driver.
> This allows for the ASoC components to be aware of what USB devices are
> available for offloading.
> 
> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
> Signed-off-by: Wesley Cheng <quic_wcheng@xxxxxxxxxxx>
> ---
>  include/sound/soc-usb.h |  97 ++++++++++++++++++
>  sound/soc/Kconfig       |  10 ++
>  sound/soc/Makefile      |   2 +
>  sound/soc/soc-usb.c     | 220 ++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 329 insertions(+)
>  create mode 100644 include/sound/soc-usb.h
>  create mode 100644 sound/soc/soc-usb.c
> 
> diff --git a/include/sound/soc-usb.h b/include/sound/soc-usb.h
> new file mode 100644
> index 000000000000..bd4c5632bb62
> --- /dev/null
> +++ b/include/sound/soc-usb.h
> @@ -0,0 +1,97 @@
> +/* SPDX-License-Identifier: GPL-2.0
> + *
> + * Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved.
> + */
> +
> +#ifndef __LINUX_SND_SOC_USB_H
> +#define __LINUX_SND_SOC_USB_H
> +
> +#include <sound/soc.h>
> +
> +/**
> + * struct snd_soc_usb_device

    * struct snd_soc_usb_device - <some short description of what this is>

Same comment applies to other structs below.

> + * @card_idx - sound card index associated with USB device
> + * @chip_idx - USB sound chip array index
> + * @cpcm_idx - capture PCM index array associated with USB device
> + * @ppcm_idx - playback PCM index array associated with USB device
> + * @num_capture - number of capture streams
> + * @num_playback - number of playback streams
> + * @list - list head for SoC USB devices

All of the struct members/fields above should be separated from their
description with a ':', not a '-'.

Same comment applies to other structs below.

> + **/
> +struct snd_soc_usb_device {
> +	int card_idx;
> +	int chip_idx;
> +
> +	/* PCM index arrays */
> +	unsigned int *cpcm_idx; /* TODO: capture path is not tested yet */
> +	unsigned int *ppcm_idx;
> +	int num_capture; /* TODO: capture path is not tested yet */
> +	int num_playback;
> +
> +	struct list_head list;
> +};
> +
> +/**
> + * struct snd_soc_usb
> + * @list - list head for SND SOC struct list
> + * @component - reference to ASoC component
> + * @connection_status_cb - callback to notify connection events
> + * @priv_data - driver data
> + **/
> +struct snd_soc_usb {
> +	struct list_head list;
> +	struct snd_soc_component *component;
> +	int (*connection_status_cb)(struct snd_soc_usb *usb,
> +				    struct snd_soc_usb_device *sdev,
> +				    bool connected);
> +	void *priv_data;
> +};
> +


> diff --git a/sound/soc/soc-usb.c b/sound/soc/soc-usb.c
> new file mode 100644
> index 000000000000..3b8e47e3f469
> --- /dev/null
> +++ b/sound/soc/soc-usb.c
> @@ -0,0 +1,220 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved.
> + */
> +#include <linux/of.h>
> +#include <linux/usb.h>
> +#include <sound/soc-usb.h>
> +#include "../usb/card.h"
> +
> +static DEFINE_MUTEX(ctx_mutex);
> +static LIST_HEAD(usb_ctx_list);
> +

[snip]

> +/**
> + * snd_soc_usb_allocate_port() - allocate a SoC USB port for offloading support
> + * @component: USB DPCM backend DAI component
> + * @num_streams: number of offloading sessions supported

There is no num_streams function parameter.

> + * @data: private data
> + *
> + * Allocate and initialize a SoC USB port.  The SoC USB port is used to communicate
> + * different USB audio devices attached, in order to start audio offloading handled
> + * by an ASoC entity.  USB device plug in/out events are signaled with a
> + * notification, but don't directly impact the memory allocated for the SoC USB
> + * port.
> + *
> + */
> +struct snd_soc_usb *snd_soc_usb_allocate_port(struct snd_soc_component *component,
> +					      void *data)
> +{
> +	struct snd_soc_usb *usb;
> +
> +	usb = kzalloc(sizeof(*usb), GFP_KERNEL);
> +	if (!usb)
> +		return ERR_PTR(-ENOMEM);
> +
> +	usb->component = component;
> +	usb->priv_data = data;
> +
> +	return usb;
> +}
> +EXPORT_SYMBOL_GPL(snd_soc_usb_allocate_port);
> +


-- 
~Randy





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux