// Author: Cezary Rojewski <cezary.rojewski@intel.com>
//
+#include <linux/cleanup.h>
#include <linux/pm_runtime.h>
#include <sound/soc.h>
#include <sound/pcm_params.h>
return catpt_topology[type];
}
+/* Caller responsible for holding ->stream_mutex. */
struct catpt_stream_runtime *
catpt_stream_find(struct catpt_dev *cdev, u8 stream_hw_id)
{
struct catpt_stream_runtime *pos, *result = NULL;
- spin_lock(&cdev->list_lock);
list_for_each_entry(pos, &cdev->stream_list, node) {
if (pos->info.stream_hw_id == stream_hw_id) {
result = pos;
}
}
- spin_unlock(&cdev->list_lock);
return result;
}
INIT_LIST_HEAD(&stream->node);
snd_soc_dai_set_dma_data(dai, substream, stream);
- spin_lock(&cdev->list_lock);
- list_add_tail(&stream->node, &cdev->stream_list);
- spin_unlock(&cdev->list_lock);
-
return 0;
err_request:
stream = snd_soc_dai_get_dma_data(dai, substream);
- spin_lock(&cdev->list_lock);
- list_del(&stream->node);
- spin_unlock(&cdev->list_lock);
-
release_resource(stream->persistent);
kfree(stream->persistent);
catpt_dsp_update_srampge(cdev, &cdev->dram, cdev->spec->dram_mask);
if (ret)
return CATPT_IPC_RET(ret);
+ guard(mutex)(&cdev->stream_mutex);
+
ret = catpt_dai_apply_usettings(dai, stream);
if (ret) {
catpt_ipc_free_stream(cdev, stream->info.stream_hw_id);
return ret;
}
+ list_add_tail(&stream->node, &cdev->stream_list);
stream->allocated = true;
return 0;
}
if (!stream->allocated)
return 0;
+ mutex_lock(&cdev->stream_mutex);
+ list_del(&stream->node);
+ mutex_unlock(&cdev->stream_mutex);
+
catpt_ipc_reset_stream(cdev, stream->info.stream_hw_id);
catpt_ipc_free_stream(cdev, stream->info.stream_hw_id);
int ret;
int i;
+ guard(mutex)(&cdev->stream_mutex);
+
stream = catpt_stream_find(cdev, pin_id);
if (!stream) {
for (i = 0; i < CATPT_CHANNELS_MAX; i++)
long *ctlvol = (long *)kcontrol->private_value;
int ret, i;
+ guard(mutex)(&cdev->stream_mutex);
+
stream = catpt_stream_find(cdev, pin_id);
if (!stream) {
for (i = 0; i < CATPT_CHANNELS_MAX; i++)
bool mute;
int ret;
+ guard(mutex)(&cdev->stream_mutex);
+
mute = (bool)ucontrol->value.integer.value[0];
stream = catpt_stream_find(cdev, CATPT_PIN_ID_REFERENCE);
if (!stream) {