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

Commit 0d7b8c20 authored by Maya Erez's avatar Maya Erez
Browse files

msm_11ad: change wigig_en to be an optional property



Some platforms don't support the wigig_en GPIO.
Changing wigig_en to be an optional property allows
removing the redundant setting of this GPIO in platforms
that do not support it.

Change-Id: Iad33d3876c1657cc4cc6b779b11d1c634f58a243
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
parent 13d9b5a3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@ Required properties:
- compatible: "qcom,wil6210"
- qcom,smmu-support: Boolean flag indicating whether PCIe has SMMU support
- qcom,pcie-parent: phandle for the PCIe root complex to which 11ad card is connected
- qcom,wigig-en: Enable GPIO connected to 11ad card
- Refer to "Documentation/devicetree/bindings/arm/msm/msm_bus.txt" for
  the below optional properties:
	- qcom,msm-bus,name
@@ -21,6 +20,7 @@ Required properties:

Optional properties:
- qcom,sleep-clk-en: GPIO for sleep clock used for low power modes by 11ad card
- qcom,wigig-en: Enable GPIO connected to 11ad card

Example:
	wil6210: qcom,wil6210 {
+35 −25
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ static int ops_suspend(void *handle)
			rc);
		return rc;
	}
	if (ctx->gpio_en >= 0)
		gpio_direction_output(ctx->gpio_en, 0);

	if (ctx->sleep_clk_en >= 0)
@@ -120,8 +121,10 @@ static int ops_resume(void *handle)
		gpio_direction_output(ctx->sleep_clk_en, 1);

	pcidev = ctx->pcidev;
	if (ctx->gpio_en >= 0) {
		gpio_direction_output(ctx->gpio_en, 1);
		msleep(WIGIG_ENABLE_DELAY);
	}

	rc = msm_pcie_pm_control(MSM_PCIE_RESUME, pcidev->bus->number,
				 pcidev, NULL, PM_OPT_RESUME);
@@ -143,6 +146,7 @@ err_suspend_rc:
	msm_pcie_pm_control(MSM_PCIE_SUSPEND, pcidev->bus->number,
			    pcidev, NULL, PM_OPT_SUSPEND);
err_disable_power:
	if (ctx->gpio_en >= 0)
		gpio_direction_output(ctx->gpio_en, 0);

	if (ctx->sleep_clk_en >= 0)
@@ -240,11 +244,12 @@ static int msm_11ad_probe(struct platform_device *pdev)
	 * iommus = <&anoc0_smmu>;
	 * qcom,smmu-exist;
	 */

	/* wigig-en is optional property */
	ctx->gpio_en = of_get_named_gpio(of_node, gpio_en_name, 0);
	if (ctx->gpio_en < 0) {
		dev_err(ctx->dev, "GPIO <%s> not found\n", gpio_en_name);
		return ctx->gpio_en;
	}
	if (ctx->gpio_en < 0)
		dev_warn(ctx->dev, "GPIO <%s> not found, enable GPIO not used\n",
			gpio_en_name);
	ctx->sleep_clk_en = of_get_named_gpio(of_node, sleep_clk_en_name, 0);
	if (ctx->sleep_clk_en < 0)
		dev_warn(ctx->dev, "GPIO <%s> not found, sleep clock not used\n",
@@ -264,6 +269,7 @@ static int msm_11ad_probe(struct platform_device *pdev)

	/*== execute ==*/
	/* turn device on */
	if (ctx->gpio_en >= 0) {
		rc = gpio_request(ctx->gpio_en, gpio_en_name);
		if (rc < 0) {
			dev_err(ctx->dev, "failed to request GPIO %d <%s>\n",
@@ -272,12 +278,12 @@ static int msm_11ad_probe(struct platform_device *pdev)
		}
		rc = gpio_direction_output(ctx->gpio_en, 1);
		if (rc < 0) {
		dev_err(ctx->dev, "failed to set GPIO %d <%s>\n", ctx->gpio_en,
			gpio_en_name);
			dev_err(ctx->dev, "failed to set GPIO %d <%s>\n",
				ctx->gpio_en, gpio_en_name);
			goto out_set;
		}

		msleep(WIGIG_ENABLE_DELAY);
	}

	/* enumerate it on PCIE */
	rc = msm_pcie_enumerate(ctx->rc_index);
@@ -337,8 +343,10 @@ static int msm_11ad_probe(struct platform_device *pdev)

	return 0;
out_rc:
	if (ctx->gpio_en >= 0)
		gpio_direction_output(ctx->gpio_en, 0);
out_set:
	if (ctx->gpio_en >= 0)
		gpio_free(ctx->gpio_en);
out_req:
	ctx->gpio_en = -EINVAL;
@@ -356,8 +364,10 @@ static int msm_11ad_remove(struct platform_device *pdev)

	msm_bus_cl_clear_pdata(ctx->bus_scale);
	pci_dev_put(ctx->pcidev);
	if (ctx->gpio_en >= 0) {
		gpio_direction_output(ctx->gpio_en, 0);
		gpio_free(ctx->gpio_en);
	}
	if (ctx->sleep_clk_en >= 0)
		gpio_free(ctx->sleep_clk_en);
	return 0;