Browse Source

cnss2: Add pinctrl support for SOL GPIOs

Add pinctrl support for SOL GPIOs so that default state of the
GPIOs can be set properly.

Change-Id: I2694d5d61074df04ab2e14251a743d387f814ae1
Yue Ma 3 years ago
parent
commit
ce5d7eafbc
2 changed files with 29 additions and 0 deletions
  1. 1 0
      cnss2/main.h
  2. 28 0
      cnss2/power.c

+ 1 - 0
cnss2/main.h

@@ -106,6 +106,7 @@ struct cnss_clk_info {
 struct cnss_pinctrl_info {
 	struct pinctrl *pinctrl;
 	struct pinctrl_state *bootstrap_active;
+	struct pinctrl_state *sol_default;
 	struct pinctrl_state *wlan_en_active;
 	struct pinctrl_state *wlan_en_sleep;
 	int bt_en_gpio;

+ 28 - 0
cnss2/power.c

@@ -58,6 +58,9 @@ static struct cnss_clk_cfg cnss_clk_list[] = {
 
 #define BOOTSTRAP_GPIO			"qcom,enable-bootstrap-gpio"
 #define BOOTSTRAP_ACTIVE		"bootstrap_active"
+#define HOST_SOL_GPIO			"wlan-host-sol-gpio"
+#define DEV_SOL_GPIO			"wlan-dev-sol-gpio"
+#define SOL_DEFAULT			"sol_default"
 #define WLAN_EN_GPIO			"wlan-en-gpio"
 #define BT_EN_GPIO			"qcom,bt-en-gpio"
 #define XO_CLK_GPIO			"qcom,xo-clk-gpio"
@@ -725,6 +728,20 @@ int cnss_get_pinctrl(struct cnss_plat_data *plat_priv)
 		}
 	}
 
+	if (of_find_property(dev->of_node, HOST_SOL_GPIO, NULL) &&
+	    of_find_property(dev->of_node, DEV_SOL_GPIO, NULL)) {
+		pinctrl_info->sol_default =
+			pinctrl_lookup_state(pinctrl_info->pinctrl,
+					     SOL_DEFAULT);
+		if (IS_ERR_OR_NULL(pinctrl_info->sol_default)) {
+			ret = PTR_ERR(pinctrl_info->sol_default);
+			cnss_pr_err("Failed to get sol default state, err = %d\n",
+				    ret);
+			goto out;
+		}
+		cnss_pr_dbg("Got sol default state\n");
+	}
+
 	if (of_find_property(dev->of_node, WLAN_EN_GPIO, NULL)) {
 		pinctrl_info->wlan_en_active =
 			pinctrl_lookup_state(pinctrl_info->pinctrl,
@@ -834,6 +851,17 @@ static int cnss_select_pinctrl_state(struct cnss_plat_data *plat_priv,
 			}
 			udelay(BOOTSTRAP_DELAY);
 		}
+		if (!IS_ERR_OR_NULL(pinctrl_info->sol_default)) {
+			ret = pinctrl_select_state
+				(pinctrl_info->pinctrl,
+				 pinctrl_info->sol_default);
+			if (ret) {
+				cnss_pr_err("Failed to select sol default state, err = %d\n",
+					    ret);
+				goto out;
+			}
+			cnss_pr_dbg("Selected sol default state\n");
+		}
 		cnss_set_xo_clk_gpio_state(plat_priv, true);
 		if (!IS_ERR_OR_NULL(pinctrl_info->wlan_en_active)) {
 			ret = pinctrl_select_state