尧图网站设计 尧图网站设计YAOTU DESIGN
ARTICLE DETAIL

资讯详情

深耕网站设计与一线实操的经验洞察。

修改mt6357 PMIC 耳机插入中断极性

修改mt6357 PMIC 耳机插入中断极性 提示文章写完后目录可以自动生成如何生成可参考右边的帮助文档文章目录前言一、耳机插拔检测二、patch前言在patch之前先讲解一下耳机的三段检测就是耳机插入的检测一、耳机插拔检测见博文https://blog.csdn.net/weixin_43699191/article/details/131127269这个对照自己的原理图即可。二、patch这里硬件为插入出现 高的一个中断 c---a/kernel-4.19/arch/arm/boot/dts/ai6807t_l40mme_32.dtsb/kernel-4.19/arch/arm/boot/dts/ai6807t_l40mme_32.dts -280,7280,7 headset-mode-setting0x5000x50010x1f00x8000x8000x200x44;accdet-plugout-debounce1;accdet-mic-mode1;-headset-eint-level-pol8;headset-eint-level-pol4;headset-three-key-threshold080220400;headset-three-key-threshold-CDD0121192600;headset-four-key-threshold058121192400;diff--git a/kernel-4.19/arch/arm/boot/dts/mt6357.dtsi b/kernel-4.19/arch/arm/boot/dts/mt6357.dtsi index e6d131f7e0b..cb8cde2855d100644---a/kernel-4.19/arch/arm/boot/dts/mt6357.dtsib/kernel-4.19/arch/arm/boot/dts/mt6357.dtsi -13,713,7 accdet-mic-mode1;headset-mode-setting0x5000x50010x1f00x8000x8000x200x44;-headset-eint-level-pol8;headset-eint-level-pol4;headset-use-ap-eint0;headset-eint-num0;headset-eint-trig-mode0;diff--git a/kernel-4.19/arch/arm64/boot/dts/mediatek/mt6357.dtsi b/kernel-4.19/arch/arm64/boot/dts/mediatek/mt6357.dtsi index9990bed1d42..fad8730d6ba100644---a/kernel-4.19/arch/arm64/boot/dts/mediatek/mt6357.dtsib/kernel-4.19/arch/arm64/boot/dts/mediatek/mt6357.dtsi -13,713,7 accdet-mic-mode1;headset-mode-setting0x5000x50010x1f00x8000x8000x200x44;-headset-eint-level-pol8;headset-eint-level-pol4;headset-use-ap-eint0;headset-eint-num0;headset-eint-trig-mode0;diff--git a/kernel-4.19/sound/soc/codecs/mt6357-accdet.c b/kernel-4.19/sound/soc/codecs/mt6357-accdet.c index b01d249ed35..b1a56dabb56100644---a/kernel-4.19/sound/soc/codecs/mt6357-accdet.cb/kernel-4.19/sound/soc/codecs/mt6357-accdet.c -187,6187,12staticvoidaccdet_init_debounce(void);staticvoidconfig_eint_init_by_mode(void);staticu32get_triggered_eint(void);staticvoidsend_status_event(u32 cable_type,u32 status);/* * 下面两个是修改accdet 中断极性相关 */staticu32 accdet_eint_pol_typeIRQ_TYPE_LEVEL_HIGH;staticvoidaccdet_for_plug_highlow(void);/* global function declaration */inlineu32accdet_read(u32 addr){---a/kernel-4.19/sound/soc/codecs/mt6357-accdet.cb/kernel-4.19/sound/soc/codecs/mt6357-accdet.c -187,6187,12staticvoidaccdet_init_debounce(void);staticvoidconfig_eint_init_by_mode(void);staticu32get_triggered_eint(void);staticvoidsend_status_event(u32 cable_type,u32 status);/* * 下面两个是修改accdet 中断极性相关 */staticu32 accdet_eint_pol_typeIRQ_TYPE_LEVEL_HIGH;staticvoidaccdet_for_plug_highlow(void);/* global function declaration *//* * 下面两个是修改accdet 中断极性相关 */staticu32 accdet_eint_pol_typeIRQ_TYPE_LEVEL_HIGH;staticvoidaccdet_for_plug_highlow(void);/* global function declaration */inlineu32accdet_read(u32 addr){-973,6979,10staticu32get_triggered_eint(void)staticvoideint_polarity_reverse(u32 eint_id){/* global function declaration */inlineu32accdet_read(u32 addr){-973,6979,10staticu32get_triggered_eint(void)staticvoideint_polarity_reverse(u32 eint_id){accdet-accdet_eint_typeIRQ_TYPE_LEVEL_HIGH;pr_info(%s begin!\n,__func__);if(eint_idPMIC_EINT0){if(accdet-cur_eint_stateEINT_PLUG_OUT){if(accdet-accdet_eint_typeIRQ_TYPE_LEVEL_HIGH)-1153,61163,7staticvoideint_work_callback(structwork_struct*work)ACCDET_CMP_PWM_IDLE_SFT,0x7,0x7);disable_accdet();headset_plug_out();accdet_for_plug_highlow();}if(HAS_CAP(accdet-data-caps,ACCDET_AP_GPIO_EINT))-1800,61811,43staticintaccdet_get_dts_data(void)return0;}/* * mt6357的accdet中断使能是低我们硬件电路的accdet插入后是高 * 因此需要修改mt6357的中断触发极性需要修改为高 */staticvoidaccdet_for_plug_highlow(void){if(accdet_eint_pol_typeIRQ_TYPE_LEVEL_HIGH){pr_err(%s LEVEL_HIGH \n,__func__);dump_register();accdet_write(0x231e,accdet_read(0x231e)~0x0444);accdet_write(0x231e,accdet_read(0x231e)|(0x0114));accdet_write(0x230a,accdet_read(0x230a)|(0x013));if(accdet_read(0x232c)(0x78)){pr_err(%s EINT STATE 0x%x BIT 8,9,10 NOT ALL ZERO \n ,__func__,accdet_read(0x232c));dump_register();}else{accdet_write(0x230a,accdet_read(0x230a)(~(0x013)));pr_err(%s we should clear CTRL : 0x%x \n,__func__,accdet_read(0x230a));}if(accdet_read(0x232c)(0X78)){pr_err(%s double check EINT0_STATE bit 8910 not zero \n,__func__);}else{pr_err(%s double check EINT0_STATE bit 8910 is zero ! \n,__func__);}accdet_write(0x2320,accdet_read(0x2320)|(0x0114));accdet_write(0x2194,accdet_read(0x2194)|(0X16));usleep_range(2000,3000);//加条这个accdet_write(0x230a,accdet_read(0x230a)(~(0x013)));//加条这个pr_err(%s AUDENC_ANA_CON6 ox%x \n,__func__,accdet_read(0x2194));}else{accdet_write(0x2320,accdet_read(0x2320)(~(0x0114)));}}staticvoidconfig_digital_init_by_mode(void){unsignedintreg0;-1912,61960,10staticvoidaccdet_init_once(void)}elseif(HAS_CAP(accdet-data-caps,ACCDET_AP_GPIO_EINT)){//TBD}accdet_for_plug_highlow();dump_register();pr_info(%s done!\n,__func__);}
返回列表