aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/audio_module.c
diff options
context:
space:
mode:
authorVaibhav Agarwal <vaibhav.agarwal@linaro.org>2016-04-13 09:53:39 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2016-04-25 18:02:57 -0700
commit05ab5f0daa524915176d170f3873b97ad10d7c43 (patch)
treec9971f6742ac5a5a7b67adc17e88c0c1a0977f78 /drivers/staging/greybus/audio_module.c
parentgreybus: audio: Rename widget_type to jack_attrubute (diff)
downloadlinux-dev-05ab5f0daa524915176d170f3873b97ad10d7c43.tar.xz
linux-dev-05ab5f0daa524915176d170f3873b97ad10d7c43.zip
greybus: audio: Identify jack type based on attributes reported
Originally, idea was to use widget_type to identify jack_type. However, suggestive way is to identify jack based on jack attributes. Changes already exists in codec FW to report jack attributes. 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/staging/greybus/audio_module.c')
-rw-r--r--drivers/staging/greybus/audio_module.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/staging/greybus/audio_module.c b/drivers/staging/greybus/audio_module.c
index bdc5ec50b30b..05bda486f490 100644
--- a/drivers/staging/greybus/audio_module.c
+++ b/drivers/staging/greybus/audio_module.c
@@ -27,7 +27,7 @@ static int gbaudio_request_jack(struct gbaudio_module_info *module,
int report, button_status;
dev_warn(module->dev, "Jack Event received: type: %u, event: %u\n",
- req->widget_type, req->event);
+ req->jack_attribute, req->event);
mutex_lock(&module->lock);
if (req->event == GB_AUDIO_JACK_EVENT_REMOVAL) {
@@ -43,18 +43,9 @@ static int gbaudio_request_jack(struct gbaudio_module_info *module,
return 0;
}
- report &= ~GBCODEC_JACK_MASK;
/* currently supports Headphone, Headset & Lineout only */
- if (req->widget_type && GB_AUDIO_WIDGET_TYPE_HP)
- report |= SND_JACK_HEADPHONE & GBCODEC_JACK_MASK;
-
- if (req->widget_type && GB_AUDIO_WIDGET_TYPE_MIC)
- report = SND_JACK_MICROPHONE & GBCODEC_JACK_MASK;
-
- if (req->widget_type && GB_AUDIO_WIDGET_TYPE_LINE)
- report = (report & GBCODEC_JACK_MASK) |
- SND_JACK_LINEOUT | SND_JACK_LINEIN;
-
+ report &= ~GBCODEC_JACK_MASK;
+ report |= req->jack_attribute & GBCODEC_JACK_MASK;
if (module->jack_type)
dev_warn(module->dev, "Modifying jack from %d to %d\n",
module->jack_type, report);