lpi4a add wakeup gpio key and usb resume fix
authorhuaming.jiang <jianghuaming@linux.alibaba.com>
Tue, 2 Jan 2024 11:45:37 +0000 (19:45 +0800)
committerJaehoon Chung <jh80.chung@samsung.com>
Wed, 13 Mar 2024 06:59:03 +0000 (15:59 +0900)
Change-Id: I0479ed6cd676af7ad087968e1bb22f2b04e89337
(cherry picked from commit 1d7ed6a0c691726277ea12d63cc075af91936ead)
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
arch/riscv/boot/dts/thead/th1520-lpi4a.dtsi
drivers/usb/dwc3/dwc3-thead.c

index 9ad5f25e700eb61cc197a323f1f3d37587b0a124..1f6f6c9ad964e389a1adf2b5da09be10a4d21608 100644 (file)
                regulator-max-microvolt = <1200000>;
                gpio = <&pcal6408ahk_d 2 1>;
                enable-active-high;
-               regulator-always-on;
+
        };
 
        reg_usb_hub_vcc5v: regulator-hub-vcc5v-en {
                regulator-max-microvolt = <5000000>;
                gpio = <&pcal6408ahk_d 3 1>;
                enable-active-high;
-               regulator-always-on;
+
        };
 
        wcn_wifi: wireless-wlan {
 
        gpio-keys {
                compatible = "gpio-keys";
-               pinctrl-0 = <&pinctrl_volume>;
+               pinctrl-0 = <&pinctrl_volume &pinctrl_sleep>;
                pinctrl-names = "default";
                key-volumedown {
                        label = "Volume Down Key";
                        debounce-interval = <1>;
                        gpios = <&gpio2_porta 25 0x1>;
                };
+        key-sleep {
+                       label = "Sleep Wake Key";
+                       wakeup-source;
+                       linux,code = <KEY_SLEEP>;
+                       debounce-interval = <1>;
+                       gpios = <&ao_gpio_porta 2 0x1>;
+               };
        };
 
        aon: aon {
                        regulator-max-microvolt = <3300000>;
                        gpio = <&gpio1_porta 22 1>;
                        enable-active-high;
-                       regulator-always-on;
+               
                };
 
 
                        pinctrl_audiopa30: audiopa30 {
                                thead,pins = < FM_AUDIO_PA30 LIGHT_PIN_FUNC_0 0x000 >;
                        };
+            pinctrl_sleep: sleep_grp {
+                               thead,pins = <
+                    FM_CPU_JTG_TCLK 0x3   0x238
+                               >;
+                       };
 
        };
 };
index 0959b9f57cb6faa90ea7fdae350ee91f93f4cc56..5f71a06635a26848aeb1dfcab5017dd3f4968498 100644 (file)
@@ -257,10 +257,23 @@ static int dwc3_thead_remove(struct platform_device *pdev)
 static int dwc3_thead_pm_suspend(struct device *dev)
 {
        struct dwc3_thead *thead = dev_get_drvdata(dev);
-
+    int ret;
        dwc3_thead_assert(thead);
 
        clk_bulk_disable(thead->num_clocks, thead->clks);
+    ret = regulator_disable(thead->vbus);
+    if (ret) {
+                       dev_err(dev, "failed to disable regulator vbus %d\n", ret);
+    }
+    ret = regulator_disable(thead->hub1v2);
+    if (ret) {
+        dev_err(dev, "failed to disable regulator hub1v2 %d\n", ret);
+    }
+    ret = regulator_disable(thead->hub5v);
+
+    if (ret) {
+        dev_err(dev, "failed to disable regulator hub1v2 %d\n", ret);
+    }
 
        return 0;
 }
@@ -270,6 +283,20 @@ static int dwc3_thead_pm_resume(struct device *dev)
 {
        struct dwc3_thead *thead = dev_get_drvdata(dev);
        int ret;
+    dev_info(dev,"%s\n",__func__);
+    ret = regulator_enable(thead->vbus);
+    if (ret) {
+                       dev_err(dev, "failed to enable regulator vbus %d\n", ret);
+    }
+    ret = regulator_enable(thead->hub1v2);
+    if (ret) {
+        dev_err(dev, "failed to enable regulator hub1v2 %d\n", ret);
+    }
+    ret = regulator_enable(thead->hub5v);
+
+    if (ret) {
+        dev_err(dev, "failed to enable regulator hub1v2 %d\n", ret);
+    }
 
        ret = clk_bulk_prepare_enable(thead->num_clocks, thead->clks);
        if (ret) {