[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110503163409.24853.74450.stgit@bob.linux.org.uk>
Date: Tue, 03 May 2011 17:34:13 +0100
From: Alan Cox <alan@...rguk.ukuu.org.uk>
To: greg@...ah.com, linux-kernel@...r.kernel.org
Subject: [PATCH 12/23] intel_sst: Headphone Automute support
From: xingchao <xingchao.wang@...el.com>
When detected a Jack event, Audio sound routes between internal speaker
and headphone/headset automatically.
Signed-off-by: xingchao <xingchao.wang@...el.com>
Signed-off-by: Alan Cox <alan@...ux.intel.com>
---
drivers/staging/intel_sst/intelmid_v2_control.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/intel_sst/intelmid_v2_control.c b/drivers/staging/intel_sst/intelmid_v2_control.c
index 3d90f45..7cae970 100644
--- a/drivers/staging/intel_sst/intelmid_v2_control.c
+++ b/drivers/staging/intel_sst/intelmid_v2_control.c
@@ -996,6 +996,19 @@ static int nc_get_vol(int dev_id, int *value)
return retval;
}
+static void hp_automute(enum snd_jack_types type, int present)
+{
+ u8 in = DMIC;
+ u8 out = INTERNAL_SPKR;
+ if (present) {
+ if (type == SND_JACK_HEADSET)
+ in = HS_MIC;
+ out = STEREO_HEADPHONE;
+ }
+ nc_set_selected_input_dev(in);
+ nc_set_selected_output_dev(out);
+}
+
static void nc_pmic_irq_cb(void *cb_data, u8 intsts)
{
u8 value = 0;
@@ -1016,6 +1029,7 @@ static void nc_pmic_irq_cb(void *cb_data, u8 intsts)
present = (value == 0x1) ? 1 : 0;
jack_event_flag = 1;
mjack->jack.type = SND_JACK_HEADSET;
+ hp_automute(SND_JACK_HEADSET, present);
}
if (intsts & 0x2) {
@@ -1024,6 +1038,7 @@ static void nc_pmic_irq_cb(void *cb_data, u8 intsts)
present = (value == 0x2) ? 1 : 0;
jack_event_flag = 1;
mjack->jack.type = SND_JACK_HEADPHONE;
+ hp_automute(SND_JACK_HEADPHONE, present);
}
if (intsts & 0x4) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists