Index: Makefile
===================================================================
--- Makefile	(revision 9208)
+++ Makefile	(working copy)
@@ -43,7 +43,7 @@
 	$(RM) -fr $(TOP)/3rdpartyappliance/revision
 
 rpm: changeserverip
-	tar zcvf avx-driver-monitor-1.0.1.tar.gz monitor.spec -C kern/monitor/ avx_ipmi.h avx_ipmi.c avx_led.c avx_led.h avx_module.c avx_module.h avx_monitor.c avx_monitor.h ESDKerr.h gpio.c gpio.h Makefile start_avxko.sh stop_avxmonitor.sh start_avxmonitor.sh
+	tar zcvf avx-driver-monitor-1.0.1.tar.gz monitor.spec -C kern/monitor/ avx_ipmi.h avx_ipmi.c avx_led.c avx_led.h avx_module.c avx_module.h avx_monitor.c avx_monitor.h ESDKerr.h gpio.c gpio.h Makefile start_avxko.sh stop_avxmonitor.sh start_avxmonitor.sh gpio_nuvoton/
 	rpmbuild -ta avx-driver-monitor-1.0.1.tar.gz --define "%_topdir `pwd`/build/"
 	tar zcvf avx_cli-1.0.tar.gz avx_cli.spec conf kern lib Makefile Makefile.master README src tools update scripts init kern/sslcard kern/n3_zip kern/CNN55XX-SDK
 	rpmbuild -ta avx_cli-1.0.tar.gz --define "%_topdir `pwd`/build/"
@@ -76,7 +76,7 @@
 avx-driver-monitor-1.0.1.tar.gz:
 	cp monitor.spec .monitor.spec
 	sed -i 's/Release:        1/Release:        2/g' monitor.spec
-	tar zcvf avx-driver-monitor-1.0.1.tar.gz monitor.spec -C kern/monitor/ avx_ipmi.h avx_ipmi.c avx_led.c avx_led.h avx_module.c avx_module.h avx_monitor.c avx_monitor.h ESDKerr.h gpio.c gpio.h Makefile start_avxko.sh stop_avxmonitor.sh start_avxmonitor.sh
+	tar zcvf avx-driver-monitor-1.0.1.tar.gz monitor.spec -C kern/monitor/ avx_ipmi.h avx_ipmi.c avx_led.c avx_led.h avx_module.c avx_module.h avx_monitor.c avx_monitor.h ESDKerr.h gpio.c gpio.h Makefile start_avxko.sh stop_avxmonitor.sh start_avxmonitor.sh gpio_nuvoton/
 	mv .monitor.spec monitor.spec
 
 avx_cli-1.0.tar.gz:
Index: kern/monitor/Makefile
===================================================================
--- kern/monitor/Makefile	(revision 9208)
+++ kern/monitor/Makefile	(working copy)
@@ -2,7 +2,7 @@
 DEBUG = y
 
 
-# Add your debugging flag (or not) to EXTRA_CFLAGS 
+# Add your debugging flag (or not) to EXTRA_CFLAGS
 ifeq ($(DEBUG),y)
   DEBFLAGS = -O -g -DAVX_DEBUG # "-O" is needed to expand inlines
 else
@@ -24,13 +24,16 @@
 KERNELVER       := $(shell rpm -q --queryformat "%{installtime} %{version}-%{release}.%{arch}\n" kernel | sort -nr | sed -n 1p | cut -d' ' -f2)
 KERNELDIR ?= /lib/modules/$(KERNELVER)/build
 PWD       := $(shell pwd)
+GPIO_NUVOTON_DIR := $(PWD)/gpio_nuvoton
 
 modules:
+	$(MAKE) -C $(GPIO_NUVOTON_DIR) all
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD)/../include modules
 
 endif
 
 clean:
+	$(MAKE) -C $(GPIO_NUVOTON_DIR) clean
 	rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions *.symvers *.order *.xen *.ko.unsigned
 
 depend .depend dep:
@@ -40,4 +43,4 @@
 ifeq (.depend,$(wildcard .depend))
 include .depend
 endif
- 
+
Index: kern/monitor/avx_led.h
===================================================================
--- kern/monitor/avx_led.h	(revision 9208)
+++ kern/monitor/avx_led.h	(working copy)
@@ -34,6 +34,8 @@
 
 void cb1920_led_uninit();
 
