From 980a6decfb2945f0c4225ea2891183e371e69b55 Mon Sep 17 00:00:00 2001
From: Markus Gothe <markus.gothe@genexis.eu>
Date: Thu, 27 Feb 2025 11:50:02 +0100
Subject: [PATCH] ecnt_init: Fix SMP affinity for VoIP stack.

---
 airoha/base-files/etc/init.d/ecnt_init | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/airoha/base-files/etc/init.d/ecnt_init b/airoha/base-files/etc/init.d/ecnt_init
index 6754609e1..05df7ce64 100755
--- a/airoha/base-files/etc/init.d/ecnt_init
+++ b/airoha/base-files/etc/init.d/ecnt_init
@@ -40,6 +40,20 @@ boot() {
 	    . $PROFILE_CFG
 	fi
 
+	if [ -x /userfs/bin/voip_loader -a "$(cat /proc/device-tree/airoha-voice/slic-power-mode)" != "none" ]; then
+		if [ "$TCSUPPORT_CPU_ARMV8" != "" ] ;then
+			HID=`cat /proc/tc3162/hid`
+			if [ "$HID" = "f" ] || [ "$HID" = "10" ]; then
+				CPUIDX=0x2
+				/userfs/bin/irqCpuBind set PCM1 1
+			else
+				CPUIDX=0x8
+				/userfs/bin/irqCpuBind set PCM1 3
+			fi
+			printf "%x" $((0xf&~CPUIDX)) > /proc/irq/default_smp_affinity
+		fi
+	fi
+
 	echo 65535 > /proc/net/skbmgr_driver_max_skb
 	echo 32768 > /proc/net/skbmgr_limit
 	echo 32767 > /proc/net/skbmgr_4k_limit
-- 
GitLab