From 7e1950eb53ce0b05e5a39b8aef15428691a2a417 Mon Sep 17 00:00:00 2001
From: tzh <tanzhtanzh@gmail.com>
Date: Tue, 23 Jul 2024 02:00:21 +0000
Subject: [PATCH] feat(patch): add ido patch

---
 longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/sysconfig.c      |    6 --
 longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/kbuild/kbuild.mk               |    6 +-
 longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/sunxi_platform.c |   58 +----------------------------
 longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/config/compiler.mk             |    4 +-
 build.sh                                                                                                |   11 +++--
 longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/platform.h       |    1 
 longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/sunxi_android/Makefile         |    8 +--
 7 files changed, 17 insertions(+), 77 deletions(-)

diff --git a/build.sh b/build.sh
index 800f950..051fc41 100755
--- a/build.sh
+++ b/build.sh
@@ -11,11 +11,11 @@
 	./build.sh
 	cd -
 	
-	cd android
-	. ./build/envsetup.sh
-	lunch ceres_c3-userdebug
-	extract-bsp && pack
-	cd -
+	#cd android
+	#. ./build/envsetup.sh
+	#lunch ceres_c3-userdebug
+	#extract-bsp && pack
+	#cd -
 fi
 
 if [ x"$1" == "xa" ] ;then	
@@ -23,6 +23,7 @@
 	. ./build/envsetup.sh
 	lunch ceres_c3-userdebug
 	extract-bsp
+	make installclean
 	make BUILD_NUMBER=ido-a133 -j10 && pack
 #	make -j10 && pack -v
 	cd -
diff --git a/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/config/compiler.mk b/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/config/compiler.mk
index 746bddd..cef11ec 100644
--- a/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/config/compiler.mk
+++ b/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/config/compiler.mk
@@ -180,7 +180,7 @@
  _kernel_cross_compile := $(if $(filter undef,$(KERNEL_CROSS_COMPILE)),,$(KERNEL_CROSS_COMPILE))
  # We can take shortcuts with KERNEL_CROSS_COMPILE, as we don't want to
  # respect CC and we don't support clang in that part currently.
- _kernel_cross_compile := $(_kernel_cross_compile)
+ _kernel_cross_compile := $(_kernel_cross_compile)gcc
  # Then check the compiler.
  $(eval $(call calculate-compiler-preferred-target,target,$(_kernel_cross_compile)))
  $(eval $(call include-compiler-file,$(target_compiler_preferred_target)))
@@ -239,7 +239,7 @@
   $(warning $(space)$(space)KERNEL_CROSS_COMPILE=$(KERNEL_CROSS_COMPILE))
   $(warning $(space)$(space)$(space)builds for $(_kernel_primary_arch))
   $(warning ********************************************************)
-  $(warning Mismatching kernel and user-mode cross compilers)
+  $(error Mismatching kernel and user-mode cross compilers)
  endif
 endif
 
diff --git a/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/kbuild/kbuild.mk b/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/kbuild/kbuild.mk
index c80f371..97f204b 100644
--- a/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/kbuild/kbuild.mk
+++ b/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/kbuild/kbuild.mk
@@ -68,10 +68,10 @@
 		INTERNAL_EXTRA_KBUILD_OBJECTS="$(INTERNAL_EXTRA_KBUILD_OBJECTS)" \
 		BRIDGE_SOURCE_ROOT=$(abspath $(BRIDGE_SOURCE_ROOT)) \
 		TARGET_PRIMARY_ARCH=$(TARGET_PRIMARY_ARCH) \
-		CLANG_TRIPLE="$(CLANG_TRIPLE)" \
-		CROSS_COMPILE="$(CROSS_COMPILE)" \
+		CLANG_TRIPLE=$(patsubst %-android,%-gnu,$(CROSS_TRIPLE))- \
+		CROSS_COMPILE="$(CCACHE) $(KERNEL_CROSS_COMPILE)" \
 		EXTRA_CFLAGS="$(ALL_KBUILD_CFLAGS)" \
-		CC=$(if $(KERNEL_CC),$(KERNEL_CC),$(KERNEL_CROSS_COMPILE)) \
+		CC=$(if $(KERNEL_CC),$(KERNEL_CC),$(KERNEL_CROSS_COMPILE)gcc) \
 		CHECK="$(patsubst @%,%,$(CHECK))" $(if $(CHECK),C=1,) \
 		V=$(V) W=$(W) TOP=$(TOP)
 	@for kernel_module in $(addprefix $(TARGET_PRIMARY_OUT)/kbuild/,$(INTERNAL_KBUILD_OBJECTS:.o=.ko)); do \
diff --git a/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/sunxi_android/Makefile b/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/sunxi_android/Makefile
index 630674a..7a25642 100644
--- a/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/sunxi_android/Makefile
+++ b/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/build/linux/sunxi_android/Makefile
@@ -41,7 +41,7 @@
 export MULTIARCH=64only
 export EXCLUDED_APIS=opencl opengl vulkan cldnn imgdnn
 export USE_CLANG:=0
-#export V := 1
+
 # If a TARGET_PRODUCT is specified but not a TARGET_DEVICE, try to
 # derive the TARGET_DEVICE from TARGET_PRODUCT.
 #
@@ -68,10 +68,8 @@
 
 include ../common/android/arch.mk
 include ../common/android/features.mk
