// SPDX-License-Identifier: GPL-2.0+ /* * virtio-snd: Virtio sound device * Copyright (C) 2021 OpenSynergy GmbH */ #include <linux/virtio_config.h> #include <sound/jack.h> #include <sound/hda_verbs.h> #include "virtio_card.h" /** * DOC: Implementation Status * * At the moment jacks have a simple implementation and can only be used to * receive notifications about a plugged in/out device. * * VIRTIO_SND_R_JACK_REMAP * is not supported */ /** * struct virtio_jack - VirtIO jack. * @jack: Kernel jack control. * @nid: Functional group node identifier. * @features: Jack virtio feature bit map (1 << VIRTIO_SND_JACK_F_XXX). * @defconf: Pin default configuration value. * @caps: Pin capabilities value. * @connected: Current jack connection status. * @type: Kernel jack type (SND_JACK_XXX). */ struct virtio_jack { … }; /** * virtsnd_jack_get_label() - Get the name string for the jack. * @vjack: VirtIO jack. * * Returns the jack name based on the default pin configuration value (see HDA * specification). * * Context: Any context. * Return: Name string. */ static const char *virtsnd_jack_get_label(struct virtio_jack *vjack) { … } /** * virtsnd_jack_get_type() - Get the type for the jack. * @vjack: VirtIO jack. * * Returns the jack type based on the default pin configuration value (see HDA * specification). * * Context: Any context. * Return: SND_JACK_XXX value. */ static int virtsnd_jack_get_type(struct virtio_jack *vjack) { … } /** * virtsnd_jack_parse_cfg() - Parse the jack 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_jack_parse_cfg(struct virtio_snd *snd) { … } /** * virtsnd_jack_build_devs() - Build ALSA controls for jacks. * @snd: VirtIO sound device. * * Context: Any context that permits to sleep. * Return: 0 on success, -errno on failure. */ int virtsnd_jack_build_devs(struct virtio_snd *snd) { … } /** * virtsnd_jack_event() - Handle the jack event notification. * @snd: VirtIO sound device. * @event: VirtIO sound event. * * Context: Interrupt context. */ void virtsnd_jack_event(struct virtio_snd *snd, struct virtio_snd_event *event) { … }