summaryrefslogtreecommitdiffstats
path: root/sound/virtio
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhostLinus Torvalds6 days1-1/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull virtio updates from Michael Tsirkin: "Several new features here: - virtio-net is finally supported in vduse - virtio (balloon and mem) interaction with suspend is improved - vhost-scsi now handles signals better/faster And fixes, cleanups all over the place" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (48 commits) virtio-pci: Check if is_avq is NULL virtio: delete vq in vp_find_vqs_msix() when request_irq() fails MAINTAINERS: add Eugenio Pérez as reviewer vhost-vdpa: Remove usage of the deprecated ida_simple_xx() API vp_vdpa: don't allocate unused msix vectors sound: virtio: drop owner assignment fuse: virtio: drop owner assignment scsi: virtio: drop owner assignment rpmsg: virtio: drop owner assignment nvdimm: virtio_pmem: drop owner assignment wifi: mac80211_hwsim: drop owner assignment vsock/virtio: drop owner assignment net: 9p: virtio: drop owner assignment net: virtio: drop owner assignment net: caif: virtio: drop owner assignment misc: nsm: drop owner assignment iommu: virtio: drop owner assignment drm/virtio: drop owner assignment gpio: virtio: drop owner assignment firmware: arm_scmi: virtio: drop owner assignment ...
| * sound: virtio: drop owner assignmentKrzysztof Kozlowski8 days1-1/+0
| | | | | | | | | | | | | | | | | | | | virtio core already sets the .owner, so driver does not need to. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Message-Id: <20240331-module-owner-virtio-v2-25-98f04bfaf46a@linaro.org> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Anton Yakovlev <anton.yakovlev@opensynergy.com>
* | ALSA: misc: Use *-y instead of *-objs in MakefileTakashi Iwai2024-05-081-1/+1
|/ | | | | | | | | | | | | *-objs suffix is reserved rather for (user-space) host programs while usually *-y suffix is used for kernel drivers (although *-objs works for that purpose for now). Let's correct the old usages of *-objs in Makefiles. Signed-off-by: Takashi Iwai <tiwai@suse.de> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20240507135513.14919-10-tiwai@suse.de
* ALSA: virtio: Fix "Coverity: virtsnd_kctl_tlv_op(): Uninitialized variables" ↵Aiswarya Cyriac2024-02-161-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | warning. This commit fixes the following warning when building virtio_snd driver. " *** CID 1583619: Uninitialized variables (UNINIT) sound/virtio/virtio_kctl.c:294 in virtsnd_kctl_tlv_op() 288 289 break; 290 } 291 292 kfree(tlv); 293 vvv CID 1583619: Uninitialized variables (UNINIT) vvv Using uninitialized value "rc". 294 return rc; 295 } 296 297 /** 298 * virtsnd_kctl_get_enum_items() - Query items for the ENUMERATED element type. 299 * @snd: VirtIO sound device. " This warning is caused by the absence of the "default" branch in the switch-block, and is a false positive because the kernel calls virtsnd_kctl_tlv_op() only with values for op_flag processed in this block. Also, this commit unifies the cleanup path for all possible control paths in the callback function. Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> Signed-off-by: Aiswarya Cyriac <aiswarya.cyriac@opensynergy.com> Reported-by: coverity-bot <keescook+coverity-bot@chromium.org> Addresses-Coverity-ID: 1583619 ("Uninitialized variables") Fixes: d6568e3de42d ("ALSA: virtio: add support for audio controls") Acked-by: Michael S. Tsirkin <mst@redhat.com> Link: https://lore.kernel.org/r/20240216100643.688590-1-aiswarya.cyriac@opensynergy.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: virtio: add support for audio controlsAnton Yakovlev2024-02-094-0/+510
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementation of support for audio controls in accordance with the extension of the virtio sound device specification [1] planned for virtio-v1.3-cs01. The device can announce the VIRTIO_SND_F_CTLS feature. If the feature is negotiated, then an additional field appears in the configuration space: struct virtio_snd_config { ... /* number of available control elements */ __le32 controls; }; The driver can send the following requests to manage audio controls: enum { ... /* control element request types */ VIRTIO_SND_R_CTL_INFO = 0x0300, VIRTIO_SND_R_CTL_ENUM_ITEMS, VIRTIO_SND_R_CTL_READ, VIRTIO_SND_R_CTL_WRITE, VIRTIO_SND_R_CTL_TLV_READ, VIRTIO_SND_R_CTL_TLV_WRITE, VIRTIO_SND_R_CTL_TLV_COMMAND, ... }; And the device can send the following audio control event notification: enum { ... /* control element event types */ VIRTIO_SND_EVT_CTL_NOTIFY = 0x1200, ... }; See additional details in [1]. [1] https://lists.oasis-open.org/archives/virtio-comment/202104/msg00013.html Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> Signed-off-by: Aiswarya Cyriac <aiswarya.cyriac@opensynergy.com> Link: https://lore.kernel.org/r/20240115133654.576068-2-aiswarya.cyriac@opensynergy.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: virtio: remove duplicate check if queue is brokenLi RongQing2024-01-243-6/+0
| | | | | | | | | | virtqueue_enable_cb() will call virtqueue_poll() which will check if queue is broken at beginning, so remove the virtqueue_is_broken() call Signed-off-by: Li RongQing <lirongqing@baidu.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Link: https://lore.kernel.org/r/20240124120834.49410-1-lirongqing@baidu.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: virtio: use ack callbackMatias Ezequiel Vara Larsen2023-10-274-61/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit uses the ack() callback to determine when a buffer has been updated, then exposes it to guest. The current mechanism splits a dma buffer into descriptors that are exposed to the device. This dma buffer is shared with the user application. When the device consumes a buffer, the driver moves the request from the used ring to available ring. The driver exposes the buffer to the device without knowing if the content has been updated from the user. The section 2.8.21.1 of the virtio spec states that: "The device MAY access the descriptor chains the driver created and the memory they refer to immediately". If the device picks up buffers from the available ring just after it is notified, it happens that the content may be old. When the ack() callback is invoked, the driver exposes only the buffers that have already been updated, i.e., enqueued in the available ring. Thus, the device always picks up a buffer that is updated. For capturing, the driver starts by exposing all the available buffers to device. After device updates the content of a buffer, it enqueues it in the used ring. It is only after the ack() for capturing is issued that the driver re-enqueues the buffer in the available ring. Co-developed-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com> Link: https://lore.kernel.org/r/ZTjkn1YAFz67yfqx@fedora Signed-off-by: Takashi Iwai <tiwai@suse.de>
* virtio: wrap config->reset callsMichael S. Tsirkin2022-01-141-2/+2
| | | | | | | | | | | This will enable cleanups down the road. The idea is to disable cbs, then add "flush_queued_cbs" callback as a parameter, this way drivers can flush any work queued after callbacks have been disabled. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Link: https://lore.kernel.org/r/20211013105226.20225-1-mst@redhat.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* ALSA: virtio: Replace zero-length array with flexible-array memberGustavo A. R. Silva2021-09-301-3/+2
| | | | | | | | | | | | | | | | | | There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. Also, make use of the struct_size() helper in kzalloc(). [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://www.kernel.org/doc/html/v5.10/process/deprecated.html#zero-length-and-one-element-arrays Link: https://github.com/KSPP/linux/issues/78 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20210929191504.GA337268@embeddedor Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: virtio: fix kernel-docPierre-Louis Bossart2021-04-271-1/+1
| | | | | | | | | | | | make W=1 warning: sound/virtio/virtio_ctl_msg.c:70: warning: expecting prototype for virtsnd_ctl_msg_request(). Prototype was for virtsnd_ctl_msg_response() instead Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20210426213902.234711-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: virtio: use module_virtio_driver() to simplify the codeChen Huang2021-04-121-11/+1
| | | | | | | | | | module_virtio_driver() makes the code simpler by eliminating boilerplate code. Signed-off-by: Chen Huang <chenhuang5@huawei.com> Reviewed-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> Link: https://lore.kernel.org/r/20210408125429.1158703-1-chenhuang5@huawei.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: virtio: introduce device suspend/resume supportAnton Yakovlev2021-03-073-7/+85
| | | | | | | | | All running PCM substreams are stopped on device suspend and restarted on device resume. Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> Link: https://lore.kernel.org/r/20210302164709.3142702-10-anton.yakovlev@opensynergy.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: virtio: introduce PCM channel map supportAnton Yakovlev2021-03-075-0/+242
| | | | | | | | Enumerate all available PCM channel maps and create ALSA controls. Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> Link: https://lore.kernel.org/r/20210302164709.3142702-9-anton.yakovlev@opensynergy.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: virtio: introduce jack supportAnton Yakovlev2021-03-074-0/+260
| | | | | | | | | | | Enumerate all available jacks and create ALSA controls. At the moment jacks have a simple implementation and can only be used to receive notifications about a plugged in/out device. Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> Link: https://lore.kernel.org/r/20210302164709.3142702-8-anton.yakovlev@opensynergy.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: virtio: PCM substream operatorsAnton Yakovlev2021-03-074-1/+454
| | | | | | | | Introduce the operators required for the operation of substreams. Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> Link: https://lore.kernel.org/r/20210302164709.3142702-7-anton.yakovlev@opensynergy.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: virtio: handling control and I/O messages for the PCM deviceAnton Yakovlev2021-03-076-5/+515
| | | | | | | | | | | | | | | | | The driver implements a message-based transport for I/O substream operations. Before the start of the substream, the hardware buffer is sliced into I/O messages, the number of which is equal to the current number of periods. The size of each message is equal to the current size of one period. I/O messages are organized in an ordered queue. The completion of the I/O message indicates an elapsed period (the only exception is the end of the stream for the capture substream). Upon completion, the message is automatically re-added to the end of the queue. Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> Link: https://lore.kernel.org/r/20210302164709.3142702-6-anton.yakovlev@opensynergy.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: virtio: build PCM devices and substream hardware descriptorsAnton Yakovlev2021-03-075-1/+581
| | | | | | | | | | | | | | | | | | | Like the HDA specification, the virtio sound device specification links PCM substreams, jacks and PCM channel maps into functional groups. For each discovered group, a PCM device is created, the number of which coincides with the group number. Introduce the module parameters for setting the hardware buffer parameters: pcm_buffer_ms [=160] pcm_periods_min [=2] pcm_periods_max [=16] pcm_period_ms_min [=10] pcm_period_ms_max [=80] Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> Link: https://lore.kernel.org/r/20210302164709.3142702-5-anton.yakovlev@opensynergy.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: virtio: handling control messagesAnton Yakovlev2021-03-075-1/+410
| | | | | | | | | | | | | | The control queue can be used by different parts of the driver to send commands to the device. Control messages can be either synchronous or asynchronous. The lifetime of a message is controlled by a reference count. Introduce a module parameter to set the message completion timeout: msg_timeout_ms [=1000] Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> Link: https://lore.kernel.org/r/20210302164709.3142702-4-anton.yakovlev@opensynergy.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: virtio: add virtio sound driverAnton Yakovlev2021-03-074-0/+406
Introduce skeleton of the virtio sound driver. The driver implements the virtio sound device specification, which has become part of the virtio standard. Initial initialization of the device, virtqueues and creation of an empty ALSA sound device. Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> Link: https://lore.kernel.org/r/20210302164709.3142702-3-anton.yakovlev@opensynergy.com Signed-off-by: Takashi Iwai <tiwai@suse.de>