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

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

Merge "dsp: fix shared buffer format mixer control"

parents a78b3224 3c2489df
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -1252,7 +1252,7 @@ int get_lsm_port(void)
 */
int q6lsm_set_afe_data_format(uint64_t fe_id, uint16_t afe_data_format)
{
	int n = 0;
	int n = 0, free_session = LSM_INVALID_SESSION_ID;

	if (0 != afe_data_format && 1 != afe_data_format)
		goto done;
@@ -1261,8 +1261,13 @@ int q6lsm_set_afe_data_format(uint64_t fe_id, uint16_t afe_data_format)
		 afe_data_format ? "unprocessed" : "processed");

	for (n = LSM_MIN_SESSION_ID; n <= LSM_MAX_SESSION_ID; n++) {
		if (0 == lsm_client_afe_data[n].fe_id) {
			lsm_client_afe_data[n].fe_id = fe_id;
		/* Save ID of the first available free session */
		if (LSM_INVALID_SESSION_ID == free_session &&
		    0 == lsm_client_afe_data[n].fe_id)
			free_session = n;

		/* Find the matching session with fe_id */
		if (fe_id == lsm_client_afe_data[n].fe_id) {
			lsm_client_afe_data[n].unprocessed_data =
							afe_data_format;
			pr_debug("%s: session ID is %d, fe_id is %d\n",
@@ -1270,6 +1275,18 @@ int q6lsm_set_afe_data_format(uint64_t fe_id, uint16_t afe_data_format)
			return 0;
		}
	}
	/*
	 * When no matching session is found, allocate
	 * a new one if a free session is available.
	 */
	if (free_session != LSM_INVALID_SESSION_ID) {
		lsm_client_afe_data[free_session].fe_id = fe_id;
		lsm_client_afe_data[free_session].unprocessed_data =
							afe_data_format;
		pr_debug("%s: session ID is %d, fe_id is %d\n",
			 __func__, free_session, fe_id);
		return 0;
	}

	pr_err("%s: all lsm sessions are taken\n", __func__);
done: