[bugfix][T108][task-view-1874] solve gpio output error in sleep mode

Only Configure: No
Affected branch: GSW_V1453
Affected module: hsm
Self-test: yes
Doc Update: no

Change-Id: Id5ac78c1fd1f92844bfc7c38c07b64784e94320c
diff --git a/marvell/linux/arch/arm/boot/dts/asr1806-p301.dts b/marvell/linux/arch/arm/boot/dts/asr1806-p301.dts
index b2d94d1..6b3737d 100755
--- a/marvell/linux/arch/arm/boot/dts/asr1806-p301.dts
+++ b/marvell/linux/arch/arm/boot/dts/asr1806-p301.dts
@@ -1647,10 +1647,11 @@
 	mbtk_GpioWakeUp {
 		compatible = "mbtk,GpioWakeUp";
 		pinctrl-names = "default", "sleep";
-		pinctrl-0 = <&wake_pmx_func &wake_pmx_func1>;
+		pinctrl-0 = <&wake_pmx_func &wake_pmx_func1 &hsm_enable_func>;
 		pinctrl-1 = <&wake_pmx_func_sleep>;
 		wakeup-in-gpio = <&gpio 118 0>;
 		wakeup-out-gpio = <&gpio 117 0>;
+	        hsm-en-out-gpio = <&gpio 10 0>;
 		status = "okay";
     };
 
@@ -1658,7 +1659,7 @@
     dtsleds{
     	compatible = "gpio-leds";
     	pinctrl-names = "default";
-		pinctrl-0 = <&led_pmx_func1 &hsm_enable_func>;
+		pinctrl-0 = <&led_pmx_func1>;
     	status = "okay";
     	led0{
         	label = "red";      
@@ -1668,13 +1669,6 @@
 
 		default-state = "off";
 		};
-    	led1{
-        	label = "hsm_en";      
-        	gpios = <&gpio 10 0>;
-        	linux,default-trigger = "pattern";    
-        	led-pattern = "100:100:100"; 
-		default-state = "on";
-		};
 		
     //	led1{
     //    	label = "blue";      
diff --git a/marvell/linux/drivers/input/keyboard/wake_gpio.c b/marvell/linux/drivers/input/keyboard/wake_gpio.c
index 43ba28c..008327b 100755
--- a/marvell/linux/drivers/input/keyboard/wake_gpio.c
+++ b/marvell/linux/drivers/input/keyboard/wake_gpio.c
@@ -301,7 +301,7 @@
 int mbtkGpioWakeUp_probe(struct platform_device *pdev)

 {

 	int gpio;

-

+        int hsm_en_gpio;

 	int gpio_value; 

 	unsigned long flags;

 	int ret = 0, error;

@@ -323,6 +323,24 @@
 		goto wake_source_init_fail;

 	}	

 

+        hsm_en_gpio = of_get_named_gpio(np, "hsm-en-out-gpio", 0);

+	if (unlikely(hsm_en_gpio < 0)) {

+		pr_err("%s. parse hsm-en-out-gpio failed\n", __func__);

+		ret = -EINVAL;

+	} else {

+		pr_err("%s. hsm-en-out-gpio=%d\n", __func__, hsm_en_gpio);

+		if (gpio_request(hsm_en_gpio, "hsm-en-out-gpio")) {

+			pr_err("Failed to request GPIO %d\n", hsm_en_gpio);

+			ret = -EBUSY;

+		}

+		if (gpio_direction_output(hsm_en_gpio, 1)) {  

+			pr_err("Failed to set GPIO %d as output\n", hsm_en_gpio);

+			ret = -EIO;

+		}

+		pr_err("hsm-gpio config sucess\n");

+		gpio_free(hsm_en_gpio);

+	}

+

 

 	gpio = of_get_named_gpio(np, "wakeup-in-gpio", 0);

 	if (unlikely(gpio < 0)) {