summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVaibhav Agarwal <vaibhav.agarwal@linaro.org>2016-08-04 09:44:33 (GMT)
committerGreg Kroah-Hartman <gregkh@google.com>2016-08-04 17:07:30 (GMT)
commit487dcbd6ba46548f8f24dbd75423785ec8153712 (patch)
tree0a16c7ff3d0e5c8a2998a5f0d02fb067f7b7d029 /drivers
parent4ffca62a051c3e1722bcaf6a367b419e6e5e40e0 (diff)
downloadlinux-487dcbd6ba46548f8f24dbd75423785ec8153712.tar.xz
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/greybus/audio_codec.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index e2a0c163..3067c1a 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -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;