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

Commit fb5ac59d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: qdsp6v2: Add get for App Type mixer control"

parents 4bb1fce5 d18b7ac1
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -2704,7 +2704,35 @@ static int msm_compr_app_type_cfg_put(struct snd_kcontrol *kcontrol,
static int msm_compr_app_type_cfg_get(struct snd_kcontrol *kcontrol,
				      struct snd_ctl_elem_value *ucontrol)
{
	return 0;
	u64 fe_id = kcontrol->private_value;
	int ret = 0;
	int app_type;
	int acdb_dev_id;
	int sample_rate;

	pr_debug("%s: fe_id- %llu\n", __func__, fe_id);
	if (fe_id >= MSM_FRONTEND_DAI_MAX) {
		pr_err("%s Received out of bounds fe_id %llu\n",
			__func__, fe_id);
		ret = -EINVAL;
		goto done;
	}

	ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, &app_type,
		&acdb_dev_id, &sample_rate);
	if (ret < 0) {
		pr_err("%s: msm_pcm_routing_get_stream_app_type_cfg failed returned %d\n",
			__func__, ret);
		goto done;
	}

	ucontrol->value.integer.value[0] = app_type;
	ucontrol->value.integer.value[1] = acdb_dev_id;
	ucontrol->value.integer.value[2] = sample_rate;
	pr_debug("%s: fedai_id %llu, app_type %d, acdb_dev_id %d, sample_rate %d\n",
		__func__, fe_id, app_type, acdb_dev_id, sample_rate);
done:
	return ret;
}

static int msm_compr_channel_map_put(struct snd_kcontrol *kcontrol,
+30 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1148,7 +1148,35 @@ static int msm_pcm_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
static int msm_pcm_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	return 0;
	u64 fe_id = kcontrol->private_value;
	int ret = 0;
	int app_type;
	int acdb_dev_id;
	int sample_rate;

	pr_debug("%s: fe_id- %llu\n", __func__, fe_id);
	if (fe_id >= MSM_FRONTEND_DAI_MAX) {
		pr_err("%s Received out of bounds fe_id %llu\n",
			__func__, fe_id);
		ret = -EINVAL;
		goto done;
	}

	ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, &app_type,
		&acdb_dev_id, &sample_rate);
	if (ret < 0) {
		pr_err("%s: msm_pcm_routing_get_stream_app_type_cfg failed returned %d\n",
			__func__, ret);
		goto done;
	}

	ucontrol->value.integer.value[0] = app_type;
	ucontrol->value.integer.value[1] = acdb_dev_id;
	ucontrol->value.integer.value[2] = sample_rate;
	pr_debug("%s: fedai_id %llu, app_type %d, acdb_dev_id %d, sample_rate %d\n",
		__func__, fe_id, app_type, acdb_dev_id, sample_rate);
done:
	return ret;
}

static int msm_pcm_add_app_type_controls(struct snd_soc_pcm_runtime *rtd)
+47 −2
Original line number Diff line number Diff line
@@ -529,8 +529,8 @@ void msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int app_type,
	pr_debug("%s: fedai_id %d, app_type %d, sample_rate %d\n",
		__func__, fedai_id, app_type, sample_rate);
	if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) {
		/* bad ID assigned in machine driver */
		pr_err("%s: bad MM ID %d\n", __func__, fedai_id);
		pr_err("%s: Invalid machine driver ID %d\n",
			__func__, fedai_id);
		return;
	}
	fe_dai_app_type_cfg[fedai_id].app_type = app_type;
@@ -538,6 +538,51 @@ void msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int app_type,
	fe_dai_app_type_cfg[fedai_id].sample_rate = sample_rate;
}

/**
 * msm_pcm_routing_get_stream_app_type_cfg
 *
 * Receives fedai_id and populates app_type, acdb_dev_id, &
 * sample rate. Returns 0 on success. On failure returns
 * -EINVAL and does not alter passed values.
 *
 * fedai_id - Passed value, front end ID for which app type config is wanted
 * app_type - Returned value, app type used by app type config
 * acdb_dev_id - Returned value, ACDB device ID used by app type config
 * sample_rate - Returned value, sample rate used by app type config
 */
int msm_pcm_routing_get_stream_app_type_cfg(int fedai_id, int *app_type,
					    int *acdb_dev_id, int *sample_rate)
{
	int ret = 0;

	if (app_type == NULL) {
		pr_err("%s: NULL pointer sent for app_type\n", __func__);
		ret = -EINVAL;
		goto done;
	} else if (acdb_dev_id == NULL) {
		pr_err("%s: NULL pointer sent for acdb_dev_id\n", __func__);
		ret = -EINVAL;
		goto done;
	} else if (sample_rate == NULL) {
		pr_err("%s: NULL pointer sent for sample rate\n", __func__);
		ret = -EINVAL;
		goto done;
	} else if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) {
		pr_err("%s: Invalid FE ID %d\n",
			__func__, fedai_id);
		ret = -EINVAL;
		goto done;
	}
	*app_type = fe_dai_app_type_cfg[fedai_id].app_type;
	*acdb_dev_id = fe_dai_app_type_cfg[fedai_id].acdb_dev_id;
	*sample_rate = fe_dai_app_type_cfg[fedai_id].sample_rate;

	pr_debug("%s: fedai_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n",
		__func__, fedai_id, *app_type, *acdb_dev_id, *sample_rate);
done:
	return ret;
}
EXPORT_SYMBOL(msm_pcm_routing_get_stream_app_type_cfg);

static struct cal_block_data *msm_routing_find_topology_by_path(int path)
{
+2 −0
Original line number Diff line number Diff line
@@ -401,4 +401,6 @@ void msm_pcm_routing_release_lock(void);

void msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int app_type,
					int acdb_dev_id, int sample_rate);
int msm_pcm_routing_get_stream_app_type_cfg(int fedai_id, int *app_type,
					int *acdb_dev_id, int *sample_rate);
#endif /*_MSM_PCM_H*/