|
发表于 2016-2-17 17:28:36
只看该作者
7#
加上这个patch后会自动切换mic:
diff --git a/kernel/sound/soc/codecs/es8323.c b/kernel/sound/soc/codecs/es8323.c
index cc0ebad..506c39c 100755
--- a/kernel/sound/soc/codecs/es8323.c
+++ b/kernel/sound/soc/codecs/es8323.c
@@ -1074,6 +1074,25 @@ void spk_timer_callback(unsigned long data )
}
#endif
+static int es8323_hp_jack_change(struct notifier_block *nb,
+ unsigned long flags, void *data)
+{
+ if(es8323_mic_state == 0) {
+ if(flags == 1){
+ printk("hp mic use extern\n");
+ snd_soc_write(es8323_codec, 0x0b,0x82);
+ }else {
+ printk("hp mic use intern\n");
+ snd_soc_write(es8323_codec, 0x0b,0x02);
+ }
+ }
+
+ return NOTIFY_OK;
+}
+
+static struct notifier_block es8323_hp_jack_nb = {
+ .notifier_call = es8323_hp_jack_change,
+};
static void es8323_jack_init(struct snd_soc_codec *codec)
{
if(es8323_hp_det_gpio != INVALID_GPIO)
@@ -1084,6 +1103,7 @@ static void es8323_jack_init(struct snd_soc_codec *codec)
snd_soc_jack_add_gpios(&firefly_es8323_hp_jack,
1,
&firefly_es8323_hp_jack_gpio);
+ snd_soc_jack_notifier_register(&firefly_es8323_hp_jack, &es8323_hp_jack_nb);
}
}
|
|