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

Commit 832723d7 authored by Aditya Bavanari's avatar Aditya Bavanari
Browse files

ASoC: msm: qdsp6v2: Expose APIs to get and set Instance ID support



Expose APIs to get and set instance ID support by exposing
a mixer control for HAL to set the support status as well as APIs for
kernel components to querry for instance ID support.

CRs-Fixed: 2151551
Change-Id: I76a97c92cd02e28f03a0efb73757c4be75152d1f
Signed-off-by: default avatarSiena Richard <sienar@codeaurora.org>
Signed-off-by: default avatarAditya Bavanari <abavanar@codeaurora.org>
parent 501a8de7
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
/* Copyright (c) 2017, 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
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef __Q6COMMON_H__
#define __Q6COMMON_H__

#include <linux/qdsp6v2/apr.h>

void q6common_update_instance_id_support(bool supported);
bool q6common_is_instance_id_supported(void);

#endif /* __Q6COMMON_H__ */
+1 −1
Original line number Diff line number Diff line
@@ -19,6 +19,6 @@ obj-$(CONFIG_DTS_SRS_TM) += msm-dts-srs-tm-config.o
obj-$(CONFIG_QTI_PP) += msm-qti-pp-config.o
obj-y += audio_calibration.o audio_cal_utils.o q6adm.o q6afe.o q6asm.o \
	q6audio-v2.o q6voice.o q6core.o rtac.o q6lsm.o \
	msm-pcm-q6-noirq.o
	msm-pcm-q6-noirq.o q6common.o
ocmem-audio-objs += audio_ocmem.o
obj-$(CONFIG_AUDIO_OCMEM) += ocmem-audio.o
+46 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <sound/q6adm-v2.h>
#include <sound/q6asm-v2.h>
#include <sound/q6afe-v2.h>
#include <sound/q6common.h>
#include <sound/tlv.h>
#include <sound/asound.h>
#include <sound/pcm_params.h>
@@ -16426,6 +16427,47 @@ static const struct snd_kcontrol_new stereo_channel_reverse_control[] = {
	msm_routing_stereo_channel_reverse_control_put),
};
static int msm_routing_instance_id_support_info(struct snd_kcontrol *kcontrol,
						struct snd_ctl_elem_info *uinfo)
{
	uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
	uinfo->count = 1;
	return 0;
}
static int msm_routing_instance_id_support_put(
	struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
	bool supported = ucontrol->value.integer.value[0] ? true : false;
	q6common_update_instance_id_support(supported);
	return 0;
}
static int msm_routing_instance_id_support_get(
	struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
	bool supported = false;
	supported = q6common_is_instance_id_supported();
	ucontrol->value.integer.value[0] = supported ? 1 : 0;
	return 0;
}
static const struct snd_kcontrol_new
	msm_routing_feature_support_mixer_controls[] = {
		{
			.access = SNDRV_CTL_ELEM_ACCESS_READ |
				  SNDRV_CTL_ELEM_ACCESS_WRITE,
			.info = msm_routing_instance_id_support_info,
			.name = "Instance ID Support",
			.put = msm_routing_instance_id_support_put,
			.get = msm_routing_instance_id_support_get,
		},
};
static struct snd_pcm_ops msm_routing_pcm_ops = {
	.hw_params	= msm_pcm_routing_hw_params,
	.close          = msm_pcm_routing_close,
@@ -16585,6 +16627,10 @@ static int msm_routing_probe(struct snd_soc_platform *platform)
					ARRAY_SIZE(aptx_dec_license_controls));
	snd_soc_add_platform_controls(platform, stereo_channel_reverse_control,
				ARRAY_SIZE(stereo_channel_reverse_control));
	snd_soc_add_platform_controls(
		platform, msm_routing_feature_support_mixer_controls,
		ARRAY_SIZE(msm_routing_feature_support_mixer_controls));
	return 0;
}
+32 −0
Original line number Diff line number Diff line
/* Copyright (c) 2017, 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
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <sound/q6common.h>

struct q6common_ctl {
	bool instance_id_supported;
};

static struct q6common_ctl common;

void q6common_update_instance_id_support(bool supported)
{
	common.instance_id_supported = supported;
}
EXPORT_SYMBOL(q6common_update_instance_id_support);

bool q6common_is_instance_id_supported(void)
{
	return common.instance_id_supported;
}
EXPORT_SYMBOL(q6common_is_instance_id_supported);