+void CAPB_5070NR_led_init();
+
+void CAPB_5070NR_led_uninit();
+
 #endif //_AVX_LED_H_
-
- 
Index: kern/monitor/avx_led.c
===================================================================
--- kern/monitor/avx_led.c	(revision 9208)
+++ kern/monitor/avx_led.c	(working copy)
@@ -163,14 +163,14 @@
 	argv[2] = 0x2e;
 	argv[3] = 0x2f;
 	argv[4] = 0x00;
-	NCT6791D_uninit(5, argv); 
+	NCT6791D_uninit(5, argv);
 
 	argv[0] = 0x00;
 	argv[1] = 0x00;
 	argv[2] = 0x00;
 	argv[3] = 0x00;
 	argv[4] = 0x00;
-	PCH_Wellsburg_uninit(5, argv); 
+	PCH_Wellsburg_uninit(5, argv);
 }
 
 static void cb1920_led_set(avx_led_id led, avx_led_action act)
@@ -195,6 +195,101 @@
 }
 
 
+/**
+ * nct6796d_set_gpio_use_sel - Configure GPIO function selection
+ * @cmd:  Super I/O logical device or command selector [select:1, deselect:0]
+ * @pin:  GPIO pin number
+ * This function is implemented in gpio-nuvoton.ko and configures the GPIO function selection of the NCT6796D Super I/O controller on the CAPB-5070NR platform.
+ * It switches the specified pin between GPIO mode and alternative hardware function.
+ */
+extern void nct6796d_set_gpio_use_sel(int cmd, int pin);
+/**
+ * nct6796d_set_gp_io_sel - Configure GPIO direction (input/output)
+ * @cmd:  Super I/O logical device or command selector [input:1, output:0]
+ * @pin:  GPIO pin number
+ * This function is implemented in gpio-nuvoton.ko and configures the I/O direction of a GPIO pin on the NCT6796D Super I/O controller.
+ * It sets the specified GPIO pin as either input or output according to the direction control associated with the given command selector.
+ */
+extern void nct6796d_set_gp_io_sel(int cmd, int pin);
+/**
+ * nct6796d_set_gp_lvl - Set GPIO output level
+ * @cmd:  Super I/O logical device or command selector [high:1, low:0]
+ * @pin:  GPIO pin number
+ * This function is provided by gpio-nuvoton.ko and sets the GPIO output level of the NCT6796D controller on CAPB-5070NR.
+ * The target GPIO pin must be configured as output before invoking this function.
+ */
+extern void nct6796d_set_gp_lvl(int cmd, int pin);
+
+/* CAPB-5070NR LED GPIO control */
+#define LOW			0
+#define HIGH			1
+#define RUN_GPIO_1		60
+#define RUN_GPIO_2		61
+#define WARN_GPIO_1		66
+#define WARN_GPIO_2		67
+
+static void gpio_nuvoton_led_init(int gpio_pin)
+{
+	nct6796d_set_gpio_use_sel(1, gpio_pin);
+	nct6796d_set_gp_io_sel(0, gpio_pin);
+}
+
+void CAPB_5070NR_led_init()
+{
+	gpio_nuvoton_led_init(RUN_GPIO_1);
+	gpio_nuvoton_led_init(RUN_GPIO_2);
+	gpio_nuvoton_led_init(WARN_GPIO_1);
+	gpio_nuvoton_led_init(WARN_GPIO_2);
+}
+
+static void gpio_nuvoton_led_uninit(int gpio_pin)
+{
+	nct6796d_set_gpio_use_sel(0, gpio_pin);
+}
+
+void CAPB_5070NR_led_uninit()
+{
+	gpio_nuvoton_led_uninit(RUN_GPIO_1);
+	gpio_nuvoton_led_uninit(RUN_GPIO_2);
+	gpio_nuvoton_led_uninit(WARN_GPIO_1);
+	gpio_nuvoton_led_uninit(WARN_GPIO_2);
+}
+
+static void gpio_nuvoton_led_set(int gpio_pin, int led_status)
+{
+	nct6796d_set_gp_lvl(led_status, gpio_pin);
+}
+
+static void CAPB_5070NR_led_set(avx_led_id led, avx_led_action act)
+{
+	if(led == AVX_LED_ID_RUN) {
+		if(act == AVX_LED_ACT_OFF) {
+			// LED2(Run) off
+			gpio_nuvoton_led_set(RUN_GPIO_1, LOW);
+			gpio_nuvoton_led_set(RUN_GPIO_2, LOW);
+			return;
+		}else {
+			// LED2(Run) green on
+			gpio_nuvoton_led_set(RUN_GPIO_1, HIGH);
+			gpio_nuvoton_led_set(RUN_GPIO_2, LOW);
+			return;
+		}
+	}
+	else if(led == AVX_LED_ID_FAULT) {
+		if(act == AVX_LED_ACT_OFF) {
+			// LED3(Warning) off
+			gpio_nuvoton_led_set(WARN_GPIO_1, LOW);
+			gpio_nuvoton_led_set(WARN_GPIO_2, LOW);
+			return;
+		}else {
+			// LED3(Warning) red on
+			gpio_nuvoton_led_set(WARN_GPIO_1, LOW);
+			gpio_nuvoton_led_set(WARN_GPIO_2, HIGH);
+			return;
+		}
+	}
+}
+
 /*
  * led : which led.
  * act : on/off
@@ -204,22 +299,29 @@
 	switch (led) {
 	case AVX_LED_ID_RUN:
 		if (chipset_id == CHIPSET_ID_CB_1920) {
-    		cb1920_led_set(led, act);
-    	} else {
+			cb1920_led_set(led, act);
+		} else if (chipset_id == CHIPSET_ID_CAPB_5070NR_8000) {
+			CAPB_5070NR_led_set(led, act);
+		} else {
 			led_set(MCR_DTR, act);
 		}
 		return;
 	case AVX_LED_ID_FAULT:
 		if (chipset_id == CHIPSET_ID_CB_1920) {
-    		cb1920_led_set(led, act);
+			cb1920_led_set(led, act);
+		} else if (chipset_id == CHIPSET_ID_CAPB_5070NR_8000) {
+			CAPB_5070NR_led_set(led, act);
 		} else {
 			led_set(MCR_RTS, act);
 		}
 		return;
 	case AVX_LED_ID_ALL:
 		if (chipset_id == CHIPSET_ID_CB_1920) {
-    		cb1920_led_set(AVX_LED_ID_RUN, act);
+			cb1920_led_set(AVX_LED_ID_RUN, act);
 			cb1920_led_set(AVX_LED_ID_FAULT, act);
+		} else if (chipset_id == CHIPSET_ID_CAPB_5070NR_8000) {
+			CAPB_5070NR_led_set(AVX_LED_ID_RUN, act);
+			CAPB_5070NR_led_set(AVX_LED_ID_FAULT, act);
 		} else {
 			led_set(MCR_DTR | MCR_RTS, act);
 		}
@@ -270,6 +372,3 @@
 
 	return *ppos;
 }
-
-
- 
Index: kern/monitor/avx_monitor.c
===================================================================
--- kern/monitor/avx_monitor.c	(revision 9208)
+++ kern/monitor/avx_monitor.c	(working copy)
@@ -119,24 +119,24 @@
 	} else {
 		monitor_states.fan_s1 = STATE_NORMAL;
 	}
-	
+
 	if (IS_FAN_ABNORMAL(avx_ipmi_getval(AVX_IPMI_FAN_S2))) {
 		monitor_states.fan_s2 = STATE_ABNORMAL;
-		rv++;		
+		rv++;
 	} else {
 		monitor_states.fan_s2 = STATE_NORMAL;
 	}
-	
+
 	if (IS_FAN_ABNORMAL(avx_ipmi_getval(AVX_IPMI_FAN_S3))) {
 		monitor_states.fan_s3 = STATE_ABNORMAL;
 		rv++;
 	} else {
 		monitor_states.fan_s3 = STATE_NORMAL;
 	}
-	
+
 	if (IS_FAN_ABNORMAL(avx_ipmi_getval(AVX_IPMI_FAN_S4))) {
 		monitor_states.fan_s4 = STATE_ABNORMAL;
-		rv++;		
+		rv++;
 	} else {
 		monitor_states.fan_s4 = STATE_NORMAL;
 	}
@@ -159,7 +159,7 @@
 static int monitor_check_overheat(void)
 {
 	int rv = 0;
-	
+
 	if (IS_TMPC_ABNORMAL(avx_ipmi_getval(AVX_IPMI_TEMP_C1))) {
 		monitor_states.tmp_c1 = STATE_ABNORMAL;
 		rv++;
@@ -222,7 +222,7 @@
 	} else {
 		monitor_states.power = STATE_NORMAL;
 	}
-	
+
 	return rv;
 }
 
@@ -273,7 +273,7 @@
 		monitor_runled_flag = 1;
 		avx_led_update(AVX_LED_ID_RUN, AVX_LED_ACT_OFF);
 	}
-	
+
 	/*
 	 * Update ipmi sensor table.
 	 */
