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

Commit e4120987 authored by Sameer Thalappil's avatar Sameer Thalappil Committed by Komal Seelam
Browse files

CNSS: Handle WLAN_EN GPIO for Applicable Platforms



WLAN_EN GPIO is not available in MPQ8092 platform.
So control WLAN_EN GPIO based on the property (wlan-en-gpio)
defined in device tree.

Change-Id: I677c269825b76c50d745ceebf4eade3afd646fea
Signed-off-by: default avatarKomal Seelam <kseelam@codeaurora.org>
parent 5f4d31f2
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ struct cnss_wlan_gpio_info {
	u32 num;
	bool state;
	bool init;
	bool prop;
};

struct cnss_wlan_vreg_info {
@@ -138,6 +139,9 @@ err_gpio_req:

static void cnss_wlan_gpio_set(struct cnss_wlan_gpio_info *info, bool state)
{
	if (!info->prop)
		return;

	if (info->state == state) {
		pr_debug("Already %s gpio is %s\n",
			 info->name, state ? "high" : "low");
@@ -176,6 +180,12 @@ static int cnss_wlan_get_resources(struct platform_device *pdev)
	}
	vreg_info->state = VREG_ON;

	if (!of_find_property((&pdev->dev)->of_node, gpio_info->name, NULL)) {
		gpio_info->prop = false;
		goto end;
	}

	gpio_info->prop = true;
	ret = of_get_named_gpio((&pdev->dev)->of_node,
				gpio_info->name, 0);

@@ -198,6 +208,7 @@ static int cnss_wlan_get_resources(struct platform_device *pdev)
		goto err_gpio_init;
	}

end:
	return ret;

err_gpio_init:
@@ -221,6 +232,7 @@ static void cnss_wlan_release_resources(void)
	gpio_free(gpio_info->num);
	regulator_put(vreg_info->wlan_reg);
	gpio_info->state = WLAN_EN_LOW;
	gpio_info->prop = false;
	vreg_info->state = VREG_OFF;
}

@@ -768,6 +780,7 @@ static int cnss_probe(struct platform_device *pdev)
	penv->gpio_info.num = 0;
	penv->gpio_info.state = WLAN_EN_LOW;
	penv->gpio_info.init = WLAN_EN_HIGH;
	penv->gpio_info.prop = false;
	penv->vreg_info.wlan_reg = NULL;
	penv->vreg_info.state = VREG_OFF;