diff options
| author | Aditya Bavanari <abavanar@codeaurora.org> | 2017-05-08 12:31:23 -0700 |
|---|---|---|
| committer | Aditya Bavanari <abavanar@codeaurora.org> | 2017-12-04 18:02:27 +0530 |
| commit | 832723d733d6b4b83e6f8142428e268032bd1e15 (patch) | |
| tree | 51354f0da1b774fabc769a52d2f5190c23dee791 | |
| parent | 501a8de7b638d28c32338a124908258509b55371 (diff) | |
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: Siena Richard <sienar@codeaurora.org>
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
| -rw-r--r-- | include/sound/q6common.h | 21 | ||||
| -rw-r--r-- | sound/soc/msm/qdsp6v2/Makefile | 2 | ||||
| -rw-r--r-- | sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c | 46 | ||||
| -rw-r--r-- | sound/soc/msm/qdsp6v2/q6common.c | 32 |
4 files changed, 100 insertions, 1 deletions
diff --git a/include/sound/q6common.h b/include/sound/q6common.h new file mode 100644 index 000000000000..9b722f1de5bf --- /dev/null +++ b/include/sound/q6common.h @@ -0,0 +1,21 @@ +/* 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__ */ diff --git a/sound/soc/msm/qdsp6v2/Makefile b/sound/soc/msm/qdsp6v2/Makefile index 4116f79890a3..67d3d277404d 100644 --- a/sound/soc/msm/qdsp6v2/Makefile +++ b/sound/soc/msm/qdsp6v2/Makefile @@ -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 diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c index 70531872076b..13eb97ae3660 100644 --- a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c @@ -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; } diff --git a/sound/soc/msm/qdsp6v2/q6common.c b/sound/soc/msm/qdsp6v2/q6common.c new file mode 100644 index 000000000000..7886916f03da --- /dev/null +++ b/sound/soc/msm/qdsp6v2/q6common.c @@ -0,0 +1,32 @@ +/* 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); + |