@@ -285,7 +285,7 @@
 
 	/*
 	 * Do the checking.
-	 * 1. fan stop 
+	 * 1. fan stop
 	 * 2. over heat
 	 * 3. power state
 	 */
@@ -298,7 +298,7 @@
 	} else {
 		avx_led_update(AVX_LED_ID_FAULT, AVX_LED_ACT_OFF);
 	}
-		
+
 restart_timer:
 	mod_timer(&monitor_timer, jiffies + MONITOR_TIMEOUT);
 	return;
@@ -341,7 +341,7 @@
         }
 		else if (strncmp(boardname, TM_NCE_MB_CAPB_5070NR_8000, sizeof(TM_NCE_MB_CAPB_5070NR_8000)) == 0) {
             chipset_id = CHIPSET_ID_CAPB_5070NR_8000;
-			//TODO: CAPB_5070NR_led_init() here
+			CAPB_5070NR_led_init();
         }
 	}
 
@@ -351,20 +351,20 @@
 	rv = avx_ipmi_init();
 	if (rv) {
 		atomic_notifier_chain_unregister(&panic_notifier_list,
-						 			&monitor_panic_notifier);
+									&monitor_panic_notifier);
 		printk(KERN_WARNING PFX "can't init ipmi\n");
 		return rv;
 	}
 
 	/* Set up workqueue and timer for fault monitor. */
 	monitor_workqueue = create_singlethread_workqueue("avx_monitor");
