linux/sound/virtio/virtio_card.h

/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * virtio-snd: Virtio sound device
 * Copyright (C) 2021 OpenSynergy GmbH
 */
#ifndef VIRTIO_SND_CARD_H
#define VIRTIO_SND_CARD_H

#include <linux/slab.h>
#include <linux/virtio.h>
#include <sound/core.h>
#include <uapi/linux/virtio_snd.h>

#include "virtio_ctl_msg.h"
#include "virtio_pcm.h"

#define VIRTIO_SND_CARD_DRIVER
#define VIRTIO_SND_CARD_NAME
#define VIRTIO_SND_PCM_NAME

struct virtio_jack;
struct virtio_pcm_substream;

/**
 * struct virtio_snd_queue - Virtqueue wrapper structure.
 * @lock: Used to synchronize access to a virtqueue.
 * @vqueue: Underlying virtqueue.
 */
struct virtio_snd_queue {};

/**
 * struct virtio_kctl - VirtIO control element.
 * @kctl: ALSA control element.
 * @items: Items for the ENUMERATED element type.
 */
struct virtio_kctl {};

/**
 * struct virtio_snd - VirtIO sound card device.
 * @vdev: Underlying virtio device.
 * @queues: Virtqueue wrappers.
 * @card: ALSA sound card.
 * @ctl_msgs: Pending control request list.
 * @event_msgs: Device events.
 * @pcm_list: VirtIO PCM device list.
 * @jacks: VirtIO jacks.
 * @njacks: Number of jacks.
 * @substreams: VirtIO PCM substreams.
 * @nsubstreams: Number of PCM substreams.
 * @chmaps: VirtIO channel maps.
 * @nchmaps: Number of channel maps.
 * @kctl_infos: VirtIO control element information.
 * @kctls: VirtIO control elements.
 * @nkctls: Number of control elements.
 */
struct virtio_snd {};

/* Message completion timeout in milliseconds (module parameter). */
extern u32 virtsnd_msg_timeout_ms;

static inline struct virtio_snd_queue *
virtsnd_control_queue(struct virtio_snd *snd)
{}

static inline struct virtio_snd_queue *
virtsnd_event_queue(struct virtio_snd *snd)
{}

static inline struct virtio_snd_queue *
virtsnd_tx_queue(struct virtio_snd *snd)
{}

static inline struct virtio_snd_queue *
virtsnd_rx_queue(struct virtio_snd *snd)
{}

static inline struct virtio_snd_queue *
virtsnd_pcm_queue(struct virtio_pcm_substream *vss)
{}

int virtsnd_jack_parse_cfg(struct virtio_snd *snd);

int virtsnd_jack_build_devs(struct virtio_snd *snd);

void virtsnd_jack_event(struct virtio_snd *snd,
			struct virtio_snd_event *event);

int virtsnd_chmap_parse_cfg(struct virtio_snd *snd);

int virtsnd_chmap_build_devs(struct virtio_snd *snd);

int virtsnd_kctl_parse_cfg(struct virtio_snd *snd);

int virtsnd_kctl_build_devs(struct virtio_snd *snd);

void virtsnd_kctl_event(struct virtio_snd *snd, struct virtio_snd_event *event);

#endif /* VIRTIO_SND_CARD_H */