]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
intel_sst: Headphone Automute support
authorxingchao <xingchao.wang@intel.com>
Tue, 3 May 2011 16:34:13 +0000 (17:34 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 May 2011 19:58:27 +0000 (12:58 -0700)
When detected a Jack event, Audio sound routes between internal speaker
and headphone/headset automatically.

Signed-off-by: xingchao <xingchao.wang@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/intel_sst/intelmid_v2_control.c

index f168c95067dc9749a7f03b0576a44ef98ca919da..0461fb3ed14844b18715f4bede3044a0f6d0933c 100644 (file)
@@ -995,6 +995,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;
@@ -1015,6 +1028,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) {
@@ -1023,6 +1037,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) {