-	
+
 	init_timer(&monitor_timer);
 	monitor_timer.function = monitor_timeout;
 	monitor_timer.data = 0;
 	monitor_timer.expires = jiffies + MONITOR_TIMEOUT;
 	add_timer(&monitor_timer);
-	
+
 	return 0;
 }
 
@@ -382,7 +382,7 @@
 
 	atomic_notifier_chain_unregister(&panic_notifier_list,
 								 &monitor_panic_notifier);
-	
+
 	if (strncmp(boardname, TM_NCE_MB_CB_1920, sizeof(TM_NCE_MB_CB_1920)) == 0) {
 			cb1920_led_uninit();
 	}
@@ -390,7 +390,7 @@
 			//TODO: cb1924_led_uninit();
 	}
 	if (strncmp(boardname, TM_NCE_MB_CAPB_5070NR_8000, sizeof(TM_NCE_MB_CAPB_5070NR_8000)) == 0) {
-			//TODO: CAPB_5070NR_led_uninit();
+			CAPB_5070NR_led_uninit();
 	}
 	return avx_ipmi_exit();
 }
Index: kern/monitor/gpio_nuvoton/Makefile
===================================================================
--- kern/monitor/gpio_nuvoton/Makefile	(revision 0)
+++ kern/monitor/gpio_nuvoton/Makefile	(working copy)
@@ -0,0 +1,6 @@
+all:
+	chmod +x ./build.sh
+	./build.sh
+clean:
+	rm -rf CHANGELOG README src SUPPORT_LIST
+install:
\ No newline at end of file
Index: kern/monitor/gpio_nuvoton/array_OS.patch
===================================================================
--- kern/monitor/gpio_nuvoton/array_OS.patch	(revision 0)
+++ kern/monitor/gpio_nuvoton/array_OS.patch	(working copy)
@@ -0,0 +1,32 @@
+--- src/driver/Makefile.orig	2026-02-02 04:06:52.756124973 -0500
++++ src/driver/Makefile	2026-02-02 04:07:09.545314081 -0500
+@@ -7,10 +7,19 @@
+ obj-m += $(DRIVER_NAME).o
+ $(DRIVER_NAME)-objs := $(CFILES:.c=.o)
+
+-KSRC  ?= /lib/modules/$(shell uname -r)/build
++KSRC  ?= /lib/modules/$(shell rpm -q --queryformat "%{installtime} %{version}-%{release}.%{arch}\n" kernel | sort -nr | sed -n 1p | cut -d' ' -f2)/build
++
++KERN_MONITOR_DIR := ../../..
+
+ all:
+	make -C $(KSRC) M=$(shell pwd) modules
++	@echo "== Copy Module.symvers to kern/monitor =="
++	@if [ -f Module.symvers ]; then \
++		cp Module.symvers $(KERN_MONITOR_DIR)/; \
++	else \
++		echo "Module.symvers not found!"; \
++		exit 1; \
++	fi
+
+ clean:
+	make -C $(KSRC) M=$(shell pwd) clean
+--- src/driver/nct6796d.c.orig      2026-02-04 02:37:57.492086608 -0500
++++ src/driver/nct6796d.c  2026-02-04 02:38:48.540687513 -0500
+@@ -485,5 +485,6 @@
+
+
+ EXPORT_SYMBOL(nct6796d_set_gpio_use_sel);
++EXPORT_SYMBOL(nct6796d_set_gp_io_sel);
+ EXPORT_SYMBOL(nct6796d_set_gp_lvl);
+ EXPORT_SYMBOL(nct6796d_get_gp_lvl);
Index: kern/monitor/gpio_nuvoton/build.sh
===================================================================
--- kern/monitor/gpio_nuvoton/build.sh	(revision 0)
+++ kern/monitor/gpio_nuvoton/build.sh	(working copy)
@@ -0,0 +1,4 @@
+unzip caswell_drv_gpio-nuvoton-V1.10.4.zip
+patch -p0 < array_OS.patch
+cd src/driver/
+make
Index: kern/monitor/gpio_nuvoton/caswell_drv_gpio-nuvoton-V1.10.4.zip
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/zip
Index: kern/monitor/gpio_nuvoton/caswell_drv_gpio-nuvoton-V1.10.4.zip
===================================================================
--- kern/monitor/gpio_nuvoton/caswell_drv_gpio-nuvoton-V1.10.4.zip	(revision 9208)
+++ kern/monitor/gpio_nuvoton/caswell_drv_gpio-nuvoton-V1.10.4.zip	(working copy)

