修改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__);}

相关新闻

终极免费文档转换神器:3分钟掌握FlashAI Convert Lite离线转换技巧

终极免费文档转换神器:3分钟掌握FlashAI Convert Lite离线转换技巧

终极免费文档转换神器:3分钟掌握FlashAI Convert Lite离线转换技巧 【免费下载链接】convert-lite flashai-convert-lite,离线免费文档转换工具,支持pdf to markdown,word to markdown,excel to markdown,ppt to markdown, html to markdown,…

2026/8/8 18:52:54 阅读更多 →
JVM基础1:内存区域、GC垃圾回收算法

JVM基础1:内存区域、GC垃圾回收算法

JVM 运行时五大内存分区分类、存储内容与对应异常内存分区两大分类标准(线程私有 / 线程共享)JVM 运行时数据区分为两类,核心区别:是否每个线程独立拥有内存、是否容易产生 OOM线程私有(单线程独占,线程销毁…

2026/8/8 18:52:54 阅读更多 →
BetterNCM安装器终极指南:3分钟精通网易云插件管理

BetterNCM安装器终极指南:3分钟精通网易云插件管理

BetterNCM安装器终极指南:3分钟精通网易云插件管理 【免费下载链接】BetterNCM-Installer 一键安装 Better 系软件 项目地址: https://gitcode.com/gh_mirrors/be/BetterNCM-Installer BetterNCM安装器是一款专为网易云音乐用户设计的强大插件管理工具&#…

2026/8/8 18:51:53 阅读更多 →

最新新闻

Apache Artemis终极指南:构建高性能消息中间件的5个关键策略

Apache Artemis终极指南:构建高性能消息中间件的5个关键策略

Apache Artemis终极指南:构建高性能消息中间件的5个关键策略 【免费下载链接】artemis Apache Artemis 项目地址: https://gitcode.com/gh_mirrors/act/artemis 在当今分布式系统的世界里,消息中间件已经成为连接微服务、处理异步通信的基石。Apa…

2026/8/8 19:45:12 阅读更多 →
Sark API完全手册:从基础到高级的函数参考

Sark API完全手册:从基础到高级的函数参考

Sark API完全手册:从基础到高级的函数参考 【免费下载链接】Sark IDAPython Made Easy 项目地址: https://gitcode.com/gh_mirrors/sa/Sark Sark是一个让IDAPython变得简单的强大工具库,它为逆向工程师提供了直观的API接口,简化了在ID…

2026/8/8 19:45:12 阅读更多 →
10个实用技巧:解锁Django-photologue的高级图片处理能力

10个实用技巧:解锁Django-photologue的高级图片处理能力

10个实用技巧:解锁Django-photologue的高级图片处理能力 【免费下载链接】django-photologue A customizable plug-in photo gallery management application for the Django web framework. 项目地址: https://gitcode.com/gh_mirrors/dja/django-photologue …

2026/8/8 19:45:12 阅读更多 →
响应式设计必备:Corner Smoothing插件如何适配不同屏幕分辨率?

响应式设计必备:Corner Smoothing插件如何适配不同屏幕分辨率?

响应式设计必备:Corner Smoothing插件如何适配不同屏幕分辨率? 【免费下载链接】corner-smoothing  Apple-like smooth corners for Tailwind CSS. 项目地址: https://gitcode.com/gh_mirrors/co/corner-smoothing 在现代Web设计中,…

2026/8/8 19:45:12 阅读更多 →
开会录音转写慢还整理不清?2026年iOS语音转文字APP测评供你参考

开会录音转写慢还整理不清?2026年iOS语音转文字APP测评供你参考

本次2026年iOS语音转文字APP测评结果显示,对于需要处理会议、访谈、视频内容转写整理的自媒体从业者,听脑AI更适配长录音批量转写、结构化内容输出的需求,关键依据是其支持1小时录音约2分钟出稿,覆盖7种语言19种方言,不…

2026/8/8 19:45:12 阅读更多 →
Windows AI功能彻底移除指南:如何一键清理Copilot、Recall等AI组件,提升系统性能与隐私保护

Windows AI功能彻底移除指南:如何一键清理Copilot、Recall等AI组件,提升系统性能与隐私保护

Windows AI功能彻底移除指南:如何一键清理Copilot、Recall等AI组件,提升系统性能与隐私保护 【免费下载链接】RemoveWindowsAI Force Remove Copilot, Recall and More in Windows 11 项目地址: https://gitcode.com/GitHub_Trending/re/RemoveWindows…

2026/8/8 19:44:11 阅读更多 →

日新闻

AI多智能体时代来临,读懂MCP与A2A架构,抢占企业数字化新风口

AI多智能体时代来临,读懂MCP与A2A架构,抢占企业数字化新风口

当下AI应用飞速普及,无数企业下场搭建智能体系统,可落地阶段难题接踵而至:上下文无限堆积频繁爆栈、AI工具调用准确率低下、Token成本居高不下、企业数据权限混乱暗藏安全隐患……很多团队卡在架构搭建环节,空有前沿技术概念&…

2026/8/8 0:00:07 阅读更多 →
PHP二维码生成终极指南:用chillerlan/php-qrcode打造专业级二维码

PHP二维码生成终极指南:用chillerlan/php-qrcode打造专业级二维码

PHP二维码生成终极指南:用chillerlan/php-qrcode打造专业级二维码 【免费下载链接】php-qrcode A PHP QR Code generator and reader with a user-friendly API. 项目地址: https://gitcode.com/gh_mirrors/ph/php-qrcode 在当今数字时代,二维码已…

2026/8/8 0:00:08 阅读更多 →
UniApp微信小程序隐私保护组件开发:从原理到实战

UniApp微信小程序隐私保护组件开发:从原理到实战

1. 项目缘起:为什么我们需要一个隐私保护通用组件?最近在维护一个基于uniapp开发的微信小程序矩阵时,我遇到了一个非常棘手的问题。随着平台对用户隐私保护的要求越来越严格,几乎每一个新版本发布,或者在某些特定机型&…

2026/8/8 0:00:08 阅读更多 →

周新闻

最大流算法详解:从水管网络到Ford-Fulkerson与Dinic实战

最大流算法详解:从水管网络到Ford-Fulkerson与Dinic实战

1. 从水管网络到最大流:一个核心问题的诞生想象一下,你是一个城市供水系统的总工程师。你的城市有多个水源(水库),需要通过一个复杂的地下管道网络,将水输送到各个居民区。每条管道都有其最大通水能力&…

2026/8/8 17:02:43 阅读更多 →
基于Springboot的企业门户网站(源码+LW+调试文档+讲解)

基于Springboot的企业门户网站(源码+LW+调试文档+讲解)

温馨提示:本人主页置顶文章(点我)开头有 CSDN 平台官方提供的学长联系方式的名片! 温馨提示:本人主页置顶文章(点我)开头有 CSDN 平台官方提供的学长联系方式的名片! 温馨提示:本人主页置顶文章(点我)开头有 CSDN 平台…

2026/8/8 8:58:26 阅读更多 →
MATLAB xcorr函数详解:从互相关原理到四大实战应用

MATLAB xcorr函数详解:从互相关原理到四大实战应用

1. 从一次信号“找茬”说起:为什么我们需要互相关几年前,我在处理一组声学传感器数据时遇到了一个棘手的问题。我有两个麦克风记录了一段相同的音频信号,理论上它们接收到的声音波形应该非常相似,只是由于麦克风位置不同&#xff…

2026/8/7 23:24:08 阅读更多 →

月新闻

免费解锁百度网盘SVIP加速:macOS用户必备的下载提速终极指南

免费解锁百度网盘SVIP加速:macOS用户必备的下载提速终极指南

免费解锁百度网盘SVIP加速:macOS用户必备的下载提速终极指南 【免费下载链接】BaiduNetdiskPlugin-macOS For macOS.百度网盘 破解SVIP、下载速度限制~ 项目地址: https://gitcode.com/gh_mirrors/ba/BaiduNetdiskPlugin-macOS 还在为百度网盘macOS版的龟速下…

2026/8/8 17:02:44 阅读更多 →
终极ncmdump指南:3分钟实现网易云NCM音乐解密与格式转换

终极ncmdump指南:3分钟实现网易云NCM音乐解密与格式转换

终极ncmdump指南:3分钟实现网易云NCM音乐解密与格式转换 【免费下载链接】ncmdump 项目地址: https://gitcode.com/gh_mirrors/ncmd/ncmdump 还在为网易云音乐下载的NCM格式文件无法在其他播放器播放而烦恼吗?ncmdump解密工具帮你轻松解决这个困…

2026/8/7 23:54:54 阅读更多 →
HarmonyOS 应用开发《掌上英语》第81篇: 智能体卡片:为英语学习 App 打造桌面级学习助手

HarmonyOS 应用开发《掌上英语》第81篇: 智能体卡片:为英语学习 App 打造桌面级学习助手

AgentCard 智能体卡片:为英语学习 App 打造桌面级学习助手适用平台:HarmonyOS 7.0 (API 26 Beta)一、引言 HarmonyOS 7.0(API 26 Beta)新增了 AgentCard 智能体卡片能力,这是继 HMAF(鸿蒙智能体框架&#x…

2026/8/8 17:02:44 阅读更多 →