From 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Mon, 11 Dec 2023 02:46:07 +0000 Subject: [PATCH] add audio --- kernel/sound/firewire/isight.c | 21 ++++++++------------- 1 files changed, 8 insertions(+), 13 deletions(-) diff --git a/kernel/sound/firewire/isight.c b/kernel/sound/firewire/isight.c index 0717ab9..6655af5 100644 --- a/kernel/sound/firewire/isight.c +++ b/kernel/sound/firewire/isight.c @@ -1,8 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Apple iSight audio driver * * Copyright (c) Clemens Ladisch <clemens@ladisch.de> - * Licensed under the terms of the GNU General Public License, version 2. */ #include <asm/byteorder.h> @@ -286,12 +286,6 @@ struct snd_pcm_hw_params *hw_params) { struct isight *isight = substream->private_data; - int err; - - err = snd_pcm_lib_alloc_vmalloc_buffer(substream, - params_buffer_bytes(hw_params)); - if (err < 0) - return err; WRITE_ONCE(isight->pcm_active, true); @@ -337,7 +331,7 @@ isight_stop_streaming(isight); mutex_unlock(&isight->mutex); - return snd_pcm_lib_free_vmalloc_buffer(substream); + return 0; } static int isight_start_streaming(struct isight *isight) @@ -447,13 +441,11 @@ static const struct snd_pcm_ops ops = { .open = isight_open, .close = isight_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = isight_hw_params, .hw_free = isight_hw_free, .prepare = isight_prepare, .trigger = isight_trigger, .pointer = isight_pointer, - .page = snd_pcm_lib_get_vmalloc_page, }; struct snd_pcm *pcm; int err; @@ -465,6 +457,7 @@ strcpy(pcm->name, "iSight"); isight->pcm = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; isight->pcm->ops = &ops; + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0); return 0; } @@ -602,8 +595,6 @@ struct isight *isight = card->private_data; fw_iso_resources_destroy(&isight->resources); - fw_unit_put(isight->unit); - mutex_destroy(&isight->mutex); } static u64 get_unit_base(struct fw_unit *unit) @@ -703,7 +694,11 @@ isight_stop_streaming(isight); mutex_unlock(&isight->mutex); - snd_card_free_when_closed(isight->card); + // Block till all of ALSA character devices are released. + snd_card_free(isight->card); + + mutex_destroy(&isight->mutex); + fw_unit_put(isight->unit); } static const struct ieee1394_device_id isight_id_table[] = { -- Gitblit v1.6.2