diff --git a/asoc/msm-pcm-routing-v2.c b/asoc/msm-pcm-routing-v2.c index ff2be80b13e6..2b6a69f0bb29 100644 --- a/asoc/msm-pcm-routing-v2.c +++ b/asoc/msm-pcm-routing-v2.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2018, 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 @@ -37,6 +37,7 @@ #include #include #include +#include #include #include "msm-pcm-routing-v2.h" @@ -16829,6 +16830,46 @@ 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 const struct snd_pcm_ops msm_routing_pcm_ops = { .hw_params = msm_pcm_routing_hw_params, .close = msm_pcm_routing_close, @@ -16900,6 +16941,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; } diff --git a/dsp/Kbuild b/dsp/Kbuild index 2bf3b26a99cd..3eeca047e778 100644 --- a/dsp/Kbuild +++ b/dsp/Kbuild @@ -73,6 +73,7 @@ ifdef CONFIG_SND_SOC_MSM_QDSP6V2_INTF Q6_OBJS += q6audio-v2.o Q6_OBJS += q6voice.o Q6_OBJS += q6core.o + Q6_OBJS += q6common.o Q6_OBJS += rtac.o Q6_OBJS += q6lsm.o Q6_OBJS += audio_slimslave.o diff --git a/dsp/q6common.c b/dsp/q6common.c new file mode 100644 index 000000000000..014ab4ce4d3f --- /dev/null +++ b/dsp/q6common.c @@ -0,0 +1,43 @@ +/* Copyright (c) 2017-2018, 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 + +struct q6common_ctl { + bool instance_id_supported; +}; + +static struct q6common_ctl common; + +/** + * q6common_update_instance_id_support + * + * Update instance ID support flag to true/false + * + * @supported: enable/disable for instance ID support + */ +void q6common_update_instance_id_support(bool supported) +{ + common.instance_id_supported = supported; +} +EXPORT_SYMBOL(q6common_update_instance_id_support); + +/** + * q6common_is_instance_id_supported + * + * Returns true/false for instance ID support + */ +bool q6common_is_instance_id_supported(void) +{ + return common.instance_id_supported; +} +EXPORT_SYMBOL(q6common_is_instance_id_supported); diff --git a/include/dsp/q6common.h b/include/dsp/q6common.h new file mode 100644 index 000000000000..587a6b645d56 --- /dev/null +++ b/include/dsp/q6common.h @@ -0,0 +1,21 @@ +/* Copyright (c) 2017-2018, 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 + +void q6common_update_instance_id_support(bool supported); +bool q6common_is_instance_id_supported(void); + +#endif /* __Q6COMMON_H__ */