-ifneq ($(origin CC),undefined)
-KERNEL_CC :=$(CC)
-endif
-$(info $(KERNEL_CC) == $(CC))
+
+KERNEL_CROSS_COMPILE := $(CROSS_COMPILE)
 PVR_ANDROID_COMPOSERHAL := null
 
 PDUMP_STREAMBUF_SIZE_MB := 10
diff --git a/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/platform.h b/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/platform.h
index ff10830..9a0a5cd 100644
--- a/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/platform.h
+++ b/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/platform.h
@@ -63,7 +63,6 @@
 	PVRSRV_DEVICE_CONFIG   *config;
 };
 
-bool sunxi_ic_version_ctrl(struct device *dev);
 int sunxi_platform_init(struct device *dev);
 void sunxi_platform_term(void);
 void sunxiSetFrequencyDVFS(IMG_UINT32 *ui32Frequency);
diff --git a/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/sunxi_platform.c b/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/sunxi_platform.c
index 04b1fb6..7a53fcf 100644
--- a/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/sunxi_platform.c
+++ b/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/sunxi_platform.c
@@ -590,50 +590,6 @@
 }
 #endif /* CONFIG_DEBUG_FS */
 
-static inline int sunxi_get_ic_version(struct device *dev, char *version)
-{
-#define SYS_CFG_BASE 0x03000000
-#define VER_REG_OFFS 0x00000024
-	void __iomem *io = NULL;
-	static char ver = 0xff;
-	/* IC version:
-	 * A/B/C: 0
-	 *     D: 3
-	 *     E: 4
-	 *     F: 5
-	 *        6/7/1/2 to be used in future.
-	 */
-	*version = 0;
-	if (ver == 0xff) {
-		io = ioremap(SYS_CFG_BASE, 0x100);
-		if (io == NULL) {
-			dev_err(dev, "ioremap of sys_cfg register failed!\n");
-			return -1;
-		}
-		*version = (char)(readl(io + VER_REG_OFFS) & 0x7);
-		iounmap(io);
-		ver = *version;
-	} else {
-		*version = ver;
-	}
-	return 0;
-}
-
-bool sunxi_ic_version_ctrl(struct device *dev)
-{
-	char ic_version = 0;
-	sunxi_get_ic_version(dev, &ic_version);
-	/*
-	 * The flow of jtag reset before gpu reset will cause MIPS crash, so we
-	 * will put the domainA, domainB and gpu reset operations to boot0 stage.
-	 * And in kernel stage, we will always keep domainA poweron.
-	 */
-	if (ic_version == 0 || ic_version == 3 || ic_version == 4 || ic_version == 5)
-		return false;
-	return true;
-}
-
-
 int sunxi_platform_init(struct device *dev)
 {
 #if defined(CONFIG_OF)
@@ -641,7 +597,7 @@
 	struct platform_device *pdev = to_platform_device(dev);
 #endif /* defined(CONFIG_OF) */
 	unsigned int val, volt_val = 0;
-	char ic_version = 0;
+
 	sunxi_data = (struct sunxi_platform *)kzalloc(sizeof(struct sunxi_platform), GFP_KERNEL);
 	if (!sunxi_data) {
 		dev_err(dev, "failed to get kzalloc sunxi_platform");
@@ -678,20 +634,11 @@
 	sunxi_data->power_idle = 1;
 	sunxi_data->dvfs = 1;
 	sunxi_data->independent_power = 0;
-	sunxi_data->soft_mode = 0;
+	sunxi_data->soft_mode = 1;
 
 	parse_dts(dev, sunxi_data);
 	if (!sunxi_data->independent_power)
 		sunxi_data->dvfs = 0;
-	sunxi_get_ic_version(dev, &ic_version);
-	dev_info(dev, "IC version: 0x%08x \n", ic_version);
-
-	if (!sunxi_ic_version_ctrl(dev)) {
-		sunxi_data->power_idle = 0;
-		sunxi_data->soft_mode = 1;
-	} else {
-		sunxi_data->soft_mode = 0;
-	}
 
 	sunxi_decide_pll(sunxi_data);
 	spin_lock_init(&sunxi_data->lock);
@@ -720,7 +667,6 @@
 	sunxi_data->power_idle = 0;
 	regulator_set_voltage(sunxi_data->regula, 900000, 900000);
 #endif
-
 	init_waitqueue_head(&dvfs_wq);
 
 	dev_info(dev, "idle:%d dvfs:%d power:%d %s mode:%d volt:%u core:%lu\n",
diff --git a/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/sysconfig.c b/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/sysconfig.c
index ae6bfbf..3467c93 100755
--- a/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/sysconfig.c
+++ b/longan/kernel/linux-4.9/modules/gpu/img-rgx/android/rogue_km/services/system/rgx_sunxi/sysconfig.c
@@ -144,11 +144,7 @@
 	 * Setup RGX specific timing data
 	 */
 	gsRGXTimingInfo.ui32CoreClockSpeed        = clk_get_rate(sunxi_data->clks.core);
-	if (sunxi_ic_version_ctrl(dev)) {
-		gsRGXTimingInfo.bEnableActivePM   = IMG_TRUE;
-	} else {
-		gsRGXTimingInfo.bEnableActivePM   = IMG_FALSE;
-	}
+	gsRGXTimingInfo.bEnableActivePM           = IMG_FALSE;
 	gsRGXTimingInfo.bEnableRDPowIsland        = IMG_TRUE;
 	gsRGXTimingInfo.ui32ActivePMLatencyms     = SYS_RGX_ACTIVE_POWER_LATENCY_MS;
 

--
Gitblit v1.6.2