Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fcd9a9af authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dsp: add change to enable preemption at cal_utils_dealloc_cal."

parents 60fc2c46 811d618e
Loading
Loading
Loading
Loading
+22 −3
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@
#include <linux/mutex.h>
#include <dsp/audio_cal_utils.h>

struct mutex cal_lock;

static int unmap_memory(struct cal_type_data *cal_type,
			struct cal_block_data *cal_block);

@@ -946,7 +948,9 @@ int cal_utils_dealloc_cal(size_t data_size, void *data,
	if (ret < 0)
		goto err;

	mutex_lock(&cal_lock);
	delete_cal_block(cal_block);
	mutex_unlock(&cal_lock);
err:
	mutex_unlock(&cal_type->lock);
done:
@@ -1061,6 +1065,11 @@ void cal_utils_mark_cal_used(struct cal_block_data *cal_block)
}
EXPORT_SYMBOL(cal_utils_mark_cal_used);

int __init cal_utils_init(void)
{
	mutex_init(&cal_lock);
	return 0;
}
/**
 * cal_utils_is_cal_stale
 *
@@ -1070,9 +1079,19 @@ EXPORT_SYMBOL(cal_utils_mark_cal_used);
 */
bool cal_utils_is_cal_stale(struct cal_block_data *cal_block)
{
	if ((cal_block) && (cal_block->cal_stale))
		return true;
	bool ret = false;

	return false;
	mutex_lock(&cal_lock);
	if (!cal_block) {
		pr_err("%s: cal_block is Null", __func__);
		goto unlock;
	}

	if (cal_block->cal_stale)
	    ret = true;

unlock:
	mutex_unlock(&cal_lock);
	return ret;
}
EXPORT_SYMBOL(cal_utils_is_cal_stale);
+2 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2014, 2016-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014, 2016-2017, 2020, The Linux Foundation. All rights reserved.
 */
#include <linux/slab.h>
#include <linux/fs.h>
@@ -591,6 +591,7 @@ int __init audio_cal_init(void)

	pr_debug("%s\n", __func__);

	cal_utils_init();
	memset(&audio_cal, 0, sizeof(audio_cal));
	mutex_init(&audio_cal.common_lock);
	for (; i < MAX_CAL_TYPES; i++) {
+1 −1
Original line number Diff line number Diff line
@@ -3282,7 +3282,7 @@ static int send_afe_cal_type(int cal_index, int port_id)
				this_afe.cal_data[cal_index]);

	if (cal_block == NULL || cal_utils_is_cal_stale(cal_block)) {
		pr_err("%s cal_block not found!!\n", __func__);
		pr_err_ratelimited("%s cal_block not found!!\n", __func__);
		ret = -EINVAL;
		goto unlock;
	}
+3 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2014, 2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014, 2018, 2020, The Linux Foundation. All rights reserved.
 */
#ifndef _AUDIO_CAL_UTILS_H
#define _AUDIO_CAL_UTILS_H
@@ -95,4 +95,6 @@ int32_t cal_utils_get_cal_type_version(void *cal_type_data);
void cal_utils_mark_cal_used(struct cal_block_data *cal_block);

bool cal_utils_is_cal_stale(struct cal_block_data *cal_block);

int cal_utils_init(void);
#endif