greybus: audio: Use AIF widget to enable path between module & APB

Currently, SPK Amp switch is used to identify when to enable data path
between module and APB. With headset, other switch controls added, it is
not possible to use this switch to control data path. Instead path
should be established based on AIF widget.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Vaibhav Agarwal 2016-08-04 15:14:33 +05:30 committed by Greg Kroah-Hartman
parent 4ffca62a05
commit 487dcbd6ba

View File

@ -30,16 +30,6 @@ find_data(struct gbaudio_module_info *module, const char *name)
return NULL;
}
static int find_stream(const char *name)
{
int stream = 0;
if (strnstr(name, "SPK Amp", NAME_SIZE))
stream |= GB_PLAYBACK;
return stream;
}
static int gbaudio_module_enable_tx(struct gbaudio_codec_info *codec,
struct gbaudio_module_info *module)
{
@ -336,33 +326,30 @@ int gbaudio_module_update(struct gbaudio_codec_info *codec,
struct snd_soc_dapm_widget *w,
struct gbaudio_module_info *module, int enable)
{
int stream, ret = 0;
int ret = 0;
const char *w_name = w->name;
dev_dbg(module->dev, "%s:Module update %s sequence\n", w_name,
enable ? "Enable":"Disable");
stream = find_stream(w_name);
if (!stream) {
if ((w->id != snd_soc_dapm_aif_in) && (w->id != snd_soc_dapm_aif_out)){
dev_dbg(codec->dev, "No action required for %s\n", w_name);
return 0;
}
mutex_lock(&codec->lock);
if (stream & GB_PLAYBACK) {
if (w->id == snd_soc_dapm_aif_in) {
if (enable)
ret = gbaudio_module_enable_tx(codec, module);
else
ret = gbaudio_module_disable_tx(codec, module);
}
/* check if capture active */
if (stream & GB_CAPTURE) {
} else if (w->id == snd_soc_dapm_aif_out) {
if (enable)
ret = gbaudio_module_enable_rx(codec, module);
else
ret = gbaudio_module_disable_rx(codec, module);
}
mutex_unlock(&codec->lock);
return ret;