当前位置:网站首页>On the solution of es8316's audio burst
On the solution of es8316's audio burst
2022-07-06 04:43:00 【Never bald programmer】
List of articles
Recently, I encountered a problem about playing audio before and after , The horn will produce Da A voice , At present, the real reason has not been found , But you can do software evasion .
One 、 Evasive thinking
Control the power amplifier angle of the horn , Turn on the power amplifier horn before using the horn , Turn off the power amplifier corner after using the horn , In this way, you can avoid the appearance of this sound .
Two 、 Related codes
frameworks/av/
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index dce34db..1b2db64 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -31,6 +31,12 @@
#include <media/AudioUtilmtk.h>
#endif
// Add node path here
+const char *SPEAKER_ENABLE_PATH = "/sys/class/gpio/gpio114/value";
+static bool stream_system_on = false;
+static bool stream_notification_on = false;
+static bool stream_music_on = false;
+static bool stream_other_on = false;
+
namespace android {
@@ -270,8 +276,33 @@
sp<AudioPlaybackClient> client;
sp<AudioPolicyEffects>audioPolicyEffects;
// open audio The process time enables the power amplifier
+ FILE *fp = fopen(SPEAKER_ENABLE_PATH, "w");
+ if (fp != NULL) {
+ char buf[2] = "1";
+ if (fwrite(buf, 1, 1, fp))
+ ALOGE("%s() fwrite success", __FUNCTION__);
+ else
+ ALOGE("%s() fwrite fail", __FUNCTION__);
+ fclose(fp);
+ } else
+ ALOGE("+%s() open failed", __FUNCTION__);
+
getPlaybackClientAndEffects(portId, client, audioPolicyEffects, __func__);
+ switch (client->stream) {
+ case 1: //AUDIO_STREAM_SYSTEM button sound
+ stream_system_on = true;
+ break;
+ case 3: //AUDIO_STREAM_MUSIC
+ stream_music_on = true;
+ break;
+ case 5://AUDIO_STREAM_NOTIFICATION
+ stream_notification_on = true;
+ break;
+ default:
+ stream_other_on = true;
+ }
+
if (audioPolicyEffects != 0) {
// create audio processors according to stream
status_t status = audioPolicyEffects->addOutputSessionEffects(
@@ -307,6 +338,34 @@
getPlaybackClientAndEffects(portId, client, audioPolicyEffects, __func__);
+ switch (client->stream) {
+ case 1: //AUDIO_STREAM_SYSTEM button sound
+ stream_system_on = false;
+ break;
+ case 3: //AUDIO_STREAM_MUSIC
+ stream_music_on = false;
+ break;
+ case 5://AUDIO_STREAM_NOTIFICATION
+ stream_notification_on = false;
+ break;
+ default:
+ stream_other_on = false;
+ }
+ // close audio Turn off the power amplifier during the process
+ if ((stream_system_on == false) && (stream_music_on == false) &&
+ (stream_notification_on == false) && (stream_other_on == false)) {
+ FILE *fp = fopen(SPEAKER_ENABLE_PATH, "w");
+ if (fp != NULL) {
+ char buf[2] = "0";
+ if (fwrite(buf, 1, 1, fp))
+ ALOGE("%s() fwrite success", __FUNCTION__);
+ else
+ ALOGE("%s() fwrite fail", __FUNCTION__);
+ fclose(fp);
+ } else
+ ALOGE("+%s() open failed", __FUNCTION__);
+ }
+
if (audioPolicyEffects != 0) {
// release audio processors from the stream
status_t status = audioPolicyEffects->releaseOutputSessionEffects(
device/nxp/
Add corresponding permissions
diff --git a/init.mt8168.rc b/init.mt8168.rc
index 40ef21b..015f327 100644
--- a/init.mt8168.rc
+++ b/init.mt8168.rc
@@ -623,6 +623,10 @@
# EEPROM
chmod 0666 /sys/bus/i2c/devices/2-0050/eeprom
+# SPEAKER_ENABLE
+ chown system system /sys/class/gpio/gpio114/value
+ chmod 0666 /sys/class/gpio/gpio114/value
+
on property:vold.decrypt=trigger_reset_main
write /proc/bootprof "INIT:vold.decrypt=trigger_reset_main"
setprop sys.boot_completed 0
kernel Lieutenant general frameworks Apply for the required nodes
diff --git a/drivers/misc/biol_misc.c b/drivers/misc/biol_misc.c
index 6d98a60ed992..a651892d2dda 100644
--- a/drivers/misc/biol_misc.c
+++ b/drivers/misc/biol_misc.c
@@ -122,8 +122,9 @@ static int sbc_biol_probe(struct platform_device *pdev)
amp_en = of_get_named_gpio(np,"amp-en", 0);
if (!gpio_is_valid(amp_en))
{
return -ENODEV;
}
gpio_request(amp_en, "amp-en");
gpio_direction_output(amp_en, 0);
// Application node , It needs to be changed to 1 Otherwise No, /sys/class/gpio/gpio114/ Of direction Catalog
gpio_export(amp_en, 1);
msleep(1);
gpio_set_value(amp_en, 1);
msleep(1);
// Corresponding dts You can refer to what I wrote before , It's just a tool for adding nodes
// https://blog.csdn.net/weixin_51178981/article/details/125097672?spm=1001.2014.3001.5501
边栏推荐
- 关于imx8mp的es8316的芯片调试
- cdc 能全量拉去oracle 表嘛
- Yyds dry goods inventory OSI & tcp/ip
- CADD course learning (7) -- Simulation of target and small molecule interaction (flexible docking autodock)
- P3500 [POI2010]TES-Intelligence Test(二分&离线)
- Distributed transaction solution
- Crawler notes: improve data collection efficiency! Use of proxy pool and thread pool
- Mixed development of QML and QWidget (preliminary exploration)
- Programmers' position in the Internet industry | daily anecdotes
- P3500 [poi2010]tes intelligence test (two points & offline)
猜你喜欢

8. Static file

Unity screen coordinates ugui coordinates world coordinates conversion between three coordinate systems

Bill Gates posted his 18-year-old resume and expected an annual salary of $12000 48 years ago

How to estimate the population with samples? (mean, variance, standard deviation)

比尔·盖茨晒18岁个人简历,48年前期望年薪1.2万美元
![[face recognition series] | realize automatic makeup](/img/a5/de98d0522b9dae809cd242aac305b3.jpg)
[face recognition series] | realize automatic makeup

Lombok principle and the pit of ⽤ @data and @builder at the same time

麥斯克電子IPO被終止:曾擬募資8億 河南資產是股東

Basic explanation of turtle module - draw curve
![[FreeRTOS interrupt experiment]](/img/8f/54422d346bb54d23fab824be2f17a3.jpg)
[FreeRTOS interrupt experiment]
随机推荐
[FreeRTOS interrupt experiment]
[leetcode question brushing day 33] 1189 The maximum number of "balloons", 201. The number range is bitwise AND
The most detailed and comprehensive update content and all functions of guitar pro 8.0
Flink kakfa data read and write to Hudi
11. Intranet penetration and automatic refresh
Lagrange polynomial
Redis has four methods for checking big keys, which are necessary for optimization
Easyrecovery靠谱不收费的数据恢复电脑软件
MPLS experiment
Digital children < daily question> (Digital DP)
Redis —— Redis In Action —— Redis 实战—— 实战篇一 —— 基于 Redis 的短信登录功能 —— Redis + Token 的共享 session 应用— 有代码
[05-1, 05-02, 05-03] network protocol
Visio draws Tai Chi
【HBZ分享】云数据库如何定位慢查询
npm命令--安装依赖包--用法/详解
捷码赋能案例:专业培训、技术支撑,多措并举推动毕业生搭建智慧校园毕设系统
优秀PM必须经历这3层蜕变!
[detailed steps of FreeRTOS shift value for the first time]
Patent | subject classification method based on graph convolution neural network fusion of multiple human brain maps
View workflow