// SPDX-License-Identifier: GPL-2.0+ /* * virtio-snd: Virtio sound device * Copyright (C) 2022 OpenSynergy GmbH */ #include <sound/control.h> #include <linux/virtio_config.h> #include "virtio_card.h" /* Map for converting VirtIO types to ALSA types. */ static const snd_ctl_elem_type_t g_v2a_type_map[] = …; /* Map for converting VirtIO access rights to ALSA access rights. */ static const unsigned int g_v2a_access_map[] = …; /* Map for converting VirtIO event masks to ALSA event masks. */ static const unsigned int g_v2a_mask_map[] = …; /** * virtsnd_kctl_info() - Returns information about the control. * @kcontrol: ALSA control element. * @uinfo: Element information. * * Context: Process context. * Return: 0 on success, -errno on failure. */ static int virtsnd_kctl_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { … } /** * virtsnd_kctl_get() - Read the value from the control. * @kcontrol: ALSA control element. * @uvalue: Element value. * * Context: Process context. * Return: 0 on success, -errno on failure. */ static int virtsnd_kctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *uvalue) { … } /** * virtsnd_kctl_put() - Write the value to the control. * @kcontrol: ALSA control element. * @uvalue: Element value. * * Context: Process context. * Return: 0 on success, -errno on failure. */ static int virtsnd_kctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *uvalue) { … } /** * virtsnd_kctl_tlv_op() - Perform an operation on the control's metadata. * @kcontrol: ALSA control element. * @op_flag: Operation code (SNDRV_CTL_TLV_OP_XXX). * @size: Size of the TLV data in bytes. * @utlv: TLV data. * * Context: Process context. * Return: 0 on success, -errno on failure. */ static int virtsnd_kctl_tlv_op(struct snd_kcontrol *kcontrol, int op_flag, unsigned int size, unsigned int __user *utlv) { … } /** * virtsnd_kctl_get_enum_items() - Query items for the ENUMERATED element type. * @snd: VirtIO sound device. * @cid: Control element ID. * * This function is called during initial device initialization. * * Context: Any context that permits to sleep. * Return: 0 on success, -errno on failure. */ static int virtsnd_kctl_get_enum_items(struct virtio_snd *snd, unsigned int cid) { … } /** * virtsnd_kctl_parse_cfg() - Parse the control element configuration. * @snd: VirtIO sound device. * * This function is called during initial device initialization. * * Context: Any context that permits to sleep. * Return: 0 on success, -errno on failure. */ int virtsnd_kctl_parse_cfg(struct virtio_snd *snd) { … } /** * virtsnd_kctl_build_devs() - Build ALSA control elements. * @snd: VirtIO sound device. * * Context: Any context that permits to sleep. * Return: 0 on success, -errno on failure. */ int virtsnd_kctl_build_devs(struct virtio_snd *snd) { … } /** * virtsnd_kctl_event() - Handle the control element event notification. * @snd: VirtIO sound device. * @event: VirtIO sound event. * * Context: Interrupt context. */ void virtsnd_kctl_event(struct virtio_snd *snd, struct virtio_snd_event *event) { … }