ASoC: Expose APIs to get and set Instance ID support

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

CRs-Fixed: 2151551
Change-Id: I3b462a4c0f31152a2865af8f4e9664a6c4d324c3
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
This commit is contained in:
Vignesh Kulothungan 2018-01-24 17:36:18 -08:00 • committed by Gerrit - the friendly Code Review server
commit 5c10992ad9
4 changed files with 111 additions and 1 deletions

View file

@ -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 <dsp/q6afe-v2.h>
#include <dsp/q6lsm.h>
#include <dsp/q6core.h>
#include <dsp/q6common.h>
#include <dsp/audio_cal_utils.h>
#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;
}

View file

@ -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

43
dsp/q6common.c Normal file
View file

@ -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 <dsp/q6common.h>
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);

21
include/dsp/q6common.h Normal file
View file

@ -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 <ipc/apr.h>
void q6common_update_instance_id_support(bool supported);
bool q6common_is_instance_id_supported(void);
#endif /* __Q6COMMON_H__ */