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

Commit 6c4e0476 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 a53e735b 08ebb669
Loading
Loading
Loading
Loading
+29 −1
Original line number Original line Diff line number Diff line
@@ -2749,7 +2749,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,
static int msm_compr_app_type_cfg_get(struct snd_kcontrol *kcontrol,
				      struct snd_ctl_elem_value *ucontrol)
				      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,
static int msm_compr_channel_map_put(struct snd_kcontrol *kcontrol,
+29 −1
Original line number Original line Diff line number Diff line
@@ -1174,7 +1174,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,
static int msm_pcm_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
					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)
static int msm_pcm_add_app_type_controls(struct snd_soc_pcm_runtime *rtd)
+47 −2
Original line number Original line Diff line number Diff line
@@ -551,8 +551,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",
	pr_debug("%s: fedai_id %d, app_type %d, sample_rate %d\n",
		__func__, fedai_id, app_type, sample_rate);
		__func__, fedai_id, app_type, sample_rate);
	if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) {
	if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) {
		/* bad ID assigned in machine driver */
		pr_err("%s: Invalid machine driver ID %d\n",
		pr_err("%s: bad MM ID %d\n", __func__, fedai_id);
			__func__, fedai_id);
		return;
		return;
	}
	}
	fe_dai_app_type_cfg[fedai_id].app_type = app_type;
	fe_dai_app_type_cfg[fedai_id].app_type = app_type;
@@ -560,6 +560,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;
	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)
static struct cal_block_data *msm_routing_find_topology_by_path(int path)
{
{
+2 −0
Original line number Original line Diff line number Diff line
@@ -414,4 +414,6 @@ void msm_pcm_routing_release_lock(void);


void msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int app_type,
void msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int app_type,
					int acdb_dev_id, int sample_rate);
					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*/
#endif /*_MSM_PCM_H*/