linux/drivers/usb/gadget/function/u_audio.h

/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * u_audio.h -- interface to USB gadget "ALSA sound card" utilities
 *
 * Copyright (C) 2016
 * Author: Ruslan Bilovol <[email protected]>
 */

#ifndef __U_AUDIO_H
#define __U_AUDIO_H

#include <linux/usb/composite.h>
#include "uac_common.h"

/*
 * Same maximum frequency deviation on the slower side as in
 * sound/usb/endpoint.c. Value is expressed in per-mil deviation.
 */
#define FBACK_SLOW_MAX

/*
 * Maximum frequency deviation on the faster side, default value for UAC1/2.
 * Value is expressed in per-mil deviation.
 * UAC2 provides the value as a parameter as it impacts the endpoint required
 * bandwidth.
 */
#define FBACK_FAST_MAX

/* Feature Unit parameters */
struct uac_fu_params {};

struct uac_params {};

struct g_audio {};

static inline struct g_audio *func_to_g_audio(struct usb_function *f)
{}

static inline uint num_channels(uint chanmask)
{}

/*
 * g_audio_setup - initialize one virtual ALSA sound card
 * @g_audio: struct with filled params, in_ep_maxpsize, out_ep_maxpsize
 * @pcm_name: the id string for a PCM instance of this sound card
 * @card_name: name of this soundcard
 *
 * This sets up the single virtual ALSA sound card that may be exported by a
 * gadget driver using this framework.
 *
 * Context: may sleep
 *
 * Returns zero on success, or a negative error on failure.
 */
int g_audio_setup(struct g_audio *g_audio, const char *pcm_name,
					const char *card_name);
void g_audio_cleanup(struct g_audio *g_audio);

int u_audio_start_capture(struct g_audio *g_audio);
void u_audio_stop_capture(struct g_audio *g_audio);
int u_audio_start_playback(struct g_audio *g_audio);
void u_audio_stop_playback(struct g_audio *g_audio);

int u_audio_get_capture_srate(struct g_audio *audio_dev, u32 *val);
int u_audio_set_capture_srate(struct g_audio *audio_dev, int srate);
int u_audio_get_playback_srate(struct g_audio *audio_dev, u32 *val);
int u_audio_set_playback_srate(struct g_audio *audio_dev, int srate);

int u_audio_get_volume(struct g_audio *g_audio, int playback, s16 *val);
int u_audio_set_volume(struct g_audio *g_audio, int playback, s16 val);
int u_audio_get_mute(struct g_audio *g_audio, int playback, int *val);
int u_audio_set_mute(struct g_audio *g_audio, int playback, int val);

void u_audio_suspend(struct g_audio *g_audio);

#endif /* __U_AUDIO_H */