Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de4cd7bb authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cnss: Set correct boot sequence for WLAN chip"

parents fd7e6316 97eabd60
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ Optional properties:
    has exclusive access to UART.
  - vdd-wlan-io-supply: phandle to the 1.8V IO regulator for QCA6174
  - vdd-wlan-xtal-supply: phandle to the 1.8V XTAL regulator for QCA6174
  - vdd-wlan-sp2t-supply: phandle to the 2.7V SP2T regulator for QCA6174
  - qcom,wlan-ramdump-dynamic: To enable CNSS RAMDUMP collection
    by providing the size of CNSS DUMP
  - reg: Memory regions defined as starting address and size
+57 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ static struct cnss_fw_files FW_FILES_DEFAULT = {
#define WLAN_VREG_NAME		"vdd-wlan"
#define WLAN_VREG_IO_NAME	"vdd-wlan-io"
#define WLAN_VREG_XTAL_NAME	"vdd-wlan-xtal"
#define WLAN_VREG_SP2T_NAME	"vdd-wlan-sp2t"
#define WLAN_SWREG_NAME		"wlan-soc-swreg"
#define WLAN_EN_GPIO_NAME	"wlan-en-gpio"
#define WLAN_BOOTSTRAP_GPIO_NAME "wlan-bootstrap-gpio"
@@ -118,6 +119,8 @@ static struct cnss_fw_files FW_FILES_DEFAULT = {
#define WLAN_VREG_IO_MIN	1800000
#define WLAN_VREG_XTAL_MAX	1800000
#define WLAN_VREG_XTAL_MIN	1800000
#define WLAN_VREG_SP2T_MAX	2700000
#define WLAN_VREG_SP2T_MIN	2700000

#define POWER_ON_DELAY		2000
#define WLAN_ENABLE_DELAY	10000
@@ -164,6 +167,7 @@ struct cnss_wlan_vreg_info {
	struct regulator *soc_swreg;
	struct regulator *wlan_reg_io;
	struct regulator *wlan_reg_xtal;
	struct regulator *wlan_reg_sp2t;
	bool state;
};

@@ -296,6 +300,15 @@ static int cnss_wlan_vreg_on(struct cnss_wlan_vreg_info *vreg_info)
		}
	}

	if (vreg_info->wlan_reg_sp2t) {
		ret = regulator_enable(vreg_info->wlan_reg_sp2t);
		if (ret) {
			pr_err("%s: regulator enable failed for wlan_reg_sp2t\n",
				__func__);
			goto error_enable_reg_sp2t;
		}
	}

	if (vreg_info->soc_swreg) {
		ret = regulator_enable(vreg_info->soc_swreg);
		if (ret) {
@@ -308,6 +321,9 @@ static int cnss_wlan_vreg_on(struct cnss_wlan_vreg_info *vreg_info)
	return ret;

error_enable_soc_swreg:
	if (vreg_info->wlan_reg_sp2t)
		regulator_disable(vreg_info->wlan_reg_sp2t);
error_enable_reg_sp2t:
	if (vreg_info->wlan_reg_xtal)
		regulator_disable(vreg_info->wlan_reg_xtal);
error_enable_reg_xtal:
@@ -332,6 +348,15 @@ static int cnss_wlan_vreg_off(struct cnss_wlan_vreg_info *vreg_info)
		}
	}

	if (vreg_info->wlan_reg_sp2t) {
		ret = regulator_disable(vreg_info->wlan_reg_sp2t);
		if (ret) {
			pr_err("%s: regulator disable failed for wlan_reg_sp2t\n",
				__func__);
			goto error_disable;
		}
	}

	if (vreg_info->wlan_reg_xtal) {
		ret = regulator_disable(vreg_info->wlan_reg_xtal);
		if (ret) {
@@ -550,6 +575,28 @@ static int cnss_wlan_get_resources(struct platform_device *pdev)
		}
	}

	if (of_get_property(pdev->dev.of_node,
		WLAN_VREG_SP2T_NAME"-supply", NULL)) {
		vreg_info->wlan_reg_sp2t =
			regulator_get(&pdev->dev, WLAN_VREG_SP2T_NAME);
		if (!IS_ERR(vreg_info->wlan_reg_sp2t)) {
			ret = regulator_set_voltage(vreg_info->wlan_reg_sp2t,
				WLAN_VREG_SP2T_MIN, WLAN_VREG_SP2T_MAX);
			if (ret) {
				pr_err("%s: Set wlan_vreg_sp2t failed!\n",
					__func__);
				goto err_reg_sp2t_set;
			}

			ret = regulator_enable(vreg_info->wlan_reg_sp2t);
			if (ret) {
				pr_err("%s: Enable wlan_vreg_sp2t failed!\n",
					__func__);
				goto err_reg_sp2t_enable;
			}
		}
	}

	if (of_find_property((&pdev->dev)->of_node,
				"qcom,wlan-uart-access", NULL))
		penv->cap.cap_flag |= CNSS_HAS_UART_ACCESS;
@@ -651,6 +698,14 @@ err_reg_set:
		regulator_put(vreg_info->soc_swreg);

err_reg_get2:
	if (vreg_info->wlan_reg_sp2t)
		regulator_disable(vreg_info->wlan_reg_sp2t);

err_reg_sp2t_enable:
	if (vreg_info->wlan_reg_sp2t)
		regulator_put(vreg_info->wlan_reg_sp2t);

err_reg_sp2t_set:
	if (vreg_info->wlan_reg_xtal)
		regulator_disable(vreg_info->wlan_reg_xtal);

@@ -688,6 +743,8 @@ static void cnss_wlan_release_resources(void)
	cnss_wlan_vreg_set(vreg_info, VREG_OFF);
	if (vreg_info->soc_swreg)
		regulator_put(vreg_info->soc_swreg);
	if (vreg_info->wlan_reg_sp2t)
		regulator_put(vreg_info->wlan_reg_sp2t);
	if (vreg_info->wlan_reg_xtal)
		regulator_put(vreg_info->wlan_reg_xtal);
	if (vreg_info->wlan_reg_io)