Property changes on: kern/monitor/gpio_nuvoton/caswell_drv_gpio-nuvoton-V1.10.4.zip
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/zip
\ No newline at end of property
Index: kern/monitor/start_avxmonitor.sh
===================================================================
--- kern/monitor/start_avxmonitor.sh	(revision 9208)
+++ kern/monitor/start_avxmonitor.sh	(working copy)
@@ -6,6 +6,21 @@
     exit 0
 fi
 
+# install gpio kmod for CAR-5070 motherboard
+model=`cat /var/array/public/config/arraymodel`
+if [ "x${model}" == "x957902" ] || [ "x${model}" == "x959902" ]; then
+    gpio_driver=$(lsmod | grep gpio_nuvoton)
+    if [ ! -z "${gpio_driver}" ]; then
+        echo "Already install kmod gpio_nuvoton"
+    else
+        insmod /usr/local/avx/bin/gpio-nuvoton.ko
+        gpio_driver=$(lsmod | grep gpio_nuvoton)
+        if [ -z "${gpio_driver}" ]; then
+            echo "Failed to install kmod gpio_nuvoton"
+        fi
+    fi
+fi
+
 pushd /usr/local/avx/bin/
 rmmod avx.ko
 modprobe ipmi_si
Index: monitor.spec
===================================================================
--- monitor.spec	(revision 9208)
+++ monitor.spec	(working copy)
@@ -46,6 +46,7 @@
 install -m 755 %{build_dir}/avx.ko %{buildroot}/%{avx_bin_dir}
 install -m 755 %{build_dir}/start_avxmonitor.sh %{buildroot}/%{avx_bin_dir}
 install -m 755 %{build_dir}/stop_avxmonitor.sh %{buildroot}/%{avx_bin_dir}
+install -m 755 %{build_dir}/gpio_nuvoton/src/driver/gpio-nuvoton.ko %{buildroot}/%{avx_bin_dir}
 #%make_install
 
 # first install
@@ -127,5 +128,6 @@
 %{avx_bin_dir}/avx.ko
 %{avx_bin_dir}/start_avxmonitor.sh
 %{avx_bin_dir}/stop_avxmonitor.sh
+%{avx_bin_dir}/gpio-nuvoton.ko
 
 %changelog
