|
@@ -74,6 +74,12 @@ static struct snd_soc_jack_pin mfld_jack_pins[] = {
|
|
|
},
|
|
|
};
|
|
|
|
|
|
+/* jack detection voltage zones */
|
|
|
+static struct snd_soc_jack_zone mfld_zones[] = {
|
|
|
+ {MFLD_MV_START, MFLD_MV_AM_HS, SND_JACK_HEADPHONE},
|
|
|
+ {MFLD_MV_AM_HS, MFLD_MV_HS, SND_JACK_HEADSET},
|
|
|
+};
|
|
|
+
|
|
|
/* sound card controls */
|
|
|
static const char *headset_switch_text[] = {"Earpiece", "Headset"};
|
|
|
|
|
@@ -264,6 +270,12 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime)
|
|
|
pr_err("adding jack pins failed\n");
|
|
|
return ret_val;
|
|
|
}
|
|
|
+ ret_val = snd_soc_jack_add_zones(&mfld_jack,
|
|
|
+ ARRAY_SIZE(mfld_zones), mfld_zones);
|
|
|
+ if (ret_val) {
|
|
|
+ pr_err("adding jack zones failed\n");
|
|
|
+ return ret_val;
|
|
|
+ }
|
|
|
|
|
|
/* we want to check if anything is inserted at boot,
|
|
|
* so send a fake event to codec and it will read adc
|