通过耳机状态切换耳机mic与板子麦
/work/rk3288/firefly-rk3288_android5.1_git_20180126/kernel/sound/soc/codecs/es8323.c
static int es8323_hp_jack_change(struct notifier_block *nb,unsigned long flags, void *data) {if(es8323_adc)hp_jack_adc(flags);else{if(es8323_mic_state == 0) {if(flags == 1){/* carroll add switch mic start */printk("carroll mic use extern board mic switch off\n");//snd_soc_write(es8323_codec, 0x0b,0x02);snd_soc_write(es8323_codec, 0x0b,0x82);/* carroll add switch mic end */}else {printk("carroll mic use intern board mic switch on\n");snd_soc_write(es8323_codec, 0x0b,0x02);}if(line_in_state == 1) spk_detect_do_switch(1);}}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){firefly_es8323_hp_jack_gpio.gpio = es8323_hp_det_gpio;snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,&firefly_es8323_hp_jack);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);}}